A straightforward implementation of NDCG, a measure of ranking quality, which closely follows the definition from https://en.wikipedia.org/wiki/Discounted_cumulative_gain.
Jan Motl (2020). Normalized Discounted Cumulative Gain (NDCG) (https://www.mathworks.com/matlabcentral/fileexchange/65570-normalized-discounted-cumulative-gain-ndcg), MATLAB Central File Exchange. Retrieved .
@ahmed The function accepts `pred_relevance` vector that can be shorter than `y` vector. If you want nDCG@10, simply pass to the function `pred_relevance` that is truncated to the top 10 items.
The example in the function illustrates calculation of nDCG@6 for 8 items in vector `y`. The example is described into the details at Wikipedia article about DCG.
how to Implementation nDCG@10 ?
Adds illustrative image with the used equation