eggplantbren / DNest4

Diffusive Nested Sampling
MIT License
60 stars 21 forks source link

Python postprocessing functions yielding different results #3

Open tripathi opened 8 years ago

tripathi commented 8 years ago

Hi!

When running the Gaussian python example from commit 190180.. on a Mac (OSX10.10) with Python 2.7, it runs into NaNs for log_x_diff, and thus log_z when calculated by analysis.py's postprocess->compute_stats function. See analysispy.txt

However, if I manually postprocess the output using the postprocess function in deprecated.py, I get a reasonable value for log_z. See deprecatedpy.txt

Should I continue to use the deprecated function?

Note I've used MACOSX_DEPLOYMENT_TARGET=10.10 python setup.py install for builds (although I get the same result with TARGET=10.9).

dfm commented 8 years ago

I can't reproduce this even with the same commit. What version of numpy? It's doing something weird with the way it handles underflow...

tripathi commented 8 years ago

Thanks for the quick response! I have numpy 1.9.2 (installed using canopy).

dfm commented 8 years ago

Can you also attach the text files that the Gaussian example saves?

tripathi commented 8 years ago

posterior_sample.txt weights.txt levels.txt sample_info.txt sample.txt sampler_state.txt sample_log_X.txt (You can see all the infs) stats.txt

Note these are from a different run as that mentioned above, so I'm also attaching the new log file newlog.txt

Thanks!

omaclaren commented 8 years ago

(I just came across the same issue btw - I'll try to post a more informative comment later)

eggplantbren commented 8 years ago

The workaround is to always use

import dnest4.classic
dnest4.classic.postprocess()
omaclaren commented 8 years ago

Awesome, thanks, this worked for me.

And, I just realised that this is also discussed under https://github.com/eggplantbren/DNest4/issues/10

(sorry!). So to confirm - classic works for me but the default doesn't (i.e. it gives nans). I'm running Python 2.7.11.