首页 > 其他 > 详细

二分类下的混淆矩阵

时间:2019-10-22 12:32:44      阅读:420      评论:0      收藏:0      [点我收藏+]
from sklearn.metrics import confusion_matrix
import matplotlib.pyplot as plt

y_test = [0, 0, 0, 0, 0, 1, 1, 1, 1, 1]
y_pred = [0, 1, 0, 0, 0, 0, 0, 1, 1, 1]
confusion_matrix = confusion_matrix(y_test, y_pred)
print(confusion_matrix)
plt.matshow(confusion_matrix)
plt.title(Confusion matrix)
plt.colorbar()
plt.ylabel(True label)
plt.xlabel(Predicted label)
plt.show()
[[4 1]
 [2 3]]

技术分享图片

二分类下的混淆矩阵

原文:https://www.cnblogs.com/starcrm/p/11718616.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!