版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u013608336/article/details/82693705
原理
横轴一般是predict label,纵轴是ground truth label,对角线是预测正确的概率或个数
绘制
sklearn 中confusion_matrix函数的使用:
sklearn.metrics.confusion_matrix(y_true, y_pred, labels=None, sample_weight=None)
from sklearn.metrics import confusion_matrix
y_true=[2,1,0,1,2,0]
y_pred=[2,0,0,1,2,1]
C=confusion_matrix(y_true, y_pred)