Precision
When a classifier predicts “positive,” you usually want that prediction to be trustworthy. Precision captures exactly that: how clean your model’s positive predictions are, without getting distracted by how many positives it missed.
What precision measures
Precision is the fraction of predicted positives that are truly positive. Using the confusion matrix terms, it is:
precision = TP / (TP + FP)
Here, TP (true positives) are correct “positive” predictions, and FP (false positives) are incorrect “positive” predictions. Intuitively, precision answers: “When the model raises an alarm, how often is it right?” A high-precision model produces few false alarms.
Why it matters in real problems
Precision becomes critical when false positives are costly or disruptive. Examples:
- Spam detection: low precision means important emails get flagged as spam.
- Fraud detection: low precision wastes investigator time chasing legitimate transactions.
- Disease diagnosis: low precision can trigger unnecessary follow-up tests and anxiety.
In these settings, you might accept missing some true cases (lower recall) to keep alerts reliable.
How it’s used in practice
Precision depends on the decision threshold (e.g., predicting positive when probability ≥ 0.5). Raising the threshold typically increases precision by reducing FP, but can reduce TP too. In scikit-learn, you’ll see it via sklearn.metrics.precision_score and precision-recall curves, especially with imbalanced classes where accuracy can look good even while precision is poor.
Precision is a classification metric defined as the proportion of predicted positives that are truly positive: TP / (TP + FP). It measures how reliable positive predictions are, penalizing false positives. Precision matters when the cost of false alarms is high (e.g., flagging legitimate transactions as fraud), and it is commonly paired with recall or summarized via the F1-score.
Think of a spam filter. When it flags an email as spam, you want it to be right most of the time. Precision measures exactly that: out of everything the model said was “positive” (like “this is spam” or “this is fraud”), how many were truly positive.
So a model with high precision doesn’t cry wolf very often. That matters in situations where false alarms are costly or annoying—like blocking important emails, freezing a customer’s credit card, or wrongly telling someone they have a disease. Precision doesn’t tell you whether the model caught all the real spam; it tells you how trustworthy its positive alerts are.