Skip to content

ENH Smoke test for invalid parameters in __init__ and get_params #21355

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

Conversation

thomasjpfan
Copy link
Member

Reference Issues/PRs

Related to #16945

What does this implement/fix? Explain your changes.

This PR adds a new test that checks that no validation is done during __init__ and set_params. I fixed the on in _BaseComposition because it is inherited by many estimators.

Any other comments?

Maybe this can be a good intermediate sprint issue?

Copy link
Member

@ogrisel ogrisel left a comment

Choose a reason for hiding this comment

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

Besides the comment below, the test it-self looks like a good idea.

I am not sure that Pipeline and FeatureUnion or other complex meta-estimators will all ever pass this test though, but for "regular" estimators, I think it's a good idea not to validate in __init__ or set_params in general.

I would not make it a check_estimator requirement though.

@glemaitre
Copy link
Member

I assume that we need to open a subsequent issue to reduce the list of the estimator validating parameters in the wrong place.

@glemaitre glemaitre merged commit 6e7fc0e into scikit-learn:main Oct 22, 2021
@glemaitre glemaitre mentioned this pull request Oct 23, 2021
10 tasks
@amueller
Copy link
Member

Somehow I thought I added that test before but I guess I just complained loudly three years ago in #12652. lol...

samronsin pushed a commit to samronsin/scikit-learn that referenced this pull request Nov 30, 2021
avm19 pushed a commit to avm19/scikit-learn that referenced this pull request Apr 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants