10

I am attempting to run below code.

from sklearn.metrics import plot_confusion_matrix

And I am receiving below error.

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-66-ebfa5cfc2bb8> in <module>
----> 1 from sklearn.metrics import plot_confusion_matrix

ImportError: cannot import name 'plot_confusion_matrix' from 'sklearn.metrics' (C:\Program Files\Anaconda3\lib\site-packages\sklearn\metrics\__init__.py)
desertnaut
  • 57,590
  • 26
  • 140
  • 166
excelman
  • 189
  • 1
  • 2
  • 10

2 Answers2

8

plot_confusion_matrix deprecated now so use sklearn.metrics.ConfusionMatrixDisplay

enter image description here


PIP

pip install --upgrade scikit-learn
or 
conda update -c conda-forge scikit-learn
Equinox
  • 6,483
  • 3
  • 23
  • 32
5

Try to use sklearn.metrics.ConfusionMatrixDisplay instead?

Document Here: sklearn.metrics.ConfusionMatrixDisplay

CCCougar
  • 59
  • 1
  • 4
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Dec 27 '22 at 08:54