DiscreteLTIGaussian

class probnum.statespace.DiscreteLTIGaussian(state_trans_mat, shift_vec, proc_noise_cov_mat, proc_noise_cov_cholesky=None, forward_implementation='classic', backward_implementation='classic')[source]

Bases: probnum.statespace.discrete_transition.DiscreteLinearGaussian

Discrete, linear, time-invariant Gaussian transition models of the form.

\[x_{i+1} \sim \mathcal{N}(G x_i + v, S)\]

for some dynamics matrix \(G\), force vector \(v\), and diffusion matrix \(S\).

Parameters
  • state_trans_mat (ndarray) – State transition matrix \(G\).

  • shift_vec (ndarray) – Shift vector \(v\).

  • proc_noise_cov_mat (ndarray) – Process noise covariance matrix \(S\).

Raises

TypeError – If state_trans_mat, shift_vec and proc_noise_cov_mat have incompatible shapes.

See also

DiscreteModel, DiscreteGaussianLinearModel

Attributes Summary

proc_noise_cov_cholesky

Methods Summary

backward_realization(realization_obtained, rv)

Backward-pass of a realisation of a state, according to the transition.

backward_rv(rv_obtained, rv[, rv_forwarded, …])

Backward-pass of a state, according to the transition.

forward_realization(realization, t[, _diffusion])

Forward-pass of a realization of a state, according to the transition.

forward_rv(rv, t[, compute_gain, _diffusion])

Forward-pass of a state, according to the transition.

jointly_sample_list_backward(rv_list, locations)

Jointly sample from a list of random variables, according to the present transition.

proc_noise_cov_cholesky_fun(t)

smooth_list(rv_list, locations[, …])

Apply smoothing to a list of random variables, according to the present transition.

Attributes Documentation

proc_noise_cov_cholesky

Methods Documentation

backward_realization(realization_obtained, rv, rv_forwarded=None, gain=None, t=None, _diffusion=1.0, **kwargs)

Backward-pass of a realisation of a state, according to the transition. In other words, return a description of

\[p(x(t) \,|\, {\mathcal{G}_t(x(t)) = \xi})\]

for an observed realization \(\xi\) of \({\mathcal{G}_t}(x(t))\). For example, this function is called in a Kalman update step.

Parameters
  • realization_obtained – Observed realization \(\xi\) as an array.

  • rv – “Current” distribution \(p(x(t))\) as a RandomVariable.

  • rv_forwarded – “Forwarded” distribution (think: \(p(\mathcal{G}_t(x(t)) \,|\, x(t))\)) as a RandomVariable. Optional. If provided (in conjunction with gain), computation might be more efficient, because most backward passes require the solution of a forward pass. If rv_forwarded is not provided, forward_rv() might be called internally (depending on the object) which is skipped if rv_forwarded has been provided

  • gain – Expected gain. Optional. If provided (in conjunction with rv_forwarded), some additional computations may be avoided (depending on the object).

  • t – Current time point.

  • dt – Increment \(\Delta t\). Ignored for discrete-time transitions.

  • _diffusion – Special diffusion of the driving stochastic process, which is used internally.

  • _linearise_at – Specific point of linearisation for approximate forward passes (think: extended Kalman filtering). Used internally for iterated filtering and smoothing.

Returns

  • RandomVariable – New state, after applying the backward-pass.

  • Dict – Information about the backward-pass.

backward_rv(rv_obtained, rv, rv_forwarded=None, gain=None, t=None, _diffusion=1.0, **kwargs)

Backward-pass of a state, according to the transition. In other words, return a description of

\[p(x(t) \,|\, z_{\mathcal{G}_t}) = \int p(x(t) \,|\, z_{\mathcal{G}_t}, \mathcal{G}_t(x(t))) p(\mathcal{G}_t(x(t)) \,|\, z_{\mathcal{G}_t})) d \mathcal{G}_t(x(t)),\]

for observations \(z_{\mathcal{G}_t}\) of \({\mathcal{G}_t}(x(t))\). For example, this function is called in a Rauch-Tung-Striebel smoothing step, which computes a Gaussian distribution

\[p(x(t) \,|\, z_{\leq t+\Delta t}) = \int p(x(t) \,|\, z_{\leq t+\Delta t}, x(t+\Delta t)) p(x(t+\Delta t) \,|\, z_{\leq t+\Delta t})) d x(t+\Delta t),\]

from filtering distribution \(p(x(t) \,|\, z_{\leq t})\) and smoothing distribution \(p(x(t+\Delta t) \,|\, z_{\leq t+\Delta t})\), where \(z_{\leq t + \Delta t}\) contains both \(z_{\leq t}\) and \(z_{t + \Delta t}\).

