Skip to content

Commit f2d212c

Browse files
author
Christian Jorgensen
committed
Changing shape of y in pcovr tests
1 parent 1b7fcef commit f2d212c

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

tests/test_pcovr.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def __init__(self, *args, **kwargs):
2424

2525
self.X, self.Y = get_dataset(return_X_y=True)
2626
self.X = StandardScaler().fit_transform(self.X)
27-
self.Y = StandardScaler().fit_transform(np.vstack(self.Y))
27+
self.Y = StandardScaler().fit_transform(np.vstack(self.Y)).ravel()
2828

2929
def setUp(self):
3030
pass
@@ -91,14 +91,13 @@ def test_lr_with_x_errors(self):
9191
and that the prediction error increases with `mixing`
9292
"""
9393
prev_error = -1.0
94-
Ytrue = self.Y.ravel()
9594

9695
for mixing in np.linspace(0, 1, 11):
9796
pcovr = self.model(mixing=mixing, n_components=2, tol=1e-12)
9897
pcovr.fit(self.X, self.Y)
9998

10099
Yp = pcovr.predict(X=self.X)
101-
error = np.linalg.norm(Ytrue - Yp) ** 2.0 / np.linalg.norm(Ytrue) ** 2.0
100+
error = np.linalg.norm(self.Y - Yp) ** 2.0 / np.linalg.norm(self.Y) ** 2.0
102101

103102
with self.subTest(error=error):
104103
self.assertFalse(np.isnan(error))

0 commit comments

Comments
 (0)