修正了部分文档中的笔误
This commit is contained in:
parent
fe9d4eaf6b
commit
841c5a2dc7
|
|
@ -241,45 +241,40 @@ model.score(X_test, y_test)
|
|||
| **实际为未患病** | 30(FP) | 870(TN) |
|
||||
|
||||
1. **准确率**(Accuracy)。
|
||||
|
||||
$$
|
||||
\text{准确率} = \frac{\text{TP} + \text{TN}}{\text{TP} + \text{FP} + \text{FN} + \text{TN}}
|
||||
\text{Accuracy} = \frac{\text{TP} + \text{TN}}{\text{TP} + \text{FP} + \text{FN} + \text{TN}}
|
||||
$$
|
||||
|
||||
上面的例子,模型预测的准确率为: $\small{\frac{80 + 870}{80 + 30 + 20 + 870} = \frac{950}{1000} = 0.95}$ 。
|
||||
|
||||
|
||||
2. **精确率**(Precesion)。精确率用于衡量在所有被预测为正类的样本中,实际上属于正类的比例,通常也被称为查准率。
|
||||
|
||||
$$
|
||||
\text{精确率} = \frac{\text{TP}}{\text{TP} + \text{FP}}
|
||||
\text{Precesion} = \frac{\text{TP}}{\text{TP} + \text{FP}}
|
||||
$$
|
||||
|
||||
上面的例子,模型预测的精确率为: $\small{\frac{80}{80 + 30} = \frac{80}{110} = 0.73}$ 。
|
||||
|
||||
|
||||
3. **召回率**(Recall)。召回率用于衡量在所有实际为正类的样本中,被模型正确预测为正类的比例,通常也被称为查全率或真正例率(True Positive Rate)。
|
||||
|
||||
$$
|
||||
\text{召回率} = \frac{\text{TP}}{\text{TP} + \text{FN}}
|
||||
\text{Recall} = \frac{\text{TP}}{\text{TP} + \text{FN}}
|
||||
$$
|
||||
|
||||
上面的例子,模型预测的召回率为: $\small{\frac{80}{80 + 20} = \frac{80}{100} = 0.8}$ 。
|
||||
|
||||
|
||||
4. **F1 分数**(F1 Score)。F1 分数是精确率和召回率的调和平均数,它在精确率和召回率之间寻求一个平衡,尤其适用于在两者之间有权衡的情况。
|
||||
|
||||
$$
|
||||
\text{F1分数} = \frac{2}{\frac{1}{\text{精确率}} + \frac{1}{\text{召回率}}} = 2 \times \frac{\text{精确率} \times \text{召回率}}{\text{精确率} + \text{召回率}}
|
||||
\text{F1 Score} = \frac{2}{\frac{1}{\text{Precision}} + \frac{1}{\text{Recall}}} = 2 \times \frac{\text{Precision} \times \text{Recall}}{\text{Precesion} + \text{Recall}}
|
||||
$$
|
||||
|
||||
上面的例子,模型预测的F1 分数为: $\small{2 \times \frac{0.7273 * 0.8}{0.7273 + 0.8} = 0.76}$ 。
|
||||
|
||||
|
||||
5. **特异度**(Specificity)和**假正例率**(False Positive Rate)。特异度用于衡量的是在所有实际为负类的样本中,被模型正确预测为负类的比例,类似于召回率,只不过针对的是负类样本。
|
||||
|
||||
$$
|
||||
\text{特异度} = \frac{\text{TN}}{\text{TN} + \text{FP}}
|
||||
\text{Specificity} = \frac{\text{TN}}{\text{TN} + \text{FP}}
|
||||
$$
|
||||
|
||||
$$
|
||||
\text{假正例率} = 1 - \text{特异度}
|
||||
\text{False Positive Rate} = 1 - \text{Specificity}
|
||||
$$
|
||||
|
||||
上面的例子,模型预测的特异度为: $\small{\frac{870}{870 + 30} = \frac{870}{900} = 0.97}$ 。
|
||||
|
|
|
|||
Loading…
Reference in New Issue