KalmanPosterior

class probnum.filtsmooth.KalmanPosterior(locations, state_rvs, gauss_filter, with_smoothing)

Bases: probnum.filtsmooth.filtsmoothposterior.FiltSmoothPosterior

Posterior Distribution after (Extended/Unscented) Kalman Filtering/Smoothing

Parameters:
  • locations (array_like) – Locations / Times of the discrete-time estimates.
  • state_rvs (list of RandomVariable) – Estimated states (in the state-space model view) of the discrete-time estimates.
  • gauss_filter (GaussFiltSmooth) – Filter/smoother used to compute the discrete-time estimates.

Attributes Summary

locations Locations / times of the discrete observations
state_rvs Discrete-time posterior state estimates

Methods Summary

__call__(t) Evaluate the time-continuous posterior at location t
sample([locations, size]) Draw samples from the filtering/smoothing posterior.

Attributes Documentation

locations

Locations / times of the discrete observations

Type:np.ndarray
state_rvs

Discrete-time posterior state estimates

Type:list of RandomVariable

Methods Documentation

__call__(t)[source]

Evaluate the time-continuous posterior at location t

Algorithm: 1. Find closest t_prev and t_next, with t_prev < t < t_next 2. Predict from t_prev to t 3. (if self._with_smoothing=True) Predict from t to t_next 4. (if self._with_smoothing=True) Smooth from t_next to t 5. Return random variable for time t

Parameters:t (float) – Location, or time, at which to evaluate the posterior.
Returns:Estimate of the states at time t.
Return type:RandomVariable
sample(locations=None, size=())[source]

Draw samples from the filtering/smoothing posterior.

If nothing is specified, a single sample is drawn (supported on self.locations). If locations are specified, the samples are drawn on those locations. If size is specified, more than a single sample is drawn.

Parameters:
  • locations (array_like, optional) – Locations on which the samples are wanted. Default is none, which implies that self.location is used.
  • size (int or tuple of ints, optional) – Indicates how many samples are drawn. Default is an empty tuple, in which case a single sample is returned.
Returns:

Drawn samples. If size has shape (A1, …, Z1), locations have shape (L,), and the state space model has shape (A2, …, Z2), the output has shape (A1, …, Z1, L, A2, …, Z2). For example: size=4, len(locations)=4, dim=3 gives shape (4, 4, 3).

Return type:

numpy.ndarray