What is Precision and Recall?

Precision and Recall are complementary classification metrics: Precision is the share of predicted positives that are truly positive, while Recall is the share of actual positives that the classifier detects.

Quick Facts

SpecificationOfficial Specification

How It Works

Treat zero denominators as missing evidence

Precision is undefined when the model predicts no positive examples, and Recall is undefined when the evaluated sample contains no actual positives. Returning zero or one can be a deliberate aggregation policy, but it must not be mistaken for observed performance. The current scikit-learn API therefore exposes an explicit zero_division policy and per-class support.

Select thresholds from costs and capacity

Lowering a score threshold usually predicts more positives, raising Recall while admitting more false positives and often lowering Precision. Raising it usually does the reverse. Inspect the complete Precision-Recall curve, then choose an operating point from missed-case cost, false-alarm cost, review capacity, latency, and required coverage. Do not tune the threshold on the final test set.

Keep prevalence and aggregation visible

Precision is population-dependent: the same conditional error rates can yield very different Precision when positive prevalence changes. For multiclass or multilabel tasks, report per-class values and declare whether Micro, Macro, Weighted, or Samples averaging is used. Davis and Goadrich show that ROC and PR curves are related but use different geometry, and that linear interpolation in PR space is generally incorrect.

Key Characteristics

  • Precision conditions on predicted positives and penalizes false positives
  • Recall conditions on actual positives and penalizes false negatives
  • Both change with the positive-class definition and decision threshold
  • Precision changes with class prevalence even when conditional rates stay fixed
  • Undefined denominators require an explicit reporting policy
  • Multiclass results depend on the declared class set and averaging method

Common Use Cases

  1. Controlling false accusations in content or fraud alerts with Precision
  2. Reducing missed safety, disease, or incident cases with Recall
  3. Selecting a classifier threshold under a fixed review budget
  4. Comparing per-class failures in imbalanced multiclass models
  5. Monitoring model behavior after prevalence or policy changes

Example

loading...
Loading code...

Frequently Asked Questions

What is the difference between Precision and Recall?

Precision asks how many predicted positives are correct, using `TP+FP` as the denominator. Recall asks how many actual positives were found, using `TP+FN`. The first exposes false-alarm burden; the second exposes missed-case burden.

When should Precision be prioritized over Recall?

Prioritize Precision when acting on a positive prediction is costly or harmful, such as accusing a user, blocking a legitimate transaction, or sending an analyst an alert. Still enforce a minimum Recall so the model cannot appear precise by flagging almost nothing.

When should Recall be prioritized over Precision?

Prioritize Recall when missing a positive is the larger harm, such as an initial safety screen or incident detector. Also constrain false positives and workload; perfect Recall achieved by predicting everything positive is rarely an acceptable operating policy.

Why can Precision change after deployment even if Recall is stable?

Precision depends on the prevalence of positives in the served population. A rarer event creates more opportunities for false positives among all positive alerts, so the positive predictive value can fall even when conditional sensitivity and specificity remain stable.

How should Precision and Recall be averaged across classes?

Start with per-class values and support. Macro averaging gives each class equal weight, Micro aggregates counts before computing the metric, Weighted uses true-class support, and Samples applies to multilabel examples. The choice is part of the metric definition and must be published.

Related Terms

Related Articles