Esc
Ask AIAnswers may be inaccurate; check the linked pages.Esc
Ask anything about these docs, like how to get started or what a function does.

StateSpaceModel

chronax.auto_arima.StateSpaceModel · inherits NamedTuple

Immutable container describing the ARIMA state-space representation used by Kalman filtering and forecasting kernels.

Attribute Type Description
T Array Transition dynamics.
Z Array Observation mapping.
V Array Process covariance.
a0 Array Initial state location.
P0 Array Initial uncertainty.

ARIMAResult

chronax.auto_arima.ARIMAResult · inherits NamedTuple

Immutable selection summary for a candidate ARIMA specification.

Attribute Type Description
loglik float Exact log-likelihood for the model.
sigma2 float Innovation variance estimate.
aic float Akaike Information Criterion.
bic float Bayesian Information Criterion.
aicc float Small-sample corrected AIC.
ic float Selected information criterion value.
success bool Indicates finite and valid fit result.

AutoARIMA

chronax.auto_arima.AutoARIMA · inherits BaseForecaster

Performs automatic ARIMA model selection and fitting over configured search spaces, then exposes forecasting and interval prediction APIs.

Attributes: * uses_exog: True * model_: dict[str, Any] | None * standardize: bool * _cached_order: tuple[int, int, int] | None * _cached_seasonal_order: tuple[int, int, int] | None * _cached_delta: Array | None

__init__(self, d=None, D=None, max_p=5, max_q=5, max_P=2, max_Q=2, max_order=5, max_d=2, max_D=1, start_p=2, start_q=2, start_P=1, start_Q=1, stationary=False, seasonal=True, ic='aicc', stepwise=True, nmodels=94, method='CSS-ML', allowdrift=True, allowmean=True, period=None)

Set up AutoARIMA search bounds, options, and internal caches.

Parameter Type Default Description
d Optional[int] None Optional non-seasonal differencing override; None to infer.
D Optional[int] None Optional seasonal differencing override; None to infer.
max_p int 5 Maximum non-seasonal AR order.
max_q int 5 Maximum non-seasonal MA order.
max_P int 2 Maximum seasonal AR order.
max_Q int 2 Maximum seasonal MA order.
max_order int 5 Maximum total ARMA order budget.
max_d int 2 Upper bound for inferred non-seasonal differencing.
max_D int 1 Upper bound for inferred seasonal differencing.
start_p int 2 Stepwise starting AR order.
start_q int 2 Stepwise starting MA order.
start_P int 1 Stepwise starting seasonal AR order.
start_Q int 1 Stepwise starting seasonal MA order.
stationary bool False Force stationary differencing (d=D=0) when true.
seasonal bool True Enable seasonal search behavior.
ic str 'aicc' Information criterion for selection.
stepwise bool True Stepwise vs full grid search.
nmodels int 94 Max stepwise iterations.
method str 'CSS-ML' CSS, ML, or CSS-ML.
allowdrift bool True Drift and mean inclusion.
allowmean bool True Drift and mean inclusion.
period Optional[int] None Seasonal period or None for auto-detect.

fit(self, y, X=None) -> AutoARIMA

Fit automatic ARIMA model selection on a series.

Optionally standardizes the series, infers/uses seasonal period, executes automatic order search, and caches the winning order for subsequent fast forecast calls.

Parameters:

Parameter Type Default Description
y jnp.ndarray - Training target series.
X Optional[jnp.ndarray] None Optional exogenous regressors.

Returns: AutoARIMA (The fitted estimator instance; sets self.model_).

forecast(self, h, y, X=None, X_future=None, level=None, fitted=False) -> Dict[str, jnp.ndarray]

Produce fast forecasts from history with cached-order optimization.

On first invocation, this method runs full automatic selection via fit. On later calls, it reuses cached orders and only runs the optimization/forecast kernels needed for fresh predictions.

Parameters:

Parameter Type Default Description
h int - Forecast horizon.
y jnp.ndarray - Input history series.
X Optional[jnp.ndarray] None Optional exogenous matrix.
X_future Optional[jnp.ndarray] None Future exogenous regressors (unused; included for BaseForecaster compliance).
level Optional[list] None Confidence levels (unused; included for BaseForecaster compliance).
fitted bool False Whether to return fitted values (unused; included for BaseForecaster compliance).

Returns: dict[str, jnp.ndarray] (Forecast dictionary containing mean). Return Keys: * mean: jnp.ndarray

predict(self, h, X=None, level=None) -> Dict[str, jnp.ndarray]

Forecast from the fitted automatic ARIMA model.

Uses stored fitted model state to generate mean forecasts and, when confidence levels are provided, symmetric interval bounds.

Parameters:

Parameter Type Default Description
h int - Forecast horizon.
X Optional[jnp.ndarray] None Optional future exogenous matrix.
level Optional[Union[int, Tuple[int, ...]]] None Confidence levels.

