8000 [MRG] Remove some warnings from test suit by TomDLT · Pull Request #5283 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

[MRG] Remove some warnings from test suit #5283

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 2 commits into from
Sep 19, 2015

Conversation

TomDLT
Copy link
Member
@TomDLT TomDLT commented Sep 16, 2015

I removed some warnings from the test suit.

  • (1 left) "DeprecationWarning: elementwise comparison failed; this will raise the error in the future"
  • (0 left) "Warning: The least populated class in y has only 2 members, which is too few. The minimum number of labels for any class cannot be less than 3"
  • (0 left) "DeprecationWarning: Default 'multioutput' behavior now corresponds to 'variance_weighted' value, it will be changed to 'uniform_average' in 0.18"
  • (some left) "UndefinedMetricWarning: Precision is ill-defined and being set to 0.0 due to no predicted samples."

Issue #5089
Complementary work #5277

sorted_array = np.arange(201, 300)
assert_true(np.any(sorted_array != ind[train]))
assert_true(np.any(np.arange(100) != ind[test]))
assert_true(np.any(np.arange(100, 200) != ind[test]))
Copy link
Member

Choose a reason for hiding this comment

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

why changing 101 to 100?

Copy link
Member Author

Choose a reason for hiding this comment

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

np.arange(100) = [0, ..., 99] (100 elements)
np.arange(100, 200) = [100, ..., 199] (100 elements)
np.arange(101, 200) = [101, ..., 199] (99 elements)

The test was asserting the arrays are different because of different sizes, and not because of the shuffling (as expected).

@agramfort
Copy link
Member

besides LGTM

@@ -323,6 +322,7 @@ def test_cohen_kappa():
assert_almost_equal(cohen_kappa_score(y1, y2), .8013, decimal=4)


@ignore_warnings
Copy link
Member

Choose a reason for hiding this comment

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

What is the issue being raised here? Is ignoring the warning the only way?

Copy link
Member Author

Choose a reason for hiding this comment

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

RuntimeWarning: Degrees of freedom <= 0 for slice
np.corrcoef raises a warning when dividing by zero, and return a NaN.
This test verifies that matthews_corrcoef transforms the NaN in zeros, so we can silence the warning

Copy link
Member

Choose a reason for hiding this comment

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

Ah, excellent.

@jmschrei
Copy link
Member

Other than my comments, this LGTM. I don't think the best solution to warnings is just squelching them if they can be fixed, because in the future we can't see which warnings have to be fixed.

@TomDLT
Copy link
Member Author
TomDLT commented Sep 17, 2015

I fixed the warnings without using ignore_warning whenever possible.
In this PR, ignore_warning is only used when the test specifically tests the warning cases.

@jmschrei
Copy link
Member

With my comments addressed, this LGTM.

@TomDLT
Copy link
Member Author
TomDLT commented Sep 17, 2015

Thanks for the review !

agramfort added a commit that referenced this pull request Sep 19, 2015
[MRG] Remove some warnings from test suit
@agramfort agramfort merged commit 37bd275 into scikit-learn:master Sep 19, 2015
@agramfort
Copy link
Member

thanks @TomDLT !

raghavrv added a commit to raghavrv/scikit-learn that referenced this pull request Oct 5, 2015
raghavrv added a commit to raghavrv/scikit-learn that referenced this pull request Oct 5, 2015
@TomDLT TomDLT deleted the remove_warnings branch October 16, 2015 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0