Ejemplo n.º 1
0
class AgglomerativeAverageGroupEuclideanTestSuite(unittest.TestCase):
    """Agglomerative Average-Group with Euclidean Distance test cases."""

    @classmethod
    def setUpClass(self):
        self.filename = './tests/models/agglo-avg-group_euclidean.model'
        self.agg = Agglomerative(
            linkage="average-group", affinity="euclidean", n_clusters=3)
        self.agg.fit_predict(iris_data)

    def test_agglo_return_labels_with_type_numpy_array(self):
        self.assertIsInstance(self.agg.labels_, ndarray)
        print_in_test("Agglomerative (Distance=Euclidean, Linkage=Average-group): %f" %
                      purity_score(iris_target, self.agg.labels_))
Ejemplo n.º 2
0
class AgglomerativeSingleManhattanTestSuite(unittest.TestCase):
    """Agglomerative Single with Manhattan Distance test cases."""
    @classmethod
    def setUpClass(self):
        self.filename = './tests/models/agglo-single_manhattan.model'
        self.agg = Agglomerative(linkage="single",
                                 affinity="manhattan",
                                 n_clusters=3)
        self.agg.fit_predict(iris_data)

    def test_agglo_return_labels_with_type_numpy_array(self):
        self.assertIsInstance(self.agg.labels_, ndarray)
        print_in_test(
            "Agglomerative (Distance=Manhattan, Linkage=Single): %f" %
            purity_score(iris_target, self.agg.labels_))
Ejemplo n.º 3
0
 def setUpClass(self):
     self.filename = './tests/models/agglo-avg-group_euclidean.model'
     self.agg = Agglomerative(
         linkage="average-group", affinity="euclidean", n_clusters=3)
     self.agg.fit_predict(iris_data)
Ejemplo n.º 4
0
 def setUpClass(self):
     self.filename = './tests/models/agglo-single_manhattan.model'
     self.agg = Agglomerative(linkage="single",
                              affinity="manhattan",
                              n_clusters=3)
     self.agg.fit_predict(iris_data)