Skip to main content

State-space model inference with JAX

Project description

cuthbert logo

A JAX library for state-space model inference (filtering, smoothing, static parameter estimation).

Disclaimer: The name cuthbert was chosen as a playful nod to the well-known caterpillar cake rivalry between Aldi and M&S in the UK, as the classic state-space model diagram looks vaguely like a caterpillar. However, this software project has no formal connection to Aldi, M&S, or any food products (notwithstanding the coffee drunk during its writeup). cuthbert is simply a fun name for this state-space model library and should not be interpreted as an endorsement, association, or affiliation with any brand or animal themed baked goods.

Discord GitHub PyPI Docs

Goals

  • Simple, flexible and performant interface for state-space model inference.
  • Decoupling of model specification and inference. cuthbert is built to swap between different inference methods without be tied to a specific model specification.
  • Compose with the JAX ecosystem for extensive external tools.
  • Functional API: The only classes in cuthbert are NamedTuples and Protocols. All functions are pure and work seamlessly with jax.grad, jax.jit, jax.vmap etc.
  • Methods for filtering: $p(x_t \mid y_{1:t}, \theta)$.
  • Methods for smoothing: $p(x_{0:T} \mid y_{1:T}, \theta)$ or $p(x_{t} \mid y_{1:T}, \theta)$.
  • Methods for static parameter estimation: $p(\theta \mid y_{1:T})$ or $\text{argmax} p(y_{1:T} \mid \theta)$.
  • This includes support for forward-backward/Baum-Welch, particle filtering/sequential Monte Carlo, Kalman filtering (+ extended/unscented/ensemble), expectation-maximization and more!

Non-goals

Codebase structure

The codebase is structured as follows:

  • cuthbert: The main package with unified interface for filtering and smoothing.
  • cuthbertlib: A collection of atomic, smaller-scoped tools useful for state-space model inference, that represent the building blocks that power the main cuthbert package.
  • docs: Source code for the documentation for cuthbert and cuthbertlib.
  • pkg: Packaging configuration for publishing cuthbert and cuthbertlib to PyPI.
  • tests: Tests for the cuthbert and cuthbertlib packages.

Installation

cuthbert depends on JAX, so you'll need to install JAX for the available hardware (CPU, GPU, or TPU). For example, on computers with NVIDIA GPUs:

pip install -U "jax[cuda13]"

From PyPI

pip install -U cuthbert

Installing cuthbert will also install cuthbertlib. You can also install cuthbertlib on its own:

pip install -U cuthbertlib

Local development (uv)

git clone https://github.com/state-space-models/cuthbert.git
cd cuthbert
uv sync --package cuthbert --extra tests

Local development (pip)

git clone https://github.com/state-space-models/cuthbert.git
cd cuthbert
pip install -e ./pkg/cuthbertlib
pip install -e "./pkg/cuthbert[tests]"

Ecosystem

  • cuthbert is built on top of jax and composes easily with other JAX packages, e.g. optax for optimization, flax for neural networks, and blackjax for (SG)MCMC as well as the PPLs mentioned above.
  • What about dynamax?
    • dynamax is a great library for state-space model specification and inference with discrete or Gaussian state-space models. cuthbert is focused on inference with arbitrary state-space models via e.g. SMC that is not supported in dynamax. However as they are both built on jax they can be used together! A dynamax model can be passed to cuthbert for inference.
  • And particles?
  • Much of the code in cuthbert is built on work from sqrt-parallel-smoothers, mocat and abile.

Contributing

We're always looking for contributions! Check out the contributing guide for more information.

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

cuthbert-0.0.11.tar.gz (37.9 kB view details)

Uploaded Source

Built Distribution

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

cuthbert-0.0.11-py3-none-any.whl (61.2 kB view details)

Uploaded Python 3

File details

Details for the file cuthbert-0.0.11.tar.gz.

File metadata

  • Download URL: cuthbert-0.0.11.tar.gz
  • Upload date:
  • Size: 37.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cuthbert-0.0.11.tar.gz
Algorithm Hash digest
SHA256 3e228e312e6e5d4b98d28b166b029a35694fe34b1f82207bc0a59998d0646bc5
MD5 2f0273a3702e01fab64558b284a6b7e8
BLAKE2b-256 9b8c6241bcc139d934a14189c1a9772044971ff129cae84c5085bcb5716fdd45

See more details on using hashes here.

Provenance

The following attestation bundles were made for cuthbert-0.0.11.tar.gz:

Publisher: pypi.yaml on state-space-models/cuthbert

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

File details

Details for the file cuthbert-0.0.11-py3-none-any.whl.

File metadata

  • Download URL: cuthbert-0.0.11-py3-none-any.whl
  • Upload date:
  • Size: 61.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cuthbert-0.0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 21f426b2cf7d6985f467b6c24d985a5d9ed938fdf65e9dc5cd3decb0b803f652
MD5 58cb2a2be6a067741d952d052a8c7390
BLAKE2b-256 d256b7cddecf7170e1cd81921d57e11c56fa56879822c0266c6027bf3007e467

See more details on using hashes here.

Provenance

The following attestation bundles were made for cuthbert-0.0.11-py3-none-any.whl:

Publisher: pypi.yaml on state-space-models/cuthbert

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