📏  F1-score

F1-score#

The harmonic mean of precision and recall.

Important

✨ AI-generated content. This page was written with the assistance of an AI language model and is provided as a learning aid. Despite careful review, it may still contain mistakes, omissions, or out-of-date information. Whether you are new to the topic, a team lead, or a senior practitioner, treat it as a starting point rather than an authoritative reference: read it critically and independently verify anything you act on (code, commands, figures, and factual claims) against official documentation and primary sources before relying on it.

What it is#

The F1-score combines precision and recall into one number by taking their harmonic mean:

\[F_1 = 2\cdot\frac{P \cdot R}{P + R} = \frac{2\,TP}{2\,TP + FP + FN}.\]

It ranges from 0 to 1, and is high only when both precision and recall are high.

Why harmonic#

Using the harmonic mean makes F1 penalize lopsided models — a classifier with 0.95 precision but 0.20 recall scores a low F1, unlike accuracy or a plain average. This makes F1 far more informative than accuracy on imbalanced data, and it deliberately ignores true negatives.

Its variants#

For multiclass problems, F1 is aggregated with micro, macro or weighted averaging; the general score tilts the balance toward recall (β > 1) or precision (β < 1) when the two errors carry different costs.


Theme: Classification & Averaging Metrics  ·  All terminology



See also

Source article Adapted (context, re-expressed) in our own words from: F1-score (insightful-data-lab.com).

Tags: purpose: reference topic: terminology level: intermediate