-
Notifications
You must be signed in to change notification settings - Fork 331
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
scikit-learn 0.22 compatibility #353
Conversation
Codecov Report
@@ Coverage Diff @@
## master #353 +/- ##
==========================================
+ Coverage 97.31% 97.32% +<.01%
==========================================
Files 49 49
Lines 3134 3138 +4
Branches 584 584
==========================================
+ Hits 3050 3054 +4
Misses 44 44
Partials 40 40
|
Failed tests are not related to new sklearn version. |
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 for the PR @zzz4zzz, this fixes some failures in master. Could you please check one question regarding the import?
eli5/sklearn/text.py
Outdated
try: | ||
from sklearn.feature_extraction.text import _VectorizerMixin as VectorizerMixin | ||
except ImportError: # Changed in scikit-learn 0.22 | ||
from sklearn.feature_extraction.text import VectorizerMixin # type: ignore |
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.
In the same file there is an import of from sklearn.feature_extraction.text import VectorizerMixin
on line 4, so at this point either VectorizerMixin
has already been imported, or the whole module would fail to import. So unless I misread the code, this would be better moved to the top of the module, replacing current VectorizerMixin
import.
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.
Yes, that's right. I have just moved import to the top of file.
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.
Looks great, thanks @zzz4zzz 👍
from sklearn.pipeline import FeatureUnion # type: ignore | ||
try: | ||
from sklearn.feature_extraction.text import _VectorizerMixin as VectorizerMixin | ||
except ImportError: # Changed in scikit-learn 0.22 |
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.
FWIW it still works in sklearn 0.22, but it's already deprecated (to be removed in 0.24), so good that we are ready 👍
Adjust ELI5 to scikit-learn 0.22.