Definitioncore
Mean average precision
Also called MAP metric.
The mean over queries of average precision, the mean of the precision values at the ranks of the relevant documents.
Average precision (AP) scores one ranking for one query. It takes the precision at the rank of each relevant document, counts 0 for each relevant document that the ranking does not return, and divides the sum by the number of relevant documents. Mean average precision (MAP) is the arithmetic mean of AP over the queries of a test collection. AP is the area under the uninterpolated precision-recall curve, so one number rewards both early precision and high recall.
Definition
Input. A ranking of distinct document ids, with ranks starting at 1, and graded judgments , where a document that is not judged has . A document is relevant when . when is relevant, and is the precision at rank . is the number of relevant documents in the judgments.
Value. When ,
- Gain: binary, with the threshold . A grade 2 document counts the same as a grade 1 document.
- Discount: there is no fixed discount per rank. The relevant document at rank adds , which is smaller when more nonrelevant documents come before it.
- Normalization: division by , the number of relevant documents in the judgments. It is not the number of relevant documents retrieved. A relevant document that is not in the ranking adds 0 to the sum and still counts in .
- Cutoff: none. The whole ranking counts. TREC runs return at most 1000 documents per topic, so the TREC value is in effect AP over the first 1000 ranks.
- Ties: AP depends on the order of tied scores. This area orders by score descending, then by document id ascending. trec_eval orders tied documents by document number in reverse lexical order, and the toy example below shows that this changes AP from 0.8056 to 0.5889.
- No relevant documents (): undefined, because the sum is empty and the divisor is 0. Return None and leave the query out of the mean. trec_eval evaluates only the queries that are in its judgments file. For such a query with no relevant document it reports 0 and counts it in the mean.
MAP is the arithmetic mean of AP over the queries with . GMAP, the geometric mean, is over the same queries. An AP of 0 makes the logarithm undefined, so implementations put a small floor under AP first; trec_eval takes the log of (file m_gm_map.c). GMAP gives more weight to the queries where a system does badly. The NIST appendix says that it came from the TREC 2004 robust track.
Claim 1 (area). For , let be the precision at the smallest rank whose recall is at least , and let if no rank of the ranking reaches recall . Then .
Proof. Let be the ranks of the relevant documents in the ranking, so . Recall at rank is (number of relevant documents in the first ranks). It changes only at the ranks , where it goes from to . Take in the interval with . The first rank with recall at least is the first rank with recall at least , which is . So on that interval. For , no rank reaches recall , so on the interval. Each interval has length , so
Manning, Raghavan and Schuetze (Section 8.4) state this as an approximation to the area under the uninterpolated curve. With defined as above, a step function, the equality is exact.
Claim 2 (range). , and exactly when the first ranks hold all the relevant documents.
Proof. With the notation of Claim 1, the -th relevant document is at rank , so . The sum has terms, each at most 1, so . Equality needs and for every , that is, the relevant documents fill ranks 1 to . Conversely, such a ranking has every term equal to 1.
Claim 3. If , AP equals the reciprocal rank of the one relevant document, or 0 if it is not retrieved.
Proof. The sum has at most one term, , and .
So mean reciprocal rank and MAP agree on a query set where every query has exactly one relevant document.
Examples and non-examples
The fixed run on the toy collection
Query q1 "sorted array search" has the relevant documents d1 (grade 2), d2 and d8 (grade 1), so . The fixed run ranks 1, 6, 8, 2, 4 with the tie rule of this area. The relevant documents are at ranks 1, 3 and 4.
| Rank of relevant document | 1 | 3 | 4 |
|---|---|---|---|
| Relevant so far | 1 | 2 | 3 |
| Precision at that rank | 1 | 2/3 | 3/4 |
By Claim 1, the same number is the area under the step function that is 1 for recall in , on and on : .
Ties change AP
The scores tie d1 with d6 at 2.0 and d2 with d4 at 1.0. There are four orders of the tied documents.
| Order | Relevant at ranks | AP |
|---|---|---|
| 1, 6, 8, 2, 4 (this area) | 1, 3, 4 | 29/36 = 0.8056 |
| 1, 6, 8, 4, 2 | 1, 3, 5 | 34/45 = 0.7556 |
| 6, 1, 8, 2, 4 | 2, 3, 4 | 23/36 = 0.6389 |
| 6, 1, 8, 4, 2 (trec_eval) | 2, 3, 5 | 53/90 = 0.5889 |
For the trec_eval order, . One run file thus gives 0.8056 or 0.5889, depending only on the tie rule. The tie-aware AP of McSherry and Najork (2008) is the mean over the four orders: . Their paper shows how to get this mean without listing the orders, which matters when a tie group is large.
MAP over several queries
| Query | Ranking | Relevant at ranks | AP | |
|---|---|---|---|---|
| q1 | 3 | 1, 6, 8, 2, 4 | 1, 3, 4 | 29/36 |
| q2 "posting list merge" | 3 | 8, 5, 1, 4, 2 | 2, 4 (d3 missing) | 1/3 |
| q3 "rank documents" | 1 | 2, 6, 7, 1, 5 | 3 | 1/3 |
| q4 "quantum circuit" | 0 | 1, 2, 3, 4, 5 | none | None |
For q2, ; the 0 is for d3, which the run does not return. For q3 the only relevant document is at rank 3, so (Claim 3). q4 is left out.
- MAP .
- If q4 is wrongly kept with the value 0, the mean becomes . The same run file gives two different MAP values, so a report must say how it handles queries with .
- GMAP , lower than MAP because two of the three values are low.
Non-examples
- Dividing by the number of relevant documents retrieved. For q2 that gives instead of , so a run that stops early is not punished for the relevant document it never found.
- Detection mean average precision in object detection. It matches predicted boxes to ground-truth boxes by overlap, computes an interpolated precision-recall area per class, and averages over classes. It shares the name but not the input or the formula.
- The 11-point average of the interpolated precision-recall curve. For the fixed run on q1 it is , not , because interpolation takes the maximum precision over later ranks.
- Normalized discounted cumulative gain, which uses the grades. AP gives d1 (grade 2) and d8 (grade 1) the same weight.
Related definitions
- R-precision and AP are both normalized by and both reach 1 only on a ranking with all relevant documents first.
- Mean reciprocal rank uses only the first relevant document, and equals MAP when on every query.
- Bpref and inferred average precision are built for judgments that are far from complete. AP counts every unjudged document as nonrelevant.
- AP and MAP are standard targets in learning to rank.
What is proved here: Claims 1 to 3, which hold for every ranking. What is only measured: how stable MAP is as a way to order systems, and how it behaves with incomplete judgments. Buckley and Voorhees (2004) report that MAP, P(10) and R-precision become unreliable when the judgments are made much less complete, while bpref stays closer to the ranking of systems under full judgments. A claim that one system has a higher MAP than another needs a paired test over the queries, such as the sign test, the Wilcoxon signed-rank test, a permutation test or a bootstrap interval, with the number of queries and the p-value.
References
- Christopher D. Manning, Prabhakar Raghavan and Hinrich Schuetze, Introduction to Information Retrieval, Cambridge University Press, 2008, Chapter 8, Section 8.4 (mean average precision, and the remark that it approximates the area under the uninterpolated precision-recall curve)
- Common Evaluation Measures, appendix to the TREC 2006 proceedings, NIST, sections on average precision (worked example with relevant documents at ranks 1, 2, 4 and 7) and on geometric MAP
- trec_eval, the TREC evaluation program by Chris Buckley, maintained by NIST, file m_map.c (sum of precision at each relevant retrieved document, divided by num_rel), file m_gm_map.c (log of MAX(AP, MIN_GEO_MEAN)), file form_res_rels.c (order of tied scores)
- Frank McSherry and Marc Najork, Computing information retrieval performance measures efficiently in the presence of tied scores, ECIR 2008, LNCS 4956, pp. 414-421, tie-aware average precision, equal to the mean over all orders of the tied documents
- Chris Buckley and Ellen M. Voorhees, Retrieval evaluation with incomplete information, SIGIR 2004, pp. 25-32, Sections 3 and 4 (MAP is not robust when the judgments become much less complete)
- Ellen M. Voorhees and Donna K. Harman (editors), TREC, Experiment and Evaluation in Information Retrieval, MIT Press, 2005, Chapter 3, Chris Buckley and Ellen M. Voorhees, Retrieval system evaluation, pp. 53-75
Where this leads
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H0 no proof |
|
| Lean | L0 no Lean part |
|
| Visual | V0 none |
|
| Writing | W4 complete |
|
Tag WP8DJA Edit this page History Report an error Markdown