Skip to content
Tutorials Center
My learning

Topics

Lesson 30 of 40 ยท Machine Learning Forecasting

Multi-step Forecasting Strategies

Forecast many steps ahead with machine learning models: the recursive strategy, the direct strategy, multi-output models, error accumulation and how to choose between them.

A model built from lag features predicts one step ahead: given the last few values, what comes next? But real forecasting questions look further: next week's daily sales, the next 24 hours of load. A machine learning model has no built-in notion of a horizon, so you must decide how to turn a one-step learner into a multi-step forecaster. There are three classic strategies, each with a different trade-off between simplicity, error growth and cost.

flowchart TB
    subgraph R["Recursive: one model, fed its own output"]
      direction LR
      r1["y(t+1)"] --> r2["y(t+2)"] --> r3["y(t+3)"]
    end
    subgraph D["Direct: one model per horizon"]
      direction LR
      d1["model h=1"] --- d2["model h=2"] --- d3["model h=3"]
    end
    subgraph M["MIMO: one model, all horizons at once"]
      direction LR
      m1["model"] --> m2["y(t+1..t+3)"]
    end

Three ways to forecast h steps ahead from a one-step feature table.

Strategy 1: recursive

Train one model to predict the next value. To forecast three steps, predict step 1, append that prediction to the history as if it were observed, then predict step 2 from it, and so on.

  • Simple, one model, any horizon.
  • Errors accumulate: a mistake at step 1 becomes an input at step 2. Bias compounds.
Python Recursive forecasting with a linear model

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Strategy 2: direct

Train a separate model for each horizon h. The model for h = 3 learns "from the information at time t, predict y at time t + 3". Targets are shifted by h and nothing is ever fed back.

  • No error accumulation through feedback; each model targets its own horizon.
  • More models to train and store (one per step), and the models do not know about each other, so the forecast path can look jagged.
Python Direct strategy: one model per horizon

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Strategy 3: multi-output (MIMO)

Train one model whose output is the whole vector of future values [y(t+1), ..., y(t+H)]. Some scikit-learn models (linear models, KNeighborsRegressor, RandomForestRegressor, MLPRegressor) accept a multi-column target natively; others can be wrapped in MultiOutputRegressor, which simply fits one model per column (equivalent to direct).

Python A multi-output forest

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

A forest with a vector target builds splits that serve all horizons at once, which keeps the forecast path coherent.

Which strategy to choose

Recursive Direct MIMO
Models to train 1 H 1
Error accumulation Yes No No
Handles any horizon Yes Only trained ones Only trained ones
Future exogenous values Needed for every step Not needed at origin Not needed at origin
Typical use Short horizons, linear models Long horizons, trees Neural nets, forests

Rules of thumb:

  • Short horizon and a stable, mostly autoregressive series: recursive is hard to beat for simplicity.
  • Long horizon or nonlinear models: prefer direct or MIMO. Trees in particular are poor at feeding back their own flattened predictions.
  • Mixed approach: recursive for the first few steps, direct beyond that (a "DirRec" hybrid).
  • Always compare with the seasonal naive baseline at every horizon; accuracy normally falls as h grows, and a good model beats the baseline at all of them.

Features at the forecast origin

With the direct and MIMO strategies, features must be known at the forecast origin (the last observed time). Calendar features of the target date (day of week of t + h) are fine because the calendar is known in advance. Lags with a shift smaller than h are not available for the direct model of horizon h in a recursive setup, so build features that exist at time t only.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What is the main weakness of the recursive strategy?

    Each step uses earlier predictions as inputs, so errors compound as the horizon grows.
  2. 2. How many models does the direct strategy train for a 12-step horizon?

    One model for each horizon h = 1 to 12.
  3. 3. What does MIMO mean in this context?

    Multiple-input multiple-output: one model predicts the vector of future values together.
  4. 4. Which features are safe in a direct model for horizon h?

    Only information available at the origin (plus calendars known in advance) can be used; anything else leaks the future.

Summary

  • A one-step ML model needs a strategy to forecast many steps: recursive, direct or multi-output.
  • Recursive is simple but accumulates errors; direct avoids feedback at the cost of H models; MIMO predicts the whole path at once.
  • Use features known at the forecast origin and judge accuracy per horizon against baselines.

Next: Regularized Linear Models for Forecasting