当前位置:网站首页>分类模型评价标准(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)。
边栏推荐
- 招标公告:盘锦市人民医院盘锦医院数据库维保项目
- Xingruige database was shortlisted as the "typical solution for information technology application and innovation in Fujian Province in 2021"
- Three. JS introductory learning notes 11:three JS group composite object
- Syntaxhighlight highlights the right scroll bar
- Summary of knowledge points of xlua hot update solution
- JS array foreach source code parsing
- 融云斩获 2022 中国信创数字化办公门户卓越产品奖!
- It's different for rich people to buy a house
- TCP framework___ Unity
- Limit of total fields [1000] in index has been exceeded
猜你喜欢

Vertex shader to slice shader procedure, varying variable

C4D learning notes 2- animation - timeline and time function

SPI master rx time out中断

torch.numel作用

Mesh merging under ue4/ue5 runtime
通知Notification使用全解析

Write sequence frame animation with shader

numpy--数据清洗

Whole process analysis of unity3d rendering pipeline

保证接口数据安全的10种方案
随机推荐
Three. JS introductory learning notes 18: how to export JSON files with Blender
强化实时数据管理,英方软件助力医保平台安全建设
Three. JS introductory learning notes 15: threejs frame animation module
Postman generate timestamp, future timestamp
融云斩获 2022 中国信创数字化办公门户卓越产品奖!
有钱人买房就是不一样
webgl_ Enter the three-dimensional world (2)
2022山东智慧养老展,适老穿戴设备展,养老展,山东老博会
asyncio 概念和用法
用手机在通达信上开户靠谱吗?这样炒股有没有什么安全隐患
numpy--疫情数据分析案例
Bidding announcement: Panjin people's Hospital Panjin hospital database maintenance project
通知Notification使用全解析
Unity3D_ Class fishing project, bullet rebound effect is achieved
Shandong old age Expo, 2022 China smart elderly care exhibition, smart elderly care and aging technology exhibition
Ue4/ue5 multi thread development attachment plug-in download address
Bidding announcement: 2022 Yunnan Unicom gbase database maintenance public comparison and selection project (second) comparison and selection announcement
Cocos creator collision and collision callback do not take effect
【花雕体验】15 尝试搭建Beetle ESP32 C3之Arduino开发环境
分步式监控平台zabbix