Skip to content
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

Merged
merged 5 commits into from
Dec 12, 2019
Merged

scikit-learn 0.22 compatibility #353

merged 5 commits into from
Dec 12, 2019

Conversation

zzz4zzz
Copy link
Contributor

@zzz4zzz zzz4zzz commented Dec 10, 2019

Adjust ELI5 to scikit-learn 0.22.

@codecov-io
Copy link

codecov-io commented Dec 10, 2019

Codecov Report

Merging #353 into master will increase coverage by <.01%.
The diff coverage is 100%.

@@            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
Impacted Files Coverage Δ
eli5/sklearn/text.py 97.87% <100%> (+0.09%) ⬆️

@zzz4zzz
Copy link
Contributor Author

zzz4zzz commented Dec 10, 2019

Failed tests are not related to new sklearn version.

Copy link
Contributor

@lopuhin lopuhin left a 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?

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
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

@lopuhin lopuhin left a 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
Copy link
Contributor

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 👍

@lopuhin lopuhin merged commit 9b8f0f0 into TeamHG-Memex:master Dec 12, 2019
@zzz4zzz zzz4zzz deleted the sklearn_0.22 branch December 12, 2019 15:17
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.

3 participants