A search engine returns 4 results for three queries with binary relevance , and , where 1 means relevant and each query has exactly 2 relevant documents in the corpus. What are MRR and MAP, and when would you prefer each?
ML systems and evaluation, Ranking metrics
Level L2 Elementary. Length Medium. Nature Mat Mathematical.
What's being asked
Whether you can compute reciprocal rank and average precision accurately—including handling unretrieved relevant documents—and pick the right ranking metric.
Key idea
MRR averages across queries (where is the position of the first relevant hit), whereas MAP averages across queries, where is precision at rank , indicates relevance at rank , and is the total number of relevant documents in the corpus.
Steps
- Compute reciprocal rank (RR) for each query from the first relevant rank: , , .
- Average to get .
- Compute average precision (AP) with total relevant items per query: for query 1, hits at ranks 2 and 4 give and , so .
- For query 2, hits at ranks 1 and 3 give ; for query 3, one hit at rank 3 (and the second relevant item missed) gives .
- Average to get . Use MRR for navigational or question-answering tasks where one good answer suffices, and MAP when the user needs all relevant items retrieved high up.
Common mistakes
- Dividing by 1 (the number of retrieved relevant items) instead of (the total relevant items in the corpus), which hides missing relevant items.
- Using MRR or MAP when relevance has graded levels (0 to 3); use NDCG for graded relevance.
How long your answer should be
Five lines of arithmetic and two sentences comparing MRR and MAP; 3–4 minutes.
Last checked on 4 December 2026.
Read this
Previous in ML systems and evaluation: A regression model predicts for true targets . What are the MAE and RMSE, why is RMSE strictly larger here, and when is each metric preferred?
Next in ML systems and evaluation: You are training a pneumonia detector on 5,000 chest X-rays collected from 500 patients (10 scans per patient). Why does standard or stratified -fold cross-validation overestimate test accuracy, and how does group -fold fix it?