F1 score is the harmonic mean of precision and recall — balancing quality and coverage in a single metric, widely used when both precision and recall matter equally.
What Is F1 Score?
- Definition: Harmonic mean of precision and recall.
- Formula: F1 = 2 × (Precision × Recall) / (Precision + Recall).
- Range: 0 (worst) to 1 (perfect).
Why Harmonic Mean?
- Penalizes Imbalance: Low precision or recall significantly reduces F1.
- Balanced: Requires both precision and recall to be high.
- Example: P=1.0, R=0.1 → F1=0.18 (not 0.55 like arithmetic mean).
F1 vs. Arithmetic Mean
Arithmetic Mean: (P + R) / 2 = (1.0 + 0.1) / 2 = 0.55. Harmonic Mean (F1): 2PR/(P+R) = 2×1.0×0.1/(1.0+0.1) = 0.18. Harmonic mean penalizes imbalance more.
When to Use F1
Good For: Binary classification, information retrieval, when precision and recall equally important. Not Ideal For: When precision and recall have different importance (use F-beta instead).
F-Beta Score: Generalization allowing different precision/recall weights.
- F2: Weights recall 2× more than precision.
- F0.5: Weights precision 2× more than recall.
F1@K: F1 score computed on top-K results.
Limitations
- Binary: Doesn't handle graded relevance.
- Equal Weighting: Assumes precision and recall equally important.
- Ignores True Negatives: Only considers positives.
Applications: Classification evaluation, information retrieval, search evaluation, any precision-recall trade-off.
Tools: scikit-learn, standard in ML libraries.
F1 score is the standard for balanced evaluation — by harmonically combining precision and recall, F1 provides a single metric that requires both quality and coverage to be high.
Explore 500+ Semiconductor & AI Topics
From EUV lithography to CUDA optimization — search the full knowledge base or chat with our AI assistant.