SquareRootFilter#

class pymc_extras.statespace.filters.SquareRootFilter[source]#

Kalman filter with Cholesky factorization

Kalman filter implementation using a Cholesky factorization plus pt.solve_triangular to (attempt) to speed up inversion of the observation covariance matrix F.

__init__()#

Kalman Filter.

Notes

The BaseFilter class is an abstract base class (ABC) for implementing kalman filters. It defines common attributes and methods used by kalman filter implementations.

seq_names#

A list of name representing time-varying statespace matrices. That is, inputs that will need to be provided to the sequences argument of pytensor.scan

Type:

list[str]

non_seq_names#

A list of names representing static statespace matrices. That is, inputs that will need to be provided to the non_sequences argument of pytensor.scan

Type:

list[str]

Methods

__init__()

Kalman Filter.

add_check_on_time_varying_shapes(data, ...)

Insert a check that time-varying matrices match the data shape to the computational graph.

build_graph(data, a0, P0, c, d, T, Z, R, H, Q)

Construct the computation graph for the Kalman filter.

check_params(data, a0, P0, c, d, T, Z, R, H, Q)

Apply any checks on validity of inputs.

handle_missing_values(y, Z, H, d)

Handle missing values in the observation data y.

kalman_step(*args)

Performs a single iteration of the Kalman filter, which is composed of two steps : an update step and a prediction step.

predict(a, P, c, T, R, Q)

Compute one-step forecasts for the hidden states conditioned on information up to, but not including, the current timestep, a_hat, along with the forcast covariance matrix, P_hat.

unpack_args(args)

The order of inputs to the inner scan function is not known, since some, all, or none of the input matrices can be time varying.

update(a, P, y, d, Z, H, all_nan_flag)

Compute posterior estimates of the hidden state distributions conditioned on the observed data, up to and including the present timestep.