当前位置:网站首页>分类模型评价标准(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)。
边栏推荐
- Three singleton modes of unity (hungry man, lazy man, monobehavior)
- LeetCode1_ Sum of two numbers
- leetcode 241. Different ways to add parentheses design priority for operational expressions (medium)
- Three. JS introduction learning notes 12: the model moves along any trajectory line
- 2022第四届中国(济南)国际智慧养老产业展览会,山东老博会
- Numpy -- epidemic data analysis case
- Use of SVN
- asyncio 概念和用法
- Dotween -- ease function
- Three. JS introductory learning notes 04: external model import - no material obj model
猜你喜欢

10 schemes to ensure interface data security

Async and await

Write sequence frame animation with shader

AB package details in unity (super detail, features, packaging, loading, manager)
Notification uses full resolution

Whole process analysis of unity3d rendering pipeline

Shandong old age Expo, 2022 China smart elderly care exhibition, smart elderly care and aging technology exhibition

企业级日志分析系统ELK

numpy--数据清洗

2022 the 4th China (Jinan) International Smart elderly care industry exhibition, Shandong old age Expo
随机推荐
Rongyun won the 2022 China Xinchuang digital office portal excellence product award!
Getting started with webgl (1)
企业级日志分析系统ELK
Dotween -- ease function
讲师征集令 | Apache SeaTunnel(Incubating) Meetup 分享嘉宾火热招募中!
nodejs package. JSON version number ^ and~
Plate - forme de surveillance par étapes zabbix
postman生成时间戳,未来时间戳
How does geojson data merge the boundaries of regions?
一个普通人除了去工厂上班赚钱,还能干什么工作?
Three. JS introductory learning notes 15: threejs frame animation module
How to implement backspace in shell
Async and await
TS typescript type declaration special declaration field number is handled when the key key
AB package details in unity (super detail, features, packaging, loading, manager)
Shipping companies' AI products are mature, standardized and applied on a large scale. CIMC, the global leader in port and shipping AI / container AI, has built a benchmark for international shipping
Virtual memory, physical memory /ram what
尤雨溪,来了!
Summary of knowledge points of xlua hot update solution
Whole process analysis of unity3d rendering pipeline