Skip to content
AI360XpertBeta
Core ML

Visual explainer

Precision-Recall Curve

Trace six scored cases through changing cutoffs, count precision and recall, and distinguish average precision from the operating policy you choose.

Precision asks how many alerts are correct; recall asks how many actual positives are caught. A precision-recall curve evaluates both quantities across cutoffs, exposing workload and misses that accuracy can conceal. A curve describes observed scores and labels, not guaranteed future service quality.

Predicting no for ten cases misses the only positive.
Predicting no for ten cases misses the only positive.

Start with a separate ten-case example: one actual positive P, shown as a circle, and nine actual negatives N, shown as squares. Predicting negative for everyone makes nine correct decisions, so accuracy is 9/10=.9. The doubled circle is the sole positive, missed: recall is 0/1=0.

With no alerts, precision is undefined because its denominator is zero. A plotting convention may place a PR endpoint at precision one and recall zero; it does not mean a zero-alert model made a correct alert. The official PR API distinguishes that endpoint from threshold observations.

Two Different Denominators

Precision counts three positives among four alerts while recall catches all three positives.
Precision counts three positives among four alerts while recall catches all three positives.

Now switch to the main six-case fixture, in descending score order: .9P, .8N, .7P, .6P, .4N, .2N. This is an illustrative sample, also used in ROC and AUC. Scores indicate evidence for P; they need not be calibrated probabilities or lie between zero and one in general. Predict positive when score is at least cutoff t.

At t=.6, the four alerts contain three circles and one square. True positives TP=3, false positives FP=1, false negatives FN=0 and true negatives TN=2. Precision=TP/(TP+FP)=3/4=.75. Recall=TP/(TP+FN)=3/3=1. The lower row shows the actual-positive denominator rather than the alert denominator. True negatives enter neither formula.

A Curve Can Rise

The PR path can rise as the cutoff falls.
The PR path can rise as the cutoff falls.

Both axes span zero to one. Lowering the cutoff through .9,.8,.7,.6,.4,.2 yields (recall,precision)=(1/3,1), (1/3,1/2), (2/3,2/3), (1,3/4), (1,3/5), (1,1/2). The dots are these six observed operating points; straight connecting segments guide the eye and are not additional deterministic thresholds. The dashed top segment comes from the zero-recall plotting convention.

Admitting the first negative reduces precision without changing recall. Admitting the next two positives raises both. Thus recall cannot decrease as the cutoff falls, but precision need not decrease monotonically. Smooth curves invented between these few observations would conceal that behavior. Tied scores must be admitted together under the stated >= rule.

Two Views Of One Threshold

The same four alerts define one ROC point and one PR point.
The same four alerts define one ROC point and one PR point.

The two plots have identical zero-to-one scales. At t=.6, the ROC point is (FPR,TPR)=(1/3,1); the PR point is (recall,precision)=(1,.75). Dashed guides project each point to its axes. They describe exactly the same three true alerts and one false alert.

ROC normalizes false alerts by all actual negatives; precision normalizes true alerts by all alerts. These are different questions, not a truthful-versus-deceptive contest. Rare positives can make a modest FPR produce many false alerts; PR helps quantify their proportion among alerts. One threshold point determines neither AUROC nor PR area.

Respect The Review Budget

Four alerts catch more positives than two alerts in this ranking.
Four alerts catch more positives than two alerts in this ranking.

Each row repeats the same six cases from highest score on the left to lowest on the right. With a two-alert budget, the selected prefix P,N catches one of three positives: precision=1/2,recall=1/3. A four-alert budget permits P,N,P,P: precision=3/4,recall=1. The two newly caught positives are outlined in mint.

This example improves both rates while doubling review volume; that does not hold for every ranking. A capacity constraint and a precision target describe different policies. Record the selected threshold, observed counts and population, then evaluate the policy on data that did not choose it. A historical precision of .75 is not a guarantee for a new queue.

Price The Errors

Changing error costs changes which cutoff is cheaper.
Changing error costs changes which cutoff is cheaper.

At t=.9 there are two misses and zero false alerts. At t=.6 there are zero misses and one false alert. Each bar's height is total empirical cost, using the same scale of 25 drawing units per cost unit; the smaller bar in each pair is highlighted.

