Understanding the F-beta score calculator — concept and principle
The F-beta score combines precision and recall into one number while letting you decide how much more one matters than the other. It is used to compare classifiers, search systems and detection models when false negatives and false positives have different costs: β = 2 for tasks where missing a case is worse, β = 0.5 where false alarms are worse, and β = 1 for the ordinary F1 score.
How it is calculated
F_β = (1 + β²) × P × R ÷ (β² × P + R)
- P is precision and R is recall, both entered as percentages, so the result is also on a 0–100 scale.
- β is a non-negative weight. β = 1 gives F1 = 2PR ÷ (P + R).
- β = 0 reduces the score to precision alone; as β grows very large, the score approaches recall.
The principle
F_β is a weighted harmonic mean of precision and recall. A harmonic mean is dominated by the smaller value, so a model cannot score well by being excellent at one and poor at the other. C. J. van Rijsbergen derived the measure from an effectiveness function for information retrieval, choosing the weighting so that a user who attaches β times as much importance to recall as to precision gets the right trade-off. In practice, raising β pulls the score toward recall; lowering it pulls the score toward precision.
Worked example
- Inputs: P = 80, R = 60, β = 2, so β² = 4.
- Numerator: (1 + 4) × 80 × 60 = 24,000.
- Denominator: 4 × 80 + 60 = 380.
- F₂ = 24,000 ÷ 380 = 63.16.
For comparison, the same model has F1 = 68.57 and F0.5 = 75. Because β = 2 favours recall, and recall (60) is the weaker value, F₂ falls closer to 60.
| Recall (%) | F-beta |
|---|---|
| 15 | 17.91044776 |
| 30 | 34.28571429 |
| 45 | 49.31506849 |
| 60 | 63.15789474 |
| 75 | 75.94936709 |
| 90 | 87.80487805 |
| 120 | 109.0909091 |
How to read the result
F_β always lies between the smaller and the larger of P and R (inclusive). If changing β moves the score a lot, precision and recall are far apart, and you should look at both directly. Only compare F_β values computed with the same β, the same positive class and the same test set.
Common mistakes
- Entering precision as a fraction (0.8) and recall as a percentage (60).
- Using β = 2 just because it is common, without checking which error is costlier.
- Writing β² × R instead of β² × P in the denominator, which reverses the weighting.
Frequently asked questions
Does β = 2 mean recall counts twice as much?
In van Rijsbergen's definition, β is the ratio of importance the user places on recall versus precision; the formula then squares it.
When should I use F0.5?
When false positives are expensive, for example flagging legitimate transactions as fraud or showing irrelevant search results.
Can I average F-beta across classes?
Yes, either macro-averaged (mean of per-class scores) or micro-averaged (from pooled counts); say which one you used.
Sources: C. J. van Rijsbergen, Information Retrieval, 2nd ed., Butterworths, 1979 · C. D. Manning, P. Raghavan and H. Schütze, Introduction to Information Retrieval, Cambridge University Press, 2008