ImportError: cannot import name 'plot_confusion_matrix' from 'sklearn.metrics'
13,220
plot_confusion_matrix
is available only after v0.22
. If you are not using the latest version please update using one of the following commands.
Anaconda
conda update -c conda-forge scikit-learn
PIP
pip install --upgrade scikit-learn
Author by
excelman
Updated on December 24, 2022Comments
-
excelman over 1 year
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)
-
Sanushi Salgado almost 2 yearsI'm getting the same error i.e. cannot import name 'plot_confusion_matrix' when running my notebook via Kaggle kernel. Even tried to upgrade sklearn via this command -> !pip install --upgrade scikit-learn. But still I'm getting the above error.