当前位置:网站首页>分类模型评价标准(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. JS introductory learning notes 0: illustration of how webgl and threejs work
- Cocos creator collision and collision callback do not take effect
- hellogolang
- Aerospace Hongtu information won the bid for the database system research and development project of a unit in Urumqi
- 2022山东智慧养老展,适老穿戴设备展,养老展,山东老博会
- C Alibaba cloud OSS file upload, download and other operations (unity is available)
- webgl_ Graphic transformation (rotation, translation, zoom)
- numpy---基础学习笔记
- Webgl texture
- webgl_ Enter the three-dimensional world (2)
猜你喜欢
Plate - forme de surveillance par étapes zabbix
Cocos creator collision and collision callback do not take effect
Vite path alias @ configuration
Numpy -- data cleaning
Eye of depth (VI) -- inverse of matrix (attachment: some ideas of logistic model)
Eye of depth (VII) -- Elementary Transformation of matrix (attachment: explanation of some mathematical models)
Getting started with webgl (1)
航運船公司人工智能AI產品成熟化標准化規模應用,全球港航人工智能/集裝箱人工智能領軍者CIMC中集飛瞳,打造國際航運智能化標杆
分步式监控平台zabbix
喜讯!科蓝SUNDB数据库与鸿数科技隐私数据保护管理软件完成兼容性适配
随机推荐
Shandong old age Expo, 2022 China smart elderly care exhibition, smart elderly care and aging technology exhibition
Streaming end, server end, player end
MySQL数据库基本操作-DQL-基本查询
分步式监控平台zabbix
Application example of infinite list [uigridview]
SysOM 案例解析:消失的内存都去哪了 !| 龙蜥技术
Unity drawing plug-in = = [support the update of the original atlas]
A wave of open source notebooks is coming
Virtual memory, physical memory /ram what
121. 买卖股票的最佳时机
尤雨溪,来了!
Apache Doris刚“毕业”:为什么应关注这种SQL数据仓库?
10 schemes to ensure interface data security
Cut ffmpeg as needed, and use emscripten to compile and run
Three. JS introductory learning notes 07: external model import -c4d to JSON file for web pages -fbx import
应用程序和matlab的通信方式
webgl_ Graphic transformation (rotation, translation, zoom)
Getting started with webgl (3)
numpy--数据清洗
2022山东智慧养老展,适老穿戴设备展,养老展,山东老博会