TeamHG-Memex / eli5

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

Future Warning Error #360

Open dangbluechip opened 4 years ago

dangbluechip commented 4 years ago

Started receiving the following message after a few updates. Sklearn access in upcoming versions should only be through their public api.

FutureWarning: The sklearn.metrics.scorer 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.metrics. Anything that cannot be imported from sklearn.metrics is now part of the private API. 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. warnings.warn(message, FutureWarning)

hermidalc commented 4 years ago

I get the same too, it's because of upgrading to scikit-learn 0.22.x. You can suppress it like:

warnings.filterwarnings('ignore', category=FutureWarning,
                        module='sklearn.utils.deprecation')
# all ELI5 imports here
from eli5 import explain_weights, explain_prediction
warnings.filterwarnings('always', category=FutureWarning,
                        module='sklearn.utils.deprecation')
lukeplausin commented 3 years ago

I get this exception when using eli5 as installed from pypi

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/luke/.virtualenvs/myenv/lib/python3.8/site-packages/eli5/__init__.py", line 13, in <module>
    from .sklearn import explain_weights_sklearn, explain_prediction_sklearn
  File "/home/luke/.virtualenvs/myenv/lib/python3.8/site-packages/eli5/sklearn/__init__.py", line 3, in <module>
    from .explain_weights import (
  File "/home/luke/.virtualenvs/myenv/lib/python3.8/site-packages/eli5/sklearn/explain_weights.py", line 78, in <module>
    from .permutation_importance import PermutationImportance
  File "/home/luke/.virtualenvs/myenv/lib/python3.8/site-packages/eli5/sklearn/permutation_importance.py", line 15, in <module>
    from sklearn.metrics.scorer import check_scoring  # type: ignore
ModuleNotFoundError: No module named 'sklearn.metrics.scorer'

If anyone else got this error after using a fresh install of eli5, you can fix by running pip install "scikit-learn<=0.23.0" in your environment. eli5 maintainers - you should set the scikit-learn dependency in requirements.txt or setup.py to scikit-learn<=0.23.0 until eli5 gets a proper update so that new users don't get a broken installation.

michael135 commented 3 years ago

It's relevant not only for new user, but for every user, which occasionaly update scikit learn to its last version.

arc12 commented 3 years ago

please fix this asap; it is not a fix to use an old version of sklearn which contains issues which are fixed in 0.24. Keep on top of deprecation warnings!

PR is https://github.com/TeamHG-Memex/eli5/pull/397

toltoxgh commented 3 years ago

A fix so that eli5 could be used with scikit-learn 0.24 would be really appreciated, thanks.

lopuhin commented 3 years ago

Hi folks, sorry for lack of activity here, I really hope we can get all the fixes and hopefully some features merged in Jan, we need to also update the CI and do some other house-keeping.