IteratedKalman

class probnum.filtsmooth.IteratedKalman(kalman, stoppingcriterion=None)[source]

Bases: probnum.filtsmooth.gaussfiltsmooth.kalman.Kalman

Iterated filter/smoother based on posterior linearisation.

In principle, this is the same as a Kalman filter; however, 1. predict() and update() in each filter step may be repeated. 2. approximate Gaussian filtering and smoothing can use posterior linearisation.

There is an additional method: iterated_filtsmooth(), which computes things like MAP estimates.

Methods Summary

condition_state_on_measurement(randvar, …)

Condition the state on the observed data.

filter(dataset, times[, intermediate_step, …])

Apply Gaussian filtering (no smoothing!) to a data set.

filter_step(start, stop, current_rv, data[, …])

Filter step of iterated filter.

filtsmooth(dataset, times[, intermediate_step])

Apply Gaussian filtering and smoothing to a data set.

iterated_filtsmooth(dataset, times, **kwargs)

Repeated filtering and smoothing using posterior linearisation.

measure(time, randvar)

Propagate the state through the measurement model.

predict(start, stop, randvar[, …])

(Possibly iterated) prediction step.

smooth(filter_posterior[, intermediate_step])

Apply Gaussian smoothing to the filtering outcome (i.e.

smooth_list(rv_list, locations[, …])

Apply smoothing to a list of RVs with desired final random variable.

smooth_step(unsmoothed_rv, smoothed_rv, …)

A single smoother step.

smoother_step(**kwargs)

Smoother step.

update(time, randvar, data[, linearise_at])

(Possibly iterated) update step.

Methods Documentation

condition_state_on_measurement(randvar, meas_rv, data, crosscov)

Condition the state on the observed data.

Parameters
  • randvar (Normal) – Random variable to be updated with the measurement and data.

  • meas_rv (Normal) – Measured random variable, as returned by the measurement model.

  • data (np.ndarray) – Data to update on.

  • crosscov (np.ndarray) – Cross-covariance between the state random variable randvar and the measurement random variable meas_rv.

Returns

Updated Normal random variable (new filter estimate)

Return type

Normal

filter(dataset, times, intermediate_step=None, linearise_at=None)

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.

Returns

Posterior distribution of the filtered output

Return type

KalmanPosterior

filter_step(start, stop, current_rv, data, previous_posterior=None, intermediate_step=None)[source]

Filter step of iterated filter.

Different to Kalman.filter in the sense that there may be multiple iterated updates for a single predict, or multiple iterated predicts for a single update, or multiple iterated predicts and updates in general. This retrieves methods such as the iterated extended Kalman filter. By further specifying a previous_posterior (KalmanPosterior), the first of those possibly iterated updates is linearised at the previous posterior estimate. This retrieves methods such as the iterated extended Kalman smoother.

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.

  • previous_posterior (KalmanPosterior) – Posterior distribution of a previous smoothing iteration. Optional. If specified, posterior linearisation is applied.

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, intermediate_step=None)

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.

Returns

Posterior distribution of the smoothed output

Return type

KalmanPosterior

iterated_filtsmooth(dataset, times, **kwargs)[source]

Repeated filtering and smoothing using posterior linearisation.

measure(time, randvar)

Propagate the state through the measurement model.

Parameters
  • time (float) – Time of the measurement.

  • randvar (Normal) – Random variable to be propagated through the measurement model.

Returns

  • meas_rv (Normal) – Measured random variable, as returned by the measurement model.

  • info (dict) – Additional info. Contains at leas the key crosscov which is the cross covariance between the input random variable and the measured random variable.

predict(start, stop, randvar, linearise_at=None, intermediate_step=None)[source]

(Possibly iterated) prediction step.

smooth(filter_posterior, intermediate_step=None)

Apply Gaussian smoothing to the filtering outcome (i.e. a KalmanPosterior).

Parameters
  • filter_posterior (KalmanPosterior) – Posterior distribution obtained after filtering

  • intermediate_step – Step-size to be taken by approximate transition methods.

Returns

Posterior distribution of the smoothed output

Return type

KalmanPosterior

smooth_list(rv_list, locations, intermediate_step=None)

Apply smoothing to a list of RVs with desired final random variable.

Specification of a final RV is useful to compute joint samples from a KalmanPosterior object, because in this case, the final RV is a Dirac (over a sample from the final Normal RV) and not a Normal RV.

Parameters
  • rv_list (_RandomVariableList or array_like) – List of random variables to be smoothed.

  • locations (array_like) – Locations of the random variables in rv_list.

  • intermediate_step – Step-size to be taken by approximate transition methods.

Returns

List of smoothed random variables.

Return type

_RandomVariableList

smooth_step(unsmoothed_rv, smoothed_rv, start, stop, intermediate_step=None)

A single smoother step.

Consists of predicting from the filtering distribution at time t to time t+1 and then updating based on the discrepancy to the smoothing solution at time t+1. If preconditioning is available in the dynamic model, this is leveraged here. If not, a classic smoothing step estimate is taken.

Parameters
  • unsmoothed_rv (RandomVariable) – Filtering distribution at time t.

  • smoothed_rv (RandomVariable) – Prediction at time t+1 of the filtering distribution at time t.

  • start (float) – Time-point of the to-be-smoothed RV.

  • stop (float) – Time-point of the already-smoothed RV.

  • intermediate_step – Step-size to be taken by approximate transition methods.

smoother_step(**kwargs)

Smoother step.

update(time, randvar, data, linearise_at=None)[source]

(Possibly iterated) update step.