Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to calcuate nDCG in this paper? #56

Open
swyo opened this issue Jan 1, 2022 · 1 comment
Open

How to calcuate nDCG in this paper? #56

swyo opened this issue Jan 1, 2022 · 1 comment

Comments

@swyo
Copy link

swyo commented Jan 1, 2022

I'm wondering how to calcuate nDCG paper? 😕

Question: The nDCG calculation needs the link predictions of all unobserved items, but It is not tractable(because of sparse density). What is your nDCG protocol to reproduce the performance table in this paper as follows.
image

If anyone know about it, please explain how to reproduce the nDCG. 🙏

Your model predicts link preferences between user and item pairs.

nDCG needs item ranking lists for each user.

Your model predicts only test link.

If nDCG is calculated, all unobserved items' preferences should be predicted.
However, it takes too much time to predict all the items.

I am confusing while reviewing the NGCF paper.


Alternatively NeuCF model use Leave-one-out protocol as follows.

Xiangnan He, Lizi Liao, Hanwang Zhang, Liqiang Nie, Xia Hu, and Tat-Seng
Chua. 2017. Neural Collaborative Filtering. In WWW. 173–182.
In [14], Leave-one-out protocol:

  1. Use the last timestamp item and do K negative sampling for each user/
  2. Predict rating K negative samples and the last timestamp test data(only one for each user), and then raking.
  3. Calculate Top K ranking metric (such as Precision, Recall, F1, nDCG@K). i.e., check whether the test data exist in the TopK ranking.

However, the paper(in NGCF) mentioned as follows.
image

I tried to follow [31], but in there, train test split ratio was 4:1.

So, I think the leave-one-out protocol is not used. I am very curious about how to reproduce nDCG in this paper.

@kuzeko
Copy link

kuzeko commented Apr 12, 2022

Hi,
just to further clarify the issue, at this line:

return r[0] + np.sum(r[1:] / np.log2(np.arange(2, r.size + 1)))

The way to compute the NDCG doesn't look the correct one, the index starts with a 2, but if you see here on WikiPedia is 2+i so should start with 3 and do +2
https://en.wikipedia.org/wiki/Discounted_cumulative_gain

return r[0] + np.sum(r[1:] / np.log2(np.arange(3, r.size + 2)))

See also here the same problem
MI-911/warm-start-framework#9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants