JohannesBuchner / UltraNest

Fit and compare complex models reliably and rapidly. Advanced nested sampling.
https://johannesbuchner.github.io/UltraNest/
Other
142 stars 30 forks source link

logl values associated with equally weighted samples #86

Closed lboogaard closed 1 year ago

lboogaard commented 1 year ago

Thanks a lot for Ultranest. I am interested in the likelihood of the points in the final set of samples. I noticed the logl associated with each sample is not saved in equal_weighted_post.txt, is there a reason for this? Currently I just recall utils.resample_equal on the samples including the logl values from weighted_post.txt to recreate them - is there anything against this?

JohannesBuchner commented 1 year ago

That's fine and how the equally weighted posterior samples are created internally (in all nested samplers).

If you need the likelihood of the posterior samples, I suspect you are doing something dodgy though ... What do you need it for?

lboogaard commented 1 year ago

Mostly bookkeeping actually: I'm optimizing a larger model for which I recompute the full output on the equally weighted posterior samples (to speed-up during optimization, I only compute the subset of the output relevant for comparing to the actual observables we have).

I'm now curious what the outputs actually look like for the samples that produced highest likelihood. Hence it seems useful to still have the likelihoods associated with the samples.

JohannesBuchner commented 1 year ago

Yeah, considering the likelihood isn't really a Bayesian approach because it doesn't consider the prior density, I'd usually just grab the first hundred or so posterior points to work with (e.g., plot the model fit). In many cases both approaches end up behaving similarly though.

lboogaard commented 1 year ago

Yes, of course - thanks for the clarifications!