eggplantbren / DNest4

Diffusive Nested Sampling
MIT License
62 stars 22 forks source link

getting nan in gaussian.py example #10

Open timothydmorton opened 8 years ago

timothydmorton commented 8 years ago

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...]
dfm commented 8 years ago

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?

timothydmorton commented 8 years ago

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 commented 8 years ago

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

dfm commented 8 years ago

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 commented 8 years ago

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

from dnest4.analysis import postprocess
postprocess()

Still nans?

eggplantbren commented 8 years ago

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

dfm commented 8 years ago

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 notifications@github.com 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 .

timothydmorton commented 8 years ago

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 notifications@github.com 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 < notifications@github.com> 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 commented 8 years ago

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

dfm commented 8 years ago

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