Identify the time period over which you want the MAP (e.g., monthly, quarterly).
For each query (q):
For each relevant document (d) in the ranked list, compute precision at each rank where (d) appears:
(P@k = frac{text{# relevant documents in top } k}{k})
Compute Average Precision (AP):
(displaystyle AP(q)=frac{1}{R_q}sum_{k=1}^{N} left[text{rel}(k)right]cdot P@k)
where (R_q) = total number of relevant documents for query (q), (text{rel}(k)=1) if the document at rank (k) is relevant, else 0, and (N) is the evaluated ranking length.
Compute Mean Average Precision (MAP) across all queries:
(displaystyle MAP=frac{1}{|Q|}sum_{qin Q} AP(q))
If using a cutoff (K) (MAP@K):
Restrict the summation in (AP(q)) to ranks (k le K).
Optionally use (R_q@K) (only relevant documents within top (K)) depending on the evaluation protocol.
