Precision measures how trustworthy a model’s positive calls are. Of all the cases it flagged, how many were real? If a spam filter moves 100 emails to the junk folder and 90 of them are spam, its precision is 90%. The other 10 were false positives: real mail wrongly flagged.
As a formula, precision is true positives divided by everything predicted positive: TP / (TP + FP). In information retrieval, where the measure is just as standard, it’s the fraction of returned documents that are relevant to the search.
What it ignores
The diagram highlights one column of the confusion matrix, and that’s all precision looks at. It says nothing about the positives the model missed. A spam filter that flags a single obvious spam email and lets everything else through has perfect precision and is nearly useless.
That blind spot is covered by recall: of all the real positives, how many did the model catch? The two usually pull against each other. Raise the decision threshold and the model flags only cases it’s sure of, so precision tends to climb while recall drops. Lower it and the reverse happens. A precision-recall curve plots that trade-off across every threshold, and the F1 score squeezes the pair into one number, their harmonic mean.
When to care most
Favour precision when a false alarm is expensive:
- A spam filter, where burying a real email costs more than letting one spam through.
- Search results and recommendations, where people only look at the top few and every bad one wastes attention.
- An automated system that takes action on its own, like blocking a payment or banning an account.
When missing a positive is the costly error, as in disease screening, recall usually takes priority instead.
The catch
Precision is much more informative than accuracy on rare events, but it still depends on how common positives are. The same model, applied to a population where positives are ten times rarer, will usually show lower precision, because there are more negatives available to be flagged by mistake. When comparing precision across datasets or over time, check whether the base rate changed.
Precision is also undefined when a model makes no positive predictions at all, since TP + FP is zero. Libraries handle that differently, so an unexpected 0 or NaN often just means the model never said yes.