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
(regression_problem[, _previous_posterior])Apply Gaussian filtering (no smoothing!) to a data set.
filter_step
(start, stop, current_rv, data[, …])A single filter step.
filtered_states_generator
(regression_problem)Apply Gaussian filtering (no smoothing!) to a data set.
filtsmooth
(regression_problem[, …])Apply Gaussian filtering and smoothing to a data set.
iterated_filtsmooth
(regression_problem[, …])Compute an iterated smoothing estimate with repeated posterior linearisation.
Compute iterated smoothing estimates 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
(regression_problem, _previous_posterior=None)[source]¶ Apply Gaussian filtering (no smoothing!) to a data set.
- Parameters
regression_problem (
RegressionProblem
) –_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
KalmanPosterior – Posterior distribution of the filtered output
info_dicts – list of dictionaries containing filtering information
See also
RegressionProblem
a regression problem data class
-
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.
-
filtered_states_generator
(regression_problem, _previous_posterior=None)[source]¶ Apply Gaussian filtering (no smoothing!) to a data set.
- Parameters
regression_problem (
RegressionProblem
) –_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.
- Yields
filtrv – Random variable returned from prediction and update of the Kalman filter.
info_dict – Dictionary containing filtering information
See also
RegressionProblem
a regression problem data class
-
filtsmooth
(regression_problem, _previous_posterior=None)[source]¶ Apply Gaussian filtering and smoothing to a data set.
- Parameters
regression_problem (
RegressionProblem
) –_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
KalmanPosterior – Posterior distribution of the filtered output
info_dicts – list of dictionaries containing filtering information
See also
RegressionProblem
a regression problem data class
-
iterated_filtsmooth
(regression_problem, init_posterior=None, 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.
- Parameters
regression_problem (
RegressionProblem
) –init_posterior (
Optional
[SmoothingPosterior
]) – Initial posterior to linearize at. If not specified, linearizes at the prediction random variable.stopcrit (StoppingCriterion) – A stopping criterion for iterated filtering.
- Returns
- Return type
See also
RegressionProblem
a regression problem data class
-
iterated_filtsmooth_posterior_generator
(regression_problem, init_posterior=None, stopcrit=None)[source]¶ Compute iterated smoothing estimates 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.
- Parameters
regression_problem (
RegressionProblem
) –init_posterior (
Optional
[SmoothingPosterior
]) – Initial posterior to linearize at. Defaults to computing a (non-iterated) smoothing posterior, which amounts to linearizing at the prediction random variable.stopcrit (StoppingCriterion) – A stopping criterion for iterated filtering.
- Yields
SmoothingPosterior
info_dicts – list of dictionaries containing filtering information
See also
RegressionProblem
a regression problem data class
-
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