Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Implementations of single and multi-ellipsoid nested sampling

License

NotificationsYou must be signed in to change notification settings

TuringLang/NestedSamplers.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build StatusPkgEvalCoverageLICENSE

StableDev

Implementations of single- and multi-ellipsoidal nested sampling algorithms in pure Julia. We implement theAbstractMCMC.jl interface, allowing straightforward sampling from a variety of statistical models.

This package was heavily influenced bynestle,dynesty, andNestedSampling.jl.

Citing

DOI

If you use this library, or a derivative of it, in your work, please consider citing it. This code is built off a multitude of academic works, which have been noted in the docstrings where appropriate. These references, along with references for the more general calculations, can all be found inCITATION.bib

Installation

To use the nested samplers first install this library

julia> ]add NestedSamplers

Usage

For in-depth usage, see theonline documentation. In general, you'll need to write a log-likelihood function and a prior transform function. These are supplied to aNestedModel, defining the statistical model

using NestedSamplersusing Distributionsusing LinearAlgebralogl(X)=logpdf(MvNormal([1,-1], I), X)prior(X)=4.* (X.-0.5)# or equivalentlypriors= [Uniform(-2,2),Uniform(-2,2)]model=NestedModel(logl, priors)

after defining the model, set up the nested sampler. This will involve choosing the bounding space and proposal scheme, or you can rely on the defaults. In addition, we need to define the dimensionality of the problem and the number of live points. More points results in a more precise evidence estimate at the cost of runtime. For more information, see the docs.

bounds= Bounds.MultiEllipsoidprop= Proposals.Slice(slices=10)# 1000 live pointssampler=Nested(2,1000; bounds=bounds, proposal=prop)

once the sampler is set up, we can leverage all of theAbstractMCMC.jl interface, including the step iterator, transducer, and a conveniencesample method. Thesample method takes keyword arguments for the convergence criteria.

Note: both the samplesand the sampler state will be returned bysample

using StatsBasechain, state=sample(model, sampler; dlogz=0.2)

you can resample taking into account the statistical weights, again using StatsBase

chain_resampled=sample(chain,Weights(vec(chain["weights"])),length(chain))

These are chains fromMCMCChains.jl, which offer a lot of flexibility in exploring posteriors, combining data, and offering lots of convenient conversions (like toDataFrames).

Finally, we can see the estimate of the Bayesian evidence

using Measurementsstate.logz± state.logzerr

Contributions and Support

ColPrac: Contributor's Guide on Collaborative Practices for Community Packages

Primary Author: Miles Lucas (@mileslucas)

Contributions are always welcome! In general, contributions should followColPrac. Take a look at theissues for ideas of open problems! To discuss ideas or plan contributions, open adiscussion.


[8]ページ先頭

©2009-2025 Movatter.jp