机器学习_评价指标Accuracy(准确率)、Precision(精准度/查准率)、Recall(召回率/查全率)、F1 Scores详解

首先我们先上一个整体的公式:
机器学习_评价指标Accuracy(准确率)、Precision(精准度/查准率)、Recall(召回率/查全率)、F1 Scores详解

混淆矩阵

真实情况 T或F 预测为正1,P 预测为负0,N
本来的label为1,则预测结果正的话为T,负的话为F TP(正样本预测为正) FN(正样本预测为假)
本来label为0,则预测结果正的话为T,负的话为F FP(负样本预测为正) TN(负样本预测为负)

混淆矩阵可以清楚的看出错判的样本,以便后续训练重视。

混淆矩阵中的相关名词也是我们后面要将的几个评价指标的重要变量。

Error Rate(错误率)和Accuracy(准确率)

Error Rate(错误率):分类错误的样本数占样本总数的比例。

公式:(falsepositives+falsenegatives)/totalexamples(false positives + false negatives) / total examples

Accuracy(准确率):分类正确的样本数占样本总数的比例。

公式:(truepositives+truenegatives)/totalexamples(true positives + true negatives) / total examples

Precision(精准度/查准率)和Recall(召回率/查全率)

Precision(精准度/查准率):预测出来的正样本中,正确的有多少。

公式:truepositives/(truepositives+falsepositives)true positives / (true positives + false positives)

Recall(召回率/查全率):预测出来的正样本占总样本中正样本的比例。

公式:truepositives/(truepositives+falsenegatives)true positives / (true positives + false negatives)

R-P曲线

机器学习_评价指标Accuracy(准确率)、Precision(精准度/查准率)、Recall(召回率/查全率)、F1 Scores详解

P-R 曲线越靠近右上角性能越好。

F1 Scores

F1-score 是两者的综合。F1-score 越高,说明分类模型越稳健。上面的P-R曲线中的看到的右上角平衡点就是F1分数得来的结果。