【分类模型评价】宏平均(macro avg)、微平均(micro avg)和加权平均(weighted avg)

当我们使用 sklearn.metric.classification_report 工具对模型的测试结果进行评价时,会输出如下结果:

【分类模型评价】宏平均(macro avg)、微平均(micro avg)和加权平均(weighted avg)

1、宏平均 macro avg:

对所有类别的平均

精准macro avg
=(P_no+P_yes) / 2
=(0.24+0.73) / 2 = 0.48

2、微平均 micro avg:
对数据集中的每⼀个实例不分类别进⾏统计建⽴全局混淆矩阵,然后计算相应指标:

精准micro avg = 召回micro avg = f1_micro avg
=(TP+TN) / (TP+FP+TN+FN)
=(0.54 * 7535 +0.42 * 22462 ) / (7535+22462)=0.45

3、加权平均 weighted avg:

是对宏平均的一种改进,考虑了每个类别样本数量在总样本中占比

精准加权weighted avg
=P_no * (support_no / support_all)+ P_yes * (support_yes / support_all)
=0.24(7525 / 29997) + 0.73(22462 / 29997)=0.61

参考:
分类问题的几个评价指标(Precision、Recall、F1-Score、Micro-F1、Macro-F1)
混淆矩阵(Confusion Matrix)分析
宏平均(macro avg)、微平均(micro avg)和加权平均(weighted avg)
【NLP】再看分类评估指标——宏平均,微平均

Original: https://blog.csdn.net/Joker00007/article/details/122920938
Author: Joker 007
Title: 【分类模型评价】宏平均(macro avg)、微平均(micro avg)和加权平均(weighted avg)

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/667599/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球