Skip to content

AI Glossary · Metrics

What is F1 Score?

F1 Score

The F1 score is the harmonic mean of precision and recall, used to summarize the balance between correctly selected positives and missed positives.

Also known as: F1

· Updated · Chain of Thought

AI Evaluation & Reliability

  • 2 episodes
  • 1 source

F1 combines precision and recall as 2 × precision × recall / (precision + recall). Google’s classification guide explains both the formula and why metric choice depends on the costs of false positives and false negatives (Google, Classification metrics). The equivalent count formula is 2TP / (2TP + FP + FN), which leaves out true negatives. F1 is a summary of precision and recall, not the percentage of all predictions that are correct.

For a concrete example, suppose a ticket classifier flags 100 tickets for escalation and 80 truly need it. Precision is 80/100 = 0.8. If 100 tickets in the whole test set need escalation, recall is also 0.8 and F1 is 0.8. If the system instead flags only 50 tickets and 40 are correct, precision stays at 0.8, recall falls to 0.4 and F1 falls to about 0.53.

Discussing what constitutes an acceptable evaluation score for a product, Greg Statton says, “you have to understand the end use” (episode 27, 30:30).

For builders, decide whether a missed escalation and an unnecessary escalation have equal costs before using F1 as your main score. Keep the underlying counts visible and state which class you measure. Precision and recall explains the two components; AI agent metrics beyond accuracy covers measurement beyond a single classification score.

Move the threshold, inspect the mistakes

Twelve invented messages, five actually spam. A message is flagged when its score is at least the threshold, including ties. Scores here are illustrative, not calibrated probabilities.

The worked example uses a threshold of 0.50. With JavaScript enabled, you can change it below.

6 of 12 messages flagged: 4 spam caught, 2 false alarms, 1 spam missed.

Confusion matrix at threshold 0.50
Actual spamActual not spam
Flagged4Correct flags (TP)2False alarms (FP)
Not flagged1Missed spam (FN)5Correct rejections (TN)
Precision
66.7%4 / 6 · correct among flagged
Recall
80.0%4 / 5 · caught among actual spam
F1
72.7%8 / 11 · 2TP / (2TP + FP + FN)
Inspect all 12 scored messages
Fixed scores and labels; only the threshold changes
MessageScoreActual labelDecision
A0.95SpamFlagged (TP)
B0.90SpamFlagged (TP)
C0.80Not spamFalse alarm (FP)
D0.70SpamFlagged (TP)
E0.50SpamFlagged (TP)
F0.50Not spamFalse alarm (FP)
G0.40SpamMissed spam (FN)
H0.35Not spamNot flagged (TN)
I0.30Not spamNot flagged (TN)
J0.20Not spamNot flagged (TN)
K0.10Not spamNot flagged (TN)
L0.05Not spamNot flagged (TN)
Can lowering the threshold improve precision and recall together?

Yes. Here, moving from 0.50 to 0.40 catches message G, which is spam, without adding a false alarm. Precision rises from 4/6 to 5/7, and recall rises from 4/5 to 5/5. The tradeoff is common, but precision need not fall at every step.

F1 weights precision and recall equally; it does not encode the cost of a false alarm or a miss. Formulas: Google’s classification metrics guide. How thresholds work.

Sources

From the conversation