joshspeagle / dynesty

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

Implementing an elliptical slice sampler #426

Closed mvsoom closed 1 year ago

mvsoom commented 1 year ago

I want to implement a custom slice sampler, namely the elliptical slice sampler (ESS). Context: I have a problem with Gaussian priors for which ESS works well and I would like to check if I can transport this efficiency to nested sampling.

I was browings the code today to see whether it would be possible. It seems like I only have to reimplement the generic_slice_step function. Is that right (first question)? Does slice sampling in dynesty take into account the bounding distributions as is done for example in generic_random_walk (second question)?

Thanks!

segasai commented 1 year ago

Hi,

My suggestion is to implement the sample_ellslice similarly to sample_rwalk, sample_rslice. Then you should be able to provide that function directly to dynesty.NestedSampler, i.e. NestedSampler(sample=sasmple_ellslice)

Regarding the existing slice sampling, yes it does take into account boundaries, it is used to choose the scale of the step, and 'metric' (using the ellipsoid parameters to generate random directions)

Also, I'll say that I am hoping to rewrite/restructure the sampling structure in dynesty ( #391 ) to make it more easy to add new samplers, so the integration of the new sampler into dynesty (if that's your goal), may wait till this is implemented.

mvsoom commented 1 year ago

OK, thanks for the reply!