F-score
In statistical analysis of binary classification and information retrieval systems, the F-score or F-measure is a measure of predictive performance. It is calculated from the precision and recall of the test, where the precision is the number of true positive results divided by the number of all samples predicted to be positive, including those not identified correctly, and the recall is the number of true positive results divided by the number of all samples that should have been identified as positive. Precision is also known as positive predictive value, and recall is also known as sensitivity in diagnostic binary classification.
The F1 score is the harmonic mean of the precision and recall. It thus symmetrically represents both precision and recall in one metric. The more generic score applies additional weights, valuing one of precision or recall more than the other.
The highest possible value of an F-score is 1.0, indicating perfect precision and recall, and the lowest possible value is 0, if the precision or the recall is zero.
Etymology
The name F-measure is believed to be named after a different F function in Van Rijsbergen's book, when introduced to the Fourth Message Understanding Conference.Definition
The traditional F-measure or balanced F-score is the harmonic mean of precision and recall:With and, it follows that the numerator of is the sum of their numerators and the denominator of is the sum of their denominators.
If FP=FN
or
So, F1 = precision = recall
If TP=FP=FN
or
To see it as a harmonic mean, note that.
Fβ score
A more general F score,, that uses a positive real factor, where is chosen such that recall is considered times as important as precision, is:To see that as a weighted harmonic mean, note that.
In terms of Type I and type II errors this becomes:
Two commonly used values for are 2, which weighs recall higher than precision, and 1/2, which weighs recall lower than precision.
The F-measure was derived so that "measures the effectiveness of retrieval with respect to a user who attaches times as much importance to recall as precision". It is based on Van Rijsbergen's effectiveness measure
Their relationship is: where
Diagnostic testing
This is related to the field of binary classification where recall is often termed "sensitivity".Dependence of the F-score on class imbalance
Precision-recall curve, and thus the score, explicitly depends on the ratioof positive to negative test cases.
This means that comparison of the
F-score across different problems with differing class ratios is
problematic. One way to address this issue is to use a standard class ratio when making such comparisons.
Applications
The F-score is often used in the field of information retrieval for measuring search, document classification, and query classification performance. It is particularly relevant in applications which are primarily concerned with the positive class and where the positive class is rare relative to the negative class.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 and so is seen in wide application.
The F-score is also used in machine learning. However, the F-measures do not take true negatives into account, hence measures such as the Matthews correlation coefficient, Informedness or Cohen's kappa may be preferred to assess the performance of a binary classifier.
The F-score has been widely used in the natural language processing literature, such as in the evaluation of named entity recognition and word segmentation.
Properties
The F1 score is the Dice coefficient of the set of retrieved items and the set of relevant items.- The F1-score of a classifier which always predicts the positive class converges to 1 as the probability of the positive class increases.
- The F1-score of a classifier which always predicts the positive class is equal to 2 * proportion_of_positive_class /, since the recall is 1, and the precision is equal to the proportion of the positive class.
- If the scoring model is uninformative then the optimal threshold is 0 so that the positive class is always predicted.
- F1 score is concave in the true positive rate.
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.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.
David M W 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.
Another source of critique of F1 is its lack of symmetry. It means it may change its value when dataset labeling is changed - the "positive" samples are named "negative" and vice versa.
This criticism is met by the P4 metric definition, which is sometimes indicated as a symmetrical extension of F1.
Finally, Ferrer
and Dyrland et al.
argue that the expected cost is the only principled metric for evaluation of classification decisions, having various advantages over the F-score and the MCC. Both works show that the F-score can result in wrong conclusions about the absolute and relative quality of systems.