How to Solve NameError: name 'plot_confusion_matrix' is not defined -- sklearn

Solution: Import the 'plot_confusion_matrix' module

To Solve the error, add the following line to the top of your code.

from sklearn import plot_confusion_matrix

 

For more information:
Python sklearn plot_confusion_matrix