Issue
I was trying to use the eli5 package in Python. Initially I was unable to install that, but later fixed it with conda install -c conda-forge eli5.
Now when I try to import eli5 into my Jupyter Notebbok, I get the following error: ModuleNotFoundError: No module named 'sklearn.metrics.scorer'.
How do I resolve this issue? I am trying to evaluate a model and use the eli5 command to give me the top 10 features.
Solution
For those of you who have tried to import something from sklearn.metrics.scorer
and got the error No module named 'sklearn.metrics.scorer', all you have to do is import the same objects from sklearn.metrics
since the contents have been moved in the newer versions of sklearn (1.0+). List of scorers for example used to be accessible through from sklearn.metrics.scorer import SCORERS
, but in the newer versions it is accessible through from sklearn.metrics import SCORERS
.
And for @Supreetha Krishna's question, chances are you have had installed eli5 version 0.11.0, which according to eli5 documents is compatible with sklearn version 0.18+, alongside sklearn version 1.0+. However, the moving of the contents within sklearn.metrics.scorer
has caused the error. You can either use pip (pip install eli5
) to get the latest versions of eli5 (currently 0.13.0), in which this issue is resolved, or use conda to update eli5 package, since according to https://anaconda.org/conda-forge/eli5, conda currently uses version 0.13.0 of eli5 too.
Answered By - Amir Zare
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.