Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

aspire: Accelerated Sequential Posterior Inference via REuse

DOI PyPI Documentation Status tests

aspire is a framework for reusing existing posterior samples to obtain new results at a reduced cost.

Installation

aspire can be installed from PyPI using pip

pip install aspire-inference

Important: the name of aspire on PyPI is aspire-inference but once installed the package can be imported and used as aspire.

Quickstart

import numpy as np
from aspire import Aspire, Samples

# Define a log-likelihood and log-prior
def log_likelihood(samples):
    x = samples.x
    return -0.5 * np.sum(x**2, axis=-1)

def log_prior(samples):
    return -0.5 * np.sum(samples.x**2, axis=-1)

# Create the initial samples
init = Samples(np.random.normal(size=(2_000, 4)))

# Define the aspire object
aspire = Aspire(
    log_likelihood=log_likelihood,
    log_prior=log_prior,
    dims=4,
    parameters=[f"x{i}" for i in range(4)],
)

# Fit the normalizing flow
aspire.fit(init, n_epochs=20)

# Sample the posterior
posterior = aspire.sample_posterior(
    sampler="smc",
    n_samples=500,
    sampler_kwargs=dict(n_steps=100),
)

# Plot the posterior distribution
posterior.plot_corner()

Documentation

See the documentation on ReadTheDocs.

Citation

If you use aspire in your work please cite the DOI and paper.

Metadata

Release files for aspire-inference 0.1.0a9

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

Source distribution (sdist)

Source distribution for aspire-inference 0.1.0a9
File Size Uploaded
aspire_inference-0.1.0a9.tar.gz 56.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for aspire-inference 0.1.0a9
File Interpreter ABI Platform
aspire_inference-0.1.0a9-py3-none-any.whl Python 3 none any Details

Total release size: 100.0 kB

Release files / aspire_inference-0.1.0a9.tar.gz

Download URL aspire_inference-0.1.0a9.tar.gz
Size 56.2 kB
Tags Source
SHA-256 checksum
How to use checksums
a8f978a4fccbbc9e2b8fa4aef6c8a802804885f30c159156fd71c55946c01521
BLAKE2b-256 checksum
How to use checksums
f3a9b6e46597d4a9019fbb754c364a78b7c94aeb0d1afd3a2ef3d2faf7b3f4a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Dec 1, 2025.

Transparency log

Release files / aspire_inference-0.1.0a9-py3-none-any.whl

Download URL aspire_inference-0.1.0a9-py3-none-any.whl
Size 43.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2f10c6bc5c7bc08911b65cb9dc02084430aae423d2786ba18ed46532b7f676cf
BLAKE2b-256 checksum
How to use checksums
fc41b8cbc7f5dca503cbe3be057d839358661811828143200be26712e25e8b5c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Dec 1, 2025.

Transparency log
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