Skip to content

WIP FIX Revert changes in check_is_fitted #15885

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

Closed

Conversation

qinhanmin2014
Copy link
Member

@qinhanmin2014 qinhanmin2014 commented Dec 14, 2019

Fixes #15845 revert #14545
Some users complain about the new check_is_fitted and I prefer to revert the change.
The core issue is that some estimators (e.g., TfidfVectorizer) set private attributes in __init__ and this seems reasonable:

from sklearn.utils.validation import check_is_fitted
from sklearn.feature_extraction.text import TfidfVectorizer
vectorizer = TfidfVectorizer()
check_is_fitted(vectorizer)
# pass

We can't simply remove v.startswith("_") because some estimators do not create any public attributes in fit (e.g., TfidfTransformer).

@qinhanmin2014 qinhanmin2014 changed the title FIX Revert changes in check_is_fitted WIP FIX Revert changes in check_is_fitted Dec 14, 2019
@jnothman jnothman closed this Dec 16, 2019
@jnothman jnothman reopened this Dec 16, 2019
@jnothman
Copy link
Member

Sorry for the accidental closure. CI not happy

@qinhanmin2014
Copy link
Member Author

Sorry for the accidental closure. CI not happy

Yes, I know. It's not trivial to make CI happy so I want to wait for the final decision.

@qinhanmin2014 qinhanmin2014 deleted the revert-check-is-fitted branch December 27, 2019 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

check_is_fitted has false positives on custom subclasses with private attributes
2 participants