diff --git a/src/skmatter/_selection.py b/src/skmatter/_selection.py index 8b86b80d5..0e184349b 100644 --- a/src/skmatter/_selection.py +++ b/src/skmatter/_selection.py @@ -239,7 +239,9 @@ def transform(self, X, y=None): The selected subset of the input. """ - if self.axis == 0: + check_is_fitted(self, ["_axis", "selected_idx_", "n_selected_"]) + + if self._axis == 0: raise ValueError( "Transform is not currently supported for sample selection." ) @@ -249,7 +251,7 @@ def transform(self, X, y=None): X = check_array(X) if len(X.shape) == 1: - if self.axis == 0: + if self._axis == 0: X = X.reshape(-1, 1) else: X = X.reshape(1, -1) diff --git a/tests/test_greedy_selector.py b/tests/test_greedy_selector.py index 3866764b5..0bfe6de99 100644 --- a/tests/test_greedy_selector.py +++ b/tests/test_greedy_selector.py @@ -62,7 +62,6 @@ def test_bad_warm_start(self): def test_bad_y(self): self.X, self.Y = get_dataset(return_X_y=True) Y = self.Y[:2] - print(self.X.shape, Y.shape) selector = GreedyTester(n_to_select=2) with self.assertRaises(ValueError): selector.fit(X=self.X, y=Y) diff --git a/tests/test_orthogonalizers.py b/tests/test_orthogonalizers.py index 050874c03..0578141c8 100644 --- a/tests/test_orthogonalizers.py +++ b/tests/test_orthogonalizers.py @@ -152,12 +152,10 @@ def test_copy(self): -1, 1, size=(self.n_samples, self.n_features) ) - print(X_random) idx = self.random_state.choice(X_random.shape[-1]) new_X = X_orthogonalizer(X_random, idx, tol=EPSILON, copy=True) X_orthogonalizer(X_random, idx, tol=EPSILON, copy=False) - print(new_X, X_random) self.assertTrue(np.allclose(X_random, new_X))