AutoARIMAForecaster¶
- class omnicast.AutoARIMAForecaster(seasonal_period=None, max_p=2, max_d=1, max_q=2, max_P=1, max_D=1, max_Q=1, information_criterion='aicc')[source]
Bases:
ARIMAForecasterSelect a non-seasonal or seasonal ARIMA by corrected AIC grid search.
Examples
>>> import pandas as pd >>> from omnicast import AutoARIMAForecaster >>> y = pd.Series([10.0, 12.0, 11.0, 13.0, 15.0, 14.0]) >>> model = AutoARIMAForecaster(max_p=1, max_d=1, max_q=0).fit(y) >>> model.order_ (0, 1, 0) >>> model.predict(horizon=2).mean.round(2).tolist() [14.0, 14.0]
Pass
seasonal_periodto also search(P, D, Q, m).Notes
When to use this model¶ Best for
You want ARIMA/SARIMA without hand-picking an order; the default first candidate
AutoForecastertriesAvoid when
Interactive use with a wide search space – cost scales as the product of every
max_*bound plus one, and it is often the slowest model in the package to fitHandles trend
Yes, searched via
max_dHandles seasonality
Yes, searched via
seasonal_period+max_P/max_D/max_QExtra dependencies
None (uses
statsmodels)Min. observations
Enough for the largest candidate order to be estimated; failed candidates are skipped rather than aborting the search
- Parameters:
- fit(y, X=None)[source]
- fit_predict(y, horizon, **kwargs)
- predict(horizon, X=None, level=(80, 95))
Grid-searches (p, d, q) and, if seasonal_period is given, (P, D, Q, m)
too, fitting a SARIMAX for every combination and keeping the one with the
best information criterion ("aicc" by default – corrected AIC, more
reliable than raw AIC on short series). Failed fits (non-convergent,
singular) are silently skipped rather than aborting the search.
from omnicast import AutoARIMAForecaster
model = AutoARIMAForecaster(
seasonal_period=12,
max_p=2, max_d=1, max_q=2,
max_P=1, max_D=1, max_Q=1,
information_criterion="aicc",
).fit(y)
print("chosen order:", model.order_, "seasonal_order:", model.seasonal_order_)
print(model.search_results_.head(5))
chosen order: (0, 1, 2) seasonal_order: (0, 1, 1, 12)
order seasonal_order aic aicc bic
0 (0, 1, 2) (0, 1, 1, 12) 73.75 74.68 77.73
1 (2, 0, 2) (1, 1, 1, 12) 90.70 93.50 98.01
2 (0, 1, 2) (1, 1, 1, 12) 92.28 93.71 97.26
3 (1, 0, 2) (0, 1, 1, 12) 92.82 94.25 98.04
4 (0, 1, 1) (0, 1, 1, 12) 94.10 94.64 97.23
search_results_ is sorted by information_criterion – the chosen
(0, 1, 2)(0, 1, 1, 12) beats the runner-up by a wide AICc margin here,
because it correctly captures both the trend (d=1) and yearly seasonal
differencing (D=1).
forecast = model.predict(horizon=6, level=[80, 95])
print(forecast.to_frame())
mean lower_80 upper_80 lower_95 upper_95
2026-01 207.64 206.13 209.15 205.33 209.95
2026-02 215.19 213.46 216.92 212.54 217.84
2026-03 219.77 218.00 221.55 217.05 222.50
2026-04 224.87 223.04 226.71 222.07 227.68
2026-05 225.02 223.14 226.91 222.15 227.90
2026-06 223.05 221.12 224.98 220.10 226.00
AutoARIMAForecaster subclasses ARIMAForecaster, so
after fit it exposes the same params_, aic_, bic_, and prediction
API – plus order_/seasonal_order_ (the winning search result) and
search_results_ (every candidate tried).
Cost
The search space is (max_p+1) * (max_d+1) * (max_q+1) * (max_P+1) * (max_D+1) * (max_Q+1)
SARIMAX fits. Keep the max_* bounds small for interactive use, or expect
this to take noticeably longer than any other model in the package – it’s
also why it is the default first candidate AutoForecaster tries, but the
one most likely to dominate its total runtime.