joshspeagle / dynesty

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

Allow saving additional information returned by the likelihood function #395

Closed segasai closed 1 year ago

segasai commented 1 year ago

Starting implementation of #368 The function can now return an additional blob The tests should pass, but the additional info is not saved yet. early feedback welcome

coveralls commented 1 year ago

Pull Request Test Coverage Report for Build 3108342513


Changes Missing Coverage Covered Lines Changed/Added Lines %
py/dynesty/dynamicsampler.py 33 34 97.06%
py/dynesty/utils.py 23 25 92.0%
<!-- Total: 82 85 96.47% -->
Totals Coverage Status
Change from base Build 3088827015: 0.06%
Covered Lines: 3950
Relevant Lines: 4361

💛 - Coveralls
segasai commented 1 year ago

This is now a workign version that allows the likelihood to return an arbitrary 1d numpy array (optionally) if blob=True option is specified in the sampler. Those are stored in results.blob attribute the example is in the test/test_blob.py the docs are absent It is unclear whether the name for the 'blob' is the best one, the tests need to be expanded to include pools and resuming.

segasai commented 1 year ago

I think this is ready for review. It'd be great to have a second look on this. After excluding docs/tests the patch is surprisingly small and not too difficult. The performance effects are probably non-zero given the overhead of objects etc (at least the test suite on my machine seemed to slow down by ~ 2.5%, but that's probably small enough to not worry about it) Also I am thinking of making the next version 2.0 given this change and the checkpointing..