joshspeagle / dynesty

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

Make resample_equal shuffle the array #408

Closed segasai closed 1 year ago

segasai commented 1 year ago

Currently the resample_equal https://github.com/joshspeagle/dynesty/blob/8f4d73f7f4c2af7dee1a8f4a5d91c75ebca494c6/py/dynesty/utils.py#L982

returns equally weighted samples, but it returns them in the original order. (i.e. increasing likelihood). This maybe a bit unexpected, because people may just want first N samples from it. The proposal is to make the result shuffled (at least by default). Options are either to just shuffle always, or add an option to do that. I'm inclined to just always shuffle. Comments ?

joshspeagle commented 1 year ago

This is a good point and an easy change. I agree that shuffling should be enabled always rather than being a specific flag (the end user can just sort the shuffled array if they want the likelihoods in order).

segasai commented 1 year ago

Done with 6fdeb04e84b7bae2c16a75f1d97b54effd641530