ValueError: probabilities contain NaN
See original GitHub issueTrying run node2vec on my dataset using the example code from the ReadMe. During the walk generation, I am receiving the following error:
File "mtrand.pyx", line 920, in numpy.random.mtrand.RandomState.choice
ValueError: probabilities contain NaN
Any idea where this is coming from? My dataset is ~ 120 MB, but I can provide it if helpful
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
ValueError: probabilities contain NaN in policy.py #376 - GitHub
Hey community, I made an environment with openai gym and now I am trying different settings and agents. I started with the agent...
Read more >ValueError: probabilities contain NaN - python - Stack Overflow
I'm trying to write functions for LSTM Neural network using no library except numpy and getting error will exporting the txt file. def ......
Read more >ValueError: probabilities contain NaNLoss : r/tensorflow - Reddit
I left my model train for overnight, I set max steps to 500k. At first it was doing great progress then after 6...
Read more >ValueError: Input contains NaN, infinity or a value too large for ...
I got ValueError when predicting test data using a RandomForest model. My code: clf = RandomForestClassifier(n_estimators=10, max_depth=6, n_jobs=1, verbose= ...
Read more >How to track a 'nan energy'? - Questions - PyMC Discourse
ValueError : Bad initial energy: nan. The model might be misspecified. How can I have clues about the random variable that produce such...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@davidfstein I figured out the problem - the problem is that most of your weights are zero. In the algorithm node2vec, weights cannot be zero - because weights (after normalization) are treated as walk probabilities, so essentially using the weights you can control how strongly two nodes are connected.
Zero edge weight is essentially no edge, so you cannot use zero weights. So before applying node2vec, depending on your use case decide what to do with the zero weights, you can either train without weights, or decide anything else that serves your problem - as long as you avoid assigning zero weights.
Thanks for this issue, I will make sure in the next version to give a better error message for zero weights
That makes sense. Thanks @eliorc!