UnscentedKalman

class probnum.filtsmooth.UnscentedKalman(dynamod, measmod, initrv)[source]

Bases: probnum.filtsmooth.GaussFiltSmooth

Factory method for Unscented Kalman filters.

Attributes Summary

dynamicmodel Convenience function for accessing self.dynamod.
initialdistribution Convenience function for accessing self.initdist.
initialrandomvariable Convenience function for accessing self.initrv.
measurementmodel Convenience function for accessing self.measmod.

Methods Summary

filter(dataset, times, **kwargs) Apply Gaussian filtering (no smoothing!) to a data set.
filter_step(start, stop, randvar, data, **kwargs) A single filter step.
filtsmooth(dataset, times, **kwargs) Apply Gaussian filtering and smoothing to a data set.
predict(start, stop, randvar, **kwargs) Prediction step of the Bayesian filter.
smooth(filter_posterior, **kwargs) Apply Gaussian smoothing to a set of filtered means and covariances.
smooth_list(rv_list, locations[, final_rv]) Apply smoothing to a list of RVs with desired final random variable.
smooth_step(unsmoothed_rv, pred_rv, …) A single smoother step.
smoother_step(**kwargs) Smoother step.
update(time, randvar, data, **kwargs) Update step of the Bayesian filter.

Attributes Documentation

dynamicmodel

Convenience function for accessing self.dynamod.

initialdistribution

Convenience function for accessing self.initdist.

initialrandomvariable

Convenience function for accessing self.initrv.

measurementmodel

Convenience function for accessing self.measmod.

Methods Documentation

filter(dataset, times, **kwargs)

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.
  • kwargs
Returns:

Posterior distribution of the filtered output

Return type:

KalmanPosterior

filter_step(start, stop, randvar, data, **kwargs)

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.
  • randvar (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.
Returns:

Resulting filter estimate after the single step.

Return type:

RandomVariable

filtsmooth(dataset, times, **kwargs)

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.
  • kwargs
Returns:

Posterior distribution of the smoothed output

Return type:

KalmanPosterior

predict(start, stop, randvar, **kwargs)

Prediction step of the Bayesian filter.

Not required for all filters, e.g. the Particle Filter only has an update() method.

smooth(filter_posterior, **kwargs)

Apply Gaussian smoothing to a set of filtered means and covariances.

Parameters:filter_posterior (KalmanPosterior) – Posterior distribution obtained after filtering
Returns:Posterior distribution of the smoothed output
Return type:KalmanPosterior
smooth_list(rv_list, locations, final_rv=None, **kwargs)

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.
  • final_rv (RandomVariable, optional.) – RandomVariable at the final point. Default is None, in which case standard smoothing is applied. If a random variable is specified, the smoothing iteration is based on this one, which is used for sampling (in which case the final random variable is a Dirac that represents a sample)
Returns:

List of smoothed random variables.

Return type:

_RandomVariableList

smooth_step(unsmoothed_rv, pred_rv, smoothed_rv, crosscov)

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.

Parameters:
  • unsmoothed_rv (RandomVariable) – Filtering distribution at time t.
  • pred_rv (RandomVariable) – Prediction at time t+1 of the filtering distribution at time t.
  • smoothed_rv (RandomVariable) – Smoothing distribution at time t+1.
  • crosscov (array_like) – Cross-covariance between unsmoothed_rv and pred_rv as returned by predict().
smoother_step(**kwargs)

Smoother step.

update(time, randvar, data, **kwargs)

Update step of the Bayesian filter.

Must be implemented by subclasses.