核心指标 Recall、MRR、NDCG 解析
1. Recall(召回率)
概念与原理
Recall 衡量模型正确识别正例的能力,定义为 所有真实正例中被正确预测的比例,公式为:
$$\text{Recall} = \frac{TP}{TP + FN}$$
其中,TP(True Positive)为真正例,FN(False Negative)为假反例。
特点:
- 关注“漏检”,适用于对漏检容忍度低的场景(如疾病诊断、安防检测)。
- 与 Precision(精确率)存在权衡关系,需结合 F1-score 综合评估。
实践与举例
- 代码示例(基于 sklearn):
from sklearn.metrics import recall_score y_true = [1, 0, 1, 1] # 实际标签 y_pred = [1, 0, 0, 1] # 预测标签 recall = recall_score(y_true, y_pred) # 输出 0.67(正确预测 2/3 的正例)
- 应用场景:目标检测中,若某模型在 100 个行人中正确检测出 80 个,则 Recall=80%。