# F值

**F值**（F-score），在平衡形式下也称F度量或F1分数，是二分类和信息检索中一种单数值性能指标，以精确率与召回率的调和平均数将二者结合起来。其取值范围为0到1，仅当精确率和召回率都完美时才达到1，二者中任一为零时则为0。<sup>[1](https://doi.org/10.1145/3606367)</sup>

| 关键事实 | 详情 |
|---|---|
| 定义 | 精确率P与召回率R的调和平均数：\( F_1 = \dfrac{2 \cdot P \cdot R}{P + R} = \dfrac{2 \cdot TP}{2 \cdot TP + FP + FN} \)<sup>[1](https://doi.org/10.1145/3606367)</sup> |
| 起源 | 源自范里伊斯伯根（Van Rijsbergen）1979年著作《信息检索》中的有效性度量E；“F度量”这一名称由钦科尔（Chinchor）在1992年MUC-4会议上提出<sup>[1](https://doi.org/10.1145/3606367)</sup> |
| 加权形式 | \( F_\beta = \dfrac{(\beta^2 + 1) \cdot P \cdot R}{\beta^2 \cdot P + R} \)；\( \beta < 1 \) 时强调精确率，\( \beta > 1 \) 时强调召回率<sup>[2](https://nlp.stanford.edu/IR-book/html/htmledition/evaluation-of-unranked-retrieval-sets-1.html)</sup> |
| 调和平均数的作用 | 精确率为1.0、召回率为0.01的测试，其算术平均数为0.505，但F1仅为0.02<sup>[3](https://www.medcalc.org/en/book/precision-recall.php)</sup> |
| 患病率依赖性 | 与灵敏度、特异度和AUC不同，精确率、F1和AUPRC会随疾病患病率显著变化<sup>[4](https://pubs.rsna.org/doi/10.1148/radiol.220182)</sup> |
| 临床批评 | 在一个癌症检测场景中，F1将更具特异度的测试排在更具灵敏度的测试之前，与决策分析指标净收益的排序相反；作者建议在临床评价中避免使用Fβ<sup>[5](https://doi.org/10.1186/s41512-025-00214-7)</sup> |
| 使用增长 | 在PubMed检索“F score”或“F1-score”，2013年返回不到100条引用，而2023年接近3000条<sup>[5](https://doi.org/10.1186/s41512-025-00214-7)</sup> |

## 定义

对于二分类器或检索系统，精确率是预测为正例的样本中真正为正例的比例，\( P = TP/(TP + FP) \)；召回率是真正例中被检索到的比例，\( R = TP/(TP + FN) \)。F度量通过调和平均数将二者结合：<sup>[1](https://doi.org/10.1145/3606367)</sup>

\[ F_1 = \frac{2}{\dfrac{1}{P} + \dfrac{1}{R}} = \frac{2 \cdot P \cdot R}{P + R} = \frac{2 \cdot TP}{2 \cdot TP + FP + FN}. \]

使用调和平均数而非算术平均数，是因为它会惩罚两个量之间的极端不平衡。一个检索所有文档的系统召回率完美但精确率极低，其算术平均数仍约为0.5，而调和平均数则趋近于0。在精确率为1.0、召回率为0.01的算例中，算术平均数为0.505，而F1为0.02。<sup>[2](https://nlp.stanford.edu/IR-book/html/htmledition/evaluation-of-unranked-retrieval-sets-1.html)</sup><sup> • </sup><sup>[3](https://www.medcalc.org/en/book/precision-recall.php)</sup> 调和平均数总是小于或等于算术平均数和几何平均数，且接近精确率与召回率中的较小值，因此两者中较小的值主导该分数。<sup>[2](https://nlp.stanford.edu/IR-book/html/htmledition/evaluation-of-unranked-retrieval-sets-1.html)</sup>

## 历史

该度量可追溯至C. J. 范里伊斯伯根（C. J. van Rijsbergen）的著作《信息检索》，由巴特沃斯出版社于1979年出版。范里伊斯伯根寻求一个用于检索有效性的单一综合数值，定义了有效性度量E，并通过边际相关性递减原理为精确率与召回率的调和组合提供依据：在某个点上，用户不愿为增加一单位召回率而牺牲一单位精确率。<sup>[1](https://doi.org/10.1145/3606367)</sup><sup> • </sup><sup>[6](https://nlp.stanford.edu/IR-book/html/htmledition/references-and-further-reading-8.html)</sup> Fβ度量对应于E的一种重参数化，在变换 \( \alpha = 1/(\beta^2 + 1) \) 下 \( E = 1 - F \)。<sup>[1](https://doi.org/10.1145/3606367)</sup><sup> • </sup><sup>[7](https://cseweb.ucsd.edu/~rik/foa/l2h/foa-4-3-8.html)</sup>

在信息检索之外，最早采用该度量的学科之一是信息抽取，即从文本中抽取结构化信息的任务。南希·钦科尔（Nancy Chinchor）在1992年第四届消息理解会议（MUC-4）上提出将其用于评估，给出了通用的Fβ公式，并将其命名为F度量。据佐佐木丰（Yutaka Sasaki）2007年转述大卫·D. 刘易斯（David D. Lewis）的个人通信，该名称是偶然选定的，原因是将范里伊斯伯根书中另一个不同的F函数误当作了该度量的定义。<sup>[1](https://doi.org/10.1145/3606367)</sup> 此后它传播到共指消解、文本分类，后来又扩展到计算机视觉和一般机器学习领域，往往未经明确论证便被采用。<sup>[1](https://doi.org/10.1145/3606367)</sup>

## 加权形式Fβ

一般形式允许对精确率和召回率进行不等加权：<sup>[2](https://nlp.stanford.edu/IR-book/html/htmledition/evaluation-of-unranked-retrieval-sets-1.html)</sup>

\[ F_\beta = \frac{(\beta^2 + 1) \cdot P \cdot R}{\beta^2 \cdot P + R}. \]

令 \( \beta = 1 \) 即得平衡的F1分数。\( \beta < 1 \) 的值更强调精确率，\( \beta > 1 \) 的值更强调召回率；例如，当召回率更重要时可选择 \( \beta = 3 \) 或 \( \beta = 5 \)。范里伊斯伯根将β描述为用户对召回率比对精确率更为重视的倍数。<sup>[1](https://doi.org/10.1145/3606367)</sup><sup> • </sup><sup>[2](https://nlp.stanford.edu/IR-book/html/htmledition/evaluation-of-unranked-retrieval-sets-1.html)</sup> 在实践中，几乎所有应用都采用β设为1的等权重。<sup>[5](https://doi.org/10.1186/s41512-025-00214-7)</sup>

## 跨类别平均

对于多类别和多标签问题，各类别的F1分数有几种组合方式。微平均F1在计算分数之前汇总各类别的真正例、假正例和假负例计数，对每个实例同等对待；宏平均F1计算各类别F1分数的未加权平均，对每个类别同等对待而忽略标签不平衡；加权平均则按各类别真实实例数对各类别分数加权。<sup>[8](https://scikit-learn.org/stable/modules/generated/sklearn.metrics.f1_score.html)</sup><sup> • </sup><sup>[9](https://pmc.ncbi.nlm.nih.gov/articles/PMC8936911/)</sup> 微平均F1还有一种解释，即真正例分类的总概率。<sup>[9](https://pmc.ncbi.nlm.nih.gov/articles/PMC8936911/)</sup> 当真正例、假正例和假负例全为零时，分数无定义；scikit-learn默认将其设为0.0并发出警告，`zero_division` 参数允许采用其他行为。<sup>[8](https://scikit-learn.org/stable/modules/generated/sklearn.metrics.f1_score.html)</sup>

## 批评与局限

已有若干结构性批评。F度量在单一分类阈值上计算，因此忽略了性能随阈值的变化，这一点与ROC分析不同。它还取决于哪个类别被标记为正类：偏向于大的多数类的分类器可以获得高F1，而在不改变数据的情况下重新标记类别则会产生低分。<sup>[1](https://doi.org/10.1145/3606367)</sup><sup> • </sup><sup>[10](https://pmc.ncbi.nlm.nih.gov/articles/PMC8993826/)</sup> 澳大利亚国立大学的彼得·克里斯滕（Peter Christen）、伦敦帝国理工学院的戴维·J. 汉德（David J. Hand）和尼沙迪·基里埃莱（Nishadi Kirielle）在2023年的一篇综述中得出结论：该度量的理据显得薄弱，缺乏表征意义，且由于它偏重一个类别，不适合两个类别都重要的一般分类问题，尽管它适用于只关注一个类别的高度不平衡场景。<sup>[1](https://doi.org/10.1145/3606367)</sup>

**患病率依赖性。** 在医学应用中，精确率、F1和精确率-召回率曲线下面积受疾病患病率显著影响，而灵敏度、特异度和AUC则不然。在一项检测肝细胞癌的算法模拟中，AUC保持在0.923，AUPRC在患病率28.6%时为0.830，降至9.1%时为0.595，4.8%时为0.448，其他因素均保持不变；F1因包含精确率而表现类似。<sup>[4](https://pubs.rsna.org/doi/10.1148/radiol.220182)</sup> 因此，队列患病率必须与目标人群匹配，这些指标才能迁移使用。<sup>[11](https://pmc.ncbi.nlm.nih.gov/articles/PMC12953274/)</sup>

**临床效用。** 纪念斯隆-凯特琳癌症中心的梅利莎·阿塞尔（Melissa Assel）和安德鲁·维克斯（Andrew Vickers）于2025年表明，F值对诊断测试的排序与临床效用不一致。在一个应偏向灵敏度的癌症检测场景中，F1对特异度更高的测试给出最高分，而净收益——TRIPOD AI指南中使用的决策分析指标——则将最灵敏的测试排在首位。他们还发现，即使患病率发生微小变化，也会改变所需的β值，使得无法为临床场景理性地预设β，因此他们建议避免使用Fβ，转而采用净收益并辅以区分度和校准度。<sup>[5](https://doi.org/10.1186/s41512-025-00214-7)</sup>

## 替代方案与相关指标

F*度量是F的单调变换，等于雅卡尔系数，在图像识别中也称交并比；单调性意味着按F*进行的任何排序都与按F的排序一致。<sup>[12](https://spiral.imperial.ac.uk/server/api/core/bitstreams/d313745d-dfc3-4af9-a191-6bbb08db5e32/content)</sup> 其他提出的替代方案包括马修斯相关系数，它使用混淆矩阵的全部四个单元格且在类别间对称，<sup>[10](https://pmc.ncbi.nlm.nih.gov/articles/PMC8993826/)</sup> 以及在临床评价中结合决策曲线分析的净收益。<sup>[5](https://doi.org/10.1186/s41512-025-00214-7)</sup> F1思想的扩展包括纳入特异度和阴性预测值的负F值，以及在多类别场景中计算微平均和宏平均F1置信区间的方法。<sup>[9](https://pmc.ncbi.nlm.nih.gov/articles/PMC8936911/)</sup>

## References

1. [Peter Christen, David J. Hand, Nishadi Kirielle (2023). A Review of the F-Measure: Its History, Properties, Criticism, and Alternatives. ACM Computing Surveys 56(3), Article 73.](https://doi.org/10.1145/3606367)
2. [Evaluation of unranked retrieval sets, Introduction to Information Retrieval (Stanford NLP)](https://nlp.stanford.edu/IR-book/html/htmledition/evaluation-of-unranked-retrieval-sets-1.html)
3. [Precision–Recall Curves, MedCalc](https://www.medcalc.org/en/book/precision-recall.php)
4. [Methods for Clinical Evaluation of Artificial Intelligence Algorithms for Medical Diagnosis, Radiology (2022)](https://pubs.rsna.org/doi/10.1148/radiol.220182)
5. [Melissa Assel, Andrew Vickers (2025). The F score ranks diagnostic tests and prediction models inconsistently with their clinical utility. Diagnostic and Prognostic Research 9:30.](https://doi.org/10.1186/s41512-025-00214-7)
6. [References and further reading, Introduction to Information Retrieval (Stanford NLP)](https://nlp.stanford.edu/IR-book/html/htmledition/references-and-further-reading-8.html)
7. [FOA §4.3.8 One-parameter criteria (UCSD)](https://cseweb.ucsd.edu/~rik/foa/l2h/foa-4-3-8.html)
8. [sklearn.metrics.f1_score, scikit-learn documentation](https://scikit-learn.org/stable/modules/generated/sklearn.metrics.f1_score.html)
9. [Confidence interval for micro-averaged F1 and macro-averaged F1 scores (PMC, 2022)](https://pmc.ncbi.nlm.nih.gov/articles/PMC8936911/)
10. [Steven A. Hicks et al. (2022). On evaluation metrics for medical applications of artificial intelligence. Scientific Reports 12:5979.](https://pmc.ncbi.nlm.nih.gov/articles/PMC8993826/)
11. [ESR Essentials: common performance metrics in AI, European Society of Medical Imaging Informatics (2025)](https://pmc.ncbi.nlm.nih.gov/articles/PMC12953274/)
12. [A Review of the F-Measure (full text, Imperial College London Spiral repository)](https://spiral.imperial.ac.uk/server/api/core/bitstreams/d313745d-dfc3-4af9-a191-6bbb08db5e32/content)

---
*Initially written Sep 17, 2026 · Reviewed: Sep 19, 2026; Oct 15, 2026 · Edited: Oct 15, 2026 · Last review: Oct 15, 2026*

Topic: 物质世界与数学 › 数学与统计学 › 统计学与概率论 › Applied, official, and domain statistics › Biostatistics and health statistics methodology › Medical statistics and clinical biostatistics › Diagnostic accuracy and test evaluation

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/f-score

English original: https://www.edgepedia.org/f-score
