Advanced Normalized DCG Calculator

Analyze ranked relevance lists with flexible gains and cutoff depth. Review contributions against ideal baselines. Plot insights, validate ordering, and download polished result summaries.

Calculator Inputs

Use commas, semicolons, or new lines.
Enter predicted-order relevance values.
Leave blank to auto-sort actual scores into ideal order.

Example Data Table

Rank Item Observed Relevance Ideal Relevance
1Query A33
2Query B23
3Query C32
4Query D02
5Query E11
6Query F20

This sample helps test graded relevance, cutoff depth, and the gap between observed ranking quality and the best achievable ordering.

Formula Used

Gain functions:

Linear gain: g(rel) = rel

Exponential gain: g(rel) = 2rel - 1

Discount at rank i:

discount(i) = logbase(i + 1)

Discounted Cumulative Gain:

DCG@k = Σ [ g(reli) / logbase(i + 1) ] for i = 1 to k

Ideal DCG:

IDCG@k uses the same formula after sorting relevance into the best possible order.

Normalized DCG: nDCG@k = DCG@k / IDCG@k

How to Use This Calculator

  1. Enter a label list for the ranked items, queries, or documents.
  2. Paste the observed relevance scores in the predicted ranking order.
  3. Choose the cutoff k, gain type, log base, and decimal precision.
  4. Optionally provide an already ordered ideal relevance list.
  5. Click Calculate nDCG to show metrics, details, and the Plotly graph.
  6. Use the CSV and PDF buttons to export your report.

FAQs

1. What does normalized DCG measure?

Normalized DCG measures ranking quality by comparing the observed ranked list against the best possible ranking. It rewards highly relevant items near the top and scales results between 0 and 1 when IDCG is positive.

2. Why is IDCG necessary?

IDCG gives the maximum achievable discounted gain for the same relevance values. Dividing DCG by IDCG removes scale differences and makes experiments easier to compare across queries, datasets, or ranking models.

3. When should I use exponential gain?

Use exponential gain when higher relevance grades should matter much more than lower grades. It is common in information retrieval because a grade jump near the top often represents a stronger improvement in usefulness.

4. What does cutoff k change?

Cutoff k limits the evaluation to the top ranks. This is useful when users only view the first few positions, such as search results, recommendations, or reranked document lists.

5. Can I use decimal relevance values?

Yes. The calculator accepts decimal relevance values. This helps when relevance comes from averaged labels, continuous quality scores, or weighted judgments from multiple annotators.

6. Why is my nDCG value zero?

nDCG becomes zero when DCG is zero or when all ideal gains are zero. This usually means the ranked list contains no effective relevance at the evaluated cutoff or the provided labels are all zero.

7. Should the optional ideal list already be sorted?

Yes. If you enter a custom ideal list, provide it in the order you want treated as ideal. If you leave it blank, the calculator automatically sorts the observed relevance values in descending order.

8. Is a higher nDCG always better?

Yes. A higher nDCG indicates the observed ordering is closer to the ideal ordering. A value near 1 means the model ranks relevant items very effectively within the evaluated cutoff.

Related Calculators

context recallmean average precisionmean reciprocal rankretrieval latencyretriever recallZero results rate

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.