TimeSeriesPosterior

class probnum.filtsmooth.TimeSeriesPosterior(locations, states)[source]

Bases: abc.ABC

Posterior Distribution over States after time-series algorithms such as filtering/smoothing or solving ODEs.

Parameters
  • locations (ndarray) – Locations of the posterior states (represented as random variables).

  • states (ndarray) – Posterior random variables.

Methods Summary

__call__(t)

Evaluate the time-continuous posterior at location t

interpolate(t)

Evaluate the posterior at a measurement-free point.

sample([t, size, random_state])

Draw samples from the filtering/smoothing posterior.

transform_base_measure_realizations(…[, t])

Transform a set of realizations from a base measure into realizations from the posterior.

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 (Union[Real, ndarray]) – Location, or time, at which to evaluate the posterior.

Returns

Estimate of the states at time t.

Return type

randvars.RandomVariable or _randomvariablelist._RandomVariableList

abstract interpolate(t)[source]

Evaluate the posterior at a measurement-free point.

Parameters

t (Real) – Location to evaluate at.

Returns

Dense evaluation.

Return type

randvars.RandomVariable or _randomvariablelist._RandomVariableList

abstract sample(t=None, size=(), random_state=None)[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, a single sample is drawn on those locations. If size is specified, more than a single sample is drawn.

Internally, samples from a base measure are drawn and transformed via self.transform_base_measure_realizations.

Parameters
  • t (Union[Real, ndarray, None]) – Locations on which the samples are wanted. Default is none, which implies that self.location is used.

  • size (Union[Integral, Iterable[Integral], None]) – Indicates how many samples are drawn. Default is an empty tuple, in which case a single sample is returned.

  • random_state (Union[None, int, RandomState, Generator]) – Random state (seed, generator) to be used for sampling base measure realizations.

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

np.ndarray

abstract transform_base_measure_realizations(base_measure_realizations, t=None)[source]

Transform a set of realizations from a base measure into realizations from the posterior.

Parameters
  • base_measure_realizations (ndarray) – Base measure realizations.

  • t (Union[Real, ndarray, None]) – Locations on which the transformed realizations shall represent realizations from the posterior.

Returns

Transformed realizations.

Return type

np.ndarray