Area Under Precision-Recall Curve (AP)
You'll learn how to summarize the precision-recall trade-off with a single number that's especially useful for imbalanced datasets.
What Is Average Precision?
You've already learned how the Precision-Recall Curve visualizes how precision and recall change as you adjust your classification threshold. But constantly referring to an entire curve is impractical when comparing models. Average Precision (AP) solves this by computing the area under the Precision-Recall Curve, giving you a single metric between 0 and 1.
Why AP Matters
Think of AP like calculating the "total quality" of a model across all possible decision thresholds. A perfect classifier achieves AP = 1.0 (perfect precision at all recall levels), while a useless one approaches 0.
Unlike AUC-ROC, which you learned about earlier, AP focuses specifically on the positive class. This makes it particularly valuable for imbalanced datasets where you care more about finding the rare positive cases (fraud detection, disease diagnosis, etc.) than correctly identifying negatives.
How It Works
AP computes a weighted average of precisions at each threshold, where the weight is the increase in recall from the previous threshold. In simpler terms: you're measuring "how much precision you maintain as you increase recall."
Higher AP means your model maintains high precision even as you try to catch more positive examples (increase recall) — exactly what you want!
When to Use AP
Use AP when:
- Your dataset is imbalanced
- You care primarily about the positive class
- You want to summarize precision-recall performance in one number
Key Takeaway: Average Precision (AP) condenses the entire Precision-Recall Curve into a single score, making it easier to compare models, especially on imbalanced datasets where the positive class matters most.