F1 Score
The F1 score is a single classification metric that combines precision and recall into one number by calculating their harmonic mean, providing a balanced measure of a model's performance when both false positives and false negatives…
Definition
The F1 score is a single classification metric that combines precision and recall into one number by calculating their harmonic mean, providing a balanced measure of a model's performance when both false positives and false negatives matter.
Overview
Reporting precision and recall as two separate numbers can make it hard to compare models directly, especially when one model has higher precision and another has higher recall. The F1 score solves this by combining them into a single value: F1 = 2 x (precision x recall) / (precision + recall). It uses the harmonic mean rather than a simple average because the harmonic mean penalizes extreme imbalances more heavily — a model with 100% precision but 1% recall gets a very low F1 score, correctly reflecting that it's not actually useful despite its perfect precision. The F1 score ranges from 0 to 1, with 1 representing perfect precision and recall simultaneously. It's particularly useful on imbalanced datasets, where overall accuracy can be misleadingly high, since it forces a model to perform reasonably on both fronts rather than gaming one metric at the expense of the other. A common variant, the F-beta score, generalizes this idea by letting teams weight recall more or less heavily than precision depending on which type of error matters more for their use case. Like precision and recall themselves, the F1 score is computed from the underlying counts in a confusion matrix, and for multi-class problems it's typically averaged across classes using macro, micro, or weighted averaging strategies, each handling class imbalance slightly differently. It's a standard reporting metric across applied machine learning, from binary fraud classifiers to multi-class image recognition, and appears throughout courses like Machine Learning Fundamentals.
Key Concepts
- Combines precision and recall into a single balanced score via the harmonic mean
- Ranges from 0 (worst) to 1 (perfect precision and recall)
- Penalizes extreme imbalance between precision and recall more than a simple average would
- Particularly useful for evaluating models on imbalanced datasets
- Has a generalized variant, F-beta, that lets teams weight recall versus precision
- For multi-class problems, typically averaged using macro, micro, or weighted strategies
Use Cases
Frequently Asked Questions
From the Blog
What Is the F1 Score and When to Use It
The F1 score combines precision and recall into a single number using their harmonic mean, giving you one balanced metric for classification on imbalanced data.
Read More AI & TechnologySAT Prep Tips That Actually Move Your Score
Effective SAT prep means practicing full-length timed tests, reviewing every mistake, and targeting your weakest section instead of studying everything equally. Here are the study habits that reliably raise scores.
Read More AI & TechnologyTest-Taking Tips That Actually Improve Your Score
Strong test-taking strategy comes down to managing time, reading questions carefully, and reviewing systematically rather than cramming harder. This guide covers the habits that reliably raise scores on technical and certification exams.
Read More AI & TechnologyWhat Is a ROC Curve? Understanding ROC and AUC
A ROC curve plots a classification model's true positive rate against its false positive rate across every decision threshold, and AUC summarizes that curve in a single score. Here is how to read both.
Read More