Gaussian Moments Filter and Smoother
cuthbert.gaussian.moments
cuthbert.gaussian.moments.filter
Linearized moments Kalman filter.
Takes a user provided conditional mean and chol_cov functions to define a
conditionally linear Gaussian state space model.
I.e., we approximate conditional densities as
See cuthbertlib.linearize for more details.
Parallelism via associative_scan is supported, but requires the state argument
to be ignored in get_dynamics_params and get_observation_params.
I.e. the linearization points are pre-defined or extracted from model inputs.
build_filter(get_init_params, get_dynamics_params, get_observation_params, associative=False)
Build linearized moments Kalman inference filter.
If associative is True all filtering linearization points are pre-defined or
extracted from model inputs. The state argument should be ignored in
get_dynamics_params and get_observation_params.
If associative is False the linearization points can be extracted from the
previous filter state for dynamics parameters and the predict state for
observation parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
get_init_params
|
GetInitParams
|
Function to get m0, chol_P0 from model inputs. |
required |
get_dynamics_params
|
GetDynamicsMoments
|
Function to get dynamics conditional mean and
(generalised) Cholesky covariance from linearization point and model inputs.
and linearization points (for the previous and current time points)
If |
required |
get_observation_params
|
GetObservationMoments
|
Function to get observation conditional mean,
(generalised) Cholesky covariance and observation from linearization point
and model inputs.
If |
required |
associative
|
bool
|
If True, then the filter is suitable for associative scan, but
assumes that the |
False
|
Returns:
| Type | Description |
|---|---|
Filter
|
Linearized moments Kalman filter object. |
Source code in cuthbert/gaussian/moments/filter.py
cuthbert.gaussian.moments.smoother
Linearized moments Kalman smoother.
Takes a user provided conditional mean and chol_cov functions to define a
conditionally linear Gaussian state space model.
I.e., we approximate conditional densities as
See cuthbertlib.linearize for more details.
Parallelism via associative_scan is supported, but requires the state argument
to be ignored in get_dynamics_params.
I.e. the linearization points are pre-defined or extracted from model inputs.
build_smoother(get_dynamics_params, store_gain=False, store_chol_cov_given_next=False)
Build linearized moments Kalman inference smoother for conditionally Gaussian SSMs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
get_dynamics_params
|
GetDynamicsMoments
|
Function to get dynamics conditional mean and (generalised) Cholesky covariance from linearization point and model inputs. |
required |
store_gain
|
bool
|
Whether to store the gain matrix in the smoother state. |
False
|
store_chol_cov_given_next
|
bool
|
Whether to store the chol_cov_given_next matrix in the smoother state. |
False
|
Returns:
| Type | Description |
|---|---|
Smoother
|
Linearized moments Kalman smoother object, suitable for associative scan. |
Source code in cuthbert/gaussian/moments/smoother.py
cuthbert.gaussian.moments.types
Provides types for the moment-based linearization of Gaussian state-space models.
GetDynamicsMoments
Bases: Protocol
Protocol for extracting the dynamics specifications.
__call__(state, model_inputs)
Get dynamics conditional mean and chol_cov function and linearization point.
associative_scan only supported when state is ignored.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
LinearizedKalmanFilterState
|
NamedTuple containing |
required |
model_inputs
|
ArrayTreeLike
|
Model inputs. |
required |
Returns:
| Type | Description |
|---|---|
tuple[MeanAndCholCovFunc, Array]
|
Tuple with dynamics conditional mean and (generalised) Cholesky covariance function and linearization point. |
Source code in cuthbert/gaussian/moments/types.py
GetObservationMoments
Bases: Protocol
Protocol for extracting the observation specifications.
__call__(state, model_inputs)
Get conditional mean and chol_cov function, linearization point and observation.
associative_scan only supported when state input is ignored.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
LinearizedKalmanFilterState
|
NamedTuple containing |
required |
model_inputs
|
ArrayTreeLike
|
Model inputs. |
required |
Returns:
| Type | Description |
|---|---|
tuple[MeanAndCholCovFunc, Array, Array]
|
Tuple with conditional mean and chol_cov function, linearization point and observation. |