混淆矩阵(Confusion matrix)及其指标

来源:互联网 发布:python命令行运行文件 编辑:程序博客网 时间:2024/05/16 09:48

本文引用网址:
http://bluewhale.cc/2016-05-26/confusion-matrix.html 转自“蓝鲸网站分析博客”
https://en.wikipedia.org/wiki/Confusion_matrix 维基百科

混淆矩阵是对有监督学习分类算法准确率进行评估的工具。通过将模型预测的数据与测试数据进行对比,使用各种指标对模型的分类效果进行度量。

混淆矩阵基本结构图(维基百科)

true conditon 真实值
predicted condition 预测值

基本定义

各种指标

指标公式

重要指标

precision , positive predictive value (PPV)
 PPV = TP / (TP+FP)

recall , sensitivity , true positive rate (TPR)
 TPR = TP / (TP+FN)

F1 score
 F1=2 * (PPV*TPR) / (PPV+TPR)
  =2*TP / (2TP+FP+FN)