[英]confusion matrix confusion between FN & FP on the heatmap
I'm trying to solve a classification problem with machine learning on python.我正在尝试在 python 上使用机器学习解决分类问题。 The topic is about using credit dataset to predict if the person has a good or bad credit.该主题是关于使用信用数据集来预测该人的信用是好是坏。 When a person has a good credit then 0, if not then 1. I created a confusion matrix with LR.当一个人的信用良好时,则为 0,否则为 1。我用 LR 创建了一个混淆矩阵。 I'm not sure if 13 is FN or FP.我不确定 13 是 FN 还是 FP。 Could anyone clarify this for me please?任何人都可以为我澄清这一点吗? This he confusion matrix这个他混淆矩阵
It's a bit weird to make 0 your positive class.将 0 设为正类有点奇怪。 In any case, you need to flip your confusion matrix.在任何情况下,您都需要翻转混淆矩阵。 Let's say your test and predict are such假设您的测试和预测是这样的
y_test = np.repeat([0,1,0,1],[128,34,13,25])
y_pred = np.repeat([0,0,1,1],[128,34,13,25])
We always do prediction, actual:我们总是做预测,实际:
from sklearn.metrics import confusion_matrix
import seaborn as sns
cfm = confusion_matrix(y_pred,y_test)
sns.heatmap(cfm,annot=True,cmap="Blues")
So in this case, we just go on with zero as your positive class it's exactly like what you have in this diagram from wiki for confusion matrix :因此,在这种情况下,我们只是将零作为您的正类,它与您在wiki 中的混淆矩阵图中的内容完全相同:
The top right is false positive (34) and your bottom left is false negative.右上角是假阳性 (34),左下角是假阴性。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.