F1 score

From HandWiki
Precision and recall

In statistical analysis of binary classification, the F1 score (also F-score or F-measure) is a measure of a test's accuracy. It considers both the precision p and the recall r of the test to compute the score: p is the number of correct positive results divided by the number of all positive results returned by the classifier, and r is the number of correct positive results divided by the number of all relevant samples (all samples that should have been identified as positive).

The F1 score is the harmonic mean of the precision and recall, where an F1 score reaches its best value at 1 (perfect precision and recall). The F1 score is also known as the Sørensen–Dice coefficient or Dice similarity coefficient (DSC).


Etymology

The name F-measure is believed to be named after a different F function in Van Rijsbergen's book, when introduced to MUC-4. [1]

Definition

The traditional F-measure or balanced F-score (F1 score) is the harmonic mean of precision and recall:

[math]\displaystyle{ F_1 = \frac{2}{\mathrm{recall}^{-1} + \mathrm{precision}^{-1}} = 2 \cdot \frac{\mathrm{precision} \cdot \mathrm{recall}}{\mathrm{precision} + \mathrm{recall}} = \frac{\mathrm tp}{\mathrm{tp} + \frac12 (\mathrm{fp} + \mathrm{fn}) } }[/math].

The general formula for positive real β, where β is chosen such that recall is considered β times as important as precision, is:

[math]\displaystyle{ F_\beta = (1 + \beta^2) \cdot \frac{\mathrm{precision} \cdot \mathrm{recall}}{(\beta^2 \cdot \mathrm{precision}) + \mathrm{recall}} }[/math].

The formula in terms of Type I and type II errors:

[math]\displaystyle{ F_\beta = \frac {(1 + \beta^2) \cdot \mathrm{true\ positive} }{(1 + \beta^2) \cdot \mathrm{true\ positive} + \beta^2 \cdot \mathrm{false\ negative} + \mathrm{false\ positive}}\, }[/math].

Two commonly used values for β are those corresponding to the [math]\displaystyle{ F_{2} }[/math] measure, which weighs recall higher than precision (by placing more emphasis on false negatives), and the [math]\displaystyle{ F_{0.5} }[/math] measure, which weighs recall lower than precision (by attenuating the influence of false negatives).

The F-measure was derived so that [math]\displaystyle{ F_\beta }[/math] "measures the effectiveness of retrieval with respect to a user who attaches β times as much importance to recall as precision".[2] It is based on Van Rijsbergen's effectiveness measure

[math]\displaystyle{ E = 1 - \left(\frac{\alpha}{p} + \frac{1-\alpha}{r}\right)^{-1} }[/math].

Their relationship is [math]\displaystyle{ F_\beta = 1 - E }[/math] where [math]\displaystyle{ \alpha=\frac{1}{1 + \beta^2} }[/math].

Diagnostic testing

This is related to the field of binary classification where recall is often termed "sensitivity".

Applications

The F-score is often used in the field of information retrieval for measuring search, document classification, and query classification performance.[3] Earlier works focused primarily on the F1 score, but with the proliferation of large scale search engines, performance goals changed to place more emphasis on either precision or recall[4] and so [math]\displaystyle{ F_\beta }[/math] is seen in wide application.

The F-score is also used in machine learning.[5] Note, however, that the F-measures do not take the true negatives into account, and that measures such as the Matthews correlation coefficient, Informedness or Cohen's kappa may be preferable to assess the performance of a binary classifier.[citation needed]

The F-score has been widely used in the natural language processing literature,[6] such as the evaluation of named entity recognition and word segmentation.

Criticism

David Hand and others criticize the widespread use of the F1 score since it gives equal importance to precision and recall. In practice, different types of mis-classifications incur different costs. In other words, the relative importance of precision and recall is an aspect of the problem.[7]

According to Davide Chicco and Giuseppe Jurman, the F1 score is less truthful and informative than the Matthews correlation coefficient (MCC) in binary evaluation classification.[8]

David Powers has pointed out that F1 ignores the True Negatives and thus is misleading for unbalanced classes, while kappa and correlation measures are symmetric and assess both directions of predictability - the classifier predicting the true class and the true class predicting the classifier prediction, proposing separate multiclass measures Informedness and Markedness for the two directions, noting that their geometric mean is correlation.[9]

Difference from G-measure

While the F-measure is the harmonic mean of recall and precision, the G-measure is the geometric mean.[10]

Extension to multi-class classification

The F-score is also used for evaluating classification problems with more than two classes (Multiclass classification). In this setup, the final score is obtained by micro-averaging (biased by class frequency) or macro-averaging (taking all classes as equally important). For macro-averaging, two different formulas have been used by applicants: the F-score of (arithmetic) class-wise precision and recall means or the arithmetic mean of class-wise F-scores, where the latter exhibits more desirable properties.[11]

See also

References

  1. Sasaki, Y. (2007). "The truth of the F-measure". https://www.toyota-ti.ac.jp/Lab/Denshi/COIN/people/yutaka.sasaki/F-measure-YS-26Oct07.pdf. 
  2. Van Rijsbergen, C. J. (1979). Information Retrieval (2nd ed.). Butterworth-Heinemann. http://www.dcs.gla.ac.uk/Keith/Preface.html. 
  3. Beitzel., Steven M. (2006). On Understanding and Classifying Web Queries (Ph.D. thesis). IIT. CiteSeerX 10.1.1.127.634.
  4. X. Li; Y.-Y. Wang; A. Acero (July 2008). "Learning query intent from regularized click graphs". doi:10.1145/1390334.1390393. 
  5. See, e.g., the evaluation of the [1].
  6. Derczynski, L. (2016). "Complementarity, F-score, and NLP Evaluation". https://www.aclweb.org/anthology/L16-1040. 
  7. Hand, David (in en). A note on using the F-measure for evaluating record linkage algorithms - Dimensions. doi:10.1007/s11222-017-9746-6. https://app.dimensions.ai/details/publication/pub.1084928040. Retrieved 2018-12-08. 
  8. "The advantages of the Matthews correlation coefficient (MCC) over F1 score and accuracy in binary classification evaluation". BMC Genomics 21 (6): 6. January 2020. doi:10.1186/s12864-019-6413-7. PMID 31898477. 
  9. Powers, David M W (2011). "Evaluation: From Precision, Recall and F-Score to ROC, Informedness, Markedness & Correlation". Journal of Machine Learning Technologies 2 (1): 37–63. 
  10. "Classification assessment methods". Applied Computing and Informatics. August 2018. doi:10.1016/j.aci.2018.08.003. 
  11. J. Opitz; S. Burst (2019). "Macro F1 and Macro F1". arXiv:1911.03347 [stat.ML].

de:Beurteilung eines Klassifikators#Kombinierte Maße