Course contentsShow
← Machine Learning and Deep Learning
Lesson 463 of 3,53811. Model Evaluation MetricsFree lesson

Average Precision and AUC-PR

Computing area under precision-recall curve and understanding average precision across thresholds.

Average Precision and AUC-PR

What you'll learn: How to summarize the precision-recall curve into a single score that works well for imbalanced datasets.

The Core Idea

You've already learned about precision-recall curves, which show the trade-off between precision and recall at different classification thresholds. But staring at a curve isn't always practical—you need a single number to compare models. That's where Average Precision (AP) and AUC-PR come in.

AUC-PR (Area Under the Precision-Recall Curve) is exactly what it sounds like: the area underneath the PR curve. A perfect classifier has an AUC-PR of 1.0, while random guessing on balanced data gives around 0.5 (though this baseline changes with class imbalance).

Average Precision takes a slightly more sophisticated approach. Instead of just computing the geometric area, it calculates a weighted mean of precisions at each threshold, where the weight is the increase in recall from the previous threshold. Think of it as asking: "On average, how precise was my model as I gradually relaxed the threshold to catch more positives?"

Why This Matters for Imbalanced Data

When you have far more negatives than positives (like fraud detection), the precision-recall curve and its summary metrics focus specifically on your minority class performance—unlike ROC-AUC, which can be overly optimistic because it considers true negatives heavily.

Both metrics range from 0 to 1, with higher being better. Average Precision often gives slightly different (usually lower) values than AUC-PR because it weights the precision changes more carefully.

Key Takeaway: Average Precision and AUC-PR condense the precision-recall curve into single scores that effectively measure classifier quality on imbalanced datasets, with AP providing a more interpretable weighted average across thresholds.