canari.component.periodic_component#

class canari.component.periodic_component.Periodic(period: float, std_error: float | None = 0.0, mu_states: list[float] | None = None, var_states: list[float] | None = None)[source]#

Bases: BaseComponent

Periodic class, inheriting from Canari’s BaseComponent. It models a cyclic behavior with a fixed period using a Fourrier-form harmonic. It has two hidden states.

Parameters:
  • period (float) – Length of one full cycle of the periodic component (number of time steps).

  • std_error (Optional[float]) – Standard deviation of the process noise. Defaults to 0.0.

  • mu_states (Optional[list[float]]) – Initial mean of the hidden state. Defaults: initialized to zeros.

  • var_states (Optional[list[float]]) – Initial variance of the hidden state. Defaults: initialized to zeros.

Examples

>>> from canari.component import Periodic
>>> # With known parameters and default mu_states and var_states
>>> periodic = Periodic(std_error=0.1, period=52)
>>> # With known mu_states and var_states
>>> periodic = Periodic(mu_states=[0., 0.], var_states=[1., 1.], std_error=0.1, period=52)
>>> periodic.states_name
['periodic 1', 'periodic 2']
>>> periodic.mu_states
>>> periodic.var_states
>>> periodic.transition_matrix
>>> periodic.observation_matrix
>>> periodic.process_noise_matrix
initialize_component_name()[source]#

Initialize the component’s name. str.

initialize_mu_states()[source]#

Initialize the mean of the hidden states. Output an 2D array.

initialize_num_states()[source]#

Initialize the number of hidden states. int.

initialize_observation_matrix()[source]#

Initialize the observation matrix. Output an 2D array.

initialize_process_noise_matrix()[source]#

Initialize the process noise covariance matrix. Output an 2D array.

initialize_states_name()[source]#

Initialize the names of all hidden states. list[str].

initialize_transition_matrix()[source]#
Transition matrix:
[[cos(w), sin(w)],

[-sin(w), cos(w)]]

where w = 2π / period

initialize_var_states()[source]#

Initialize the covariance matrix of the hidden states. Output an 2D array.