← AI Terminology
Precision
Precision is a classification evaluation metric that measures the fraction of positive predictions that are actually correct — answering "of all the cases the model predicted as positive, how many truly were positive?"
It is one half of the precision-recall tradeoff, paired with recall.
It is one half of the precision-recall tradeoff, paired with recall.
Why It Matters in AI
Precision matters when false positives are costly: a spam filter that flags legitimate emails as spam has low precision — damaging user experience; a cancer screening tool that calls benign tumours malignant has low precision — causing unnecessary biopsies. High precision models are conservative: they only predict positive when confident. The tradeoff is that high precision often means lower recall (missing real positives). Choosing the operating point on the precision-recall curve requires understanding the cost asymmetry in the application.
Key Points
| Aspect | Description |
|---|---|
| Range | [0, 1] — 1.0 = no false positives; 0 = all positive predictions were wrong |
| Formula | Precision = TP / (TP + FP) — true positives divided by all predicted positives |
| F1 score | Harmonic mean of precision and recall — single metric balancing both |
| vs Recall | Recall = TP / (TP + FN) — precision: of predictions; recall: of actual positives |
| Micro vs macro | Micro: compute globally over all classes; Macro: average per-class precision — different for imbalanced datasets |
| Precision-Recall curve | Plot precision vs recall at different classification thresholds — AUPRC summarises it |
Simple Analogy
A prosecutor's conviction rate: of every person charged (predicted positive), what fraction was actually guilty (true positive)? A prosecutor who only takes airtight cases has high precision — few wrongful convictions — but may let many criminals go (low recall). Precision is about not crying wolf.
Common Usage Examples
sklearn.metrics.precision_score(y_true, y_pred, average='binary')— binary precisionprecision, recall, f1, _ = sklearn.metrics.precision_recall_fscore_support(y_true, y_pred)sklearn.metrics.classification_report(y_true, y_pred)— per-class precision, recall, F1- Fraud detection: precision 0.95 = 95% of flagged transactions are actually fraudulent
sklearn.metrics.precision_recall_curve(y_true, y_scores)— plot at all thresholds
Summary
In short: Precision measures the fraction of positive predictions that are actually correct — the metric to optimise when false positives are costly, always evaluated alongside recall to understand the full tradeoff.