mattpitkin / CW_nested_sampling_doc

Documentation for the nested sampling code used in targeted searches for continuous gravitational waves from pulsars
2 stars 1 forks source link

nested sampling variants #3

Open JohannesBuchner opened 6 years ago

JohannesBuchner commented 6 years ago

Dear @mattpitkin,

I see from your paper that you are investigating various proposals within nested sampling, and some show issues. If your problem is not too high-dimensional (<20d), may I take the liberty to suggest another proposal, RadFriends (see https://arxiv.org/abs/1407.5459 ). It is rather simple: From the live points, a neighbourhood is constructed, and samples are drawn from there directly. That neighbourhood is defined by spheres around the whose radius is determined by bootstrapping leave-out of live points; but I would recommend using a standardized euclidean distance (instead of a normal euclidean distance).

The benefit is that this algorithm is parameter-free (aside from nlive_points) and gives guarantees for the correctness (uniform sampling from the prior). I have Javascript, C and Python implementations on my github profile.

Cheers, Johannes

mattpitkin commented 6 years ago

Hi Johannes, thanks for this suggestion. I'll take a look and see if it can be useful for us. I'll also bring in @johnveitch and @wdpozzo who may want to give it a try in their cpnest code.

Cheers,

Matt

johnveitch commented 6 years ago

Thanks for the pointer @JohannesBuchner I'll check it out. The test in that code also looks interesting! I see you've got a python multinest project too, was that what you used for the paper?

JohannesBuchner commented 6 years ago

pymultinest is merely a bridge for MultiNest to use Python likelihood function (but also can do analysis and plotting of MultiNest outputs). I use it in my integration algorithm testing framework (and frequently in research work), but for the statistical test I applied in the paper I wrote the likelihood function in C.

JohannesBuchner commented 6 years ago

For a python implementation of multinest, see https://github.com/kbarbary/nestle/

mattpitkin commented 6 years ago

@JohannesBuchner - is UltraNest the best place to look for examples of this method?

JohannesBuchner commented 6 years ago

Python implementation: https://github.com/JohannesBuchner/UltraNest/blob/master/nested_sampling/samplers/friends.py look at the cluster() and draw_constrained() methods, assuming hinter is None, self.jackknife = False.

Javascript implementation: You can watch the reconstructed region here: https://chi-feng.github.io/mcmc-demo/app.html#RadFriends-NS,banana line 89-300: https://github.com/JohannesBuchner/mcmc-demo/blob/master/algorithms/NSRadFriends.js#L89

C implementation: https://github.com/JohannesBuchner/UltraNest/blob/master/ultranest/draw.c The nearest_rdistance_guess functions called here (in common.c) uses jackknife at the moment instead of bootstrapping which can make the regions too small.

Btw, you may be interested in the checkpointing method implemented in https://github.com/JohannesBuchner/UltraNest/blob/master/ultranest/sampler.c It allows continuing from crashes, but also allows aborting and restarting with a different number of live points. The key is to store the Lmin threshold was generated from next to the sample, then it can be reused for any time a new sample is needed with a equal or higher Lmin threshold.