RuntimeWarning: invalid value encountered in double_scalars
See original GitHub issueGeneral information:
- emcee version: 2.2.1
- platform: Ubuntu LTS 18.04
- installation method (pip/conda/source/other?): pip
Problem description:
Expected behavior:
No error
Actual behavior:
I get a RuntimeWarning: invalid value encountered in double_scalars in the red_blue.py script at line 97: lnpdiff = f + nlp - state.log_prob[j]. The same error appears from the old ensemble.py script at the line: lnpdiff = (self.dim - 1.) * np.log(zz) + newlnprob - lnprob0 (Issue 269, now closed)
What have you tried so far?:
I have tried both versions of the code, and I can’t figure out why I get that error. For an Ensemble with a lower amount of steps I do not get that error, only when the chain gets longer.
Minimal example:
import emcee
# sample code goes here...
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
runtimewarning: invalid value encountered in double_scalars
This error occurs when you attempt to perform some mathematical operation that involves extremely small or extremely large numbers and Python ...
Read more >python - numpy division with RuntimeWarning: invalid value ...
It seems to be that the input element were too small that python turned them to be zeros, but indeed the division has...
Read more >How to Fix: runtimewarning: invalid value encountered in ...
This error simply occurs when we performing a math operation and we encounter which is not valid as input. When we perform some...
Read more >PYTHON : 'invalid value encountered in double_scalars ...
PYTHON : ' invalid value encountered in double_scalars ' warning, possibly numpy [ Gift : Animated Search Engine ...
Read more >invalid value encountered in double_scalars - PYTHON
PYTHON : numpy division with RuntimeWarning : invalid value encountered in double_scalars [ Gift : Animated Search Engine ...
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 Free
Top 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

This generally means that you are initializing in some part of parameter space where the log probability is -inf or nan. Double check that your initialized values are all ok. If they are, then there’s a chance that this is caused by your log probability function returning nan or inf, but that should be caught in the sampler. One way or another you should always try to catch issues like that in your log probability function and return
-np.inf. Give that a shot.Sir I am also facing the same issue, can you please help me.