Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

confusion matrix python code

from sklearn.metrics import confusion_matrix
cm = confusion_matrix(y_test, y_predicted)
cm
# after creating the confusion matrix, for better understaning plot the cm.
import seaborn as sn
plt.figure(figsize = (10,7))
sn.heatmap(cm, annot=True)
plt.xlabel('Predicted')
plt.ylabel('Truth')
Source by scikit-learn.org #
 
PREVIOUS NEXT
Tagged: #confusion #matrix #python #code
ADD COMMENT
Topic
Name
6+4 =