Skill Tracer
Skills › Scientific Agent Skills › aeon › forecasting.md

forecasting.md

68 lines · skills/aeon/references/forecasting.md at 5f2bc03

Open on GitHub
1# Time Series Forecasting
2
3The experimental `aeon.forecasting` module uses array-native estimators, not sktime's `fh` or `ForecastingHorizon` API. This reference targets aeon 1.6. Check capability tags before supplying multivariate data or exogenous variables; the statistical examples here are univariate.
4

Time Series Forecasting

The experimental aeon.forecasting module uses array-native estimators, not sktime's fh or ForecastingHorizon API. This reference targets aeon 1.6. Check capability tags before supplying multivariate data or exogenous variables; the statistical examples here are univariate.

Raw lines 1 to 4
5## Imports and model families
6
7- `from aeon.forecasting import NaiveForecaster, RegressionForecaster`
8- `from aeon.forecasting.stats import ARIMA, AutoARIMA, ETS, AutoETS, Theta, TAR, AutoTAR, TVP`
9- `from aeon.forecasting.deep_learning import TCNForecaster, DeepARForecaster`
11`NaiveForecaster` offers `"last"`, `"mean"`, `"seasonal_last"`, and (new in 1.6) `"drift"`. Supply a positive `seasonal_period` with enough historical observations for `seasonal_last`. `RegressionForecaster` requires a `window` and learns an h-step target with a sklearn/aeon regressor. ARIMA takes `p`, `d`, `q`, not `order=`. ETS/AutoETS are native aeon implementations; automatic selection has documented stability/efficiency limitations and should be checked against a baseline.
13Deep forecasters require **TensorFlow**, not PyTorch. `DeepARNetwork` still exists as the underlying architecture; it is not a former name of `DeepARForecaster`. A DeepAR architecture alone does not establish calibrated predictive uncertainty. Optional deep-training examples are illustrative and were not executed in this review.

Imports and model families

  • from aeon.forecasting import NaiveForecaster, RegressionForecaster
  • from aeon.forecasting.stats import ARIMA, AutoARIMA, ETS, AutoETS, Theta, TAR, AutoTAR, TVP
  • from aeon.forecasting.deep_learning import TCNForecaster, DeepARForecaster

NaiveForecaster offers "last", "mean", "seasonal_last", and (new in 1.6) "drift". Supply a positive seasonal_period with enough historical observations for seasonal_last. RegressionForecaster requires a window and learns an h-step target with a sklearn/aeon regressor. ARIMA takes p, d, q, not order=. ETS/AutoETS are native aeon implementations; automatic selection has documented stability/efficiency limitations and should be checked against a baseline.

Deep forecasters require TensorFlow, not PyTorch. DeepARNetwork still exists as the underlying architecture; it is not a former name of DeepARForecaster. A DeepAR architecture alone does not establish calibrated predictive uncertainty. Optional deep-training examples are illustrative and were not executed in this review.

Raw lines 5 to 14
15## Single horizon versus a forecast path
17For models that expose `horizon`, `predict(history)` produces **one value** h steps beyond the history. `horizon=3` does not mean return the next three values. `last` and `mean` return their constant baseline regardless of horizon; drift and seasonal-last use the horizon.
19```python
20import numpy as np
21from aeon.forecasting import NaiveForecaster
22from aeon.forecasting.stats import ARIMA, AutoETS
24y = np.arange(1.0, 31.0)
25naive = NaiveForecaster(strategy="drift", horizon=3)
26naive.fit(y)
27y_at_3 = naive.predict(y)
28assert y_at_3 == 33.0
30# iterative_forecast fits once internally and returns a vector.
31# The estimator must have horizon=1 (the default).
32path = NaiveForecaster(strategy="last").iterative_forecast(y, 3)
33assert np.array_equal(path, [30.0, 30.0, 30.0])
34arima_path = ARIMA(p=1, d=1, q=1).iterative_forecast(y, 3)
36# AutoETS does not accept horizon=; use the multi-step helper.
37ets_path = AutoETS().iterative_forecast(y, 3)
38```
40`direct_forecast(y, prediction_horizon)` fits separate models for each horizon, using estimators with `capability:horizon=True`, such as `RegressionForecaster`. `iterative_forecast` feeds earlier predictions back into the history and accumulates error. Do not call `fit` immediately before this helper expecting it to preserve a pre-fitted model: the helper fits internally.

Single horizon versus a forecast path

For models that expose horizon, predict(history) produces one value h steps beyond the history. horizon=3 does not mean return the next three values. last and mean return their constant baseline regardless of horizon; drift and seasonal-last use the horizon.

