October 19, 2024

What is this?

nDCG (normalized Discounted Cumulative Gain) is one of the metrics used to evaluate the performance of search systems. It is particularly important for assessing the quality of search results and their relevance to the ranking. nDCG quantifies how well the search results meet user expectations.

How to Compute

Computation of DCG

DCG (Discounted Cumulative Gain) is calculated by summing the relevance of each item in the search results list, discounted by its rank. The formula is expressed as follows:

\text{DCG@K} = \sum_{i=1}^{K} \frac{2^{rel_i} - 1}{\log_2(i+1)}

Computation of IDCG(Ideal DCG)

IDCG (Ideal Discounted Cumulative Gain) represents the value of DCG in an ideal (perfect) order. It is the DCG calculated under the ideal situation where items with higher relevance are placed at the top of the ranking.

Computation of nDCG

nDCG is the result of normalizing DCG with IDCG. This normalization ensures that the score falls within a range from 0 to 1, allowing for comparisons between different search tasks and different sets of queries. The formula is as follows

\text{nDCG@K} = \frac{\text{DCG@K}}{\text{IDCG@K}}

What task is sutable for this metrics?

The F1 score and precision are commonly used in classification problems, while nDCG is well-suited for evaluating the quality of rankings and search results. The nDCG is an effective metric, particularly when the quality of items at the top of the ranking is important or when there is a significant difference in the relevance of items. nDCG takes into account not only the relevance of the search results but also how they are ranked.