Average Precision (AP) is a metric that summarises the Precision-Recall curve. Precision and recall are fundamental metrics in the field of information retrieval and binary classification, especially for imbalanced datasets where the positive class (hits, relevant items) is much smaller than the negative class.
Precision is defined as the number of true positives divided by the total number of predicted positives (i.e., the sum of true positives and false positives). Recall, also known as sensitivity, is defined as the number of true positives divided by the total number of actual positives (i.e., the sum of true positives and false negatives).
The Precision-Recall curve is a plot of Precision (y-axis) versus Recall (x-axis) for different thresholds.
Average Precision (AP) computes the average precision value for recall value over the interval from 0 to 1. When a true positive is found, the precision at that recall level is interpolated and then averaged. This creates a focus on the ability of the model to return all positive instances in the top of the ranking.
The AP score is a useful measure to compare different models, because it summarises the shape of the Precision-Recall curve, and therefore it measures the quality of the classifier as the threshold is varied.
If the AP score is equal to 1, the classifier is perfect. A random classifier has an AP score equal to the ratio of positive samples in the dataset.
Updated 5 months ago