Returns: dict[str, jnp.ndarray] (Mean forecast and optional interval bounds). Return Keys: * mean: jnp.ndarray * lo-{level}: jnp.ndarray (If level is provided) * hi-{level}: jnp.ndarray (If level is provided)

summary(self) -> str

Return a compact textual summary of the fitted model.

Builds an ARIMA order summary string with AICc when fitted, or a not-fitted status message otherwise.

Parameters:

Parameter Type Default Description
self - - (undocumented)

Returns: str (Human-readable model summary).

ARIMA

chronax.auto_arima.ARIMA · inherits BaseForecaster

Fixed-order ARIMA forecaster backed by shared JAX optimization kernels.

Attributes: * uses_exog: True * model_: dict[str, Any] | None * _delta: Array * _arma: tuple[int, ...]

__init__(self, order=(0, 0, 0), seasonal_order=(0, 0, 0), period=1, include_mean=True, method='CSS', alias='ARIMA', standardize=True)

Set up fixed-order ARIMA and precompute differencing and ARMA metadata.

Stores order, seasonal_order, period, include_mean, method, and alias. Precomputes and caches the differencing polynomial (delta), ARMA structure tuple (_arma), and parameter counts (_narma, _ncxreg, _n_exog) so that fit() and forecast() do not recompute them. Initializes model to None and optional standardization stats (_y_mean, _y_std). No fitting is performed.

Parameters:

Parameter Type Default Description
order Tuple[int, int, int] (0, 0, 0) (p, d, q).
seasonal_order Tuple[int, int, int] (0, 0, 0) (P, D, Q).
period int 1 Seasonal period.
include_mean bool True Include intercept/drift.
method str 'CSS' CSS, ML, or CSS-ML.
alias str 'ARIMA' Display name.
standardize bool True Whether to standardize series in fit/forecast.

fit(self, y, X=None) -> ARIMA

Estimate ARIMA parameters and store the fitted model and training state.

Optionally standardizes y (and caches y_mean, _y_std), then calls arima_fit with the instance's order, seasonal_order, period, include_mean, and method. Stores the returned dict in model and ensures model_["arma"] has the correct tuple. Saves y_fit as y_train_ for use in predict (e.g. for _reconstruct_forecast). Returns self for method chaining.

Parameters:

Parameter Type Default Description
y jnp.ndarray - Training target series.
X Optional[jnp.ndarray] None Optional exogenous regressors (same length as y).

Returns: ARIMA (self, with model_ and y_train_ set; sets self.model_).

forecast(self, h, y, X=None, X_future=None, level=None, fitted=False) -> Dict[str, jnp.ndarray]

Fit the fixed-order model on the given series and return h-step forecasts in one shot.

Standardizes y if standardize is True, then runs BFGS (CSS and/or ML) using the cached _delta and _arma without building the full arima_fit result (no AIC/BIC/residuals). Uses _forecast_from_params for a single XLA dispatch from params to forecasts, then _reconstruct_forecast to integrate differencing and _aa_denormalize to map back to original scale. Exogenous X is not used in this fast path. Returns a dict with key "mean" containing the forecast array. Useful when only point forecasts are needed and fitting state is not retained.

Parameters:

Parameter Type Default Description
h int - Forecast horizon.
y jnp.ndarray - Training series (used only for this call).
X Optional[jnp.ndarray] None Exogenous regressors; not used in current fast path.
X_future Optional[jnp.ndarray] None Future exogenous regressors (unused; included for BaseForecaster compliance).
level Optional[list] None Confidence levels (unused; included for BaseForecaster compliance).
fitted bool False Whether to return fitted values (unused; included for BaseForecaster compliance).

Returns: Dict[str, jnp.ndarray] ({"mean": array of shape (h,)}). Return Keys: * mean: jnp.ndarray

predict(self, h, X=None, level=None) -> Dict[str, jnp.ndarray]

Produce h-step forecasts (and optional interval bands) from the fitted model.

Requires a prior fit (model_ is not None). Calls predict_arima with model_, n_ahead=h, newxreg=X, and se_fit=(level is not None). Reconstructs forecasts from differenced space via _reconstruct_forecast and denormalizes if standardize was used. When level is provided, scales standard errors for integrated models (d+D>0) by cumulative sum of squared SEs and builds symmetric intervals using _quantiles. Returns a dict with "mean" and optionally "lo" / "hi" keys for each level.

Parameters:

Parameter Type Default Description
h int - Forecast horizon.
X Optional[jnp.ndarray] None Future exogenous regressors; shape (h, n_exog).
level int \| tuple[int, ...] \| None None Confidence level(s), e.g. 90 or (80, 95).

Returns: Dict[str, jnp.ndarray] (At least "mean"; if level given, "lo" and "hi" per level). Return Keys: * mean: jnp.ndarray * lo-{level}: jnp.ndarray (If level is provided) * hi-{level}: jnp.ndarray (If level is provided)