← all concepts

F1 Score

The harmonic mean of precision and recall — the standard single-number summary of classifier performance when both false positives and false negatives matter.

What the F1 score is

The F1 score is the harmonic mean of precision and recall. It combines both metrics into one number, penalising models that sacrifice one for the other. A model with perfect precision but zero recall scores F1 = 0. A model with high precision and high recall scores close to 1. The harmonic mean is used rather than the arithmetic mean because it punishes extreme imbalances more heavily.

Formula: F1 = 2 × (precision × recall) / (precision + recall)

Why it is used as the primary evaluation metric

Accuracy — the fraction of all predictions that are correct — is misleading when classes are imbalanced. A model that predicts "not AI-generated" for every input will score 95% accuracy if 95% of the dataset is human-written, while completely failing its actual purpose. F1 is immune to this: it focuses only on how well the model handles positive cases, making it the standard metric for binary and multi-label classification tasks where the positive class is what matters.

DEJAN's model training pipelines use F1 as the primary metric for checkpoint selection — the checkpoint with the highest validation F1 is the one that ships.

F1 variants

The standard F1 weights precision and recall equally. F-beta scores shift the balance: F2 weights recall twice as heavily as precision (useful when missing positives is worse than false alarms); F0.5 weights precision more heavily. For multi-label models, macro F1 averages per-label scores equally; micro F1 aggregates across all label-instance pairs before computing the score.

Related concepts

Metric