简体   繁体   English

热图上 FN 和 FP 之间的混淆矩阵混淆

[英]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.

相关问题 在Python中是否已经实现了一些东西,可以为多类混淆矩阵计算TP,TN,FP和FN? - Is there something already implemented in Python to calculate TP, TN, FP, and FN for multiclass confusion matrix? 如何让sklearn.metrics.confusion_matrix()始终返回TP,TN,FP,FN? - How to make sklearn.metrics.confusion_matrix() to always return TP, TN, FP, FN? 热图中转置混乱矩阵的原因 - reason for transposed confusion matrix in heatmap 实例分割的混淆矩阵不返回 FN - Confusion matrix for instance segmentation returning no FN 熊猫混淆矩阵的散景热图 - Bokeh heatmap from Pandas confusion matrix Seaborn 热图混淆矩阵显示未按预期显示 - Seaborn heatmap confusion matrix display not displaying as expected 使用正确率百分比的颜色混淆矩阵热图 - Color confusion matrix heatmap using percentage of correctness 如何向通过 Seaborn 热图渲染的混淆矩阵添加工具提示? - How to add tooltips to a confusion matrix rendered via a Seaborn heatmap? 在 seaborn 热图混淆矩阵中标记单元格的百分比和绝对值 - Labelling both percentages and absolute values on the cells in seaborn heatmap confusion matrix Plotly:如何使用热图制作带注释的混淆矩阵? - Plotly: How to make an annotated confusion matrix using a heatmap?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM