How to Interpret a Precision-Recall Curve

A precision-recall curve is a picture of the trade-off every yes/no model faces: catching more real cases means raising more false alarms.1scikit-learn. Precision-Recall Reading it well means asking how high the curve stays as it moves to the right, not staring at a single number. It’s the plot many people reach for when the thing being hunted is rare, such as fraud or disease, where plain accuracy misleads.2DataCamp. How to Interpret a Precision-Recall Curve

What Each Axis and Point on the Curve Means

Precision is the share of cases the model flags as positive that really are positive. Few false alarms means high precision.1scikit-learn. Precision-Recall Recall is the share of all real positives the model manages to flag, so few missed cases means high recall.1scikit-learn. Precision-Recall The usual layout puts recall on the horizontal axis and precision on the vertical axis.3PubMed Central. Evaluating Prediction Model Performance

Take a fraud model that flags 100 transactions. If 80 of them are truly fraud, precision is 80 percent. If there were 160 frauds in total, the model caught 80 of 160, so recall is 50 percent. That pair is one dot on the curve, at recall 0.5 and precision 0.8.

Each dot comes from a cutoff. Most models give every example a score, and anything above a chosen cutoff, or threshold, is called positive.4PubMed Central / Springer. Area Under the Precision-Recall Curve: Point Estimates and Confidence Intervals Sliding that cutoff from high to low traces out the whole curve, one point per setting.5GeeksforGeeks. Precision-Recall Curve – ML Lowering the cutoff flags more cases, which raises recall but usually adds false alarms that pull precision down.6Openlayer. Precision and Recall in Machine Learning In the fraud example, a lower cutoff might flag 300 transactions and catch 140 frauds, moving the dot right and down. Raising the cutoff keeps only confident cases, which lifts precision while missing borderline positives.6Openlayer. Precision and Recall in Machine Learning So moving left to right along the curve means moving from a strict cutoff to a lenient one.

At the strictest cutoff, only the few highest-scoring cases are flagged, so recall is near zero and the curve begins at the far left. Precision there depends on whether those top-scored cases are truly positive. At the most lenient cutoff, every case is flagged, so recall reaches 1.0 and precision falls to the share of positives in the data. A curve that finishes at 0.02 isn’t broken; it reflects a dataset where about 2 percent of cases are positive.

The curve often zigzags instead of falling smoothly. Precision jumps up when the next flagged case happens to be a true positive, and drops when it’s a false alarm. Recall never goes down as the cutoff is lowered; it stays or rises. Small test sets make the jagged steps more visible, and a sawtooth shape is normal.

The plot usually doesn’t label the cutoff behind each dot, but most plotting tools return the cutoff values alongside precision and recall. So find the dot whose precision and recall you could live with, then look up the cutoff behind it.

What a Good Curve Looks Like and What to Compare It Against

A curve that stays near the top while stretching far to the right means the model catches most positives with few false alarms.1scikit-learn. Precision-Recall The more area under the curve, the better the model does on both measures at once.1scikit-learn. Precision-Recall A curve that drops steeply at the left shows the model’s most confident picks are already unreliable. A good model should have precision near 1.0 there, because its top picks should be almost all right. If the curve starts low or dips sharply, a handful of confidently wrong cases sit at the top of the ranking, which is worth investigating one by one. With so few flagged cases at the far left, though, one false positive can move precision a lot, so a small early dip may be noise.

A model that guesses at random has precision equal to the share of positives in the data, so its curve is a flat line at that height. With 1 percent fraud, a random model scores about 0.01, so an area of 0.3 can be strong. Draw that horizontal line on your own plot before judging anything, then ask how far above it the curve sits across the recall range you care about, not just at one spot. A curve that hugs the line over most of its length offers little beyond guessing, even if its area looks respectable.

People used to ROC scores often expect areas like 0.9, but on rare-event data honest precision-recall areas are often far lower. A low-looking number may still be many times better than random, so state the baseline whenever you report the score. The area changes sharply as the positive class gets rarer, even for a model of the same skill.7PubMed Central. The receiver operating characteristic curve accurately assesses imbalanced datasets Compare curves only on datasets with the same share of positives.

When two curves overlap, check whether one sits above the other everywhere. If so, that model is better at every cutoff. If they cross, each model wins in a different region, so pick the one that is higher in the recall range you actually need. A higher total area can hide worse performance in exactly that region.

Area Under the Curve Versus Average Precision

Average precision, or AP, adds up precision at each point where a new positive is found, weighted by how much recall rose.8Jérémie. AUPRC vs AP: Evaluating Binary Classification Picture walking down the ranked list from highest score to lowest. Each time you hit a real positive, you note the precision at that moment, and the average of those notes is AP. A model that finds its positives early, while precision is still high, scores better than one that finds them late.

AUPRC, the area under the precision-recall curve, measures the full area beneath the plotted curve.3PubMed Central. Evaluating Prediction Model Performance With densely sampled curves, the two give very similar values.8Jérémie. AUPRC vs AP: Evaluating Binary Classification

In scikit-learn, average_precision_score gives AP directly from labels and scores, while auc(recall, precision) gives the trapezoid area from the plotted points. Seeing two slightly different numbers for one model is expected, so say which one you report.

The disagreement comes from the trapezoid method, which joins points with straight lines and can give an overly optimistic score.9Medium. How to Interpret a Precision-Recall Curve Precision doesn’t actually fall along a straight line between two cutoffs.10Advances in Neural Information Processing Systems. Precision-Recall-Gain Curves: PR Analysis Done Right Adding cases moves it in steps, and a straight line assumes a gentle slope that never happened. With only a few points, such as a small test set or a model with few distinct scores, the lines cut across larger gaps and the inflated area is bigger. With many closely spaced points, the gaps shrink and the two numbers move closer. The gap is most likely on highly skewed data, exactly where these curves are used most.9Medium. How to Interpret a Precision-Recall Curve On imbalanced data, report AP rather than the trapezoid area.

Using the Curve to Pick a Threshold

The F1 score combines precision and recall into one number that reflects both how many errors and what kind.3PubMed Central. Evaluating Prediction Model Performance The point with the highest F1 is a common default cutoff when false alarms and misses matter equally.

It’s a default, not an answer. Few real situations treat the two errors as equal, so use it as a starting point and adjust. F1 is also a single point: two cutoffs on either side can have almost the same F1 while one has much higher recall and the other much higher precision, so look at the neighbours before settling.

Real choices also depend on costs and on capacity, such as how many alerts a team can review.11arXiv. On the Geometry of Receiver Operating Characteristic and Precision-Recall Curves In medical screening, where a miss is costly, choose a point further right with high recall. When each alert costs staff time, choose a point further left with high precision. A model that flags everything sets a floor for F1, so a chosen point should beat that clearly.12Advances in Neural Information Processing Systems. Precision-Recall-Gain Curves: PR Analysis Done Right

A practical way to choose: write down the minimum recall or precision your use case can accept, find the points on the curve that meet it, and among those pick the one best on the other measure. If a team can review only 50 alerts a day, the limit sets the cutoff instead: choose the one that yields about 50 flagged cases on a typical day, then read the curve there to see how many alerts will be real and how many real cases will be missed. If that precision is too low to justify the review time, the answer is a better model or more reviewers, not a cleverer cutoff.

The chosen point on the plot must be translated back into a score cutoff that the model applies to each new case. If the model is later retrained or recalibrated, its scores may shift, and the old cutoff may no longer produce the same point. The curve was drawn from one test set, so recheck precision and recall on new data before relying on the cutoff.

Precision-Recall Curve or ROC Curve

An ROC curve plots the share of real positives caught against the share of negatives wrongly flagged. Its shape and area stay the same whether positives are common or rare.7PubMed Central. The receiver operating characteristic curve accurately assesses imbalanced datasets That can hide a lot. In one example, the same ROC point meant 160 false alarms for 500 hits on balanced data and 1,600 on imbalanced data.13PubMed Central. The Precision-Recall Plot Is More Informative than the ROC Plot When Evaluating Binary Classifiers on Imbalanced Datasets On the precision-recall curve, that point showed 75 percent correct flags in the balanced case and only 25 percent in the imbalanced one.13PubMed Central. The Precision-Recall Plot Is More Informative than the ROC Plot When Evaluating Binary Classifiers on Imbalanced Datasets So this curve shows the real cost of false alarms when positives are rare.13PubMed Central. The Precision-Recall Plot Is More Informative than the ROC Plot When Evaluating Binary Classifiers on Imbalanced Datasets

The reason is that the ROC curve measures false alarms as a share of all negatives. When negatives vastly outnumber positives, even a small share of them is a large absolute number, so a model can show a false-alarm rate of a few percent and still bury its flags in wrong cases. The precision-recall curve counts false alarms against the model’s own flags, so the burden shows up directly.

For skewed tasks like credit card fraud, where both precision and recall matter, this curve is the more useful view.14International Conference on Applied Innovations in IT. The Difference Between Precision-recall and ROC Curves for Evaluating the Performance of Credit Card Fraud Detection Models Because the ROC area doesn’t shift with rarity, though, it is better for comparing a model across datasets with different positive shares.7PubMed Central. The receiver operating characteristic curve accurately assesses imbalanced datasets

How Much to Trust a Curve From a Small Test Set

Small test sets give noticeably uncertain precision and recall points.15Journal of Machine Learning Research. Pointwise sampling uncertainties on the Precision-Recall curve The uncertainty is largest at the low-recall end, where few positives have been found.15Journal of Machine Learning Research. Pointwise sampling uncertainties on the Precision-Recall curve There, precision comes from only a few flagged cases, so one extra false positive changes it dramatically. A curve that begins at 1.0 and dips right away may reflect a few cases rather than a real weakness. Further right, each point includes more cases and steadies.

What limits reliability is mainly the number of positives, not the total size. A set of 100,000 cases with only 30 positives still gives a shaky curve, because each positive found moves recall by a visible, chance-driven step. Count the positives before trusting the curve.

Some common ways of computing intervals around the area are invalid, though simple robust ones exist.16Springer Link. Area Under the Precision-Recall Curve: Point Estimates and Confidence Intervals Plot uncertainty bands around the curve or report a confidence interval for the area. Bootstrapping is a common way: resample the test set with replacement many times, recompute the curve each time, and see how much the results vary. The spread of the curves gives a band, and the spread of their areas gives an interval. Resample whole cases, not points on the curve, so each resample is a realistic alternative test set.

This matters most when comparing models. Two curves a little apart may not truly differ on a small test set, and overlapping bands mean the gap could be chance. Collecting more labelled positives narrows the bands most.