File Exchange

image thumbnail

Normalized Discounted Cumulative Gain (NDCG)

version 1.1.0.0 (2.77 KB) by Jan Motl
Returns the Normalized Discounted Cumulative Gain

1 Download

Updated 31 Dec 2017

View License

A straightforward implementation of NDCG, a measure of ranking quality, which closely follows the definition from https://en.wikipedia.org/wiki/Discounted_cumulative_gain.

Cite As

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 .

Comments and Ratings (2)

Jan Motl

@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.

ahmed

how to Implementation nDCG@10 ?

Updates

1.1.0.0

Adds illustrative image with the used equation

MATLAB Release Compatibility
Created with R2015a
Compatible with any release
Platform Compatibility
Windows macOS Linux