Skip to main content

A unified interface for probabilistic inference in JAX + Equinox

Project description

Inferix: A unified interface for probabilistic inference in JAX + Equinox

Inferix
Author Gary Allen
Homepage github.com/gvcallen/inferix

Installation

Inferix can be installed using pip directly:

pip install inferix

Motivation

In the JAX ecosystem, you typically have to choose between two extremes for Bayesian inference:

  • Wrappers around lower-level drivers (like BlackJAX or PolyChord), which force you to manually manage while-loops, PRNG keys, buffers, and algorithmic states.
  • High-level Probabilistic Programming Languages (PPLs) (like NumPyro or PyMC), which are user-friendly but force you to rewrite your models using their specific domain-specific languages and distribution primitives.

The goal of Inferix is to be a middle option that mirrors the API of Optimistix. It is designed for engineers and scientists who already have a forward model written in pure JAX, and just want to sample from it without managing boilerplate or adopting a heavy PPL framework.

Inferix wraps low-level algorithms in a unified interface (inferix.mcmc_sample or inferix.nested_sample) and handles any host-bridge, XLA-compiled control flow, reparameterizations and data packaging. Current kernels include JAX-native NUTS and Nested Slice Sampling (via BlackJAX), and a host-bridged PolyChord.

import jax
import jax.numpy as jnp
import inferix

# 1. Define your target functions (Pure JAX)
def my_likelihood(theta, args):
    # e.g., A complex differentiable physics simulation
    return ... 

def my_prior_transform(u, args):
    # A mapping from the uniform unit hypercube coordinates u to physical parameters theta
    return ...

# 2. Instantiate your sampler of choice e.g. inferix.NUTS, inferix.NSS or inferix.PolyChord
sampler = inferix.NSS(num_delete=10, num_inner_steps=20, logZ_convergence=1e-3)

# 3. Execute the run
key = jax.random.PRNGKey(42)
result = inferix.nested_sample(
    log_likelihood_fn=my_likelihood,
    prior_transform_fn=my_prior_transform,
    sampler=sampler,
    key=key,
)

# 4. Access the results
print(f"Final log-Evidence (logZ): {result.logZ} ± {result.logZ_err}")
print(f"Num samples: {result.samples.shape[0]}")

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

inferix-0.1.6.tar.gz (3.3 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

inferix-0.1.6-py3-none-any.whl (18.1 kB view details)

Uploaded Python 3

File details

Details for the file inferix-0.1.6.tar.gz.

File metadata

  • Download URL: inferix-0.1.6.tar.gz
  • Upload date:
  • Size: 3.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for inferix-0.1.6.tar.gz
Algorithm Hash digest
SHA256 0c433e537b08b4bfb81959b2c4b44ce3d7c7b1b71e627d226e033e462ea88427
MD5 f89d9ec21d7db7dd3eadf9cc9cf8a3bb
BLAKE2b-256 6787da5d31e4d21857c4130b1c48d3985cbdeef78e84a0c663c7b1a0dcb8777c

See more details on using hashes here.

Provenance

The following attestation bundles were made for inferix-0.1.6.tar.gz:

Publisher: publish.yml on gvcallen/inferix

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file inferix-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: inferix-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 18.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for inferix-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 6e05476bb59ee21c3d94ecda48ae7b0f099944a608fe6667a0ba67d012b23e52
MD5 864f8be6013ee421c1a2a4ef059a8444
BLAKE2b-256 84ad25e7084a2c590a7bbc3d36c054062efc4de3b3dce193b45301f9a3bf18cd

See more details on using hashes here.

Provenance

The following attestation bundles were made for inferix-0.1.6-py3-none-any.whl:

Publisher: publish.yml on gvcallen/inferix

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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