D8A Academy © Portfolio Platform
Build · Validate · Get Hired
Free introLeaderboardBlogCheatsheetsCommunity
Sign inGet started
← All cheatsheets
Data Scientist·#006·July 24, 2026·2 min read

Precision vs recall vs F1, finally clear

Two questions, two metrics, one tradeoff. Plus the class-imbalance trap that makes accuracy meaningless. Free one-page PDF.

Get the free PDF

One page, print-ready, free to share. No signup needed.

Download the PDF

Every argument about classifier quality is secretly one of two questions. Precision: when the model raised an alarm, was it right? Recall: of all the real cases, how many did it catch? Get these two straight and the rest of the metric zoo falls into place.

The four outcomes

predicted positivepredicted negative
actually positiveTP · true positiveFN · missed one
actually negativeFP · false alarmTN · true negative

Precision

TP / (TP + FP): of my alarms, how many were real?

Optimize precision when false alarms are the expensive error. A spam filter with low precision sends real mail to the junk folder. Fraud review queues drown analysts when precision drops.

Recall

TP / (TP + FN): of the real ones, how many did I catch?

Optimize recall when a miss is the expensive error. Cancer screening, safety inspections, search: the false negative is what hurts.

F1

2PR / (P + R): the harmonic mean. It punishes imbalance between the two, so you cannot buy a good F1 by maxing one and ignoring the other. Use it when you need a single number and classes are skewed.

The threshold dial

Every classifier outputs a score; the threshold turns it into a yes/no.

  • Raise it: precision up, recall down. Fewer, surer alarms.
  • Lower it: recall up, precision down. Catch more, cry wolf more.

You rarely get both. The threshold decides which one you buy with the other.

The trap: 99% accurate, 100% useless

On data with 1% fraud, a model that always predicts "legit" scores 99% accuracy and catches zero fraud. Accuracy is blind to imbalance because the giant true-negative cell dominates it.

The fix: report precision and recall (or F1), never accuracy alone. And make "what is the class balance?" your first question about any classifier.

Frequently asked questions

What is the difference between precision and recall?
Precision asks: of everything I flagged positive, how much was actually positive? Recall asks: of everything that was actually positive, how much did I catch? Precision punishes false alarms, recall punishes misses.
When should I use F1 instead of accuracy?
Whenever classes are imbalanced, which is most real problems: fraud, churn, defects, disease. Accuracy rewards predicting the majority class; F1 combines precision and recall so a model that catches nothing cannot score well.
What is a good F1 score?
There is no universal threshold: it depends on the class balance and the cost of each error type. Compare against a baseline (random, or always-positive) and against the business cost of FP vs FN rather than chasing an absolute number.
How does the decision threshold trade precision against recall?
Raising the threshold makes the model pickier: fewer alarms, higher precision, lower recall. Lowering it catches more true cases but cries wolf more. Plot the precision-recall curve and pick the point that matches your error costs.

Get the free PDF

One page, print-ready, free to share. No signup needed.

Download the PDF

More cheatsheets