Precision-Recall AUC

Machine Learning
Introduced by
Davis and Goadrich
Year
2006
Type
Evaluation metric
Family
Classification Metric

What does it do?

PR AUC is the area under the precision-recall (PR) curve, which plots precision on the y-axis against recall on the x-axis across classification thresholds.

It is most often used to evaluate binary classifiers on imbalanced datasets, where the positive class is rare and is the main object of interest. Saito and Rehmsmeier argue that PR plots can be more informative than ROC plots in this setting.

The intuition behind the method

A classifier that outputs scores assigns a positive or negative label once a threshold is chosen. Lowering the threshold predicts more cases as positive, which generally raises recall and lowers precision; raising it does the reverse. Plotting precision against recall across all thresholds gives the PR curve, and PR AUC summarises that curve as one number. On imbalanced data, precision is computed only over predicted positives, so a large number of true negatives does not dilute it. ROC plots use the false positive rate, which is based on the negatives. Saito and Rehmsmeier argue that the visual reading of ROC plots can be misleading on imbalanced data because of an intuitive but incorrect interpretation of specificity.

History

Davis and Goadrich (2006) analysed the relationship between precision-recall and ROC curves. They showed that a curve dominates in ROC space if and only if it dominates in PR space, and that PR curves give a more informative picture on highly skewed datasets. Saito and Rehmsmeier (2015) later argued, in the context of imbalanced bioinformatics classifiers, that PR plots are more informative than ROC plots.

When to use it

Choose PR AUC for binary classification when the positive class is rare or is the main object of interest, and when you need to inspect the precision-recall trade-off across thresholds. Typical settings include fraud detection, rare-disease diagnosis and retrieval tasks where relevant items are few. The method requires a model that produces continuous scores rather than only hard labels. Do not rely on PR AUC alone to compare models across datasets with different class prevalence, because its random baseline moves with prevalence. If the classes are roughly balanced and both classes matter equally, ROC AUC may be a simpler choice. PR AUC is defined for binary classification. For multiclass or multi-label tasks it is usually computed one class against the rest, and the per-class values or their averages are reported with the averaging scheme stated.

Limitations and considerations

  • The random-classifier baseline equals the positive prevalence, so PR AUC values from datasets with different class imbalance are not directly comparable.
  • Requires continuous scores or probabilities; hard class labels produce only a single point on the curve rather than a curve.
  • The computed area depends on how the curve is joined between points. Davis and Goadrich state that linear interpolation between PR points is incorrect, so the choice of integration method affects the result.
  • Less familiar to many readers than ROC AUC, so the number is easy to misread without the accompanying curve.

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • Focuses on the positive class: precision is computed only over predicted positives, so abundant true negatives do not inflate it, as Saito and Rehmsmeier discuss.
  • Shows the precision-recall trade-off across all thresholds, so an operating point can be selected against a stated precision or recall requirement.
  • Davis and Goadrich's analysis supports PR space as the more informative view when datasets are highly skewed.
  • Works from ranking scores, so it does not require a single pre-chosen decision threshold.

Applications

  • Fraud detection, where fraudulent transactions are rare and missing them is costly.
  • Rare-disease diagnosis, where the disease class is small and its detection is the purpose of the classifier.
  • Information retrieval, where relevant documents are few within a large collection.
  • Anomaly detection, where normal samples vastly outnumber anomalies.

How it works

How it works

1

For each test sample, obtain a predicted probability or confidence score for the positive class, together with its true label. Continuous scores are needed because the threshold will be varied across them.

2

Sweep the classification threshold across the observed score values. At each threshold, compute precision (true positives divided by predicted positives) and recall (true positives divided by all actual positives), and record the resulting point. The area under the curve traced by these points is PR AUC. Davis and Goadrich note that linear interpolation between points is incorrect in PR space, so the area should not be obtained by simply joining points with straight segments. Software packages do not all apply the same integration rule to the curve, so the estimator used should be stated whenever PR AUC values are reported.

3

PR AUC ranges from 0 to 1, and higher values indicate better performance. A random classifier has a PR AUC equal to the proportion of positive samples (the prevalence), so the same value means different things on datasets with different prevalence. For example, with 5% positive samples the random baseline is 0.05, so a PR AUC near 0.05 indicates performance no better than chance. Reporting the prevalence alongside the value lets readers judge the result against its baseline. A perfect classifier reaches 1.0. The curve itself should be inspected alongside the number, because a high area can conceal poor precision within a specific recall range.

Common pitfalls

  • Comparing PR AUC values across datasets with different class prevalence without accounting for the changed random baseline.
  • Reporting the area without examining the curve; a high PR AUC can mask poor precision in a particular recall range.
  • Assuming PR AUC always supersedes ROC AUC. Davis and Goadrich note that algorithms optimising the area under the ROC curve are not guaranteed to optimise the area under the PR curve, so the metric should follow the task.

Frequently asked questions

When should I use PR AUC instead of ROC AUC?

Use PR AUC when the positive class is rare and its performance is the main concern. Saito and Rehmsmeier argue that ROC plots on imbalanced datasets can be visually misleading because of an intuitive but incorrect reading of specificity, whereas PR plots evaluate the fraction of true positives among positive predictions and so give a more accurate picture of positive-class performance.

What is the baseline PR AUC for a random classifier?

For a random classifier, PR AUC equals the proportion of positive samples (prevalence). For example, if 5% of samples are positive, a random classifier's expected PR AUC is 0.05. This varies with class imbalance, making PR AUC values less comparable across datasets with different prevalences than ROC AUC.

How do I choose a threshold from the PR curve?

Examine the precision-recall curve and choose the point that matches your requirements. Because recall is on the x-axis, an operating point with high recall lies toward the right of the curve, and one with high precision usually lies toward the left, at lower recall. Which region you need depends on the relative cost of false positives and false negatives.

Related methods

Sources

  1. Davis, J., & Goadrich, M. (2006). The relationship between precision-recall and ROC curves. Proceedings of the 23rd International Conference on Machine Learning, 233-240.

    Open DOI reference
  2. Saito, T., & Rehmsmeier, M. (2015). The precision-recall plot is more informative than the ROC plot when evaluating binary classifiers on imbalanced datasets. PLoS ONE, 10(3), e0118432.

    Open DOI reference