joshspeagle / dynesty

Dynamic Nested Sampling package for computing Bayesian posteriors and evidences
https://dynesty.readthedocs.io/
MIT License
357 stars 77 forks source link

Saving history of likelihood evaluations #235

Closed segasai closed 3 years ago

segasai commented 3 years ago

Hi,

following earlier discussion, I propose a test patch that implements optional saving of all likelihood evaluations (in an hdf5 file). This is done by wrapping the likelihood function and occasionally dumping things into a file.

If there are no objections, I can tie a few loose ends, i.e. ensure that the last few calls are not lost and adding some docs.

(on a separate note, the use_pool dictionaries need a set of tests).

segasai commented 3 years ago

I've just tested this on the test eggbox problem with 100 live points. And the results were pretty surprising and instructive: fig this is a histogram of all likelihood evaluations. In retrospect it's not that surpising, but still I didn't expect that kind of behaviour of ellipsoids 'hugging individual modes and becoming extremely elongated. That is certainly a useful a diagnostics tool IMO.

joshspeagle commented 3 years ago

If there are no objections, I can tie a few loose ends, i.e. ensure that the last few calls are not lost and adding some docs.

Yes, that sounds good. If you're satisfied with what you have now, I can look into merging this in. The syntax looks reasonable to me.

(on a separate note, the use_pool dictionaries need a set of tests).

Yes, I don't have any pool-based tests set up right now. Including those would be useful.

In retrospect it's not that surprising, but still, I didn't expect that kind of behaviour of ellipsoids 'hugging individual modes and becoming extremely elongated. That is certainly a useful diagnostic tool IMO.

Agreed.

segasai commented 3 years ago

I've updated the branch, added a bit of docs. assuming it passes the tests, it's ready to be reviewed/merged

joshspeagle commented 3 years ago

Looks good to me. Merging this in.