NDCG (Normalized Discounted Cumulative Gain) measures ranking quality — evaluating how well a ranked list places relevant items at the top, with higher-ranked relevant items contributing more to the score, the most widely used ranking metric.
What Is NDCG?
- Definition: Ranking quality metric considering position and relevance.
- Range: 0 (worst) to 1 (perfect ranking).
- Key Idea: Relevant items at top positions are more valuable.
How NDCG Works
1. DCG (Discounted Cumulative Gain):
- Sum relevance scores, discounted by position.
- DCG = Σ (relevance_i / log₂(position_i + 1)).
- Higher positions contribute more (less discounting).
2. IDCG (Ideal DCG):
- DCG of perfect ranking (all relevant items at top).
3. NDCG:
- NDCG = DCG / IDCG.
- Normalizes to 0-1 range.
Why NDCG?
- Position-Aware: Top positions matter more (users rarely scroll).
- Graded Relevance: Handles multi-level relevance (not just binary).
- Normalized: Comparable across queries with different numbers of relevant items.
- Industry Standard: Used by Google, Microsoft, Amazon, Netflix.
NDCG@K: Evaluate only top K results (e.g., NDCG@10 for top 10).
Advantages: Position-aware, handles graded relevance, normalized, widely adopted.
Disadvantages: Requires relevance labels, assumes logarithmic position discount, not intuitive to non-experts.
Applications: Search engine evaluation, recommender system evaluation, learning to rank optimization.
Tools: scikit-learn, TensorFlow Ranking, custom implementations.
NDCG is the gold standard for ranking evaluation — by considering both relevance and position, NDCG accurately measures ranking quality in search, recommendations, and any ranked list application.
Explore 500+ Semiconductor & AI Topics
From EUV lithography to CUDA optimization — search the full knowledge base or chat with our AI assistant.