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.
The math
With history up to time , horizon and seasonal period (12 for monthly data):
The seasonal formula picks the value from the same position in the last complete season; the ceiling counts how many seasons back that is.
Simple exponential smoothing keeps a level with a smoothing weight between 0 and 1:
A large 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
with a constant , a coefficient and a random error . In general ARIMA(p, d, q) uses p lagged values, d differences and q lagged errors. If the forecasts move toward the long-run mean .
Worked example
Exponential smoothing. Let , start the level at 20, and observe 20, 24, 26.
- After 20: .
- After 24: .
- After 26: .
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 , 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
- Open Pipelines and choose New pipeline.
- Set the task to Time series forecasting.
- In Forecast settings, pick the Date column, a Forecast horizon and the CV folds.
- Add the naive and snaive models next to ETS and ARIMA, train, and compare them on the leaderboard.