-
-
Notifications
You must be signed in to change notification settings - Fork 25.9k
[MRG] Deprecate class support for check_estimator and parametrize_with_checks #17032
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
[MRG] Deprecate class support for check_estimator and parametrize_with_checks #17032
Conversation
@@ -105,7 +107,7 @@ def _tested_estimators(): | |||
yield estimator | |||
|
|||
|
|||
@parametrize_with_checks(_tested_estimators()) | |||
@parametrize_with_checks(list(_tested_estimators())) |
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.
without this, the iterator would be consumed in parametrize_with_checks
due to the addition of if any(isinstance(est, type) for est in estimators):
Note that the docstring of parametrize_with_checks
says that its argument should be a list.
Thanks @NicolasHug ! Generally I think this would be a good idea. A few comments,
|
BTW, is this actually necessary? We could have kept |
…move_class_support_check_estimators
…move_class_support_check_estimators
sklearn/utils/estimator_checks.py
Outdated
@@ -477,6 +513,27 @@ def check_estimator(Estimator, generate_only=False): | |||
warnings.warn(str(exception), SkipTestWarning) | |||
|
|||
|
|||
def check_estimator_class(Estimator): |
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.
YAGNI?
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.
yep will remove
Can't we just run |
Yes, I'll update asap and ping when ready ;) |
…move_class_support_check_estimators
PR ready for review @rth @jnothman @adrinjalali @thomasjpfan
|
maybe @ogrisel too if you have time |
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.
Otherwise LGTM I think.
@@ -385,6 +390,10 @@ def parametrize_with_checks(estimators): | |||
estimators : list of estimators objects or classes | |||
Estimators to generated checks for. | |||
|
|||
.. deprecated:: 0.23 |
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 estimator
is not deprecated, but changed? I'm not sure if versionchanged
works better here or not.
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.
I guess it should be deprecated
for now, and become versionchanged
in 0.24
Thanks for the reviews! do you want to have a last look @rth? Otherwise I'll merge tomorrow |
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.
LGTM, thanks @NicolasHug !
Thanks! ping #17010 |
and parametrize_with_checks
and parametrize_with_checks
and parametrize_with_checks
Fix #17030
This PR deprecates passing a class to
check_estimator
andparametrize_with_checks
.A newHopefully, this will make the code simpler and our lives easier in the long run.check_class
utility is created.CC @rth @thomasjpfan
Maybe also @adrinjalali @jnothman @amueller would want to have a look