Kalman¶
-
class
probnum.filtsmooth.
Kalman
(dynamics_model, measurement_model, initrv)[source]¶ Bases:
probnum.filtsmooth.bayesfiltsmooth.BayesFiltSmooth
Gaussian filtering and smoothing, i.e. Kalman-like filters and smoothers.
- Parameters
dynamics_model (
Transition
) – Prior dynamics. Usually an LTISDE object or an Integrator, but LinearSDE, ContinuousEKFComponent, or ContinuousUKFComponent are also valid. Describes a random process in \(K\) dimensions. If an integrator, K=spatialdim(ordint+1) for some spatialdim and ordint.measurement_model (
Transition
) – Measurement model. Usually an DiscreteLTIGaussian, but any DiscreteLinearGaussian is acceptable. This model maps the K dimensional prior state (see above) to the L dimensional space in which the observation ‘’live’’. For 2-dimensional observations, L=2. If an DiscreteLTIGaussian, the measurement matrix is \(L \times K\) dimensional, the forcevec is L dimensional and the meascov is L times L dimensional.initrv (
RandomVariable
) – Initial random variable for the prior. This is a K dimensional Gaussian distribution (not L, because it belongs to the prior)
Methods Summary
filter
(dataset, times[, _previous_posterior])Apply Gaussian filtering (no smoothing!) to a data set.
filter_step
(start, stop, current_rv, data[, …])A single filter step.
filtsmooth
(dataset, times[, _previous_posterior])Apply Gaussian filtering and smoothing to a data set.
iterated_filtsmooth
(dataset, times[, stopcrit])Compute an iterated smoothing estimate with repeated posterior linearisation.
measure
(rv, time[, _linearise_at])predict
(rv, start, stop[, _linearise_at, …])smooth
(filter_posterior[, _previous_posterior])Apply Gaussian smoothing to the filtering outcome (i.e.
update
(rv, time, data[, _linearise_at])Methods Documentation
-
filter
(dataset, times, _previous_posterior=None)[source]¶ Apply Gaussian filtering (no smoothing!) to a data set.
- Parameters
dataset (array_like, shape (N, M)) – Data set that is filtered.
times (array_like, shape (N,)) – Temporal locations of the data points. The zeroth element in times and dataset is the location of the initial random variable.
_previous_posterior (KalmanPosterior) – If specified, approximate Gaussian filtering and smoothing linearises at this, prescribed posterior. This is used for iterated filtering and smoothing. For standard filtering, this can be ignored.
- Returns
Posterior distribution of the filtered output
- Return type
-
filter_step
(start, stop, current_rv, data, _linearise_predict_at=None, _linearise_update_at=None, _diffusion=1.0)[source]¶ A single filter step.
Consists of a prediction step (t -> t+1) and an update step (at t+1).
- Parameters
start (float) – Predict FROM this time point.
stop (float) – Predict TO this time point.
current_rv (RandomVariable) – Predict based on this random variable. For instance, this can be the result of a previous call to filter_step.
data (array_like) – Compute the update based on this data.
_linearise_predict_at – Linearise the prediction step at this RV. Used for iterated filtering and smoothing.
_linearise_update_at – Linearise the update step at this RV. Used for iterated filtering and smoothing.
_diffusion – Custom diffusion for the underlying Wiener process. Used in calibration.
- Returns
RandomVariable – Resulting filter estimate after the single step.
dict – Additional information provided by predict() and update(). Contains keys pred_rv, info_pred, meas_rv, info_upd.
-
filtsmooth
(dataset, times, _previous_posterior=None)[source]¶ Apply Gaussian filtering and smoothing to a data set.
- Parameters
dataset (array_like, shape (N, M)) – Data set that is filtered.
times (array_like, shape (N,)) – Temporal locations of the data points. The zeroth element in times and dataset is the location of the initial random variable.
_previous_posterior (KalmanPosterior) – If specified, approximate Gaussian filtering and smoothing linearises at this, prescribed posterior. This is used for iterated filtering and smoothing. For standard filtering, this can be ignored.
- Returns
Posterior distribution of the filtered output
- Return type
-
iterated_filtsmooth
(dataset, times, stopcrit=None)[source]¶ Compute an iterated smoothing estimate with repeated posterior linearisation.
If the extended Kalman filter is used, this yields the IEKS. In any case, the result is an approximation to the maximum-a- posteriori estimate.
-
smooth
(filter_posterior, _previous_posterior=None)[source]¶ Apply Gaussian smoothing to the filtering outcome (i.e. a KalmanPosterior).
- Parameters
filter_posterior (KalmanPosterior) – Posterior distribution obtained after filtering
- Returns
Posterior distribution of the smoothed output
- Return type