Forecasting Methods

Once you can pull a series apart into trend, seasonality and noise, the obvious next question is: what happens next month? Forecasting is not one method but a ladder — from embarrassingly simple baselines that you must always beat, up to models that weave trend and seasonality back together. The discipline is to climb only as high as the data rewards, and to prove every rung beats the one below.

The bottom of the ladder: baselines you must beat

Before any clever model, you owe yourself two humbling benchmarks:

If your elaborate model cannot outperform "same as last year," the model is not adding value — a check that saves careers.

Moving average: smoothing out the jitter

The next rung averages the last k observations: \hat{y}_{t+1} = \frac{1}{k}\big(y_t + y_{t-1} + \cdots + y_{t-k+1}\big). A moving average trades responsiveness for stability: a long window (k large) is smooth but slow to react to a genuine change; a short window is twitchy but nimble. It weights every point in the window equally — which feels wrong, since last week surely matters more than ten weeks ago. That objection is exactly what the next rung fixes.

Exponential smoothing: recent past matters most

Exponential smoothing forecasts with a weighted blend of the latest value and the latest forecast:

\hat{y}_{t+1} = \alpha\, y_t + (1 - \alpha)\, \hat{y}_t,\qquad 0 < \alpha < 1.

Unroll that recursion and something beautiful appears: the forecast is a weighted sum of all past observations, with weights \alpha, \alpha(1-\alpha), \alpha(1-\alpha)^2, \dots that decay geometrically into the past. The smoothing parameter \alpha is the memory dial: near 1 the forecast chases the latest point (short memory, responsive); near 0 it barely moves (long memory, smooth). Drag the slider and watch the smoothed line stiffen or spring to life:

Plain exponential smoothing has no notion of trend or season, so it forecasts a flat line into the future. Holt's method adds a second equation that tracks the trend; Holt-Winters adds a third for seasonality — so the family climbs to handle exactly the components we decomposed earlier, each with its own smoothing dial.

ARIMA: the classical workhorse

ARIMA bundles three ideas whose initials spell its name:

Written \text{ARIMA}(p, d, q), the three orders say how many past values (p), how many differences (d), and how many past errors (q) to use. A seasonal variant, SARIMA, repeats the trio at the seasonal lag. ARIMA is more work to fit than exponential smoothing but more flexible, and the two remain the reliable classical baselines against which fancier machine-learning forecasters must justify themselves.

Evaluating a forecaster: respect the arrow of time

Here the ordinary machine-learning reflex — shuffle the data, split at random — is catastrophically wrong. Shuffling lets the model peek at the future to predict the past, a leak that inflates your score and collapses in production. Instead use a time-based split: train on the earliest stretch, test on the latest, and never let a test point predate a training point.

The gold standard is rolling-origin evaluation (also called time-series cross-validation): forecast the next step, reveal the true value, slide the training window forward, forecast again — mimicking how the model would really be used, one honest step at a time. Score with a metric built on the errors, such as the mean absolute error or the mean of the squared errors (RMSE).

For a random walk — a series whose next value is the current one plus unpredictable noise, a surprisingly good model of stock prices and exchange rates — the naive forecast \hat{y}_{t+1} = y_t is provably the best possible point forecast. There is genuinely no information about tomorrow beyond today's value, so any model that appears to beat naive on such data is almost always leaking, overfitting, or being tested on a lucky slice. This is why "beat naive" is not a low bar to be waved past but a real, sometimes unbeatable, benchmark. Humility is a forecasting skill.

The most common way to ruin a forecasting project is to reuse a habit from ordinary supervised learning: train_test_split(shuffle=True). On a time series this scatters future points into the training set, so the model effectively studies the answer sheet — it interpolates between points it has already seen rather than extrapolating into a genuine future. Your validation score looks spectacular; live performance is a disaster. The rule is absolute: the test period must come entirely after the training period. Any feature engineered from future information (a rolling mean that includes tomorrow, a "target from next week") is the same sin wearing a disguise.

Learn this on Kaggle

Kaggle Learn's Time Series course builds forecasters from naive baselines through trend and seasonal models, and its competitions give you real series to forecast with proper time-based validation in Python — the place to practise everything on this page.