Skip to content

Commit cdb33b5

Browse files
author
Christian Jorgensen
committed
Fixing a test with kpcovc
1 parent 314e6d3 commit cdb33b5

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

tests/test_kernel_pcovc.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from sklearn import exceptions
66
from sklearn.svm import LinearSVC
77
from sklearn.datasets import load_breast_cancer as get_dataset
8+
from sklearn.datasets import load_iris as get_multiclass_dataset
89
from sklearn.multioutput import MultiOutputClassifier
910
from sklearn.naive_bayes import GaussianNB
1011
from sklearn.utils.validation import check_X_y
@@ -633,14 +634,16 @@ def test_decision_function_multioutput(self):
633634

634635
def test_score(self):
635636
"""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)
636639
kpcovc_multi = self.model(
637640
classifier=MultiOutputClassifier(estimator=LogisticRegression())
638641
)
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)))
641644

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)
644647
self.assertEqual(score_single, score_multi)
645648

646649
def test_bad_multioutput_estimator(self):

0 commit comments

Comments
 (0)