a ranking quality metric measuring how well highly relevant documents are placed at the top. Discounted cumulative gain
DCG@k=∑i=1klog2(i+1)2reli−1, where
reli is the graded relevance at position
i (typically 0-4) and
log2(i+1) is the position discount (1 at rank 1,
log23≈1.585 at rank 2, 2 at rank 3,
log25≈2.322 at rank 4). IDCG is the DCG of the ideal ranking (relevance descending), and
NDCG@k=IDCG@kDCG@k∈[0,1]. Numerical example: true relevance [3, 2, 1, 0], model output order [2, 1, 3, 0], then
DCG@4=122−1+log2321−1+223−1+log2520−1=3+0.63+3.5+0=7.13; IDCG with the ideal order [3, 2, 1, 0]:
IDCG@4=123−1+log2322−1+221−1+0=7+1.89+0.5=9.39, so
NDCG@4≈7.13/9.39≈0.76.