Forecasting models

From naive and seasonal naive to ETS, ARIMA, Theta and regression-based forecasters, and how to pick one.

Lesson 54 of 6615 minIntermediate

You will learn to

  • Explain naive, ETS, ARIMA and Theta in plain words
  • Know when regression forecasters (cds_dt) help
  • Pick a model that suits the forecast horizon

Before this lesson

Intuition

A forecast answers one question: given everything up to now, what comes next? The simplest honest answers are surprisingly good, and the more advanced models are best understood as refinements of them.

  • Naive. Tomorrow equals today. It captures the level and nothing else.
  • Seasonal naive. This month equals the same month last year. It captures the level and the seasonal pattern.
  • Drift. The series keeps changing by its average change. It captures a trend.

The next step is smoothing. Instead of trusting only the last value, exponential smoothing keeps a running level that gives the most weight to recent values and less to older ones. ETS (error, trend, seasonality) is the family built on this idea: a smoothed level, optionally a smoothed trend, optionally a smoothed seasonal pattern.

ARIMA takes another route. It predicts the next value from a mix of recent values (the autoregressive part, AR), the number of differences needed for stability (the integrated part, I) and recent forecast errors (the moving-average part, MA). It is the natural model when the autocorrelation plots show structure.

Theta is a light model that blends a trend line with a smoothed level. It is cheap, robust and often hard to beat on short monthly series.

Finally, regression forecasters turn forecasting into an ordinary supervised problem: they remove trend and seasonality, then predict each value from the previous ones with a regressor such as a linear model or a tree ensemble. They can use extra columns (like price or holiday flags) as inputs, which the statistical models above mostly cannot.

Picture it

Three simple forecasts of the same history. The naive forecast is flat, the drift forecast follows the average slope, and the seasonal naive forecast repeats the last full year.

Forecast horizonHistoryNaiveSeasonal naiveDriftTime→
Naive, seasonal naive and drift forecasts over the same horizon (illustrative data).

The math

With history up to time TT, horizon hh and seasonal period mm (12 for monthly data):

naive: y^T+h=yTseasonal naive: y^T+h=yT+h−m⌈h/m⌉\text{naive: } \hat{y}_{T+h} = y_T \qquad \text{seasonal naive: } \hat{y}_{T+h} = y_{T+h-m\lceil h/m \rceil}

The seasonal formula picks the value from the same position in the last complete season; the ceiling ⌈h/m⌉\lceil h/m \rceil counts how many seasons back that is.

Simple exponential smoothing keeps a level ℓt\ell_t with a smoothing weight α\alpha between 0 and 1:

ℓt=α yt+(1−α) ℓt−1,y^T+h=ℓT\ell_t = \alpha\, y_t + (1-\alpha)\,\ell_{t-1}, \qquad \hat{y}_{T+h} = \ell_T

A large α\alpha follows the data closely; a small one smooths strongly. The full ETS family adds a trend and a seasonal component in the same way.

An AR(1) model, the smallest piece of ARIMA, says

yt=c+φ yt−1+εty_t = c + \varphi\, y_{t-1} + \varepsilon_t

with a constant cc, a coefficient φ\varphi and a random error εt\varepsilon_t. In general ARIMA(p, d, q) uses p lagged values, d differences and q lagged errors. If ∣φ∣<1|\varphi| < 1 the forecasts move toward the long-run mean c/(1−φ)c/(1-\varphi).

Worked example

Exponential smoothing. Let α=0.5\alpha = 0.5, start the level at 20, and observe 20, 24, 26.

  1. After 20: ℓ1=0.5⋅20+0.5⋅20=20\ell_1 = 0.5 \cdot 20 + 0.5 \cdot 20 = 20.
  2. After 24: ℓ2=0.5⋅24+0.5⋅20=22\ell_2 = 0.5 \cdot 24 + 0.5 \cdot 20 = 22.
  3. After 26: ℓ3=0.5⋅26+0.5⋅22=24\ell_3 = 0.5 \cdot 26 + 0.5 \cdot 22 = 24.

The forecast for every future step is 24, while the naive forecast is 26. The smoothed forecast is calmer: it does not react fully to the last point, which is useful when the last point is noisy and harmful when it marks a real jump.

Seasonal naive. Last year's quarters were 80, 100, 120 and 90. The seasonal naive forecast for the next four quarters is again 80, 100, 120 and 90.

AR(1). With c=2c = 2, φ=0.8\varphi = 0.8 and last value 20, the forecast one step ahead is 2 + 0.8 x 20 = 18. Two steps ahead it is 2 + 0.8 x 18 = 16.4, and so on. The values fall toward 2 / (1 - 0.8) = 10. For short horizons the model uses the recent value; for long ones it falls back to the mean.

How mlflow does it

  • Setup. Choose the task Time series forecasting in Pipeline Studio and fill the Forecast settings card: Date column, Forecast horizon, CV folds and Fold strategy. The last horizon of periods is held out to score the models.
  • Statistical models. The model list includes naive, grand_means, snaive, polytrend, arima, auto_arima, exp_smooth, ets, theta, stlf, croston, bats, tbats and prophet. Some of them need optional libraries and are only offered when those are installed.
  • Regression forecasters. Models with the suffix cds_dt (for example lr_cds_dt) are regressors wrapped with conditional deseasonalising and detrending: they remove trend and seasonality, predict with a regressor and put them back. They work like the other forecasters in the leaderboard.
  • Default metric. Models are ranked by MASE; a lower value is better. The next lesson explains it.
  • Intermittent demand. croston is made for series with many zeros, such as the sales of a slow product.

Common mistakes

  • Skipping the baseline. A complex model with no naive comparison can look good and still add nothing. Always include naive and, for seasonal data, seasonal naive.
  • Choosing by one fold. A single window can favour a model by luck. Use several folds and compare the average, as in the next lesson.
  • Forgetting the horizon. A model that chases recent values can win one step ahead and fail twelve steps ahead, while a smoother or mean-reverting model often does the opposite. Score the models at the horizon you will actually use.
  • Using a regression forecaster without enough history. These models need enough rows to learn the lagged relations. With a short series, simpler statistical models are safer.
  • Believing a precise-looking interval. A forecast far ahead is uncertain. Treat the point forecast as one scenario, not a promise.

Try it in mlflow

Train a forecasting pipeline

  1. Open Pipelines and choose New pipeline.
  2. Set the task to Time series forecasting.
  3. In Forecast settings, pick the Date column, a Forecast horizon and the CV folds.
  4. Add the naive and snaive models next to ETS and ARIMA, train, and compare them on the leaderboard.
Open in mlflow

Read in the docs

Check your understanding

  1. 1. Why should you always train a naive or seasonal naive forecaster next to a complex model?
  2. 2. Monthly data has a strong yearly cycle and almost no trend. Which simple model should be hard to beat?
  3. 3. An AR(1) model has y(t) = 2 + 0.8 y(t-1). What happens to its forecasts many steps ahead?