brinckmann / montepython_public

Public repository for the Monte Python Code
MIT License
93 stars 80 forks source link

add ultranest and snowline samplers #315

Open JohannesBuchner opened 1 year ago

JohannesBuchner commented 1 year ago

This is a work-in-progress to add two more samplers:

  1. https://johannesbuchner.github.io/UltraNest/ is a nested sampler that can be operated in two modes: (1) with MLFriends, a parameter-free safe algorithm, efficient in low dimensions and (2) with slice-sampling.
  2. https://johannesbuchner.github.io/snowline/ combines a optimizer (iminuit) with importance sampling.

The commits provide some basic documentation, and allows sampling.

Reading the output posteriors and evidence still needs work.

Please let me know if you are interested in merging this in principle.

brinckmann commented 1 year ago

Dear Johannes,

I'd love to have these added to MontePython! As a frequent user of MultiNest I'm particularly interested in getting UltraNest added. Do you need any help from our side?

Best, Thejs

JohannesBuchner commented 1 year ago

Great!

Yes, if you could handle how to deal with the UltraNest output? I did not touch "from_NS_output_to_chains"

The PR works for me to run the sampling to completion.

sampler.run() gives you all the results (posterior samples, evidence, etc) directly. Alternatively you can read them from the output files (similar to multinest's).

Snowline works the same way, you get results['samples'], results['logz'], results['logzerr']. Snowline does not store to disk by itself.

Documentation of output files: https://johannesbuchner.github.io/UltraNest/performance.html#output-files

Doc of the returned results keys: Number of nested sampling iterations (niter), Evidence estimate (logz), Effective Sample Size (ess), H (information gain), weighted samples (weighted_samples), equally weighted samples (samples), best-fit point information (maximum_likelihood), posterior summaries (posterior). https://johannesbuchner.github.io/UltraNest/ultranest.html#ultranest.netiter.combine_results

JohannesBuchner commented 1 year ago

Hi, I just updated this to be compatible with the master branch. This is ready to be merged.