Ejemplo n.º 1
0
 def test_train_hexagonal(self):
     data = pd.read_csv('../data/test_data.csv').drop(['Class'], axis=1)
     som = StandardSOM((50, 50), 5, "hexagonal")
     som.train(data)
     self.assertTrue(som.trained)
     self.assertIsNotNone(som.codebook)
     self.assertIsNotNone(som.bmu_indices)
     self.assertIsNotNone(som.bmu_distances)
     self.assertIsNotNone(som.get_first_bmus())
     self.assertIsNotNone(som.get_second_bmus())
Ejemplo n.º 2
0
 def test_rectangular(self):
     data = pd.read_csv('../../../data/test_data.csv').drop(['Class'],
                                                            axis=1)
     som = StandardSOM((50, 50), 5)
     som.train(data)
     self.assertTrue(som.trained)
     self.assertIsNotNone(som.codebook)
     self.assertIsNotNone(som.bmu_indices)
     self.assertIsNotNone(som.bmu_distances)
     self.assertIsNotNone(som.get_first_bmus())
     self.assertIsNotNone(som.get_second_bmus())
     topographic_error(som)