当前位置:网站首页>分类模型评价标准(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)。
边栏推荐
- Clang compile link ffmpeg FAQ
- Strengthen real-time data management, and the British software helps the security construction of the medical insurance platform
- The "go to definition" in VS2010 does not respond or prompts the solution of "symbol not found"
- webgl_ Enter the three-dimensional world (2)
- Cocos uses custom material to display problems
- Asynchronous application of generator function
- Notification uses full resolution
- LeetCode3_ Longest substring without duplicate characters
- Three. JS introductory learning notes 15: threejs frame animation module
- SPI master rx time out中断
猜你喜欢
Notification uses full resolution

Unity3D_ Class fishing project, control the distance between collision walls to adapt to different models
![Application example of infinite list [uigridview]](/img/11/3be1c63680e6de8f068e79690ecf12.jpg)
Application example of infinite list [uigridview]

L'application à l'échelle de la normalisation mature des produits ai des compagnies maritimes, cimc, leader mondial de l'intelligence artificielle portuaire et maritime / intelligence artificielle des

Getting started with webgl (1)

谈谈 SAP iRPA Studio 创建的本地项目的云端部署问题

20th anniversary of agile: a failed uprising

Plate - forme de surveillance par étapes zabbix

Wireless sensor networks -- ZigBee and 6LoWPAN

webgl_ Enter the three-dimensional world (2)
随机推荐
Clang compile link ffmpeg FAQ
Xingruige database was shortlisted as the "typical solution for information technology application and innovation in Fujian Province in 2021"
47_Opencv中的轮廓查找 cv::findContours()
喜讯!科蓝SUNDB数据库与鸿数科技隐私数据保护管理软件完成兼容性适配
Numpy -- data cleaning
Streaming end, server end, player end
【花雕体验】15 尝试搭建Beetle ESP32 C3之Arduino开发环境
The "go to definition" in VS2010 does not respond or prompts the solution of "symbol not found"
AE learning 01: AE complete project summary
VS2005 strange breakpoint is invalid or member variable value cannot be viewed
Virtual memory, physical memory /ram what
The "go to definition" in VS2010 does not respond or prompts the solution of "symbol not found"
SysOM 案例解析:消失的内存都去哪了 !| 龙蜥技术
Mesh merging under ue4/ue5 runtime
Three. JS introductory learning notes 19: how to import FBX static model
Three. JS introductory learning notes 13: animation learning
Bidding announcement: Panjin people's Hospital Panjin hospital database maintenance project
C4D learning notes 1- animation - animation key frames
Vite path alias @ configuration
torch.numel作用