Two routes to the same score
Precision P refers to all positive predictions; recall R refers to all actual positives. For positive P and R, the reciprocal of their harmonic mean is the average of their reciprocals. This summary is more sensitive to a low component than the ordinary average. A high F1 score therefore requires that neither component remain very small. It does not replace a decision about the practical relative consequences of false alerts and missed cases.[1]
The harmonic mean is symmetric in P and R. Convert percentages into fractions first.[1]
For TP > 0, substitution and cancellation give the count formula. Its own domain can then be checked separately.[1]
In the count form, each true positive appears twice, while FP and FN each appear once in the denominator. Nonnegative counts and a positive denominator give a result between 0 and 1. TN is absent. F1 is therefore not the overall fraction of correct predictions. Two models can have identical F1 scores while correctly rejecting very different numbers of negatives.[1]
Example 1: calculate from counts and cross-check
45 true positives and two types of error
- Given
- An original constructed test has TP = 45, FP = 15 and FN = 30.
- Find
- Calculate F1 directly and through precision and recall.
Insert the three counts into the count formula.
Obtain the component scores using their different denominators.
The harmonic mean reproduces the direct result.
Result: F1 is about 0.6667, or 66.67%.
Check: The result lies between recall 0.60 and precision 0.75. Their ordinary average would be 0.675, which is not the F1 score.
Recall the method later with the formula’s flashcards.
11 flashcards · English materials
Already have an account? Sign in for flashcardsAvailable from Essential. A ready-made formula set, no AI credits required. Article exercises are not all included.
Example 2: substitute positive percentages correctly
80% precision and 50% recall
- Given
- Both scores refer to the same specified positive class. P = 80% and R = 50% are given.
- Find
- Find F1 and explain the effect of the lower recall.
Write both scores as dimensionless fractions.
Calculate the product and sum after conversion.
Result: F1 is about 61.54%, not 65%. The lower recall pulls the harmonic mean down more than it pulls the ordinary average.
Check: One compatible integer matrix has TP = 40, FP = 10 and FN = 40. It gives P = 40/50, R = 40/80 and directly F1 = 80/130, confirming that the supplied component scores are compatible.
The figure fixes recall at 0.50 and varies precision in the harmonic mean. It plots a mathematical function of those inputs. A real model’s precision-recall curve instead comes from varying thresholds on the same labelled cases. Its shape cannot be inferred from this function graph.[1]
Zero does not always mean undefined
The count formula is defined whenever 2TP + FP + FN is positive. TP = 0 with FP + FN > 0 therefore gives a valid F1 score of zero. If TP = FP = FN = 0, however, the denominator vanishes. There are no actual or predicted positives, so the ratio is undefined without a convention. True negatives alone do not supply the missing positive reference set.[1]
The calculator’s count mode distinguishes these cases explicitly. Its precision-and-recall mode uses positive defined component scores. If a component is merely a software replacement for an empty denominator, do not silently treat it as a measured ratio. Libraries can offer different zero conventions; document the treatment for reproducible comparison.[1]
Averaging and use: what is a good F1 score?
Averaging method is part of the metric too. For macro F1, first calculate each class’s F1 score and then average those scores. This generally differs from taking a harmonic mean of already averaged precision and recall. Micro F1 aggregates the appropriate class counts before computing the ratio. This calculator offers the stated binary positive-class calculation, not automatic multiclass averaging.[1]
There is no universal cutoff for a “good” F1 score. Compare models on the same held-out test basis, against a meaningful baseline and with the same positive class. Consider consequences of both error types too. If incorrectly hiding a message is especially harmful, equal F1 scores cannot decide between two filters: precision and recall may differ despite an identical harmonic mean. Test-data selection and uncertainty also matter. F1 here evaluates one decision threshold; a single score yields neither the best threshold nor the complete precision-recall curve.[1]
Five exercises on the harmonic mean
Calculate · Foundation
Calculate F1 for TP = 28, FP = 7 and FN = 21.
Show hint
Double TP in both the numerator and its denominator term.
Learning goal: Calculate F1 from positive detections and both error types.
Show solution and calculation
The denominator is 56 + 7 + 21 = 84.
Therefore F1 = 56/84 = 2/3 ≈ 66.67%.
No TN count is required.
Error analysis · Application
A solution reports F1 = 0.60 for P = 0.90 and R = 0.30. Correct it.
Show hint
0.60 is only half the sum.
Learning goal: Distinguish harmonic and ordinary means.
Show solution and calculation
The ordinary average was mistaken for F1.
The harmonic mean is 2 × 0.90 × 0.30 / 1.20 = 0.45, making the low detection rate more apparent.
Rearrange · Challenge
Exact values P = 0.75 and F1 = 0.60 are given. Determine R.
Show hint
Multiply by P + R and collect the terms containing R.
Learning goal: Recover a component score with explicit denominator conditions.
Show solution and calculation
F1(P + R) = 2PR gives R(2P − F1) = F1P.
The denominator 1.50 − 0.60 is positive.
Therefore R = 0.45/0.90 = 0.50.
Substitution reproduces F1 = 0.60.
Interpret · Application
Two evaluations both have TP = 10, FP = 5 and FN = 5. Only TN differs: 10 versus 1000. Does F1 change?
Show hint
Check whether TN appears in the count formula.
Learning goal: Recognize limits of a score that omits true negatives.
Show solution and calculation
Both have F1 = 20/30 = 2/3.
The score is unchanged by this alteration of true negatives.
Total sample size and accuracy differ, so identical F1 values do not make the evaluations equivalent overall.
Transfer · Challenge
Two classes have (P,R) = (0.90,0.30) and (0.30,0.90). Compare macro F1 with the harmonic mean of averaged P and R.
Show hint
Compute the two class-specific F1 scores before averaging.
Learning goal: Check the order of computing and averaging scores.
Show solution and calculation
Each class has F1 = 0.45, so macro F1 is 0.45.
The averaged components both equal 0.60, whose harmonic mean is 0.60.
The order of operations therefore matters.
Check your understanding with the formula’s reference test.
8 test questions · English materials
Already have an account? Sign in for the testAvailable from Essential. A ready-made formula set, no AI credits required. Article exercises are not all included.
Sources for this explanation
Quanta · Updated November 1, 2026
Editorial responsibility: Quanta Study editorial team
Review scope
This explanation, 2 worked examples and 5 exercises are available in German and English. Structure, source references and mathematical notation undergo automated checks. Calculations, model assumptions and both language versions receive a separate AI review.
An independent, named human subject review has not yet been documented. Our exercise numbers are worked examples, rather than measurements published by the cited sources.
Editorial responsibility, sources and methodsChange history
- Derived the harmonic-mean and count forms; added two original examples, five exercises, zero cases and limits of averaging.
Cite this reference page
Quanta. F₁ score. Updated November 1, 2026. https://quanta-study.de/en/formula-sheet/f1-score
When citing a specific scientific statement, also cite the specialist source linked to that statement.