Supervised LearningTime-Series ForecastingForecasting

ARIMA / SARIMA

Primary task · Forecasting

ARIMA / SARIMA is a supervised learning method in the time-series forecasting family. This page summarizes its mechanism, practical uses, important trade-offs, and a browser-based concept explorer.

← Directory
Visual intuition

From data to learned behaviour

ARIMA / SARIMA converts patterns in observed data into a reusable prediction or representation rule. The most useful way to understand it is to watch what internal structure changes during training and how that learned structure changes outputs.

Infographic
1Data2Initial state3Optimise4Validate5InferenceTraining transforms evidence into a reusable model state
Conceptual simulation

Watch the learning mechanism form

The structure below is synchronized with the same training state used by the prediction simulation.

Mechanism view
Training control centre

Control both simulations together

Reset regenerates the synthetic data and model state. Train animates to completion. Pause freezes the animation. Train Step advances one learning stage.

Step 0 / 12
Model simulation

Inspect the learned prediction / representation

Synthetic data are generated locally in your browser.

Model description

Understand ARIMA / SARIMA after watching it learn

This section connects the animation to the actual statistical or computational idea behind the model.

Deep description

ARIMA / SARIMA ARIMA / SARIMA is a supervised learning method in the time-series forecasting family. This page summarizes its mechanism, practical uses, important trade-offs, and a browser-based concept explorer.

What is learned. During training, the algorithm builds or adjusts the parameters and internal representation used by ARIMA / SARIMA. The core learning mechanism is: Combines Autoregressive (AR), Differencing / Integrated (I), and Moving Average (MA) terms, with seasonal extensions (SARIMA) for stationary series.

How training becomes inference. Prepare data → initialise the model state → evaluate the current objective → update parameters or structure → validate progress → use the final state for inference. Once training stops, the fitted state is reused on unseen inputs rather than being reconstructed from scratch. The resulting output is: Future values or trajectories, often with trend/seasonal components and sometimes uncertainty intervals.

Why practitioners use it. Well-understood statistical foundation, confidence intervals, highly reliable on clean stationary time series. Typical fits include Macroeconomic forecasting, inventory demand planning, electricity grid baseline load modeling.

What to verify before trusting it. Cannot model non-linear relationships; struggles with complex multiple seasonalities (e.g., daily + annual). The visual simulation is intentionally simplified, so real use should still validate preprocessing, data independence, hyperparameters, uncertainty and task-appropriate metrics.

Internal statethe parameters and internal representation used by ARIMA / SARIMA
Typical outputFuture values or trajectories, often with trend/seasonal components and sometimes uncertainty intervals.
Good fitMacroeconomic forecasting, inventory demand planning, electricity grid baseline load modeling.
Main cautionCannot model non-linear relationships; struggles with complex multiple seasonalities (e.g., daily + annual).
1Training data→
2Learning objective→
3Internal model state→
4Prediction / representation→
5Evaluation
Intuition

What the model is trying to learn

ARIMA / SARIMA converts patterns in observed data into a reusable prediction or representation rule. The most useful way to understand it is to watch what internal structure changes during training and how that learned structure changes outputs.

Mathematical lens

Core logic

Combines Autoregressive (AR), Differencing / Integrated (I), and Moving Average (MA) terms, with seasonal extensions (SARIMA) for stationary series. The mathematical objective determines which model states are considered better, while regularisation and validation constrain how much complexity should be trusted.

Training sequence

How learning progresses

Prepare data → initialise the model state → evaluate the current objective → update parameters or structure → validate progress → use the final state for inference.

Original mechanism

Taxonomy description

Combines Autoregressive (AR), Differencing / Integrated (I), and Moving Average (MA) terms, with seasonal extensions (SARIMA) for stationary series.

Evaluation guide

How to evaluate this model responsibly

ValidationChoose validation that matches the independence assumptions of the data.
MetricsUse task-specific primary and complementary metrics.
HPOEstablish a baseline first, then search the parameters that materially change capacity.
Post-processingValidate any downstream transformation on held-out data.
Hyperparameters

Key parameters

(p,d,q)Typical: 1,1,1

AR order, differencing order, and moving-average order.

(P,D,Q,m)Typical: seasonal

Seasonal ARIMA orders plus seasonal period.

trendTypical: auto

Deterministic trend component.

enforce_stationarityTypical: True

Constrains AR parameters to stationary region.

Use & trade-offs

Where it fits

Typical applications

Macroeconomic forecasting, inventory demand planning, electricity grid baseline load modeling.

Strengths

Well-understood statistical foundation, confidence intervals, highly reliable on clean stationary time series.

Limitations

Cannot model non-linear relationships; struggles with complex multiple seasonalities (e.g., daily + annual).

Code example

Minimal Python implementation

# Purpose: demonstrate ARIMA / SARIMA with a small, inspectable example.
# Follow the comments and printed stages to connect each operation with its result.
# Import the library or helper used in this example.
import numpy as np
# Import the library or helper used in this example.
from statsmodels.tsa.arima.model import ARIMA

# Print this intermediate result so you can verify the workflow step by step.
print("STEP 1 · Define a short ordered time series")
# Create the numerical values used in the calculation.
y = np.array([10,11,13,12,15,16,18,17,19,21,20,23,24,25,27,26,29,30], dtype=float)
# Print this intermediate result so you can verify the workflow step by step.
print("Observations:", len(y))
# Print this intermediate result so you can verify the workflow step by step.
print("STEP 2 · Fit ARIMA(1,1,1)")
# Configure the estimator or pipeline with the chosen settings.
model = ARIMA(y, order=(1,1,1)).fit()
# Print this intermediate result so you can verify the workflow step by step.
print("AIC:", round(model.aic, 2))
# Print this intermediate result so you can verify the workflow step by step.
print("STEP 3 · Forecast the next three steps")
# Store this intermediate value with a descriptive name for the next step.
forecast = model.forecast(steps=3)
# Print this intermediate result so you can verify the workflow step by step.
print("3-step forecast:", np.round(forecast, 2).tolist())
Expected / representative output
STEP 1 · Define a short ordered time series
Observations: 18
STEP 2 · Fit ARIMA(1,1,1)
/opt/pyvenv/lib/python3.13/site-packages/statsmodels/base/model.py:607: ConvergenceWarning: Maximum Likelihood optimization failed to converge. Check mle_retvals
  warnings.warn("Maximum Likelihood optimization failed to "
AIC: 68.73
STEP 3 · Forecast the next three steps
3-step forecast: [31.07, 32.15, 33.22]