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

Mean Average Precision at K (MAP@K)

Evaluating ranking quality by averaging precision across multiple queries at cutoff K.

Mean Average Precision at K (MAP@K)

You'll learn: How to evaluate ranking systems by measuring how well they place relevant items at the top of recommendation lists.

What Is MAP@K?

Imagine you're building a music recommendation system. When a user searches for "jazz piano," your model returns a ranked list of 10 songs. Some are relevant (actual jazz piano tracks), others aren't. Mean Average Precision at K tells you how good your system is at putting the relevant items near the top of that list.

The Core Idea

MAP@K works in three steps:

  1. For each query, look at the top K results (e.g., top 10 recommendations)
  2. Calculate Precision@K at each position where a relevant item appears
  3. Average those precision values to get Average Precision for that query
  4. Average across all queries to get MAP@K

Think of it like grading a teacher who asks students to rank historical events chronologically. If the correct events appear early in the ranking, the teacher scores well. If correct answers are buried at position 9 or 10, the score drops.

Why K Matters

The "K" is a cutoff point—you only evaluate the top K results because users rarely scroll beyond the first page. MAP@3 might be more important for mobile apps where screen space is limited, while MAP@20 suits desktop search engines.

The "Mean" Part

You average across multiple queries because different searches have different relevant item counts. One user might have 5 relevant songs, another has 2. MAP@K gives you a single number summarizing performance across all these varied situations.

Key Takeaway: MAP@K measures ranking quality by rewarding systems that place relevant items early in the result list, averaged across all queries—essential for search engines, recommendation systems, and any application where order matters.