-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
[MRG] Relax init parameter checks and add explanatory error messages #17936
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
5aeae49
to
dfa6bac
Compare
a9d929f
to
1639a4e
Compare
We now allow any "type" (uninitialized classes) and all numeric numpy types. See scikit-learn#17756 for a discussion.
This can make it much easier to work with this test while making a pre-existing estimator compatible.
1639a4e
to
1e7abee
Compare
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.
Thanks @timokau ! Generally looks good, however could you please add a test to sklearn/utils/tests/test_estimator_checks.py that check that,
- on a very simple estimator similar to the example in your issue, that
check_parameters_default_constructible
now passes - on a simple estimator that would take as input some instance of a class, this estimator would fail.
7905839
to
659bea4
Compare
659bea4
to
8c6c313
Compare
I didn't think the tests had their own tests 😄 Done. Please have another look. |
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.
Thank you for the PR @timokau !
LGTM
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.
Thank you @timokau !
Reference Issues/PRs
Fixes #17756.
What does this implement/fix? Explain your changes.
See #17756. The init parameter checks were unnecessarily restrictive to achieve the goal of checking for immutability. The error messages were also not very helpful when debugging failures, since they simply pointed to failed asserts without explaining which parameter is responsible or why it should have one of the whitelisted types.