def test_heuristic_get_states(self): """Check attribute pairs after the widget has been paused""" heuristic = KMeansCorrelationHeuristic(self.data_cont) heuristic.n_clusters = 2 states = heuristic.get_states(None) _ = next(states) self.assertListEqual(list(heuristic.get_states(next(states))), [(0, 3), (2, 3), (0, 1), (1, 2), (1, 3)])
def test_heuristic(self): """Check attribute pairs got by heuristic""" heuristic = KMeansCorrelationHeuristic(self.data_cont) heuristic.n_clusters = 2 self.assertListEqual(list(heuristic.get_states(None)), [(0, 2), (0, 3), (2, 3), (0, 1), (1, 2), (1, 3)])
def test_get_states_one_cluster(self): heuristic = KMeansCorrelationHeuristic(Table("iris")[:, :2]) states = set(heuristic.get_states(None)) self.assertEqual(len(states), 1) self.assertSetEqual(states, {(0, 1)})
def setUpClass(cls): cls.data = Table(test_filename("datasets/breast-cancer-wisconsin")) cls.heuristic = KMeansCorrelationHeuristic(cls.data)
def setUpClass(cls): cls.data = Table("wine") cls.heuristic = KMeansCorrelationHeuristic(cls.data)