canari.component.intervention_component#

class canari.component.intervention_component.Intervention(interv_state_index: int, contribute_to_obs: bool | None = False)[source]#

Bases: BaseComponent

Intervention class, inheriting from Canari’s BaseComponent. It is used to add a hidden state for intervention.

NOTE: This component is under development. At the moment, use one Intervention hidden state per intervention event.

Parameters:
  • interv_state_index (int) – Index of hidden state make intervention.

  • contribute_to_obs (bool, optinal) – the intervention hidden state contribute to the observation or not. Defaults to False.

Examples

>>> from canari.component import Intervention
>>> intervention = Intervention(interv_state_index=1)
>>> intervention.transition_matrix
array([[1]])
>>> intervention.process_noise_matrix
array([[0]])
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]#

Initialize the transition matrix. Output an 2D array.

initialize_var_states()[source]#

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