def test_classification_kmeans(self): iris = datasets.load_iris() X, y = iris.data, iris.target clr = ClassifierAfterKMeans() clr.fit(X, y) acc = clr.score(X, y) self.assertGreater(acc, 0) prob = clr.predict_proba(X) self.assertEqual(prob.shape[1], 3) dec = clr.decision_function(X) self.assertEqual(prob.shape, dec.shape)
def test_classification_kmeans(self): iris = datasets.load_iris() X, y = iris.data, iris.target clr = ClassifierAfterKMeans() try: clr.fit(X, y) except AttributeError as e: if compare_module_version(sklver, "0.24") < 0: return raise e acc = clr.score(X, y) self.assertGreater(acc, 0) prob = clr.predict_proba(X) self.assertEqual(prob.shape[1], 3) dec = clr.decision_function(X) self.assertEqual(prob.shape, dec.shape)