Dynestyx brings state-space models and modern filters into probabilistic programming
This paper introduces dynestyx, a software library that makes it easier to do Bayesian inference for dynamical systems inside a probabilistic programming language. Dynamical systems are models where an unseen state evolves over time and produces observations. Dynestyx builds on the NumPyro probabilistic programming system and gives first-class support for state-space models (SSMs), including both discrete-time updates and continuous-time stochastic differential equations (SDEs). The library aims to let users specify models and priors in plain code, then try different, state-of-the-art inference methods without rewriting the model.
In practice, the authors implemented dynestyx as an extension to NumPyro that respects the “separation of concerns” between a model and the numerical methods used to infer its quantities. A model is written as a Python function that declares priors and the idealized data-generating process. That specification does not fix any particular filter, discretizer, or parameter estimator. At inference time, dynestyx interprets a model’s sampling statements through configurable handlers that pick a filter or smoother and then feed its outputs to standard NumPyro inference tools such as Hamiltonian Monte Carlo or variational inference.
At a high level dynestyx supports the state-space formalism where a latent state x_t follows either a transition law in discrete time or an SDE in continuous time, with an observation model linking states to noisy measurements. The library integrates many state-estimation methods from existing packages (dynamax, cd-dynamax, cuthbert) so users can run Kalman filtering and Rauch–Tung–Striebel smoothing, extended and unscented Kalman methods, ensemble Kalman filters (EnKF), and particle filters and smoothers. For parameter learning, dynestyx computes an approximation of the marginal likelihood (the probability of the observed data given parameters) using whatever filter the user chooses, and uses that approximation together with a prior to drive Bayesian parameter inference.