Average precision (AP) is an evaluation metric for ranking tasks. It combines precision and recall at k (p@k and r@k) in a way that provides information on how closely the predicted rank ordering tracks relevance. The average precision provides a single value associating precision and recall at all possible values of
implies that the model only returns relevant results, so that precision is perfect at all values of . implies that the model never returns relevant results, so that precision is zero at all values of .
Derivation
To derive average precision, we start by definiting precision and recall at a specific rank
where
TO DO: THE REST OF THIS SECTION DOESN’T MAKE SENSE TO ME
Now we can express precision
Notice that, since
which we can just write as
Discrete approximation
In practice, we have only
Since
Hence we can express average precision as