scientific-skills/aeon/references/forecasting.md
Aeon provides forecasting algorithms for predicting future time series values.
Simple forecasting strategies for comparison:
NaiveForecaster - Multiple strategies: last value, mean, seasonal naive
strategy ("last", "mean", "seasonal"), sp (seasonal period)Classical time series forecasting methods:
ARIMA - AutoRegressive Integrated Moving Average
p (AR order), d (differencing), q (MA order)ETS - Error-Trend-Seasonal decomposition
error, trend, seasonal typesTAR - Threshold Autoregressive model for regime switchingAutoTAR - Automated threshold discovery
Theta - Classical Theta forecasting
theta, weights for decompositionTVP - Time-varying parameter model with Kalman filtering
Neural networks for complex temporal patterns:
TCNForecaster - Temporal Convolutional Network
DeepARNetwork - Probabilistic forecasting with RNNs
Apply regression to lagged features:
RegressionForecaster - Wraps regressors for forecasting
window_length, horizonfrom aeon.forecasting.naive import NaiveForecaster
from aeon.forecasting.arima import ARIMA
import numpy as np
# Create time series
y = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
# Naive baseline
naive = NaiveForecaster(strategy="last")
naive.fit(y)
forecast_naive = naive.predict(fh=[1, 2, 3])
# ARIMA model
arima = ARIMA(order=(1, 1, 1))
arima.fit(y)
forecast_arima = arima.predict(fh=[1, 2, 3])
The forecasting horizon (fh) specifies which future time points to predict:
# Relative horizon (next 3 steps)
fh = [1, 2, 3]
# Absolute horizon (specific time indices)
from aeon.forecasting.base import ForecastingHorizon
fh = ForecastingHorizon([11, 12, 13], is_relative=False)
Use standard forecasting metrics:
from aeon.performance_metrics.forecasting import (
mean_absolute_error,
mean_squared_error,
mean_absolute_percentage_error
)
# Calculate error
mae = mean_absolute_error(y_true, y_pred)
mse = mean_squared_error(y_true, y_pred)
mape = mean_absolute_percentage_error(y_true, y_pred)
Many forecasters support exogenous features:
# Train with exogenous variables
forecaster.fit(y, X=X_train)
# Predict requires future exogenous values
y_pred = forecaster.predict(fh=[1, 2, 3], X=X_test)
BaseForecaster - Abstract base for all forecastersBaseDeepForecaster - Base for deep learning forecastersExtend these to implement custom forecasting algorithms.