|
5 | 5 | from sklearn import exceptions |
6 | 6 | from sklearn.svm import LinearSVC |
7 | 7 | from sklearn.datasets import load_breast_cancer as get_dataset |
| 8 | +from sklearn.datasets import load_iris as get_multiclass_dataset |
8 | 9 | from sklearn.multioutput import MultiOutputClassifier |
9 | 10 | from sklearn.naive_bayes import GaussianNB |
10 | 11 | from sklearn.utils.validation import check_X_y |
@@ -633,14 +634,16 @@ def test_decision_function_multioutput(self): |
633 | 634 |
|
634 | 635 | def test_score(self): |
635 | 636 | """Check that KernelPCovC's score behaves properly with multiple labels.""" |
| 637 | + X, y = get_multiclass_dataset(return_X_y=True) |
| 638 | + X = StandardScaler().fit_transform(X) |
636 | 639 | kpcovc_multi = self.model( |
637 | 640 | classifier=MultiOutputClassifier(estimator=LogisticRegression()) |
638 | 641 | ) |
639 | | - kpcovc_multi.fit(self.X, np.column_stack((self.Y, self.Y))) |
640 | | - score_multi = kpcovc_multi.score(self.X, np.column_stack((self.Y, self.Y))) |
| 642 | + kpcovc_multi.fit(X, np.column_stack((y, y))) |
| 643 | + score_multi = kpcovc_multi.score(X, np.column_stack((y, y))) |
641 | 644 |
|
642 | | - kpcovc_single = self.model().fit(self.X, self.Y) |
643 | | - score_single = kpcovc_single.score(self.X, self.Y) |
| 645 | + kpcovc_single = self.model().fit(X, y) |
| 646 | + score_single = kpcovc_single.score(X, y) |
644 | 647 | self.assertEqual(score_single, score_multi) |
645 | 648 |
|
646 | 649 | def test_bad_multioutput_estimator(self): |
|
0 commit comments