eli5 icon indicating copy to clipboard operation
eli5 copied to clipboard

Future Warning Error

Open dangbluechip opened this issue 5 years ago • 6 comments

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)

dangbluechip avatar Jan 21 '20 15:01 dangbluechip

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')

hermidalc avatar Feb 25 '20 00:02 hermidalc

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.

lukeplausin avatar Dec 27 '20 14:12 lukeplausin

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

michael135 avatar Dec 28 '20 22:12 michael135

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

arc12 avatar Jan 06 '21 10:01 arc12

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

toltoxgh avatar Jan 13 '21 00:01 toltoxgh

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.

lopuhin avatar Jan 13 '21 08:01 lopuhin