Skip to main content

nessai-torch

DOI PyPI Tests

Implementation of nessai: nested sampling with artificial intelligence in PyTorch.

Installation

nessai-torch can be install using pip:

pip install nessai-torch

We recommend installing PyTorch first to ensure the version is compatible with your system.

Basic usage

nessai-torch has a different API to nessai, the user must define a log-likelihood function and a prior-transform function instead of a model object. It also has a reduced feature set compared to standard nessai. The basic usage is shown below, for a more complete example, see the examples directory.

from nessai_torch.sampler import Sampler

# Define the log-likelihood and prior transform
...

sampler = Sampler(
	log_likelihood=log_likelihood_fn,
	prior_transform=prior_transform_fn,
	dims=dims,  # Number of dimensions
)

# Run the sampler
sampler.run()

Note that both the log_likelihood and prior_transform must be vectorized.

Citing

If you use nessai-torch in your work please cite the DOI and the relevant papers:

@article{Williams_2021,
	doi = {10.1103/physrevd.103.103006},
	url = {https://doi.org/10.1103%2Fphysrevd.103.103006},
	year = 2021,
	month = {may},
	publisher = {American Physical Society ({APS})},
	volume = {103},
	number = {10},
	author = {Michael J. Williams and John Veitch and Chris Messenger},
	title = {Nested sampling with normalizing flows for gravitational-wave inference},
	journal = {Physical Review D}
}

@article{Williams_2023,
	doi = {10.1088/2632-2153/acd5aa},
	url = {https://doi.org/10.1088%2F2632-2153%2Facd5aa},
	year = 2023,
	month = {jul},
	publisher = {{IOP} Publishing},
	volume = {4},
	number = {3},
	pages = {035011},
	author = {Michael J. Williams and John Veitch and Chris Messenger},
	title = {Importance nested sampling with normalising flows},
	journal = {Machine Learning: Science and Technology}
}

Metadata

Release files for nessai-torch 0.1.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 nessai-torch 0.1.0
File Size Uploaded
nessai_torch-0.1.0.tar.gz 24.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nessai-torch 0.1.0
File Interpreter ABI Platform
nessai_torch-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 47.1 kB

Release files / nessai_torch-0.1.0.tar.gz

Download URL nessai_torch-0.1.0.tar.gz
Size 24.2 kB
Tags Source
SHA-256 checksum
How to use checksums
202a31497402c1efb4b221501db7d3584ac793926164dd5aad0743b23baed79f
BLAKE2b-256 checksum
How to use checksums
eee75f29deef0a67251de421fca35c0c26bdd427f474f99fd4402e7d3058c32e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.0.0 CPython/3.12.3

Release files / nessai_torch-0.1.0-py3-none-any.whl

Download URL nessai_torch-0.1.0-py3-none-any.whl
Size 22.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9f3c30b1ad43752c99861c814fc74a06efa71c43c466b4d8c38a1edb2c5a3124
BLAKE2b-256 checksum
How to use checksums
8b56711c979700b9ccbb80fb48922470621d6358f37d5816ee14a7cd51fdc97c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.0.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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