F1 Score
A quality metric that combines precision and recall. It is useful when it is important not to miss rare classes and also to avoid false positives.
Precision and Recall
| Metric | Question it answers |
|---|---|
| Precision (precision) | How many of the predicted 'yes' were correct? |
| Recall (recall) | How many of the actual 'yes' did the model find? |
Formula
F1 = 2 × Precision × Recall / (Precision + Recall)
F1 is the harmonic mean: if one of the metrics drops, F1 also drops. The arithmetic mean does not show this.
When Needed
- classes are imbalanced (rare events, spam, diseases);
- precision and recall are equally important;
- simple accuracy is misleading.