Skip to content

Kalman

polars_ts.streaming.kalman

Online Kalman filter with single-observation updates.

StreamingKalmanFilter

Kalman filter supporting incremental single-observation updates.

Extends the batch KalmanFilter with an update() method for processing observations one at a time in a streaming context.

Parameters

F State transition matrix (n, n). H Observation matrix (m, n). Q Process noise covariance (n, n). R Observation noise covariance (m, m). x0 Initial state mean (n,). Defaults to zeros. P0 Initial state covariance (n, n). Defaults to diffuse prior.

fit(y)

Initialize filter by processing a batch of observations.

Parameters

y Observations array of shape (T,) or (T, m).

update(observation)

Process a single new observation, updating state in-place.

Parameters

observation Scalar or array of shape (m,).

predict(h)

Predict h steps ahead from current state.

Returns

predictions Array of shape (h,) — predicted observation means.

_step(x, P, yt, n, m)

Single predict-update cycle.