TeamHG-Memex / eli5

A library for debugging/inspecting machine learning classifiers and explaining their predictions
http://eli5.readthedocs.io
MIT License
2.75k stars 331 forks source link

Conform to new sklearn api #398

Open icfly2 opened 3 years ago

icfly2 commented 3 years ago

Made import compliant with newer API as per warning:

  File "/app/model/model.py", line 3, in <module>
    import eli5
  File "/usr/local/lib/python3.7/site-packages/eli5/__init__.py", line 13, in <module>
    from .sklearn import explain_weights_sklearn, explain_prediction_sklearn
  File "/usr/local/lib/python3.7/site-packages/eli5/sklearn/__init__.py", line 21, in <module>
    from . import transform as _
  File "/usr/local/lib/python3.7/site-packages/eli5/sklearn/transform.py", line 6, in <module>
    from sklearn.feature_selection.base import SelectorMixin  # type: ignore
  File "/usr/local/lib/python3.7/site-packages/sklearn/feature_selection/base.py", line 12, in <module>
    _raise_dep_warning_if_not_pytest(deprecated_path, correct_import_path)
  File "/usr/local/lib/python3.7/site-packages/sklearn/utils/deprecation.py", line 143, in _raise_dep_warning_if_not_pytest
    warnings.warn(message, FutureWarning)
FutureWarning: The sklearn.feature_selection.base module is  deprecated in version 0.22 and will be removed in version 0.24. The corresponding classes / functions should instead be imported from sklearn.feature_selection. Anything that cannot be imported from sklearn.feature_selection is now part of the private API.

Yes this breaks backward compatibility for sklearn but will allow eli5 to continue to work with the next version of sklearn 0.24

InterferencePattern commented 3 years ago

As with #397, changing the requirements and setup to require sklearn >= 0.20 would maintain compatibility.

icfly2 commented 3 years ago

sklearn version bump in requirements.txt and setup.py in #397

codecov-io commented 3 years ago

Codecov Report

Merging #398 (c211550) into master (017c738) will decrease coverage by 23.58%. The diff coverage is 100.00%.

@@             Coverage Diff             @@
##           master     #398       +/-   ##
===========================================
- Coverage   97.32%   73.74%   -23.59%     
===========================================
  Files          49       49               
  Lines        3142     3142               
  Branches      585      585               
===========================================
- Hits         3058     2317      -741     
- Misses         44      777      +733     
- Partials       40       48        +8     
Impacted Files Coverage Δ
eli5/sklearn/transform.py 94.28% <100.00%> (-5.72%) :arrow_down:
eli5/keras/gradcam.py 0.00% <0.00%> (-100.00%) :arrow_down:
eli5/xgboost.py 4.26% <0.00%> (-95.13%) :arrow_down:
eli5/formatters/image.py 5.47% <0.00%> (-94.53%) :arrow_down:
eli5/sklearn_crfsuite/explain_weights.py 7.40% <0.00%> (-92.60%) :arrow_down:
eli5/keras/explain_prediction.py 4.81% <0.00%> (-91.57%) :arrow_down:
eli5/lightgbm.py 4.27% <0.00%> (-90.60%) :arrow_down:
eli5/lightning.py 5.00% <0.00%> (-90.00%) :arrow_down:
eli5/formatters/as_dataframe.py 5.79% <0.00%> (-89.86%) :arrow_down:
eli5/ipython.py 11.42% <0.00%> (-88.58%) :arrow_down:
... and 17 more
lopuhin commented 3 years ago

Thanks you! This were merged in eli5-org/eli5#2 and released to PyPI with v0.11