-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
[MRG + 1] update test_common.py deprecation warning #7024
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
Conversation
@@ -222,7 +222,7 @@ def test_transformer_n_iter(): | |||
else: | |||
yield check_transformer_n_iter, name, estimator | |||
|
|||
|
|||
@ignore_warnings(category=DeprecationWarning) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not so confident about this one - the test_get_params_invariance(): is more general than just RandomizedPCA.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, in the common tests we might allow that... Or maybe, can we inspect a class to see if it is deprecated? Below there is a hard-coded test for projected gradient. We should check that if the class is deprecated, we catch the deprecation warning, but not otherwise (it might call to deprecated functions, which we should fix).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The RandomizedPCA class is also deprecated, but hard coding each class isn't best practice either... How would you recommend going about it - create a list of classes?
GaussianProcess and GMM also have the same warning, and are both deprecated:
from sklearn.mixture import GMM
hasattr(GMM.init,"deprecated_original")
True
from sklearn.gaussian_process import GaussianProcess
hasattr(GaussianProcess.init,"deprecated_original")
True
…rnings on deprecated classes per issue 7006
Great. Have you checked that the warnings are actually caught? |
As far as I can tell, I think we're good on this issue:
|
@tguillemot mrg? |
I clearly prefer that way of removing the deprecated classes. |
Thanks @blakeflei |
@tguillemot @amueller @juliathebrave Thanks for the support! I appreciate all the feedback. |
* update test_common.py deprecation warning * Updated test_common.test_get_params_invariance to omit deprecation warnings on deprecated classes per issue 7006
* update test_common.py deprecation warning * Updated test_common.test_get_params_invariance to omit deprecation warnings on deprecated classes per issue 7006
Reference Issue
Too much warnings during the testing process #7006
What does this implement/fix? Explain your changes.
sklearn.tests.test_common.test_get_params_invariance('RandomizedPCA', <class 'sklearn.d
ecomposition.pca.RandomizedPCA'>) ... /Users/bf/Desktop/Scipy2016/Sprints/scikit-learn/
scikit-learn/sklearn/utils/deprecation.py:52: DeprecationWarning: Class RandomizedPCA i
s deprecated; RandomizedPCA will be removed in 0.20. Use PCA(svd_solver='randomized') i
nstead. The new implementation DOES NOT store whiten components_. Apply transform to ge
t them.
warnings.warn(msg, category=DeprecationWarning)
Any other comments?