当前位置:网站首页>分类模型评价标准(performance measure)
分类模型评价标准(performance measure)
2022-07-07 13:53:00 【_春天_】
混淆矩阵(Confusion matrix)
对于二分类问题,实际数据可分为正例和反例。根据模型的判别类别和数据的实际类别,可以得到四种结果:真正例(True positive),假正例(False positive),真反例(True negative),假反例(False negative)。
如果判别类别和实际类别一致,则为真,不一致,则为假,也就是说,真正例的含义为,模型判别的类别和实际的一致,均为正例;而假正例的含义为假的正例:判别为正例,但是是错的(实际为反例);假反例是假的反例:判别为反例,但判别错了,实际为正例。
用TP、FP、TN、FN来代表对应结果的数量,可得到分类结果的混淆矩阵:
- | 预测为正 | 预测为负 |
---|---|---|
实际正例 | TP | FN |
实际反例 | FP | TN |
可以考虑一个例子,现在有100人,其中男生70人,女生30人。有一个模型用来分类男生和女生。模型判别结果为:男生60人(实际真实为男生的是55人,其余5人是女生),女生40人(实际真实为女生的是25人,另外15人为男生)。那么混淆矩阵可以表示为:
- | 预测为男 | 预测为女 |
---|---|---|
实际男生 | 55 | 15 |
实际女生 | 5 | 25 |
常用评价指标
Accuracy
中文翻译为正确率/精度。
是指所有判别结果中,分类正确的样本数占总样本书的比例。
在混淆矩阵中,TP和TN都属于分类正确的样本,所以,
A c c u r a c y = T P + T N T P + F P + F N + T N Accuracy= \frac{TP+TN} {TP+FP+FN+TN} Accuracy=TP+FP+FN+TNTP+TN
用上面的男女生的例子来计算Accuracy的话,acc=(55+25)/100=0.80
Precision
中文翻译为精确率/查准率。
是指模型判别为正例的样本中,有多少是真正的正例,所以,
P r e c i s i o n = T P T P + F P Precision = \frac{TP}{TP+FP} Precision=TP+FPTP
常用场景是“检索出来的信息有多少是用户真正感兴趣的”。
用上面的男女生的例子来计算Precision的话,precision=55/(55+5)=0.917
Recall
中文翻译为召回率/查全率。
是指实际所有正例中,有多少被模型判别为正例,所以
R e c a l l = T P T P + F N Recall = \frac{TP}{TP+FN} Recall=TP+FNTP
常用场景为“在所有在逃逃犯信息检索中,有多少逃犯能被检测出来”。
用上边的男女生的例子来计算Recall的话,recall=55/(55+15)=0.786
F1值
常用的F1值计算方式为:
F 1 = 2 ∗ P r e c i s i o n ∗ R e c a l l P r e c i s i o n + R e c a l l = 2 ∗ T P 样 本 总 数 + T P − T N F1=\frac{2*Precision*Recall}{Precision+Recall}=\frac{2*TP}{样本总数+TP-TN} F1=Precision+Recall2∗Precision∗Recall=样本总数+TP−TN2∗TP
用上边男女生的例子来计算的话,F1=(20.9170.786)/(0.917+0.786)=0.846,或者是F1=(2*55)/(100+55-25)=0.846
PR曲线
PR曲线是以precision为纵轴,recall为横轴,绘制的曲线。
PR曲线下面积越大,说明性能越好。
在曲线上,当precision与recall的取值相等时,该点为平衡点(Break-Even Point)。
ROC曲线
ROC全称为“受试者工作特征”。
纵轴是真正例率(TPR),横轴是假正例率(FPR)。
T P R = T P T P + F N TPR= \frac{TP}{TP+FN} TPR=TP+FNTP
F P R = F P T N + F P FPR=\frac{FP}{TN+FP} FPR=TN+FPFP
AUC
表示Area under ROC Cureve,是ROC曲线下的面积。
面积越大,则性能越好。
Cost curve 代价曲线
前面的评价标准多在关注TP,其实FP和FN在某些场景下也同样重要。
比如一个医疗场景:癌症诊断分类器将健康病人归类到癌症患者,或者将癌症患者归类为健康病人。这两种情景都是模型的错误分类,但是后一种情况造成的后果更为严重。
所以,为了更好衡量不同错误造成的不同损失,为错误赋予“非均等代价”(unequal cost)。
在计算时,我们要去优化总体代价(total cost)。
边栏推荐
- Write sequence frame animation with shader
- 尤雨溪,来了!
- Eye of depth (VI) -- inverse of matrix (attachment: some ideas of logistic model)
- C4D learning notes 1- animation - animation key frames
- C Alibaba cloud OSS file upload, download and other operations (unity is available)
- Apache Doris刚“毕业”:为什么应关注这种SQL数据仓库?
- AE learning 01: AE complete project summary
- 强化实时数据管理,英方软件助力医保平台安全建设
- Three. JS introductory learning notes 11:three JS group composite object
- asyncio 概念和用法
猜你喜欢
Plate - forme de surveillance par étapes zabbix
一大波开源小抄来袭
Whole process analysis of unity3d rendering pipeline
Numpy -- epidemic data analysis case
MySQL数据库基本操作-DQL-基本查询
过度依赖补助,大客户收款难,冲刺“国产数据库第一股”的达梦后劲有多足?
How does geojson data merge the boundaries of regions?
SPI master RX time out interrupt
神经网络c语言中的指针是怎么回事
2022第四届中国(济南)国际智慧养老产业展览会,山东老博会
随机推荐
Using eating in cocos Creator
Vite path alias @ configuration
Migration and reprint
LeetCode1_ Sum of two numbers
OpenGL's distinction and understanding of VAO, VBO and EBO
Three. JS introductory learning notes 13: animation learning
A wave of open source notebooks is coming
Bidding announcement: Panjin people's Hospital Panjin hospital database maintenance project
The unity vector rotates at a point
喜讯!科蓝SUNDB数据库与鸿数科技隐私数据保护管理软件完成兼容性适配
Please supervise the 2022 plan
C4D learning notes 3- animation - animation rendering process case
Ue4/ue5 multi thread development attachment plug-in download address
TCP framework___ Unity
Async and await
Simple understanding and application of TS generics
Eye of depth (VI) -- inverse of matrix (attachment: some ideas of logistic model)
Cocos creator collision and collision callback do not take effect
LeetCode2_ Add two numbers
How to implement backspace in shell