import numpy as np
from aeon.forecasting import NaiveForecaster
from aeon.forecasting.stats import ARIMA, AutoETS

y = np.arange(1.0, 31.0)
naive = NaiveForecaster(strategy="drift", horizon=3)
naive.fit(y)
y_at_3 = naive.predict(y)
assert y_at_3 == 33.0

# iterative_forecast fits once internally and returns a vector.
# The estimator must have horizon=1 (the default).
path = NaiveForecaster(strategy="last").iterative_forecast(y, 3)
assert np.array_equal(path, [30.0, 30.0, 30.0])
arima_path = ARIMA(p=1, d=1, q=1).iterative_forecast(y, 3)

# AutoETS does not accept horizon=; use the multi-step helper.
ets_path = AutoETS().iterative_forecast(y, 3)

direct_forecast(y, prediction_horizon) fits separate models for each horizon, using estimators with capability:horizon=True, such as RegressionForecaster. iterative_forecast feeds earlier predictions back into the history and accumulates error. Do not call fit immediately before this helper expecting it to preserve a pre-fitted model: the helper fits internally.

Raw lines 15 to 41
42## Exogenous variables without target leakage
44ARIMA supports target-time regressors: training rows align with observed `y`, and prediction needs the covariates for the future target time. Historical exogenous effects require explicit lagged features. Use only covariates known at forecast issuance, or model their uncertainty separately.
46```python
47import numpy as np
48from aeon.forecasting.stats import ARIMA
50exog_train = np.arange(30.0)[:, None]
51y_train = 2.0 + 3.0 * exog_train[:, 0]
52future_exog = np.arange(30.0, 33.0)[:, None]
53forecaster = ARIMA(p=0, d=0, q=0)
54forecaster.fit(y_train, exog=exog_train)
55y_next = forecaster.predict(y_train, exog=future_exog[:1])
56path = forecaster.iterative_forecast(
57 y_train, prediction_horizon=3,
58 exog=exog_train, future_exog=future_exog,
60```
62Keep observed history in `predict(y_train, ...)`; passing held-out target values as that history leaks future information. In aeon 1.6 the recursive helper requires both historical `exog` and `future_exog` when either is supplied.

Exogenous variables without target leakage

ARIMA supports target-time regressors: training rows align with observed y, and prediction needs the covariates for the future target time. Historical exogenous effects require explicit lagged features. Use only covariates known at forecast issuance, or model their uncertainty separately.

import numpy as np
from aeon.forecasting.stats import ARIMA

exog_train = np.arange(30.0)[:, None]
y_train = 2.0 + 3.0 * exog_train[:, 0]
future_exog = np.arange(30.0, 33.0)[:, None]
forecaster = ARIMA(p=0, d=0, q=0)
forecaster.fit(y_train, exog=exog_train)
y_next = forecaster.predict(y_train, exog=future_exog[:1])
path = forecaster.iterative_forecast(
    y_train, prediction_horizon=3,
    exog=exog_train, future_exog=future_exog,
)

Keep observed history in predict(y_train, ...); passing held-out target values as that history leaks future information. In aeon 1.6 the recursive helper requires both historical exog and future_exog when either is supplied.

Raw lines 42 to 63
64## Evaluation
66Use rolling-origin or chronological holdouts. Compare against naive and seasonal-naive baselines, keeping the same forecast horizons and available covariates. Report errors per horizon before aggregating. Align arrays explicitly, then use sklearn `mean_absolute_error`, `mean_squared_error`, or `root_mean_squared_error`. Avoid random shuffling of overlapping forecasting windows.
68Sources: [forecasting API](https://www.aeon-toolkit.org/en/stable/api_reference/forecasting.html), [1.6 source and helper contracts](https://github.com/aeon-toolkit/aeon/blob/v1.6.0/aeon/forecasting/base.py), [ARIMA source](https://github.com/aeon-toolkit/aeon/blob/v1.6.0/aeon/forecasting/stats/_arima.py). Synthetic checks exercised all non-deep examples above.

Evaluation

Use rolling-origin or chronological holdouts. Compare against naive and seasonal-naive baselines, keeping the same forecast horizons and available covariates. Report errors per horizon before aggregating. Align arrays explicitly, then use sklearn mean_absolute_error, mean_squared_error, or root_mean_squared_error. Avoid random shuffling of overlapping forecasting windows.

Sources: forecasting API, 1.6 source and helper contracts, ARIMA source. Synthetic checks exercised all non-deep examples above.

Raw lines 64 to 68