emcee icon indicating copy to clipboard operation
emcee copied to clipboard

invalid value encountered in double_scalars lnpdiff = f + nlp - state.log_prob[j]

Open SwastikC opened this issue 5 years ago • 5 comments

Hi. I am getting this warning/error everytime. Can you please help me .. :(

0%| | 0/500 [00:00<?, ?it/s]/home/swastik/anaconda3/lib/python3.8/site-packages/emcee/moves/red_blue.py:99: RuntimeWarning: invalid value encountered in double_scalars lnpdiff = f + nlp - state.log_prob[j] /home/swastik/anaconda3/lib/python3.8/site-packages/emcee/moves/red_blue.py:99: RuntimeWarning: invalid value encountered in double_scalars lnpdiff = f + nlp - state.log_prob[j] 0%|▎ | 1/500 [00:32<4:27:17, 32.14s/it]/home/swastik/anaconda3/lib/python3.8/site-packages/emcee/moves/red_blue.py:99: RuntimeWarning: invalid value encountered in double_scalars lnpdiff = f + nlp - state.log_prob[j] /home/swastik/anaconda3/lib/python3.8/site-packages/emcee/moves/red_blue.py:99: RuntimeWarning: invalid value encountered in double_scalars lnpdiff = f + nlp - state.log_prob[j] 0%|▋ | 2/500 [01:07<4:35:28, 33.19s/it]/home/swastik/anaconda3/lib/python3.8/site-packages/emcee/moves/red_blue.py:99: RuntimeWarning: invalid value encountered in double_scalars lnpdiff = f + nlp - state.log_prob[j] 1%|▉ | 3/500 [01:43<4:40:44, 33.89s/it]/home/swastik/anaconda3/lib/python3.8/site-packages/emcee/moves/red_blue.py:99: RuntimeWarning: invalid value encountered in double_scalars lnpdiff = f + nlp - state.log_prob[j] /home/swastik/anaconda3/lib/python3.8/site-packages/emcee/moves/red_blue.py:99: RuntimeWarning: invalid value encountered in double_scalars lnpdiff = f + nlp - state.log_prob[j] 1%|█▎ | 4/500 [02:20<4:48:14, 34.87s/it]/home/swastik/anaconda3/lib/python3.8/site-packages/emcee/moves/red_blue.py:99: RuntimeWarning: invalid value encountered in double_scalars lnpdiff = f + nlp - state.log_prob[j] /home/swastik/anaconda3/lib/python3.8/site-packages/emcee/moves/red_blue.py:99: RuntimeWarning: invalid value encountered in double_scalars lnpdiff = f + nlp - state.log_prob[j] 1%|█▋ | 5/500 [02:57<4:52:05, 35.41s/it]/home/swastik/anaconda3/lib/python3.8/site-packages/emcee/moves/red_blue.py:99: RuntimeWarning: invalid value encountered in double_scalars lnpdiff = f + nlp - state.log_prob[j] /home/swastik/anaconda3/lib/python3.8/site-packages/emcee/moves/red_blue.py:99: RuntimeWarning: invalid value encountered in double_scalars lnpdiff = f + nlp - state.log_prob[j] 1%|█▉ | 6/500 [03:39<5:09:31, 37.59s/it]/home/swastik/anaconda3/lib/python3.8/site-packages/emcee/moves/red_blue.py:99: RuntimeWarning: invalid value encountered in double_scalars lnpdiff = f + nlp - state.log_prob[j] /home/swastik/anaconda3/lib/python3.8/site-packages/emcee/moves/red_blue.py:99: RuntimeWarning: invalid value encountered in double_scalars lnpdiff = f + nlp - state.log_prob[j] 1%|██▎ | 7/500 [04:16<5:06:44, 37.33s/it]/home/swastik/anaconda3/lib/python3.8/site-packages/emcee/moves/red_blue.py:99: RuntimeWarning: invalid value encountered in double_scalars lnpdiff = f + nlp - state.log_prob[j] 2%|██▌ | 8/500 [04:57<5:15:00, 38.42s/it]/home/swastik/anaconda3/lib/python3.8/site-packages/emcee/moves/red_blue.py:99: RuntimeWarning: invalid value encountered in double_scalars lnpdiff = f + nlp - state.log_prob[j] /home/swastik/anaconda3/lib/python3.8/site-packages/emcee/moves/red_blue.py:99: RuntimeWarning: invalid value encountered in double_scalars lnpdiff = f + nlp - state.log_prob[j] 2%|██▉ | 9/500 [05:37<5:17:48, 38.84s/it]/home/swastik/anaconda3/lib/python3.8/site-packages/emcee/moves/red_blue.py:99: RuntimeWarning: invalid value encountered in double_scalars lnpdiff = f + nlp - state.log_prob[j] 2%|███▎ | 10/500 [06:17<5:21:14, 39.34s/it]/home/swastik/anaconda3/lib/python3.8/site-packages/emcee/moves/red_blue.py:99: RuntimeWarning: invalid value encountered in double_scalars lnpdiff = f + nlp - state.log_prob[j] /home/swastik/anaconda3/lib/python3.8/site-packages/emcee/moves/red_blue.py:99: RuntimeWarning: invalid value encountered in double_scalars lnpdiff = f + nlp - state.log_prob[j] 2%|███▌ | 11/500 [06:55<5:15:22, 38.70s/it]/home/swastik/anaconda3/lib/python3.8/site-packages/emcee/moves/red_blue.py:99: RuntimeWarning: invalid value encountered in double_scalars lnpdiff = f + nlp - state.log_prob[j] /home/swastik/anaconda3/lib/python3.8/site-packages/emcee/moves/red_blue.py:99: RuntimeWarning: invalid value encountered in double_scalars lnpdiff = f + nlp - state.log_prob[j] 2%|███▉ | 12/500 [07:36<5:20:49, 39.45s/it]/home/swastik/anaconda3/lib/python3.8/site-packages/emcee/moves/red_blue.py:99: RuntimeWarning: invalid value encountered in double_scalars lnpdiff = f + nlp - state.log_prob[j] 3%|████▏

SwastikC avatar Dec 20 '20 10:12 SwastikC

This probably means that there's a bug in your probability function. Please provide more details and try to put together a minimal example of a code snippet that can be run to reproduce this. This must be minimal (i.e. no dependencies and no real data) because the point is to isolate the issue.

dfm avatar Dec 20 '20 11:12 dfm

Hi .. I solved this issue... Some of the priors were generated randomly outside the range I wanted and so it was making them -inf. So this was the cause of the error.

SwastikC avatar Mar 15 '21 08:03 SwastikC

SwastikC I am also facing the same error, can you please tell me how you resolved it?

ayushp88 avatar Jan 05 '22 06:01 ayushp88

Hi I am also having this issue with the same error code, @SwastikC how did you resolve your prior generating outside of the range? I unfortunately have 17 priors and cannot manually go through each one for all of my simulations. Any help would be appreciated.

EmmaLitzer avatar Jan 14 '22 21:01 EmmaLitzer

Hi. @ayushp88 and @EmmaLitzer This is a normal math error and a warning in the code. This happens when one of your initial guess values falls outside the range you defined in the prior function. Basically it wont be taken into consideration for your runs and won't effect your final result. If you want to ignore this error just use np.seterr(all="ignore"). Again this will not not affect your error and your convergence for other point. If you still have doubt drop me a mail. [email protected]

SwastikC avatar Jan 15 '22 06:01 SwastikC