ArimaSurrogate¶
- class flexops.surrogates.arima.ArimaSurrogate(spec: SurrogateSpec | dict)¶
Non-seasonal ARIMA/ARIMAX relationship with explicit innovations.
See the module docstring for the spec. With
config.historythe pre-horizon state it implies is fixed; without it (regression mode) that state starts at zero and is left free for in-model estimation.A free parameter given without a value starts from these guesses:
0.0for the intercept or drift,min(1.0, max_ar_coeff)for AR lags, and1.0for MA lags and exogenous coefficients.- config_model¶
alias of
ArimaConfig
- classmethod initial_guess(name: str, config: ArimaConfig) float¶
Return a free parameter’s starting value (see the class docstring).
- classmethod make_spec(*, order: tuple[int, int, int] | list[int], input_variables: dict[str, str], output_variables: dict[str, str], values: dict[str, float] | None = None, deterministic: Literal['intercept', 'drift'] | None = None, fixed: dict[str, bool] | None = None, history: dict[str, Any] | None = None, max_ar_coeff: float | None = None, provenance: dict[str, Any] | None = None) SurrogateSpec¶
Return a validated ARIMA spec.
- Parameters:
order –
(p, d, q).input_variables –
{name: units}of each exogenous input, in order.output_variables –
{name: units}of the one output.values –
{parameter: value}by the namesarima_parameter_names()gives. A free parameter may be left out to start from its initial guess.deterministic –
"intercept"(d=0),"drift"(d=1), orNonefor no constant term.fixed –
{parameter: False}for each parameter to leave free; every other parameter is fixed.history – The pre-horizon state;
Nonefor regression mode.max_ar_coeff – Optional bound on every AR coefficient’s magnitude.
provenance – Free-form fit metadata.
- Returns:
The spec.
- Raises:
FlexConfigError – If the result does not match the contract.
- classmethod parameter_shapes(config: ArimaConfig) dict[str, tuple]¶
Return the deterministic term, one per lag and one per input.
- solved_history(block, target) dict[str, Any]¶
Return the history a solve implies, without recording it.
The history begins with the
max(p + d, q)initialization lags the block was built with (the solved values in regression mode), followed by the solved horizon’s disturbances and innovations, and starts at the horizon’s first point. Rebuilding the same horizon from it reproduces the same initial state; a later horizon starts from the solved values.- Parameters:
- Returns:
A
historymapping forconfig.- Raises:
FlexConfigError – If the block has values missing (it has not been solved).
- update_state(block, target) None¶
Rewrite
config.historyfrom the solved horizon.See
solved_history(). The spec then initializes the next horizon from the solve. Parameters are untouched; read them withread_spec().- Parameters:
- Raises:
FlexConfigError – If the block has not been solved.