F-beta Score

Machine Learning
Introduced by
C. J. van Rijsbergen
Year
1979
Type
Evaluation metric
Family
Classification Metric

What does it do?

The F-beta score is a weighted harmonic mean of precision and recall.

A parameter beta sets how much recall counts relative to precision in the score. It generalizes the F1-score, which is the special case beta = 1.

The intuition behind the method

The F-beta score is useful when precision and recall matter unequally for an application. Beta controls this weighting. Beta = 1 treats the two equally (the F1-score), beta > 1 moves the score toward recall, and beta < 1 moves it toward precision. The formula gives recall the weight beta squared relative to precision, so beta = 2 gives recall a much larger influence than beta = 1, and beta = 0.5 gives precision the larger influence. The score is therefore a judgement about which kind of error to weigh more heavily, not a direct measure of error costs.

History

The F-beta score is presented in van Rijsbergen's Information Retrieval as a generalization of the F-measure that allows different weights for precision and recall; the F1-score is its beta = 1 case. Variants with beta above or below 1 are used in information retrieval and machine learning when recall or precision is to be emphasised.

When to use it

Use the F-beta score when precision and recall should be weighted unequally and you can state which kind of error your application should avoid more. Beta above 1 suits settings where a missed positive is the main concern, and beta below 1 settings where false positives are the main concern. F2 and F0.5 are often used for these two cases, but the beta value must be justified by the specific application. Do not use the score when you cannot justify a beta value, because the choice then becomes arbitrary. It is also not a full description of classifier performance: it does not use true negatives, so it should be reported alongside precision, recall, or per-class results when those matter.

Limitations and considerations

  • Beta is not estimated from data. Its value reflects a judgement about the application, and different judgements give different rankings of models.
  • Because true negatives do not appear in the formula, the score says nothing about how the model handles the negative class.
  • A single beta value gives one point on the trade-off between precision and recall. Models that would rank differently at another beta are not distinguished by the score.
  • In multi-class settings the score depends on how class results are averaged. Micro-averaging pools true positives, false positives and false negatives over all classes before computing the score; macro-averaging computes the score per class and takes the unweighted mean; per-class reporting gives one score for each class. These can give different values, so the scheme must be reported.

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • Beta is an explicit parameter, so the emphasis on recall or precision is stated openly in the reported metric.
  • With beta = 1 the score reduces to the F1-score, so results remain comparable with F1 values.
  • The formula uses only precision and recall, so the score is not raised by a large number of correctly rejected negatives.
  • The harmonic-mean structure penalises a model that is weak on either precision or recall, so it cannot be offset by a very high value on the other.

Applications

  • Medical screening for serious conditions, where a missed case (low recall) may be considered more costly than a false alarm; a beta above 1 reflects this priority.
  • Spam filtering, where wrongly removing legitimate email (low precision) may be considered more costly than letting some spam through; a beta below 1 reflects this priority.
  • Information retrieval tasks where completeness of results is prioritised; a beta above 1 emphasises recall.
  • Anomaly detection where missed anomalies are more serious than false alarms, so recall is weighted more heavily.

How it works

How it works

1

Choose beta from the relative importance you attach to recall versus precision in your application. Beta = 2 favours recall; beta = 0.5 favours precision; beta = 1 gives equal weight. Fix beta before comparing models.

Formula
\beta > 1 \Rightarrow \text{recall emphasised};\quad \beta < 1 \Rightarrow \text{precision emphasised};\quad \beta = 1 \Rightarrow F_1
2

Compute the weighted harmonic mean: F-beta = (1 + beta^2) * (precision * recall) / (beta^2 * precision + recall).

Formula
F_\beta = \frac{(1+\beta^2)\,P\,R}{\beta^2 P + R}
3

F-beta lies between 0 and 1. Changing beta changes which of precision or recall dominates the value: as beta grows large the score approaches recall, and as beta approaches 0 it approaches precision. A model with high recall but lower precision therefore scores relatively better under a large beta, and a model with high precision scores relatively better under a small beta, so the ranking of two models can change with beta. Because the mean is harmonic, a very low value on either precision or recall keeps the score low. The score is 0 when both precision and recall are 0; when precision is undefined because there are no predicted positives, the score is undefined and should be reported as such.

Formula
F_\beta \to R \text{ as } \beta \to \infty;\quad F_\beta \to P \text{ as } \beta \to 0

Common pitfalls

  • Choosing beta after comparing models, so that the chosen beta favours a preferred model. The value should be fixed from the application before evaluation.
  • Reading beta as a direct error-cost ratio. Beta is a weight in the formula, and recall enters with beta squared rather than beta, so a 'twice as costly' reading does not map onto beta = 2 without further justification.
  • Using one beta for every class in a multi-class problem when classes have different consequences for errors.
  • Reporting only the F-beta value without precision, recall, or per-class results, which hides which of the two quantities drives the score.

Frequently asked questions

How do I choose the beta parameter?

Start from the application: decide whether missing a true positive or raising a false alarm is the more serious problem. Beta above 1 gives recall more weight, beta below 1 gives precision more weight, and beta = 1 (F1-score) gives them equal weight. Beta is a weight in the formula rather than a measured cost ratio, so it should be justified by the application's priorities and stated in the report. F2 and F0.5 are often used for recall-focused and precision-focused evaluation respectively.

Why not just set different class weights in the learning algorithm instead of using F-beta?

Setting class weights during training changes how the model is fitted to reflect error costs, while F-beta measures the performance of a given model. F-beta is an evaluation metric, so it does not require retraining. Ideally the two should be consistent: if class weights express a priority during training, evaluate with a beta that expresses the same priority.

Is there a way to choose beta automatically from data?

Beta should be fixed from the application's error priorities before evaluation, not selected by comparing models, because that favours a preferred model. If the relative cost of false negatives and false positives is known from the domain, it can inform the choice, but beta is a weight rather than a cost ratio. A sensitivity analysis over several beta values can be reported to show how rankings change, but it should be labelled as such and not used to pick beta.

Related methods

Sources

  1. van Rijsbergen, C. J. (1979). Information Retrieval (2nd ed.). Butterworth-Heinemann.

    Open publication reference
  2. Powers, D. M. (2011). Evaluation: From Precision, Recall and F-Measure to ROC, Informedness, Markedness and Correlation. Journal of Machine Learning Technologies, 2(1), 37-63.

    Open publication reference