KalmanODESolution

class probnum.diffeq.KalmanODESolution(kalman_posterior)[source]

Bases: probnum.diffeq.odesolution.ODESolution

Gaussian IVP filtering solution of an ODE problem.

Recall that in ProbNum, Gaussian filtering and smoothing is generally named “Kalman”.

Parameters

kalman_posterior (KalmanPosterior) – Gauss-Markov posterior over the ODE solver state space model. Therefore, it assumes that the dynamics model is an Integrator.

See also

GaussianIVPFilter

ODE solver that behaves like a Gaussian filter.

KalmanPosterior

Posterior over states after Gaussian filtering/smoothing.

Examples

>>> from probnum.diffeq import logistic, probsolve_ivp
>>> from probnum import randvars
>>>
>>> def f(t, x):
...     return 4*x*(1-x)
>>>
>>> y0 = np.array([0.15])
>>> t0, tmax = 0., 1.5
>>> solution = probsolve_ivp(f, t0, tmax, y0, step=0.1, adaptive=False)
>>> # Mean of the discrete-time solution
>>> print(np.round(solution.y.mean, 2))
[[0.15]
 [0.21]
 [0.28]
 [0.37]
 [0.47]
 [0.57]
 [0.66]
 [0.74]
 [0.81]
 [0.87]
 [0.91]
 [0.94]
 [0.96]
 [0.97]
 [0.98]
 [0.99]]
>>> # Times of the discrete-time solution
>>> print(solution.t)
[0.  0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.  1.1 1.2 1.3 1.4 1.5]
>>> # Individual entries of the discrete-time solution can be accessed with
>>> print(solution[5])
<Normal with shape=(1,), dtype=float64>
>>> print(np.round(solution[5].mean, 2))
[0.56]
>>> # Evaluate the continuous-time solution at a new time point t=0.65
>>> print(np.round(solution(0.65).mean, 2))
[0.70]

Attributes Summary

dy

filtering_solution

t

Time points of the discrete-time solution.

y

Methods Summary

__call__(t)

Evaluate the time-continuous solution at time t.

sample([t, size])

Sample from the Gaussian filtering ODE solution by sampling from the Gauss- Markov posterior.

Attributes Documentation

dy
filtering_solution
t
Return type

ndarray

y

Methods Documentation

__call__(t)[source]

Evaluate the time-continuous solution at time t.

Parameters

t (float) – Location / time at which to evaluate the continuous ODE solution.

Returns

Return type

Probabilistic estimate of the continuous-time solution at time t.

sample(t=None, size=())[source]

Sample from the Gaussian filtering ODE solution by sampling from the Gauss- Markov posterior.

Return type

ndarray