Landmark 4 stops to get here · leads to 2

Precision

Of everything a model flagged as positive, the fraction that really was positive: TP / (TP + FP). It answers "when the model says yes, how often is it right?"

Your route here

4 stops · basics first
  1. Machine Learning ✓ understood

    Building systems that learn patterns from data instead of following hand-written rules, getting better at a task as they see more examples.

  2. Supervised Learning ✓ understood

    Learning from examples paired with the correct answer, so a model can predict answers for new inputs it hasn't seen.

  3. Classification ✓ understood

    A supervised learning task where the model assigns each input to one of a fixed set of categories, such as spam or not spam.

  4. Confusion Matrix ✓ understood

    A table showing true positives, true negatives, false positives, and false negatives for classification evaluation.

  5. Precision · you are here ✓ understood

Picture it

PREDICTEDpositivenegativeACTUALpositivenegativeTP42FN6FP8TN44precision = TP / (TP + FP)= 42 / 50 = 0.84recall = TP / (TP + FN)= 42 / 48 = 0.88
Notice precision only looks at the predicted-positive column: of everything flagged positive, TP/(TP+FP) were actually right.

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.

Where it sits

Before this

Confusion Matrix
Precision

Explore nearby

Sources

  1. Christopher D. Manning, Prabhakar Raghavan and Hinrich Schütze, Introduction to Information Retrieval . Cambridge University Press, 2008; Evaluation of unranked retrieval sets
  2. Google, Machine Learning Crash Course: "Classification: Accuracy, recall, precision, and related metrics" . Google for Developers