8000 Further reduce the number of warnings in testing by ShangwuYao · Pull Request #11240 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

Further reduce the number of warnings in testing #11240

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

Closed

Conversation

ShangwuYao
Copy link
Contributor

Further reduce the number of warnings as suggested in #11151

@ShangwuYao
Copy link
Contributor Author
ShangwuYao commented Jun 12, 2018

I suppressed ConvergenceWarning, but I am not sure about that.
It still have hundreds of RuntimeWarning.

@ShangwuYao ShangwuYao changed the title Ignore expected warnings Further reduce the number of warnings in testing Jun 12, 2018
@jnothman
Copy link
Member
jnothman commented Jun 12, 2018 via email

@ShangwuYao
Copy link
Contributor Author

Top 20 warnings classes in python 3.6 (697 warnings in total):

 145   /Users/sw/programming/opensourceproject/suppress-warning/scikit-learn/sklearn/tree/tree.py:869: RuntimeWarning: divide by zero encountered in log
 100   /Users/sw/programming/opensourceproject/suppress-warning/scikit-learn/sklearn/preprocessing/tests/test_data.py:514: RuntimeWarning: underflow encountered in nextafter
  98   /Users/sw/programming/opensourceproject/suppress-warning/scikit-learn/sklearn/gaussian_process/kernels.py:1206: RuntimeWarning: underflow encountered in exp
  27   /Users/sw/programming/opensourceproject/suppress-warning/scikit-learn/sklearn/tree/tree.py:873: RuntimeWarning: divide by zero encountered in log
  26   /Users/sw/programming/opensourceproject/suppress-warning/scikit-learn/sklearn/gaussian_process/kernels.py:756: RuntimeWarning: underflow encountered in multiply
  25   /Users/sw/programming/opensourceproject/suppress-warning/scikit-learn/sklearn/gaussian_process/kernels.py:1224: RuntimeWarning: underflow encountered in multiply
  24   /Users/sw/programming/opensourceproject/suppress-warning/scikit-learn/sklearn/neighbors/tests/test_kde.py:41: RuntimeWarning: underflow encountered in exp
  23   /Users/sw/programming/opensourceproject/suppress-warning/scikit-learn/sklearn/gaussian_process/kernels.py:755: RuntimeWarning: underflow encountered in multiply
  22   /Users/sw/programming/opensourceproject/suppress-warning/scikit-learn/sklearn/gaussian_process/kernels.py:1216: RuntimeWarning: underflow encountered in exp
  21   /Users/sw/programming/opensourceproject/suppress-warning/scikit-learn/sklearn/metrics/pairwise.py:825: RuntimeWarning: underflow encountered in exp
  14   /Users/sw/programming/opensourceproject/suppress-warning/scikit-learn/sklearn/gaussian_process/gpc.py:400: RuntimeWarning: underflow encountered in multiply
  11   /Users/sw/programming/opensourceproject/suppress-warning/scikit-learn/sklearn/metrics/cluster/unsupervised.py:330: RuntimeWarning: divide by zero encountered in true_divide
  11   /Users/sw/programming/opensourceproject/suppress-warning/scikit-learn/sklearn/gaussian_process/gpc.py:399: RuntimeWarning: underflow encountered in multiply
   9   /anaconda/lib/python3.6/site-packages/scipy/stats/_distn_infrastructure.py:879: RuntimeWarning: invalid value encountered in less
   9   /anaconda/lib/python3.6/site-packages/scipy/stats/_distn_infrastructure.py:879: RuntimeWarning: invalid value encountered in greater
   9   /anaconda/lib/python3.6/site-packages/scipy/stats/_distn_infrastructure.py:1738: RuntimeWarning: invalid value encountered in greater_equal
   9   /anaconda/lib/python3.6/site-packages/scipy/sparse/compressed.py:746: SparseEfficiencyWarning: Changing the sparsity structure of a csr_matrix is expensive. lil_matrix is more efficient.
   8   /anaconda/lib/python3.6/site-packages/numpy/core/numeric.py:2549: RuntimeWarning: underflow encountered in multiply
   8   /Users/sw/programming/opensourceproject/suppress-warning/scikit-learn/sklearn/neighbors/tests/test_kde.py:39: RuntimeWarning: underflow encountered in exp
   8   /Users/sw/programming/opensourceproject/suppress-warning/scikit-learn/sklearn/neighbors/tests/test_ball_tree.py:132: RuntimeWarning: underflow encountered in exp

@lesteve
Copy link
Member
lesteve commented Jun 13, 2018

Without looking into this in more details, I don't have a good proposal that is guaranteed to work about how to best reduce the warnings. I have to admit that I doubt that adding a pytest.mark.filterwarnings in a bunch of test files is the right way to do it ...

Copy link
Member
@jnothman jnothman left a comment

Choose a reason for hiding this comment

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

We should not generally be suppressing DeprecationWarning. We need those DeprecationWarnings to know when we're using something we shouldn't. ConvergenceWarning can be suppressed, under the assumption that we often will run a small number of iterations in testing, and do not care about convergence.

@jnothman
Copy link
Member

ignoring warnings should be done with care.

@glemaitre
Copy link
Member

Refer to #11252 as well to complement @jnothman comment #11240 (review)

@ShangwuYao
Copy link
Contributor Author

I agree. Should I remove the filters on DeprecationWarning and ignore ConvergenceWarning only when it satisfies that assumption, or just close this PR?

@jnothman
Copy link
Member
jnothman commented Jun 13, 2018 via email

@ogrisel
Copy link
Member
ogrisel commented Jun 25, 2018

+1 for hiding some ConvergenceWarning but only on a case by case basis (in each test, not at the module level) with a short comment explaining that this test doesn't need to ensure that the model is fully converged for the test to be valid and meaningful.

@ShangwuYao I think we should never hide warnings "en masse" at the module level. See #11252 for more details.

@ShangwuYao
Copy link
Contributor Author

So we can't blindly ignore UserWarning and FutureWarning?

@jnothman
Copy link
Member
jnothman commented Jun 25, 2018 via email

@ogrisel
Copy link
Member
ogrisel commented Jul 5, 2018

So we can't blindly ignore UserWarning and FutureWarning?

No. Otherwise what would be the point of raising warnings in the first place?

@ShangwuYao
Copy link
Contributor Author

I thought they were meant to warn users, not for internal tests?

@jnothman
Copy link
Member
jnothman commented Jul 6, 2018 via email

@amueller
Copy link
Member
amueller commented Aug 5, 2019

closing this as much of this has been resolved by #11570 and there are now way too many conflicts.

@amueller amueller closed this Aug 5, 2019
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.

6 participants
0