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

getting NaN values in ndcg #13

Open
Ellyuca opened this issue Jan 8, 2020 · 3 comments
Open

getting NaN values in ndcg #13

Ellyuca opened this issue Jan 8, 2020 · 3 comments

Comments

@Ellyuca
Copy link

Ellyuca commented Jan 8, 2020

Hi,
I am playing around with the vae_cf implementation and I tried to my dataset, instead of the ML-20M. It has the same structure (userid, itemid, ratings) and I made sure data type are the same.
I left all the pre-processing part as it is. I am using google colab to run the code. When I use the ML-20M dataset everything works just fine. Instead, when I try to train the model using my dataset, I get nan values in ndcg_dist list.

Here i copy/paste the error i get:
InvalidArgumentErrorTraceback (most recent call last)

in ()
82 ndcgs_vad.append(ndcg_)
83 print("printing ndcg_var: ", ndcg_var)
---> 84 merged_valid_val = sess.run(merged_valid, feed_dict={ndcg_var: ndcg_, ndcg_dist_var: ndcg_dist})
85 print("printing feed_dict:", feed_dict)
86 summary_writer.add_summary(merged_valid_val, epoch)

3 frames

/usr/local/lib/python2.7/dist-packages/tensorflow_core/python/client/session.pyc in _do_call(self, fn, *args)
1382 '\nsession_config.graph_options.rewrite_options.'
1383 'disable_meta_optimizer = True')
-> 1384 raise type(e)(node_def, op, message)
1385
1386 def _extend_graph(self):

InvalidArgumentError: Nan in summary histogram for: ndcg_at_k_hist_validation
[[node ndcg_at_k_hist_validation (defined at /usr/local/lib/python2.7/dist-packages/tensorflow_core/python/framework/ops.py:1748) ]]

Does anyone have any clue what is the cause of this issue?
I would really appreciate any kind of advice and suggestions you may give me.

Thank you very much.
Have a great day.

@jpc327
Copy link

jpc327 commented Apr 25, 2021

Hello,
Did you ever resolve this issue? I'm encountering the same error.
Thanks!

@Ellyuca
Copy link
Author

Ellyuca commented Apr 26, 2021

Hi.
It's been months since I last worked on this project. I couldn't find any definitive solution so what I did was to ignore the dcg with zero as value which was causing a division by zero error and creating NaNs. It's not the best solution but it was the only way I could make it work.

Good luck with everything. I hope you'll be able to find a better way to solve the issue. If you do find a better solution let me know as well.

Have a great day.
Best,
Alina.

@shhoff
Copy link

shhoff commented Nov 11, 2021

Ellyuca Thanks for your concern! I have very similar problem here... Also find other sources but not satisfied solution:( I also solve the problem by adding 1e-6 to each division term hehe:) If I can find better solution, I'll contact again! Thanks for your great intuition!

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

3 participants