Skip to main content

bilby-laplace

A Bilby sampler plugin that estimates posteriors via the Laplace approximation — a Gaussian fitted at the maximum a posteriori (MAP) point using the Hessian of the log-posterior — followed by optional resampling to correct for non-Gaussianity.

The method is fast, scales well to moderate dimensions, and produces asymptotically exact posterior samples when the true posterior is close to Gaussian. It is useful as a cheap cross-check against nested sampling results.

Documentation: full guides, the configuration/API reference, and background on the method are at https://gregoryashton.github.io/bilby-laplace/.

Originally derived from bilby PR #933.

Installation

pip install bilby-laplace

Or from source:

git clone https://github.com/GregoryAshton/bilby-laplace
cd bilby-laplace
pip install -e .

Bilby discovers the sampler automatically via its plugin entry-point system — no further configuration is needed.

Quick start

import bilby

result = bilby.run_sampler(
    likelihood=likelihood,
    priors=priors,
    sampler="laplace",
    outdir="outdir",
    label="my_run",
)

result.plot_corner()
print(result.posterior)

Features

  • Several resampling strategies to correct for non-Gaussianity: rejection, importance, inprior, smc (via aspire), or none.
  • Two covariance routes: the numerical Hessian (fisher_method="hessian", any likelihood) or the genuine waveform Fisher matrix (fisher_method="waveform", for gravitational-wave likelihoods).
  • Supply a precomputed covariance via sampling_cov (e.g. from gwfast / GWFish).
  • Multimodal posteriors via SMC with n_modes > 1.
  • Laplace log-evidence always available; rejection and SMC add independent estimates.

See the documentation for the full list of options and guidance on choosing between them.

Examples

Runnable examples are in examples/ (gaussian, rosenbrock, BBH, BNS). Each has a Makefile:

cd examples/gaussian
make laplace
make compare

Citing

If you use bilby-laplace, please cite the software release; citation metadata is in CITATION.cff (GitHub's "Cite this repository" button reads it).

License

MIT; see LICENSE.

Documentation development

pip install -e ".[docs]"
mkdocs serve

Metadata

Release files for bilby-laplace 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bilby-laplace 0.2.0
File Size Uploaded Provenance Actions
bilby_laplace-0.2.0.tar.gz 191.9 kB With provenance Details for bilby_laplace-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for bilby-laplace 0.2.0
File Interpreter ABI Platform Actions
bilby_laplace-0.2.0-py3-none-any.whl Python 3 none any Details for bilby_laplace-0.2.0-py3-none-any.whl

Total release size: 307.0 kB

Release files / bilby_laplace-0.2.0.tar.gz

Download URL bilby_laplace-0.2.0.tar.gz
Size 191.9 kB
Tags Source
SHA-256 checksum
How to use checksums
29c79961095c228e6dac3dd0e616c3ad4329d0d4bd34f8e2d092b8459937b537
BLAKE2b-256 checksum
How to use checksums
b4b28b1e9abffe6b7c083e7422e44831a9f645f9fce28fd8cb1032458942c941
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Release files / bilby_laplace-0.2.0-py3-none-any.whl

Download URL bilby_laplace-0.2.0-py3-none-any.whl
Size 115.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
da9e84ffe0b782fae2b248d8580b1fba800b865a6dd29cdc3cd26536ece817ad
BLAKE2b-256 checksum
How to use checksums
5d30ed02d7f3ff018ef0495082154b89f44d22debddd25a5185f2057d4c68e3f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Security for bilby-laplace 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for bilby_laplace-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page