-
-
Notifications
You must be signed in to change notification settings - Fork 26k
[MRG + 1] Add check for estimator: parameters not modified by fit
#7846
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 + 1] Add check for estimator: parameters not modified by fit
#7846
Conversation
if hasattr(estimator, "n_clusters"): | ||
estimator.n_clusters = 1 | ||
|
||
set_random_state(estimator, 1) |
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.
this part seems to be very repetitive, so maybe it's possible to refactor / extract method here.. not sure though
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.
sounds good
def check_fit2d_predict1d(name, Estimator): | ||
# check by fitting a 2d array and prediting with a 1d array | ||
# check by fitting a 2d array and predicting with a 1d array |
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 relevant to the current commit, just caught my eye. Hope it's innocent enough!
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.
Sure that's fine :)
there are some amount of estimators, which is not follow this rule from the beginning, that's the reason of failing tests |
Could you please list the attributes that are set inappropriately here? Then the test logs will be more informative.
Reference Issue
Fixes #7763
What does this implement/fix? Explain your changes.
Add simple test to estimator_tests, which checks that
__dict__
does not have non-private attributes afterfit
Any other comments?
didn't add any documentation for that, do I need to?