Normalized discounted cumulative gain (NDCG) is an evaluation metric for ranking models. NDCG provides a measure of ranking quality, under the assumption that it is especially important to rank the most relevant documents near the top. By comparison, average precision rewards correct ordering without explicitly privileging the ordering at higher rankings over the ordering at lower rankings.
NDCG is a refinement of discounted cumulative gain (DCG), which in turn refines cumulative gain (CG). We shall define each in turn.
Cumulative gain (CG)
Let
Notice that CG does not depend on the relative ordering within the first
Discounted cumulative gain (DCG)
Discounted cumulative gain reduces the contribution of lower-ranked documents, such that the highest rankings have the largest impact on the metric. It is given as
A key limitation of DCG is that it depends implicitly on the non-discounted cumulative gain for a given query. That is, if query A has many highly relevant documents, and query B has only one highly relevant document, then their respective DCG values for the same
Normalized discounted cumulative gain (NDCG)
Given a known ground-truth ordering, it is possible to compute an ideal discounted cumulative gain
NDCG can be compared across any two queries, making it a useful measure of overall ranking model performance.