ilya-shenbin / RecVAE

The official PyTorch implementation of the paper "RecVAE: A New Variational Autoencoder for Top-N Recommendations with Implicit Feedback"
Apache License 2.0
106 stars 28 forks source link

epoch result: nan for ndcg #3

Open mir-boz opened 3 years ago

mir-boz commented 3 years ago

Greetings to the team! Your code is beautiful, but I'm lost in the implementation of it.

I have the last version of PyTorch: https://pytorch.org/get-started/locally/ & Python

When I train the model I receive the outputs:

image

If I change the utils.py in the return of ndcg function for: return DCG/IDCG to: return np.divide(DCG,IDCG, where=IDCG!=0) it solve it, but still giving 'low' values. The latter in comparison with other VAE-CF results.

Can you help me, please?

Congratulations. I reiterate, your code is beautiful in comparison to tensorflow-keras implementation.

Best regards, Mirko.

anirudhnkl commented 3 years ago

Try running it python2. That worked for me.

kinggodhj commented 2 years ago

I have the same problem with python 2.7 and python 3.8

The reason for Nan is zero value in Encoder In norm tensor, zero value exists and this makes Nan

  x = x / norm[:, None]

so i add a new code to handle this problem

  x = x / norm[:, None]
  x[x != x] = 0