The left profile assigns three cost units per miss and one per false alert. Costs are 23+01=6 at .9 and 03+11=1 at .6. The right profile reverses the weights: costs are 2 and 3, favoring the stricter cutoff among these two candidates. These are chosen abstract costs, not financial or medical estimates. A global optimum would require comparing every feasible policy and checking whether these costs and observed rates transfer.

What True Negatives Change

Adding unalerted negatives leaves this PR point unchanged.
Adding unalerted negatives leaves this PR point unchanged.

Return to cutoff .7, where TP=2,FP=1,FN=1,TN=2. Add 27 new negatives whose scores fall below .7, changing TN to 29. The bars show all actual negatives on a common count scale: the narrow FP segment stays one case while the unalerted tail grows. The positive cases and alert counts stay fixed.

Precision remains 2/3 and recall remains 2/3, but FPR changes from 1/3 to 1/30. This illustrates a fixed PR point, not identical entire PR curves: lower thresholds that admit the new negatives can change other points. On the same positive pool, two models with the same recall and precision at a nonzero-recall point cannot have tenfold different FP counts. PR sees false alerts directly through its precision denominator.

Calculate Average Precision

Average precision weights each positive's precision by its recall gain.
Average precision weights each positive's precision by its recall gain.

The main sample has three positives, so each newly caught positive increases recall by 1/3. Precision at those three admission thresholds is 1,2/3,3/4. The three blocks have equal recall widths and those precision heights. Average precision (AP) sums their areas:

AP=13⋅1+13⋅23+13⋅34=2936≈.806.\mathrm{AP}=\frac13\cdot1+\frac13\cdot\frac23+\frac13\cdot\frac34=\frac{29}{36}\approx.806.

AP is a recall-weighted mean of precision, following the official AP definition. It differs from linear trapezoidal integration of the connected PR points. For this fixture, that trapezoidal area is 1/3+(1/3)(1/2+2/3)/2+(1/3)(2/3+3/4)/2=55/72, approximately .764. State which summary convention is used rather than calling both numbers interchangeable PR AUC.

Read The Prevalence Baseline

Alerting every case sets precision to the positive prevalence.
Alerting every case sets precision to the positive prevalence.

These separate all-alert populations contain three positives and either three or nine negatives. Equal positive segments show the unchanged count of positives; total bar length grows from six to twelve cases. With everyone alerted, recall is one in both populations, while precision is 3/6=.5 and 3/12=.25.

The all-positive PR endpoint therefore equals class prevalence. The same prevalence is the population reference precision for selection independent of the label at nonzero selection rates. Finite random rankings fluctuate, and their expected finite-sample AP need not equal prevalence exactly. Changing prevalence changes the context for interpreting PR; compare evaluations with their sampling scheme made explicit.

Where It Breaks

A cutoff validated on one sample can miss positives after score distributions change.
A cutoff validated on one sample can miss positives after score distributions change.

The old row repeats the main scores; circles are P and squares N on a shared zero-to-one score scale. The new illustrative population has the same three positives and three negatives, but its scores are .9N,.8N,.7N,.6P,.4P,.2P. The t=.6 divider stays fixed, and equality is included. Crossed amber circles are positives now missed on the left.

Old counts TP=3,FP=1,FN=0 gave precision .75 and recall one. New counts TP=1,FP=3,FN=2 give precision .25 and recall 1/3. A chosen cutoff can fail when class-conditional score distributions change, even at unchanged prevalence. A held-out PR curve supplies evidence about its sampled population; evaluate fresh labeled data and workload before treating a past operating point as a continuing contract. This counterexample demonstrates the limit, not a measured forecast of any deployed model.

The Quick Version

  • Always-negative accuracy can conceal zero recall.
  • Precision counts alerts; recall counts actual positives.
  • Precision can rise as more positives cross the cutoff.
  • ROC and PR describe different denominators for the same decisions.
  • Capacity changes the number of cases a policy can review.
  • Error costs can favor different operating thresholds.
  • Adding unalerted negatives preserves a PR point but changes FPR.
  • Average precision weights precision by each recall increment.
  • All-alert precision equals the evaluated population's positive prevalence.
  • Score-distribution shifts can break a previously validated cutoff.