Parameters
  • rv_obtained – “Incoming” distribution (think: \(p(x(t+\Delta t) \,|\, z_{\leq t+\Delta t})\)) as a RandomVariable.

  • rv – “Current” distribution (think: \(p(x(t) \,|\, z_{\leq t})\)) as a RandomVariable.

  • rv_forwarded – “Forwarded” distribution (think: \(p(x(t+\Delta t) \,|\, z_{\leq t})\)) as a RandomVariable. Optional. If provided (in conjunction with gain), computation might be more efficient, because most backward passes require the solution of a forward pass. If rv_forwarded is not provided, forward_rv() might be called internally (depending on the object) which is skipped if rv_forwarded has been provided

  • gain – Expected gain from “observing states at time \(t+\Delta t\) from time \(t\)). Optional. If provided (in conjunction with rv_forwarded), some additional computations may be avoided (depending on the object).

  • t – Current time point.

  • dt – Increment \(\Delta t\). Ignored for discrete-time transitions.

  • _diffusion – Special diffusion of the driving stochastic process, which is used internally.

  • _linearise_at – Specific point of linearisation for approximate forward passes (think: extended Kalman filtering). Used internally for iterated filtering and smoothing.

Returns

  • RandomVariable – New state, after applying the backward-pass.

  • Dict – Information about the backward-pass.

forward_realization(realization, t, _diffusion=1.0, **kwargs)

Forward-pass of a realization of a state, according to the transition. In other words, return a description of

\[p(\mathcal{G}_t[x(t)] \,|\, x(t)=\xi),\]

for some realization \(\xi\).

Parameters
  • realization – Realization \(\xi\) of the random variable \(x(t)\) that describes the current state.

  • t – Current time point.

  • dt – Increment \(\Delta t\). Ignored for discrete-time transitions.

  • compute_gain – Flag that indicates whether the expected gain of the forward transition shall be computed. This is important if the forward-pass is computed as part of a forward-backward pass, as it is for instance the case in a Kalman update.

  • _diffusion – Special diffusion of the driving stochastic process, which is used internally.

  • _linearise_at – Specific point of linearisation for approximate forward passes (think: extended Kalman filtering). Used internally for iterated filtering and smoothing.

Returns

  • RandomVariable – New state, after applying the forward-pass.

  • Dict – Information about the forward pass. Can for instance contain a gain key, if compute_gain was set to True (and if the transition supports this functionality).

forward_rv(rv, t, compute_gain=False, _diffusion=1.0, **kwargs)

Forward-pass of a state, according to the transition. In other words, return a description of

\[p(\mathcal{G}_t[x(t)] \,|\, x(t)),\]

or, if we take a message passing perspective,

\[p(\mathcal{G}_t[x(t)] \,|\, x(t), z_{\leq t}),\]

for past observations \(z_{\leq t}\). (This perspective will be more interesting in light of backward_rv()).

Parameters
  • rv – Random variable that describes the current state.

  • t – Current time point.

  • dt – Increment \(\Delta t\). Ignored for discrete-time transitions.

  • compute_gain – Flag that indicates whether the expected gain of the forward transition shall be computed. This is important if the forward-pass is computed as part of a forward-backward pass, as it is for instance the case in a Kalman update.

  • _diffusion – Special diffusion of the driving stochastic process, which is used internally.

  • _linearise_at – Specific point of linearisation for approximate forward passes (think: extended Kalman filtering). Used internally for iterated filtering and smoothing.

Returns

  • RandomVariable – New state, after applying the forward-pass.

  • Dict – Information about the forward pass. Can for instance contain a gain key, if compute_gain was set to True (and if the transition supports this functionality).

jointly_sample_list_backward(rv_list, locations, _previous_posterior=None)

Jointly sample from a list of random variables, according to the present transition.

An explanation of the algorithm can be found in, for instance, this link 1.

References

1

https://stats.stackexchange.com/questions/376974/how-to-sample-an-unobserved-markov-process-using-the-forward-backward-algorithm

Parameters
  • rv_list (_RandomVariableList) – List of random variables to be sampled from (jointly).

  • locations – Locations \(t\) of the random variables in the time-domain. Used for continuous-time transitions.

  • _previous_posterior – Specify a previous posterior to improve linearisation in approximate backward passes. Used in iterated smoothing based on posterior linearisation.

Returns

List of smoothed random variables.

Return type

_RandomVariableList

proc_noise_cov_cholesky_fun(t)[source]
smooth_list(rv_list, locations, _previous_posterior=None)

Apply smoothing to a list of random variables, according to the present transition.

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

  • locations – Locations \(t\) of the random variables in the time-domain. Used for continuous-time transitions.

  • _previous_posterior – Specify a previous posterior to improve linearisation in approximate backward passes. Used in iterated smoothing based on posterior linearisation.

Returns

List of smoothed random variables.

Return type

_RandomVariableList