Machine Learning

F1 Score

The harmonic mean of precision and recall — the default single number for classification, and it encodes a decision nobody made.

Reading level: Curious
Pick your depth ↓

When not to use it

  • When your error costs are asymmetric. Which is nearly always. Use F-beta and state the ratio.
  • To decide what to deploy. It's a comparison scalar, not a decision.
  • Micro-averaged, on single-label multi-class. That's accuracy with a fancier name.
  • When the negative class matters. F1 ignores true negatives entirely.

Reach for something else instead

  • F-beta — the same metric with the weighting stated. F2 for recall, F0.5 for precision.
  • Cost-weighted error — the confusion matrix times what each mistake costs. The honest version.
  • Macro-F1 — if you must have one number on imbalanced multi-class, this is the one that notices the rare class.
  • Precision and recall, separately — two numbers, no hidden assumption.

Sources & further reading

  • van Rijsbergen (1979), Information Retrieval — where the F-measure comes from, and it was parameterised by β from the start. The β got dropped, not the concept.
  • Hand & Christen (2018), A Note on Using the F-Measure for Evaluating Record Linkage Algorithms — F1 applies different implicit cost ratios to different classifiers.
  • Powers (2011), Evaluation: From Precision, Recall and F-Measure to ROC, Informedness, Markedness & Correlation — what F1 discards, catalogued.

Primary sources, listed so you can check the claims on this page rather than take them on trust.

Where people go wrong

  • Reporting F1 without being able to justify equal weighting. It's a default, not a decision.
  • Not saying which averaging you used. Macro and micro can differ by tens of points.
  • Reporting micro-F1 on single-label multi-class as if it weren't accuracy.
  • Forgetting F1 ignores true negatives, then using it on a heavily imbalanced problem.

At a glance

FieldMachine Learning
What it isharmonic mean of precision and recall
The hidden assumptionthey're equally important
The fixF-beta, which makes you state the ratio
Ignorestrue negatives, entirely
Micro-F1 on single-label multi-classis accuracy
DifficultyBeginner
Flashcards for this concept
Question
Answer
1 / 4

Often compared with

F1 vs. F-beta — the same formula, but F-beta makes you state how much more recall matters than precision. F1 makes that choice silently and calls it neutral.