Open Agent School · Public worked example

F1 score: meaning and example

Welcome! Take one idea with you today.

F1 is the harmonic mean of precision and recall. Precision asks how many predicted positives were right; recall asks how many actual positives were found. F1 is high only when both are high.

Picture it: This worked example uses seven synthetic tickets, not the interactive lab's six: a classifier correctly flags 3 urgent tickets, falsely flags 1 routine ticket, misses 2 urgent tickets, and correctly leaves 1 routine ticket unflagged. Precision is 3/4, recall is 3/5, and F1 is 6/(6 + 1 + 2) = 2/3, about 0.667.

What is easy to mix up?

F1 ignores true negatives, depends on class and threshold, and balances two error types in a particular way. Real decision costs and affected groups still need evaluation.

Teaching example by Open Agent School. Source: scikit-learn: Model Evaluation.