Skip to content

Commit 841c5a2

Browse files
committed
修正了部分文档中的笔误
1 parent fe9d4ea commit 841c5a2

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

Day81-90/82.k最近邻算法.md

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -241,45 +241,40 @@ model.score(X_test, y_test)
241241
| **实际为未患病** | 30(FP) | 870(TN) |
242242

243243
1. **准确率**(Accuracy)。
244-
245244
$$
246-
\text{准确率} = \frac{\text{TP} + \text{TN}}{\text{TP} + \text{FP} + \text{FN} + \text{TN}}
245+
\text{Accuracy} = \frac{\text{TP} + \text{TN}}{\text{TP} + \text{FP} + \text{FN} + \text{TN}}
247246
$$
248247

249248
上面的例子,模型预测的准确率为: $\small{\frac{80 + 870}{80 + 30 + 20 + 870} = \frac{950}{1000} = 0.95}$ 。
250-
249+
251250
2. **精确率**(Precesion)。精确率用于衡量在所有被预测为正类的样本中,实际上属于正类的比例,通常也被称为查准率。
252-
253251
$$
254-
\text{精确率} = \frac{\text{TP}}{\text{TP} + \text{FP}}
252+
\text{Precesion} = \frac{\text{TP}}{\text{TP} + \text{FP}}
255253
$$
256254

257255
上面的例子,模型预测的精确率为: $\small{\frac{80}{80 + 30} = \frac{80}{110} = 0.73}$ 。
258-
256+
259257
3. **召回率**(Recall)。召回率用于衡量在所有实际为正类的样本中,被模型正确预测为正类的比例,通常也被称为查全率或真正例率(True Positive Rate)。
260-
261258
$$
262-
\text{召回率} = \frac{\text{TP}}{\text{TP} + \text{FN}}
259+
\text{Recall} = \frac{\text{TP}}{\text{TP} + \text{FN}}
263260
$$
264261

265262
上面的例子,模型预测的召回率为: $\small{\frac{80}{80 + 20} = \frac{80}{100} = 0.8}$ 。
266-
263+
267264
4. **F1 分数**(F1 Score)。F1 分数是精确率和召回率的调和平均数,它在精确率和召回率之间寻求一个平衡,尤其适用于在两者之间有权衡的情况。
268-
269265
$$
270-
\text{F1分数} = \frac{2}{\frac{1}{\text{精确率}} + \frac{1}{\text{召回率}}} = 2 \times \frac{\text{精确率} \times \text{召回率}}{\text{精确率} + \text{召回率}}
266+
\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}}
271267
$$
272268

273269
上面的例子,模型预测的F1 分数为: $\small{2 \times \frac{0.7273 * 0.8}{0.7273 + 0.8} = 0.76}$ 。
274-
270+
275271
5. **特异度**(Specificity)和**假正例率**(False Positive Rate)。特异度用于衡量的是在所有实际为负类的样本中,被模型正确预测为负类的比例,类似于召回率,只不过针对的是负类样本。
276-
277272
$$
278-
\text{特异度} = \frac{\text{TN}}{\text{TN} + \text{FP}}
273+
\text{Specificity} = \frac{\text{TN}}{\text{TN} + \text{FP}}
279274
$$
280275

281276
$$
282-
\text{假正例率} = 1 - \text{特异度}
277+
\text{False Positive Rate} = 1 - \text{Specificity}
283278
$$
284279

285280
上面的例子,模型预测的特异度为: $\small{\frac{870}{870 + 30} = \frac{870}{900} = 0.97}$ 。

0 commit comments

Comments
 (0)