Closed dilpath closed 1 year ago
I agree that's a bit of oversight. I'll think of a proper solution. But there is a way of getting equally sampled indices through this
In [1]: xs=np.random.normal(size=(1000,3))
In [2]: wts = np.random.uniform(size=1000);wts=wts/wts.sum()
In [3]: import dynesty.utils
In [4]: indx=dynesty.utils.resample_equal(np.arange(1000),wts)
Now indx will be indices that you can use to index the samples, log-likelihoods etc
Works well! Thanks for the quick response.
Firstly, thanks for the nice package! I've been implementing an interface in the pyPESTO [1] package, and so far it's been very useful! For it to work "well" there, I would need a couple of adjustments, hence this and the next issue.
Dynesty version
pip install dynesty==2.0.3
Describe the bug
dynesty
provides the ability to get an MCMC-like chain withsampler.results.samples_equal()
[2]. However, this doesn't provide the correspondingsampler.results.logl
values too. It would be great if there was someindex_resampled=sampler.results.samples_equal_index()
method that provides the index of samples returned bysampler.results.samples_equal()
. I could then get corresponding samples and log-likelihood withsampler.results.samples[index_resampled]
andsampler.results.logl[index_resampled]
.The alternative is to construct
index_resampled
by searchingsampler.results.samples
for the samples returned bysampler.results.samples_equal
, get their index, then use that asindex_resampled
. However, my attempt at this was quite slow.[1] https://github.com/ICB-DCM/pyPESTO [2] https://github.com/joshspeagle/dynesty/blob/a24b5c38e553dd47d4d5efe9e80228879266c08d/py/dynesty/utils.py#L726-L734