Skip to main content

nessai in pure PyTorch

Project description

nessai-torch

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}
}

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

nessai_torch-0.1.0rc1.tar.gz (24.0 kB view details)

Uploaded Source

Built Distribution

nessai_torch-0.1.0rc1-py3-none-any.whl (22.7 kB view details)

Uploaded Python 3

File details

Details for the file nessai_torch-0.1.0rc1.tar.gz.

File metadata

  • Download URL: nessai_torch-0.1.0rc1.tar.gz
  • Upload date:
  • Size: 24.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for nessai_torch-0.1.0rc1.tar.gz
Algorithm Hash digest
SHA256 6ec3a457350a49d2abe78803413b2a3f5790e9f9cc04a44cfb639039612ac443
MD5 d2815f1f93f9f18ca67910312234cdce
BLAKE2b-256 2f9e6ba9c1dfb5c87191006f4a7aa89827d712fa523194906f01345b6d516397

See more details on using hashes here.

File details

Details for the file nessai_torch-0.1.0rc1-py3-none-any.whl.

File metadata

File hashes

Hashes for nessai_torch-0.1.0rc1-py3-none-any.whl
Algorithm Hash digest
SHA256 20567a36ea71319e6aa90b586f27cd7c58531a8e0f3eedf8269d2e2fe1a0a291
MD5 24a7ce37e400ed1d1aa9a394e2bf3cdf
BLAKE2b-256 c9553fc60bcc34fa6332b194c600b3f71d216cce41c9d835b1d6bd2120686178

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page