Kalman Filter

The KalmanFilter is a torch.nn.Module which generates forecasts using the full kalman-filtering algorithm (or optionally extended-kalman filtering, if any measure-funs or nonlinear processes are used).

This class inherits most of its methods from torchcast.state_space.StateSpaceModel.

class torchcast.kalman_filter.kalman_filter.KalmanFilter(processes: Sequence[Process], measures: Sequence[str], measure_covariance: Covariance | None = None, process_covariance: Covariance | None = None, initial_covariance: Covariance | None = None, measure_funs: dict[str, str] | None = None, adaptive_scaling: bool = False)

Bases: StateSpaceModel

Parameters:
  • processes – A list of Process modules.

  • measures – A list of strings specifying the names of the dimensions of the time-series being measured.

  • measure_covariance – A module created with Covariance.from_measures(measures).

  • process_covariance – A module created with Covariance.from_processes(processes, type='process').

  • initial_covariance – A module created with Covariance.from_processes(measures, type='initial').

  • measure_funs – A dictionary mapping measure-names to measurement-functions. Currently only supports ‘sigmoid’.

  • adaptive_scaling – Experimental feature to adaptively scale the covariance as a function of residuals. This is useful if different groups have very different magnitudes.