canari.component.autoregression_component#
- class canari.component.autoregression_component.Autoregression(std_error: float | None = None, phi: float | None = None, mu_states: list[float] | None = None, var_states: list[float] | None = None)[source]#
Bases:
BaseComponent
Autoregression class, inheriting from Canari’s BaseComponent. It models residuals following a univariate AR(1) process with optional treatement and estimation of the autoregressive coefficient (phi) and process noise standard deviation (std_error) as hidden states.
- Parameters:
std_error (Optional[float]) – Standard deviation of the process noise. Defaults to None. If None, it will be learned using Approximate Gaussian Variance Inference (AGVI).
phi (Optional[float]) – Autoregressive coefficient. Defaults to None. If None, it will be learned using Gaussian Multiplicative Approximation (GMA).
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.
- Behavior:
Adds 2 extra (dummy) states if phi is None.
Adds 3 extra (dummy) states if std_error is None.
References
Deka, B., Nguyen, L.H. and Goulet, J.-A. (2024). Analytically Tractable Heteroscedastic Uncertainty Quantification in Bayesian Neural Networks for Regression Tasks. Neurocomputing. Volume 572, pp.127183.
Deka, B. and Goulet, J.-A. (2023). Approximate Gaussian Variance Inference for State-Space Models. International Journal of Adaptive Control and Signal Processing. Volume 37, Issue 11, pp. 2934-2962.
Examples
>>> from canari.component import Autoregression >>> # With known parameters >>> ar = Autoregression(phi=0.9, std_error=0.1) >>> # With known mu_states and var_states >>> ar = Autoregression(mu_states=[0.1], var_states=[0.1], phi=0.9, std_error=0.1) >>> # With parameters to be estimated >>> ar = Autoregression() >>> ar.component_name autoregression >>> ar.states_name ['autoregression', 'phi', 'phi_autoregression', 'AR_error', 'W2', 'W2bar'] >>> ar.mu_states >>> ar.var_states >>> ar.transition_matrix >>> ar.observation_matrix >>> ar.process_noise_matrix