Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Alexander Goscinski <alex.goscinski@posteo.de>
  • Loading branch information
rosecers and agoscinski committed Jun 1, 2023
1 parent 56ae787 commit 097b273
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
6 changes: 4 additions & 2 deletions src/skmatter/_selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."
)
Expand All @@ -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)
Expand Down
1 change: 0 additions & 1 deletion tests/test_greedy_selector.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 0 additions & 2 deletions tests/test_orthogonalizers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))


Expand Down

0 comments on commit 097b273

Please sign in to comment.