A precision-recall curve, or PR curve, is a plot of a binary classifier’s precision on the vertical axis against its recall on the horizontal axis as the decision threshold sweeps from the strictest to the most permissive setting. In model evaluation it is the preferred diagnostic when the positive class is rare, because it focuses entirely on how well a model finds and correctly labels the cases that matter.
Each point on the curve corresponds to one threshold applied to the model’s scores. The curve therefore summarizes every possible operating point in one picture and lets practitioners choose the threshold that matches the real cost of false alarms versus missed cases.
How a precision-recall curve is constructed
A precision-recall curve is built by ranking predictions by score and computing precision and recall at each candidate threshold. Precision is TP / (TP + FP), the share of predicted positives that are correct. Recall is TP / (TP + FN), the share of actual positives that the model finds.
- Score every example in the evaluation dataset with the model’s probability or confidence output.
- Sort examples by descending score.
- Treat each distinct score as a threshold and count true positives, false positives and false negatives above it.
- Plot the resulting recall and precision pairs and connect them in order of decreasing threshold.
Lowering the threshold can only raise or hold recall, but precision may rise or fall, so the raw curve is not monotonic and often looks jagged near low recall. Many tools report an interpolated curve, where precision at each recall is replaced by the maximum precision at any higher recall.
The table below shows how individual points on the curve relate to threshold choices.
| Region | Threshold | Typical behavior |
|---|---|---|
| Left edge | Very high | Few predictions, precision often high but unstable |
| Upper-right corner | Ideal balance | High precision and high recall together |
| Right edge | Very low | Recall near 1, precision falls toward prevalence |
| Knee of the curve | Moderate | Point where precision starts to drop sharply |
Summary metrics derived from the curve
The curve is often condensed into a single number so that models can be ranked, though each summary hides part of the trade-off. Average precision (AP) is the most common: it is the weighted mean of precision at each threshold, with the recall increase as the weight, and it approximates the area under the PR curve (AUPRC).
| Metric | Definition | When it is useful |
|---|---|---|
| Average precision | Step-wise sum of precision × recall change | Ranking models on rare-event tasks |
| AUPRC (trapezoidal) | Area via linear interpolation | Rarely preferred; can be optimistic |
| Best F1 score | Maximum harmonic mean on the curve | Choosing a balanced threshold |
| Precision at fixed recall | Precision where recall reaches a target | Safety or screening requirements |
| Mean average precision | Average of AP over classes or queries | Object detection and retrieval |
An important caution is that linear interpolation between PR points is invalid because precision does not change linearly with recall. Trapezoidal areas can therefore overstate performance, which is why most libraries compute AP with a step function instead.
Precision-recall curve versus ROC curve
The PR curve and the ROC curve are built from the same predictions but answer different questions. The ROC curve plots the true positive rate against the false positive rate, which divides false positives by the large number of negatives, so it changes little when negatives are abundant.
The PR curve uses precision instead, which compares false positives with true positives. When positives make up 1% or less of the data, a model can show an ROC AUC above 0.95 while its precision stays low, and only the PR curve exposes that gap.
| Aspect | Precision-recall curve | ROC curve |
|---|---|---|
| Axes | Precision vs recall | True positive rate vs false positive rate |
| Random baseline | Horizontal line at class prevalence | Diagonal line, AUC 0.5 |
| Sensitivity to imbalance | High; reflects rare positives | Low; dominated by negatives |
| Uses true negatives | No | Yes |
| Best fit | Fraud, retrieval, medical screening | Balanced classes, ranking quality |
A one-to-one mapping exists between the two curves for a given dataset, and a model that dominates in ROC space also dominates in PR space. The curves differ in emphasis, not in the underlying ranking information.
Reading the curve to choose a threshold
Choosing an operating point means translating error costs into a position on the curve. A model never ships as a curve; it ships with one threshold, and the curve shows what each choice will cost.
| Application | Priority | Typical operating point |
|---|---|---|
| Cancer screening | Missed cases are costly | Recall of 0.95 or higher |
| Spam filtering | False alarms annoy users | Precision of 0.99 or higher |
| Fraud review queue | Analyst capacity is limited | Precision matching queue size |
| Content moderation triage | Balance of both errors | Near the maximum F1 point |
The threshold should be chosen on a validation set and confirmed on a separate test set. Picking it on test data inflates the reported precision and recall through selection bias.
Limitations and common misreadings
The PR curve is powerful but easy to misread, and several pitfalls recur in practice.
- Prevalence dependence: AP values cannot be compared across datasets with different positive rates, because the random baseline equals the prevalence.
- Noisy low-recall region: with few predictions, a single error moves precision dramatically, so the left edge should not drive conclusions.
- Small test sets: with only dozens of positives, AP has wide confidence intervals; bootstrapping helps quantify that uncertainty.
- Calibration is invisible: the curve depends only on ranking, so a well-ranked model can still output poorly calibrated probabilities.
- Distribution shift: a threshold tuned on historical data may land at a very different point if the positive rate changes in production.
For multiclass problems, curves are drawn one-versus-rest per class and averaged as macro or micro AP. Reporting the per-class curves alongside the average is good practice, because averages can hide a class with poor performance.
Put simply
Think of a metal detector on a beach. Set it to beep only at strong signals and nearly every beep is real treasure, but much treasure is missed. Set it to beep at everything and almost no treasure is missed, but most beeps are bottle caps. The precision-recall curve draws every possible setting of that sensitivity dial in one picture.
Precision answers how many beeps were worth digging for. Recall answers how much of the buried treasure was found. The best model is the one whose curve stays high toward the right, finding most treasure without many false beeps.
In practice
A data science team at a payment processor builds a model to flag fraudulent card transactions, which make up about 0.2% of all transactions. The model scores an ROC AUC of 0.97, which looks excellent, but the team plots the precision-recall curve on a held-out month of data and finds an average precision of 0.41.
The fraud operations unit can review about 2,000 alerts per day out of roughly one million transactions. Reading the curve, the team picks the threshold where precision reaches 0.60 at a recall of 0.55, which produces a daily alert volume close to that capacity. After retraining with additional merchant features, the curve shifts upward, and at the same alert volume recall rises to 0.68, catching substantially more fraud with no extra analyst workload.