State-space model inference with JAX
Project description
A JAX library for state-space model inference (filtering, smoothing, static parameter estimation).
Disclaimer: The name
cuthbertwas 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).cuthbertis 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.
Goals
- Simple, flexible and performant interface for state-space model inference.
- Decoupling of model specification and inference.
cuthbertis 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
cuthbertareNamedTuples andProtocols. All functions are pure and work seamlessly withjax.grad,jax.jit,jax.vmapetc. - 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
- Tools for defining models and distributions.
cuthbertis not a probabilistic programming language (PPL). But can easily compose withdynamax,distrax,numpyroandpymcin a similar way to howblackjaxdoes. - "SMC Samplers" which sample from a posterior
distribution which is not (necessarily) a state-space model -
blackjaxis great for this.
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 maincuthbertpackage.
docs: Source code for the documentation forcuthbertandcuthbertlib.pkg: Packaging configuration for publishingcuthbertandcuthbertlibto PyPI.tests: Tests for thecuthbertandcuthbertlibpackages.
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
cuthbertis built on top ofjaxand composes easily with other JAX packages, e.g.optaxfor optimization,flaxfor neural networks, andblackjaxfor (SG)MCMC as well as the PPLs mentioned above.- What about
dynamax?dynamaxis a great library for state-space model specification and inference with discrete or Gaussian state-space models.cuthbertis focused on inference with arbitrary state-space models via e.g. SMC that is not supported indynamax. However as they are both built onjaxthey can be used together! Adynamaxmodel can be passed tocuthbertfor inference.
- And
particles?particlesand the accompanying book Sequential Monte Carlo Methods in Practice are wonderful learning materials for state-space models and SMC.cuthbertis more focused on performance and composability with the JAX ecosystem.
- Much of the code in
cuthbertis built on work fromsqrt-parallel-smoothers,mocatandabile.
Contributing
We're always looking for contributions! Check out the contributing guide for more information.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cuthbert-0.0.9.tar.gz.
File metadata
- Download URL: cuthbert-0.0.9.tar.gz
- Upload date:
- Size: 24.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
91fc57ea0e08474945ebc6feaf01c03f1118376c2bc7681f2414fe616026a7fb
|
|
| MD5 |
bda6fcfb63b90255cc888ce441d28c82
|
|
| BLAKE2b-256 |
c54034cf6fe426808a7e4938b97b1ee85abd248a9d10b85cd32b0f3067602307
|
Provenance
The following attestation bundles were made for cuthbert-0.0.9.tar.gz:
Publisher:
pypi.yaml on state-space-models/cuthbert
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cuthbert-0.0.9.tar.gz -
Subject digest:
91fc57ea0e08474945ebc6feaf01c03f1118376c2bc7681f2414fe616026a7fb - Sigstore transparency entry: 1193071348
- Sigstore integration time:
-
Permalink:
state-space-models/cuthbert@0e529bafc245beb984dfc232d8b1b427fd2302b9 -
Branch / Tag:
refs/tags/0.0.9 - Owner: https://github.com/state-space-models
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yaml@0e529bafc245beb984dfc232d8b1b427fd2302b9 -
Trigger Event:
release
-
Statement type:
File details
Details for the file cuthbert-0.0.9-py3-none-any.whl.
File metadata
- Download URL: cuthbert-0.0.9-py3-none-any.whl
- Upload date:
- Size: 42.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cfac0b8988aab84d293a45518c9fd379283647fb141a872a2cf8d05d182b273d
|
|
| MD5 |
326e08b141165b79bb8a1375b11cd23b
|
|
| BLAKE2b-256 |
507b035b06c1917e9bd7f03a1fb5505b43570b9a80dcd7fed9312ff8264ae73b
|
Provenance
The following attestation bundles were made for cuthbert-0.0.9-py3-none-any.whl:
Publisher:
pypi.yaml on state-space-models/cuthbert
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cuthbert-0.0.9-py3-none-any.whl -
Subject digest:
cfac0b8988aab84d293a45518c9fd379283647fb141a872a2cf8d05d182b273d - Sigstore transparency entry: 1193071353
- Sigstore integration time:
-
Permalink:
state-space-models/cuthbert@0e529bafc245beb984dfc232d8b1b427fd2302b9 -
Branch / Tag:
refs/tags/0.0.9 - Owner: https://github.com/state-space-models
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yaml@0e529bafc245beb984dfc232d8b1b427fd2302b9 -
Trigger Event:
release
-
Statement type: