Precision is a metric that answers the question: when the model says “positive,” how often is it right? It is the number of true positives divided by the number of items the model labeled positive, which is true positives plus false positives [1]. A spam filter with a precision of 95 percent is correct on 95 of every 100 emails it sends to the spam folder, and wrongly hides five good emails. Precision is also called positive predictive value and is one of the core measures in model evaluation. It pairs naturally with recall, and both are read from the confusion matrix.
The formula
Precision = TP / (TP + FP)
where TP is the number of true positives (items correctly flagged) and FP is the number of false positives (items wrongly flagged). Precision ranges from 0 to 1, or 0 to 100 percent. If a model flags no items at all, precision is undefined, and libraries usually report zero or give a warning.
Example
A fraud detection system reviews 10,000 transactions and flags 200 of them. After investigation, 150 of the flags were real fraud and 50 were legitimate. Precision is 150 divided by 200, or 75 percent. That means investigators spend a quarter of their time on false alarms. If the system flagged only 100 transactions and 95 were fraud, precision would rise to 95 percent, but it might also have missed many frauds that it did not flag, which is a recall problem.
What precision tells you
Precision measures the cost of false alarms. High precision means that positive predictions can be trusted and acted on. It says nothing about the cases the model missed. A model could achieve perfect precision by flagging only the single most obvious case, so precision must always be read with recall. It differs from accuracy, which counts both kinds of correct answers over everything, and it avoids the accuracy paradox on imbalanced data because it focuses on the positive class.
The precision-recall trade-off
Most classifiers produce a score, and a threshold decides which items count as positive. Raising the threshold makes the model pickier: it flags fewer items, which are more likely to be correct, so precision rises, but it misses more real positives, so recall falls. Lowering the threshold does the reverse [1]. The precision-recall curve plots precision against recall across all thresholds, and the area under it, or average precision, summarizes performance, which is especially informative when positives are rare. The F1 score, the harmonic mean of the two, gives one number; see F1 score.
When precision matters most
Precision is the priority when false alarms are costly.
- Spam and content filtering. Blocking a legitimate message is worse than letting some spam through.
- Search and recommendation. Users judge the top results, so precision at k, the share of the top k results that are relevant, is a standard measure [2].
- Legal and compliance review. Wasted reviewer time is expensive.
- Automated enforcement. Wrongly penalizing a person has real harm.
- Marketing and outreach. Irrelevant offers waste budget and annoy customers.
Where missing a positive is worse, such as cancer screening or safety alerts, recall takes priority.
Variants
- Macro, micro and weighted precision. For multi-class problems, precision can be computed per class and averaged equally (macro), pooled across all items (micro), or weighted by class size.
- Precision at k. Share of relevant items in the top k results.
- Average precision and mean average precision. Summaries used in retrieval and in object detection.
- Precision for generated text. In some language metrics, precision counts how many generated words or phrases appear in a reference, as in BLEU.
Do not confuse with measurement precision
In science and engineering, precision means how closely repeated measurements agree with each other, regardless of whether they are correct, while accuracy refers to closeness to the true value. The machine learning meaning above is a different concept. In computing, “numerical precision” also refers to the number of bits used to represent numbers, such as 16-bit or 32-bit floating point; see quantization.
Improving precision
- Raise the decision threshold.
- Add features or data that help separate confusing cases.
- Clean mislabeled negatives; see data labeling.
- Add a second-stage model or human review for items the first model flags.
- Use cost-sensitive training that penalizes false positives more heavily.
- Calibrate probabilities so thresholds behave predictably.
Improvements should be checked on held-out testing data, and the effect on recall must be monitored.
Precision in a base-rate world
Precision depends not only on how good the model is, but on how common the positive class is. Imagine a test for a rare condition that affects one person in a thousand, with a false positive rate of one percent and a recall of 99 percent. Screening 100,000 people finds about 99 of the 100 sick people, but also flags about 1,000 healthy people. Of roughly 1,099 flagged, only 99 are truly sick, so precision is about nine percent, even though the test looks excellent by its error rates. Most positive results are false alarms. This is the base-rate effect, familiar from medical screening, and it explains why rare-event detection systems, whether for fraud, disease or security threats, often need a second stage of review. It also shows why precision should be measured on test data that has the same class mix as real use, not on a balanced sample.
Reading a precision-recall curve
A precision-recall curve starts at the top left with high precision and low recall, when the threshold is strict, and moves toward the right as the threshold loosens, usually with precision falling. A model whose curve stays high for longer is better. The curve of a random model sits at a flat line equal to the share of positives in the data, which provides a baseline: on a data set with two percent positives, a precision of ten percent is five times better than chance, though still low in absolute terms. Teams choose an operating point on the curve by weighing the cost of a false alarm against the cost of a miss, for example by asking how many false alarms an analyst team can review per day.
FAQs
What is precision in machine learning? It is the share of predicted positives that are truly positive.
What is the formula for precision? True positives divided by the sum of true positives and false positives.
What is the difference between precision and recall? Precision measures how many flagged items are correct. Recall measures how many of the real positives were found.
What is the difference between precision and accuracy? Accuracy counts all correct predictions over all cases, while precision looks only at the items predicted positive.
When is high precision important? When false positives are costly, as in spam filtering, legal review or automated enforcement.
More in AI Evaluation and Reliability
Key facts
- Precision is the number of true positives divided by the number of true positives plus false positives, also called positive predictive value1.
- Precision and recall typically trade off against each other as the decision threshold of a classifier changes1.
- Precision at k and average precision are standard measures in information retrieval and recommendation, where only the top results matter2.
Related concepts
Quick checkWhat is precision in machine learning?Show answer
Precision is the share of items a model labels positive that are actually positive, calculated as true positives divided by the sum of true positives and false positives. It shows how trustworthy a model's positive predictions are.
Sources
- Tom Fawcett, An Introduction to ROC Analysis, Pattern Recognition Letters, https://doi.org/10.1016/j.patrec.2005.10.010
- Christopher Manning, Prabhakar Raghavan and Hinrich Schutze, Introduction to Information Retrieval, Cambridge University Press, https://nlp.stanford.edu/IR-book/
Editorially reviewed by Specialty Digest Editorial TeamLast reviewed November 17, 2026Researched and drafted with AI assistanceReport an issue
