MORAIDICTIONNAIRE IA
Évaluation

F1-score

The harmonic mean that reconciles precision and recall into a single evaluation number.

The F1-score is the referee that reconciles two often-clashing judges: precision and recall. Rather than picking between "being right when you predict positive" and "missing nothing," it fuses them into a harmonic mean — a measure that harshly penalizes imbalance. A model cannot cheat by excelling at just one criterion.

Precision, recall, and their trade-off

Precision answers: of my positive predictions, how many are correct? Recall answers: of the actual positives, how many did I catch? These two often pull in opposite directions: a cautious model gains precision but loses recall, and vice versa.

$$\text{Precision} = \frac{TP}{TP + FP} \qquad \text{Recall} = \frac{TP}{TP + FN}$$

The F1-score is their harmonic mean:

$$F_1 = 2 \cdot \frac{\text{Precision} \cdot \text{Recall}}{\text{Precision} + \text{Recall}}$$

The harmonic mean stays low whenever either value is small — that is what forces balance.

Why not accuracy?

On imbalanced data (e.g. fraud detection: 1 in 1000), a model that always predicts "negative" reaches 99.9% accuracy while being useless. The F1-score, by contrast, collapses.

Metric Sensitive to imbalance Best when…
Accuracy No Balanced classes
Precision Partially False positives are costly
Recall Partially False negatives are costly
F1-score Yes Precision/recall balance needed

Useful variants

The F1-score rewards only models that are both precise and thorough: one number, no shortcuts.

Explore the full AI dictionary →