Closed segasai closed 2 years ago
I second that this would be a nice feature to have. At some point in the past this was considered too complicated to implement (https://github.com/joshspeagle/dynesty/issues/98) but I wonder if that has changed in the last ~3 years.
I have started a test branch for possibly way of implementing this change https://github.com/joshspeagle/dynesty/tree/extra_info that will still need a lot of work and it may still not be the right approach, but we'll see
The idea is to basically encapsulate the output of the loglikelihood function inside a special object that can store logl and auxiliary info and still support comparisons etc. This way in theory the changes to other bits of code should be small enough.
This has been merged now
This is the issue to discuss the way of saving the quantities derived during the likelihood function evaluations. Sometimes the likelihood function does some heavy calculations and compute some derived quantities that are useful to look at after sampling. Currently the only way to look at those is to rerun the likelihood function evaluations on posterior samples.
I think it is worth having the interface for that. (unless it's already possible now somehow)
My first guess is we can store the derived quantities in RunRecord https://github.com/joshspeagle/dynesty/blob/a0acba285a1ecabc4af380c43d286112fc74b6ef/py/dynesty/utils.py#L163 The question is what is the best way to return those derived quatities, without having to write a lot of code in many places and making incompatible changes. We can possibly allow likelihood function return either a value or a tuple (logl, derived_quantities_vector) and hide the code inside this https://github.com/joshspeagle/dynesty/blob/eff15474063920c8e32bc6357e047515f5986cb2/py/dynesty/utils.py#L49 logl wrapper