# GaussianIVPFilter¶

class probnum.diffeq.odefiltsmooth.GaussianIVPFilter(ivp, prior_process, measurement_model, with_smoothing, initialization_routine, diffusion_model=None, _reference_coordinates=0)[source]

Probabilistic ODE solver based on Gaussian filtering and smoothing.

This is based on continuous-discrete Gaussian filtering.

Note: this is specific for IVPs and does not apply without further considerations to, e.g., BVPs.

Parameters

References

1

Bosch, N., and Hennig, P., and Tronarp, F.. Calibrated Adaptive Probabilistic ODE Solvers. 2021.

Methods Summary

 Returns t0 and y0 (for the solver, which might be different to ivp.y0) method_callback(time, current_guess, …) Optional callback. postprocess(odesol) If specified (at initialisation), smooth the filter output. rvlist_to_odesol(times, rvs) Create an ODESolution object. solution_generator(steprule) Generate ODE solver steps. solve(steprule) Solve an IVP. step(t, t_new, current_rv) Gaussian IVP filter step as nonlinear Kalman filtering with zero data. Construct a measurement model $$\mathcal{N}(g(m), R)$$ for an ODE.

Methods Documentation

initialise()[source]

Returns t0 and y0 (for the solver, which might be different to ivp.y0)

method_callback(time, current_guess, current_error)

Optional callback.

Can be overwritten. Do this as soon as it is clear that the current guess is accepted, but before storing it. No return. For example: tune hyperparameters (sigma).

postprocess(odesol)[source]

If specified (at initialisation), smooth the filter output.

rvlist_to_odesol(times, rvs)[source]

Create an ODESolution object.

solution_generator(steprule)

Generate ODE solver steps.

solve(steprule)

Solve an IVP.

Parameters

steprule (StepRule) – Step-size selection rule, e.g. constant steps or adaptive steps.

step(t, t_new, current_rv)[source]

Gaussian IVP filter step as nonlinear Kalman filtering with zero data.

It goes as follows:

1. The current state $$x(t) \sim \mathcal{N}(m(t), P(t))$$ is split into a deterministic component and a noisy component,

$x(t) = m(t) + p(t), \quad p(t) \sim \mathcal{N}(0, P(t))$

which is required for accurate calibration and error estimation: in order to only work with the local error, ODE solvers often assume that the error at the previous step is zero.

1. The deterministic component is propagated through dynamics model and measurement model

$\hat{z}(t + \Delta t) \sim \mathcal{N}(H \Phi(\Delta t) m(t), H Q(\Delta t) H^\top)$

which is a random variable that estimates the expected local defect $$\dot y - f(y)$$.

3. The counterpart of $$\hat{z}$$ in the (much more likely) interpretation of an erronous previous state (recall that $$\hat z$$ was based on the interpretation of an error-free previous state) is computed as,

$z(t + \Delta t) \sim \mathcal{N}(\mathbb{E}[\hat{z}(t + \Delta t)], \mathbb{C}[\hat{z}(t + \Delta t)] + H \Phi(\Delta t) P(t) \Phi(\Delta t)^\top H^\top ),$

which acknowledges the covariance $$P(t)$$ of the previous state. $$\mathbb{E}$$ is the mean, and $$\mathbb{C}$$ is the covariance. Both $$z(t + \Delta t)$$ and $$\hat z(t + \Delta t)$$ give rise to a reasonable diffusion_model estimate. Which one to use is handled by the Diffusion attribute of the solver. At this point already we can compute a local error estimate of the current step.

1. Depending on the diffusion model, there are two options now:

4.1. For a piecewise constant diffusion, the covariances are calibrated locally – that is, at each step. In this case we update the predicted covariance and measured covariance with the most recent diffusion estimate.

4.2. For a constant diffusion, the calibration happens post hoc, and the only step that is carried out here is an assembly of the full predicted random variable (up to now, only its parts were available).

5. With the results of either 4.1. or 4.2. (which both return a predicted RV and a measured RV), we finally compute the Kalman update and return the result. Recall that the error estimate has been computed in the third step.

static string_to_measurement_model(measurement_model_string, ivp, prior_process, measurement_noise_covariance=0.0)[source]

Construct a measurement model $$\mathcal{N}(g(m), R)$$ for an ODE.

Return a DiscreteGaussian (DiscreteEKFComponent) that provides a tractable approximation of the transition densities based on the local defect of the ODE

$g(m) = H_1 m(t) - f(t, H_0 m(t))$

and user-specified measurement noise covariance $$R$$. Almost always, the measurement noise covariance is zero.