Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sklearn ImportError: cannot import name plot_roc_curve

I am trying to plot a Receiver Operating Characteristics (ROC) curve with cross validation, following the example provided in sklearn's documentation. However, the following import gives an ImportError, in both python2 and python3.

from sklearn.metrics import plot_roc_curve

Error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name plot_roc_curve

python-2.7 sklearn version: 0.20.2.

python-3.6 sklearn version: 0.21.3.

I found that the following import works fine, but it's not quite the same as plot_roc_curve.

from sklearn.metrics import roc_curve

Is plot_roc_curve deprecated? Could somebody try the code and let me know the sklearn version if it works?

like image 232
Achintha Ihalage Avatar asked Feb 20 '20 13:02

Achintha Ihalage


1 Answers

Install scikit-plot and import the metric from there:

from scikitplot.metrics import plot_roc_curve
like image 73
Talha Rifaai Avatar answered Oct 02 '22 13:10

Talha Rifaai