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

ImportError: cannot import name 'safe_indexing' #1141

Closed
heydibyendu opened this issue Jan 5, 2021 · 1 comment
Closed

ImportError: cannot import name 'safe_indexing' #1141

heydibyendu opened this issue Jan 5, 2021 · 1 comment

Comments

@heydibyendu
Copy link

heydibyendu commented Jan 5, 2021

I am trying to install 'LearningCurve' from the 'yellowbrick.model_selection' module.

However, I'm facing the following problem:

from yellowbrick.model_selection import LearningCurve

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-30-c6ff95ce49ee> in <module>
     47 
     48 
---> 49 from yellowbrick.model_selection import LearningCurve

~/cdap/lib64/python3.6/site-packages/yellowbrick/__init__.py in <module>
     37 from .anscombe import anscombe
     38 from .datasaurus import datasaurus
---> 39 from .classifier import ROCAUC, ClassBalance, ClassificationScoreVisualizer
     40 
     41 # from .classifier import crplot, rocplot

~/cdap/lib64/python3.6/site-packages/yellowbrick/classifier/__init__.py in <module>
     28 from .confusion_matrix import ConfusionMatrix, confusion_matrix
     29 from .rocauc import ROCAUC, roc_auc
---> 30 from .threshold import DiscriminationThreshold, discrimination_threshold
     31 from .prcurve import PrecisionRecallCurve, PRCurve, precision_recall_curve
     32 

~/cdap/lib64/python3.6/site-packages/yellowbrick/classifier/threshold.py in <module>
     28 from sklearn.model_selection import ShuffleSplit
     29 from sklearn.metrics import precision_recall_curve
---> 30 from sklearn.utils import indexable, safe_indexing
     31 from sklearn.utils.multiclass import type_of_target
     32 

ImportError: cannot import name 'safe_indexing'

I'm not sure why this is happening. Any help would be appreciated. Thank you!

@rebeccabilbro
Copy link
Member

Duplicate of #1137

Hello @heydibyendu and thanks for checking out Yellowbrick.

Scikit-learn recently changed their public/private API, so utils.safe_indexing is now called utils._safe_indexing. In order for the utility to work in Yellowbrick, we are working on a change to our usage of safe_indexing to support users with versions of scikit-learn >= 0.24 without deprecating support for users with versions of scikit-learn < 0.24. That change will be available in the next version of Yellowbrick.

In the meantime, you can avoid the error by downgrading your version of scikit-learn to <0.24

Thanks again for checking out Yellowbrick!

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

No branches or pull requests

2 participants