Lightweight log-space nested sampling for Bayesian inference
Project description
BayesNest
BayesNest is a lightweight, log-space nested sampler for Bayesian inference, supporting multimodal and non-Gaussian posteriors. It includes both naive rejection sampling and ellipsoidal constrained sampling (inspired by MultiNest), and computes both posterior samples and Bayesian model evidence.
Features
- Log evidence computation
- Posterior sampling with log-weights
- Support for multimodal inference via ellipsoidal sampling
- Corner plot visualization of posteriors
- Convergence diagnostics for log-evidence
Installation
pip install bayesnest
Example: Linear Gaussian Model
Once installed, you can run the examples found in the github repo
python examples/linear_gaussian_example.py
This will:
-
Simulate data from a linear Gaussian model
-
Use nested sampling to estimate the posterior distribution over slope
aand interceptb -
Print the posterior mean and log evidence
-
Generate a 2D corner plot of the posterior distribution plot
-
Show the evolution of the log-evidence estimate over iterations
Example: Multimodal Posterior
A synthetic example with two separated Gaussian modes is also found in the github repo
python examples/multimodal_example.py
This example will:
-
Define a 2D likelihood with two disjoint Gaussian peaks
-
Sample using ellipsoidal decomposition
-
Reveal both modes in the posterior distribution plot
-
Demonstrate ellpisoid nested sampling’s strength in handling multimodal distributions
Expected output:
-
A bimodal posterior in the corner plot
-
A log-evidence trace that reflects both modes properly being integrated
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bayesnest-0.1.4.tar.gz.
File metadata
- Download URL: bayesnest-0.1.4.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cb616faf034d0d8096d14c47b92f8710580d808876360704d381d520c4e4e833
|
|
| MD5 |
aeb94eb9df31f4367034a736a378ab9b
|
|
| BLAKE2b-256 |
87d2cc382c61c7c5dd3343c9d32e25528a5b73f150b8dad46270653a673ace63
|
File details
Details for the file bayesnest-0.1.4-py3-none-any.whl.
File metadata
- Download URL: bayesnest-0.1.4-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3825c465c4189c97b06e8fc71c166b1fc0ed4b1d66382edde447605ccda7585d
|
|
| MD5 |
74333e34d2a66ec773d11cee6b9584f0
|
|
| BLAKE2b-256 |
a83c2d1a8b96baf4b379c6c72ac9d532c48bfc04fc56810882766a81953d069d
|