Gather the ranked list of predicted items for each query
Mark which predicted items are relevant and which are not
Compute precision at each rank where a relevant item appears
Average those precision values for one query
Repeat for all queries
Take the mean of the average precision values across all queries
Use the formula: MAP = (sum of Average Precision for all queries) / (number of queries)
