8000 TST attempt to fix the variance threshold part of #14192 by jnothman · Pull Request #14204 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

TST attempt to fix the variance threshold part of #14192 #14204

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 27, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion sklearn/feature_selection/tests/test_variance_threshold.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ def test_zero_variance_floating_point_error():
# See #13691

data = [[-0.13725701]] * 10
Copy link
Member
@rth rth Jun 27, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe using,

Suggested change
data = [[-0.13725701]] * 10
data = np.full((10, 1), -0.13725701)

would be better anyway?

assert np.var(data) != 0
if np.var(data) == 0:
pytest.skip('This test is not valid for this platform, as it relies '
'on numerical instabilities.')
for X in [data, csr_matrix(data), csc_matrix(data), bsr_matrix(data)]:
msg = "No feature in X meets the variance threshold 0.00000"
with pytest.raises(ValueError, match=msg):
Expand Down
0