DNest4 icon indicating copy to clipboard operation
DNest4 copied to clipboard

getting nan in gaussian.py example

Open timothydmorton opened this issue 8 years ago • 10 comments

Hey folks-- Just tried to run the gaussian python example, and for everything past sample 60, log(Z) = nan.

# Timothys-MacBook-Pro:gaussian tdm$ python gaussian.py 
# Seeding random number generators. First seed = 1234.
# Generating 5 particles from the prior...done.
# Creating level 1 with log likelihood = -21.2056127777.
# Creating level 2 with log likelihood = -15.3685054541.
# Creating level 3 with log likelihood = -11.7700107885.
# Creating level 4 with log likelihood = -9.32051503195.
# Creating level 5 with log likelihood = -7.78605572939.
# Creating level 6 with log likelihood = -6.75872064936.
Sample 10: log(Z) = nan [exact log(Z) = -11.5129283315]
# Creating level 7 with log likelihood = -6.0339250471.
# Creating level 8 with log likelihood = -5.53167376151.
# Creating level 9 with log likelihood = -5.21513935676.
# Creating level 10 with log likelihood = -5.00255785472.
# Creating level 11 with log likelihood = -4.86598501177.
Sample 20: log(Z) = -11.7090824614 [exact log(Z) = -11.5129283315]
# Creating level 12 with log likelihood = -4.77161110429.
# Creating level 13 with log likelihood = -4.70819909729.
# Creating level 14 with log likelihood = -4.67341103414.
# Creating level 15 with log likelihood = -4.6502281122.
Sample 30: log(Z) = nan [exact log(Z) = -11.5129283315]
# Creating level 16 with log likelihood = -4.63258890385.
# Creating level 17 with log likelihood = -4.62006698283.
# Creating level 18 with log likelihood = -4.61211722021.
Sample 40: log(Z) = -11.6631834445 [exact log(Z) = -11.5129283315]
# Creating level 19 with log likelihood = -4.60642900501.
# Done creating levels.
Sample 50: log(Z) = -11.5682956298 [exact log(Z) = -11.5129283315]
Sample 60: log(Z) = nan [exact log(Z) = -11.5129283315]
Sample 70: log(Z) = nan [exact log(Z) = -11.5129283315]
Sample 80: log(Z) = nan [exact log(Z) = -11.5129283315]
Sample 90: log(Z) = nan [exact log(Z) = -11.5129283315]
[etc...]

timothydmorton avatar Jun 24 '16 22:06 timothydmorton

I can't reproduce this. Are you using a recent github checkout? How did you install? What version of numpy do you have? Can you post your sample.txt, sample_info.txt, and levels.txt files somewhere?

dfm avatar Jun 24 '16 22:06 dfm

Yeah, I just cloned the repo, using numpy v. 1.10.0.

installed with python setup.py install in the python directory.

files are here.

timothydmorton avatar Jun 24 '16 22:06 timothydmorton

For what it's worth, I just conda update numpy'd and am still getting nans.

timothydmorton avatar Jun 24 '16 22:06 timothydmorton

I just tested with that old numpy version and your files and I still don't get nans so I'm really not sure what's going on....

dfm avatar Jun 24 '16 22:06 dfm

What about if you navigate to the directory where these files are saved and run

from dnest4.analysis import postprocess
postprocess()

Still nans?

dfm avatar Jun 24 '16 22:06 dfm

dnest4.classic.postprocess() and dnest4.analysis.postprocess() both work for me with those output files*. The former could be a workaround for now.

  • They yield very slightly different logZs, which I wasn't expecting. I thought we checked this!

eggplantbren avatar Jun 25 '16 03:06 eggplantbren

That's a work around only if the classic post process works! They both work fine for me too so we don't know what his problem is yet. On Sat, Jun 25, 2016 at 4:19 AM Brendon J. Brewer [email protected] wrote:

dnest4.classic.postprocess() and dnest4.analysis.postprocess() both work for me with those output files*. The former could be a workaround for now.

  • They yield very slightly different logZs, which I wasn't expecting. I thought we checked this!

— You are receiving this because you were assigned.

Reply to this email directly, view it on GitHub https://github.com/eggplantbren/DNest4/issues/10#issuecomment-228506208, or mute the thread https://github.com/notifications/unsubscribe/AAVYSgIKx9ALhoMZomH_KD7d70pmos_-ks5qPJ47gaJpZM4I-Ky3 .

dfm avatar Jun 25 '16 07:06 dfm

Just getting to look at this again now--- still nans for me doing what Dan suggests above. I'll try it in a fresh environment to help try to isolate what's going on.

On Sat, Jun 25, 2016 at 3:49 AM Dan Foreman-Mackey [email protected] wrote:

That's a work around only if the classic post process works! They both work fine for me too so we don't know what his problem is yet. On Sat, Jun 25, 2016 at 4:19 AM Brendon J. Brewer < [email protected]> wrote:

dnest4.classic.postprocess() and dnest4.analysis.postprocess() both work for me with those output files*. The former could be a workaround for now.

  • They yield very slightly different logZs, which I wasn't expecting. I thought we checked this!

— You are receiving this because you were assigned.

Reply to this email directly, view it on GitHub <https://github.com/eggplantbren/DNest4/issues/10#issuecomment-228506208 , or mute the thread < https://github.com/notifications/unsubscribe/AAVYSgIKx9ALhoMZomH_KD7d70pmos_-ks5qPJ47gaJpZM4I-Ky3

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/eggplantbren/DNest4/issues/10#issuecomment-228520773, or mute the thread https://github.com/notifications/unsubscribe/ABzr21egRae0qDs0XRMKQB7bPxDafPlsks5qPN1zgaJpZM4I-Ky3 .

timothydmorton avatar Jun 27 '16 13:06 timothydmorton

I've repeated this in a fresh and minimal conda environment, which I've posted here.

timothydmorton avatar Jun 27 '16 13:06 timothydmorton

Interesting. It must be a Python 2 thing then. I'll try to debug and get back to you.

dfm avatar Jun 28 '16 08:06 dfm