The F-score (also called the F-measure or F1-score in its balanced form) is a statistical measure used to evaluate the predictive performance of binary classification and information retrieval systems. It is calculated from two other metrics—precision and recall—and combines them into a single value that represents their harmonic mean.
Definition
In the context of binary classification, a test or model produces a set of predictions that can be categorized using a confusion matrix with true positives (TP), false positives (FP), true negatives (TN), and false negatives (FN).
- Precision (also called positive predictive value) is the number of true positives divided by the total number of samples predicted to be positive: TP / (TP + FP).
- Recall (also called sensitivity) is the number of true positives divided by the total number of samples that actually belong to the positive class: TP / (TP + FN).
The balanced F-score (F1) is the harmonic mean of precision and recall:
F1 = 2 · (precision · recall) / (precision + recall)
This can also be expressed directly in terms of the confusion matrix components:
F1 = 2·TP / (2·TP + FP + FN)
The F-score ranges from 0 to 1, where a value of 1.0 indicates perfect precision and recall, and 0 indicates that either precision or recall is zero.
The Fβ Score
A more general form, the Fβ score, applies a weighting factor β that controls the relative importance of recall versus precision. It is defined as:
Fβ = (1 + β²) · precision · recall / (β² · precision + recall)
When β = 1, the formula reduces to the balanced F1 score. When β > 1, recall is weighted more heavily than precision; when β < 1, precision is weighted more heavily. Common values include β = 2 (favoring recall) and β = 0.5 (favoring precision).
The F-measure is derived from C. J. van Rijsbergen's effectiveness measure (1979), where Fβ = 1 − E and the weighting relationship α = 1/(1 + β²) applies.
Etymology
The name "F-measure" is believed to originate from a function denoted "F" in Van Rijsbergen's book Information Retrieval (1979). The term was later popularized through its introduction at the Fourth Message Understanding Conference (MUC-4) in 1992.
Applications
The F-score is widely used in:
- Information retrieval, for evaluating search, document classification, and query classification performance.
- Machine learning, for evaluating classification models, particularly in cases of class imbalance where accuracy may be misleading.
- Natural language processing, including named entity recognition and word segmentation.
- Medical diagnostics, where recall is referred to as sensitivity.
The F-score is especially relevant in applications primarily concerned with the positive class, where the positive class is rare relative to the negative class.
Extensions to Multi-Class Classification
For classification problems with more than two classes, the F-score can be averaged across classes. Two common approaches are:
- Macro F1: computed as the arithmetic mean of the class-wise F1 scores (or the F1 score of class-wise precision and recall means). This treats each class equally.
- Micro F1: computed as the harmonic mean of micro precision and micro recall. In single-label multi-class classification, micro precision equals micro recall, making micro F1 equal to both.
Properties and Limitations
- The F1 score is equivalent to the Dice coefficient when applied to the set of retrieved items and the set of relevant items.
- F-measures do not account for true negatives, so they can be misleading for imbalanced datasets.
- Several researchers, including David Hand and David M. W. Powers, have criticized the widespread use of the F1 score. Criticisms include its equal weighting of precision and recall regardless of real-world error costs, its dependence on the ratio of positive to negative test cases (making cross-dataset comparisons problematic), and its asymmetry with respect to relabeling of positive and negative classes.
- Alternative metrics proposed as more informative or symmetric include the Matthews correlation coefficient (MCC), Informedness, Markedness, and Cohen's kappa.
Sources
This entry is based on content from the Wikipedia article on the F-score and the Encyclopaedia Britannica entry on the subject, which document the metric's definition, history, applications, and criticisms.