Precision is an evaluation metric used in classification. It measures how many predicted positives were actually positive.
Precision = True Positives / All Predicted Positives
When the model predicted positive, how often was it correct?
Precision focuses on the quality of the model's positive predictions.
Precision matters when false positives are costly or harmful. A false positive happens when the model predicts positive, but the true answer is negative.
High precision is important because users do not want normal emails incorrectly marked as spam.
Predicted positives are all examples the model labeled as positive. They include both true positives and false positives.
A true positive happens when the model predicts positive and the true label is also positive. True positives are correct positive predictions.
A false positive happens when the model predicts positive, but the true label is negative. False positives are incorrect positive predictions.
Precision is calculated using true positives and false positives.
Precision = True Positives / (True Positives + False Positives)
Short Form: Precision = TP / (TP + FP)
The denominator means: All predicted positives.
Imagine a model makes positive predictions for 100 examples.
70% of the model's positive predictions were correct.
High precision means most positive predictions are correct. It is useful when false positives should be avoided.
Low precision means many positive predictions are wrong. It can create frustration, risk, or wasted effort.
In spam detection, precision measures how many emails predicted as spam were truly spam.
Most emails sent to spam were truly spam — a strong precision score.
Precision can be important in medical testing when false positives create stress or unnecessary follow-up.
30% of positive predictions were false alarms. Recall is also important in medicine because missing actual cases can be dangerous.
Precision matters in fraud detection because false positives can inconvenience users.
Lower precision means many normal users may have transactions blocked.
Precision is useful in search and recommendation systems because users want relevant results.
Most returned results are useful.
Accuracy measures overall correctness. Precision focuses only on positive predictions.
Out of all predictions, how many were correct?
Out of all predicted positives, how many were actually positive?
Precision and recall measure different things. Precision focuses on avoiding false positives. Recall focuses on finding actual positives.
When the model predicted positive, how often was it correct?
Spam: How many marked spam emails were truly spam?
Out of all actual positives, how many did the model find?
Spam: How many actual spam emails were caught?
Precision and recall often have a tradeoff. If a model becomes stricter about predicting positive, precision may increase, but recall may decrease.
Only marks emails as spam when very confident.
Result: High precision, lower recall. Some spam may be missed.
Marks more emails as spam.
Result: Higher recall, lower precision. More normal emails may be marked spam.
Precision is more important when false positives are costly.
Main goal: Positive predictions should be trustworthy.
Recall may be more important when false negatives are more costly than false positives.
Main goal: Find as many actual positives as possible.
A confusion matrix shows true positives, false positives, true negatives, and false negatives. Precision uses only true positives and false positives.
Precision does not directly use True Negatives or False Negatives.
Formula: Precision = TP / (TP + FP)
This example shows how precision is calculated from a confusion matrix.
75% of the people predicted to have the disease actually had it.
Perfect precision means every positive prediction is correct. However, it does not always mean the model is perfect — it may still miss many actual positives.
The model made no false positive errors, but may have missed many actual positives.
Precision alone does not tell the full story.
A model predicts only 1 email as spam. That email is truly spam.
Precision: 100%
Problem: If there were 999 other spam emails the model missed, the model is not useful.
This is why precision should often be considered with recall.
F1 score combines precision and recall into one balanced metric. It is useful when both false positives and false negatives matter.
Precision is often useful in imbalanced datasets because it tells us whether positive predictions are trustworthy.
Most transactions are normal. Accuracy may be high without finding fraud.
Precision helps answer: When the model flags fraud, how often is it correct?
Improving precision usually means reducing false positives.
Many classification models output probabilities. A threshold decides when the model predicts positive.
A higher threshold makes the model predict positive only when it is more confident, reducing false positives.
Raising the threshold can improve precision, but it may reduce recall.
The best threshold depends on the application.
A spam filter should have high precision because users do not want important emails incorrectly placed in spam.
A model may predict which candidates should move forward. Precision measures how many recommended candidates are actually strong matches.
Recall and fairness should also be checked.
A recommendation system suggests products to users. Precision measures how many recommended products are actually relevant.
Most recommendations are useful.
A spam detection model marks 80 emails as spam. Out of those 80 emails, 60 are actually spam and 20 are normal emails.
Calculate the precision. Then explain what the precision score means and why false positives matter in this example.
Ask the AI if you need help understanding precision, predicted positives, true positives, false positives, confusion matrices, thresholds, or the difference between precision and recall.