Deep Forecasting · Nixtla in Python

One Table, Every Horizon

Three packages, the same data, the same test year. Every model is scored three ways: one step ahead, multi-step (fed its own forecasts) and multi-output (the whole year in one shot). Click any cell to see that forecast of 1960 and the line of code behind it. Then see why the recursive LSTM went flat, and what fixed it.

Goes with Deep Forecasting: Nixtla in Python, one table, every forecasting horizonThe notebook

Order the rows by
The three horizons
One step ahead: each month of 1960 is forecast from the real months before it. Multi-step: a Ty = 1 model, fed its own forecasts 12 times. Multi-output: Ty = 12, the whole year in one shot. The last two see nothing after December 1959.

The board error on 1960, percent, lower is better

StatsForecast, classical MLForecast, machine learning NeuralForecast, deep learning The benchmark

The forecast

Known in December 1959 What really happened This forecast


    

The recursive LSTM went flat

Fed its own forecasts, the LSTM scored 13.4 percent: worse than copying last year, in every one of the 10 runs. Here is the story in the order the video tells it. Step through it.

The LSTM, multi-step

What really happened The LSTM, fed its own forecasts


    

Which call gives which horizon

HorizonStatsForecastMLForecastNeuralForecast
One step aheadcross_validation(h=1, n_windows=12, step_size=1, refit=False) in all three packages: trained once on data to December 1959, then 12 forecasts, each from real data.
Multi-stepforecast(h=12), the defaultfit(train).predict(h=12), the default. The loop is inside predict.recurrent=True on an RNN, GRU or LSTM. For any other network, a short loop of your own.
Multi-outputNot available: a classical model is one equation that rolls forward.fit(train, max_horizon=12): 12 separate models, one for each month ahead.h=12: one network with 12 outputs.

1 · One step ahead flatters every model

One step ahead, every model on the board lands between 2.8 and 4.4 percent. That is the number most tutorials report. Order the rows by multi-step or by multi-output and the board looks different.

2 · The simplest model won the year

A linear regression with 12 lags, multi-output: 2.6 percent. The model for 12 months ahead was fitted on exactly that question. On a small, regular series like this one, the heavy families do not pay for themselves. On thousands of series with many features, that can change.

3 · Never report one run of a network

Every network cell is the middle of 10 runs, with its range. Train the same multi-output LSTM again with a new seed, and the year lands anywhere from 2.9 to 4.9 percent.

4 · If a recursive network goes flat

Try a longer memory first, if you have the data for it. Otherwise detrend and deseasonalize, and let the network learn the change. The same three horizons, drawn as blocks with a small model you can step by hand: One step, multi-step, multi-output. And why every error needs a benchmark next to it: Beat the benchmark.