Compare direct and recursive multi-step forecasting
In this article (5 sections)
Lag models need a strategy when the required future lag is not observed. A recursive strategy fits one next-step model, predicts horizon one, feeds that prediction back, then repeats. A direct strategy fits a separate model for each horizon. They use different assumptions and fail differently.
Recursive forecasts share one model and remain simple to maintain, but early errors enter later inputs. Direct forecasts avoid that feedback and let relationships vary by horizon, but require more models and fewer training examples at distant horizons.
One origin, six horizons
The verified lab trains linear 12-lag models on 120 development months and forecasts the first six held-out months from one origin.
| Horizon | Actual | Recursive | Direct |
|---|---|---|---|
| 1 | 99.52 | 85.83 | 85.83 |
| 2 | 103.58 | 84.87 | 84.59 |
| 3 | 106.95 | 87.45 | 87.25 |
| 4 | 106.81 | 96.49 | 96.38 |
| 5 | 110.20 | 97.23 | 96.69 |
| 6 | 126.58 | 111.39 | 111.43 |
Recursive MAE is 15.06; direct MAE is 15.25. They are close because the model is linear and the large error comes mainly from an authored upward break.
from timeseries_cases import direct_recursive_case
result = direct_recursive_case()
assert result["horizons"] == 6
assert result["recursive"][0] == result["direct"][0]
print(round(result["recursive_mae"], 2), round(result["direct_mae"], 2))The lower recursive test MAE is a reported result, not a selection decision. Choosing a strategy after seeing this test would consume the holdout. Strategy selection belongs in rolling validation across several origins.
Align the training target
For horizon h, a direct model maps features at an origin to y[t+h]. Its last usable training origin moves earlier as h grows. Log sample counts for every horizon. Recursive training uses one-step pairs, but inference sees its own predictions in place of actual lags; this training-serving difference can accumulate error.
Multi-output models offer a third option and can learn relationships between horizons. Hybrid methods recurse for some steps and use direct models for others. The best choice depends on data volume, horizon, nonlinearity and maintenance constraints.
Evaluate the forecast object
Report error by horizon and origin, not only a six-value average. Preserve coherent units and timestamps. If forecasts must aggregate across products, reconcile the complete horizon vector. If future promotions differ by horizon, supply only plans known at the origin.
Stress-test recursive models for implausible paths and define bounds through the business process rather than silently clipping after evaluation. A clipped production path should be the path scored in the backtest.
The Data Science course uses this comparison to connect supervised learning tables with real forecast issuance.
Exercise
Run both strategies across at least five origins and horizons 1–12. Plot MAE by horizon, count training rows, and choose a strategy on validation. Evaluate the chosen pipeline once on a held-out origin.
Continue learning
This article is part of the Forecasting and time-series analysis sequence. Use the neighbouring tasks when you need the prerequisite or the next application.
- Review the prerequisite or neighbouring task in Forecast evaluation during structural breaks.
- Continue with Anomaly detection in a seasonal metric.
Reference: scikit-learn’s lagged-feature forecasting example.
Pankit Kumar has 10 years in Data Science & AI, building and shipping production systems in regulated pharma and clinical environments. He is a freelance trainer at Boston Institute of Analytics, AnalytixLabs and Scaler, and has taught this material to thousands of working professionals.
This article is part of our Data Science programme — 6 months. From data foundations to machine learning, deep learning and deployment.
Explore Data Science