NDCG Score Calculator

Evaluate ranked relevance with confidence. Compare real and ideal orders quickly. See gain, discount, curves, and interpretation in one clean dashboard.

Calculator

Enter the relevance values in the model’s current ranked order.
Optional. Leave blank to create the ideal ranking automatically.
Optional labels for tables, exports, and chart tooltips.
NDCG@k only uses the first k ranked items.
Exponential gain emphasizes highly relevant results more strongly.
Choose output precision for the score and contribution tables.

Example Data Table

Sample ranking dataset
Position Item Ranked Relevance Ideal Relevance
1Doc A33
2Doc B23
3Doc C32
4Doc D02
5Doc E11
6Doc F20

Use this example to test NDCG@k, compare ranking quality, and verify how gain and discounting affect final evaluation.

Formula Used

NDCG measures how close your ranked results are to the ideal ranking. It rewards relevant items near the top and discounts lower positions.

DCG@k = Σ(i=1 to k) [ Gain(rel_i) / log2(i + 1) ] IDCG@k = DCG of the ideal ranking NDCG@k = DCG@k / IDCG@k
Gain choices: Linear gain uses rel. Exponential gain uses 2^rel - 1. Exponential gain gives much more weight to highly relevant items.

Position 1 receives full weight. Lower positions receive discounted credit through the logarithmic denominator. This makes early ranking quality more important.

How to Use This Calculator

  1. Enter relevance values in the exact ranked order returned by your model.
  2. Add ideal relevance values, or leave them blank for automatic descending sorting.
  3. Set k if you want NDCG at a specific cutoff like 3, 5, or 10.
  4. Choose linear or exponential gain based on your evaluation preference.
  5. Click Calculate NDCG to see score summaries, tables, and the chart.
  6. Use the export buttons to download CSV or PDF summaries.

Frequently Asked Questions

1) What does NDCG measure?

NDCG measures ranking quality by comparing your ranked list with an ideal order. It values relevant items more when they appear near the top.

2) What is a good NDCG score?

Scores closer to 1 are better. In many applications, 0.8 or higher is strong, but acceptable targets depend on the task, labels, and baseline.

3) Why use NDCG instead of accuracy?

Accuracy ignores position and graded relevance. NDCG is better for search, recommendation, and ranking systems where order matters significantly.

4) What is NDCG@k?

NDCG@k evaluates only the first k positions. It is useful when users usually inspect only the top portion of results.

5) When should I use exponential gain?

Use exponential gain when highly relevant items deserve much stronger emphasis than moderately relevant ones. It exaggerates top-label differences intentionally.

6) Can ideal relevance be generated automatically?

Yes. If you leave the ideal list blank, this calculator sorts the ranked relevance values in descending order to build the ideal ranking.

7) Can NDCG handle graded labels?

Yes. NDCG is designed for graded relevance, such as 0 to 3 or 0 to 5 labels, not only binary relevant versus irrelevant judgments.

8) Why can two rankings share similar DCG but different NDCG?

Because NDCG normalizes DCG by the best possible ranking. Two lists may earn similar gain, yet differ in how close they are to ideal placement.

Related Calculators

cosine similarityranking losscontextual banditpairwise rankinglistwise rankingnovelty scoreals factorizationchurn reductionbandit regretknn recommendation

Important Note: All the Calculators listed in this site are for educational purpose only and we do not guarentee the accuracy of results. Please do consult with other sources as well.