Course contentsShow
← Machine Learning and Deep Learning
Lesson 488 of 3,53811. Model Evaluation MetricsFree lesson

Mean Reciprocal Rank (MRR)

Computing the average of reciprocal ranks of first correct results across queries.

Mean Reciprocal Rank (MRR)

You'll learn how to measure how well your model ranks the correct answer across multiple queries.

What Is MRR?

Mean Reciprocal Rank (MRR) is a metric that evaluates ranking quality by focusing on where the first correct result appears in your model's ranked list. Instead of caring about all correct items, MRR asks: "How quickly does the user find a correct answer?"

The "reciprocal rank" is simply 1 divided by the position of the first correct result. If the correct answer is first, the reciprocal rank is 1/1 = 1.0 (perfect!). If it's second, you get 1/2 = 0.5. Third? 1/3 ≈ 0.33.

MRR takes the average of these reciprocal ranks across all your queries.

Why It Matters

Think of a search engine: when you search for "best pizza near me," you don't want to scroll through 50 results to find something relevant. MRR rewards models that put correct answers at the top of the ranked list.

The Formula

For Q queries:

MRR = (1/Q) × Σ(1/rank_i)

where rank_i is the position of the first correct result for query i.

Example

  • Query 1: First correct result at position 1 → 1/1 = 1.0
  • Query 2: First correct result at position 3 → 1/3 ≈ 0.33
  • Query 3: First correct result at position 2 → 1/2 = 0.5

MRR = (1.0 + 0.33 + 0.5) / 3 ≈ 0.61

Higher MRR means your model consistently ranks correct answers near the top.

Key Takeaway: MRR measures ranking quality by averaging the reciprocal of the position where the first correct result appears—higher scores mean users find relevant results faster.