# NDCG for recommender algorithm

I need to apply NDCG over the results of a recommender algorithm, but was not able to find any proper example that suits my use case in order to find out if my implementation is correct.

Here is my test set:

id | p_name | relevance
1  | p3     | 1
2  | p4     | 1
3  | p7     | 0
4  | p9     | 1


And a result set:

id | p_name | relevance
1  | p1     | 3.00
2  | p2     | 2.70
3  | p3     | 2.10
4  | p4     | 1.99
5  | p5     | 1.59
6  | p6     | 1.20
7  | p7     | 0.50


As a result I got: IDCG = 2.06, DCG = 9.347 and nDCG = 4.533. Just wanted to check, are my results are correct?

• nDCG cannot be more than 1. There seems to be something wrong. – aneesh joshi May 22 '18 at 11:45
• Can you please outline how you came to these values? As mentioned, having an idealised DCG that is lower than the realised now, is impossible so this immediately appears as a big red flag. – usεr11852 Feb 23 '19 at 0:08