Principle:Online ml River Multi Step Forecasting
| Knowledge Sources | Domains | Last Updated |
|---|---|---|
| River River Docs | Online Machine Learning, Time Series Forecasting | 2026-02-08 16:00 GMT |
Overview
Technique for producing predictions multiple time steps into the future from an online forecasting model using recursive or direct forecasting strategies.
Description
Multi-step forecasting extends single-step prediction to produce a sequence of h future values, where h is the forecast horizon. Given the current model state at time t, the forecast(horizon=h) method returns a list of predicted values for times t+1, t+2, ..., t+h.
Different forecasting models employ different strategies for multi-step prediction:
- Recursive strategy (used by SNARIMAX): The model predicts the next value, then uses that prediction as an input (lag) for predicting the subsequent value. This process chains forward for all h steps. Predictions degrade as the horizon increases because errors compound.
- Direct strategy (used by HoltWinters): The model directly extrapolates its internal components (level, trend, seasonal factors) for each horizon step without feeding predictions back as inputs. This avoids error compounding but relies on the assumption that the structural components remain stable.
Both strategies require careful handling of exogenous features: if the model uses exogenous inputs, the caller must provide future values of those features for each step of the horizon.
Usage
Use multi-step forecasting when:
- You need predictions for multiple future time steps simultaneously
- You want to compare forecaster accuracy at different horizon distances
- You are building a planning or scheduling system that requires a forecast window
- You need to evaluate a model's ability to capture long-range patterns
Theoretical Basis
Recursive Multi-Step Forecasting (SNARIMAX)
The recursive strategy generates forecasts one step at a time, feeding each prediction back as input for the next:
Given: model state at time t, horizon h
For step k = 1, 2, ..., h:
1. Construct features from:
- AR lags: hat{y}_{t+k-1}, hat{y}_{t+k-2}, ..., (mix of predictions and actuals)
- MA errors: Set to 0 for future steps (no true errors available)
- Exogenous: xs[k-1] if provided
2. Predict: hat{y'}_{t+k} = regressor.predict_one(features)
3. Undifference: hat{y}_{t+k} = undiff(hat{y'}_{t+k}, history)
4. Append hat{y}_{t+k} to history for use as lag in subsequent steps
Key characteristics:
- Errors compound across steps since each prediction uses previous predictions as inputs
- Future errors are assumed to be zero (since no true values are available)
- History deques are copied to avoid mutating model state during forecasting
Direct Multi-Step Forecasting (HoltWinters)
The direct strategy extrapolates the structural components independently for each step:
Given: level l_t, trend b_t, seasonal factors s_{...}, horizon h
For step k = 1, 2, ..., h:
Additive: hat{y}_{t+k} = l_t + k * b_t + s_{t+k-m}
Multiplicative: hat{y}_{t+k} = (l_t + k * b_t) * s_{t+k-m}
Key characteristics:
- No error compounding since each step is computed independently from the same components
- Trend contribution grows linearly with horizon step
- Seasonal factors cycle based on position within the season
Exogenous Features for Future Steps
Both forecasters accept an optional xs parameter containing exogenous features for each future step:
forecast(horizon=3, xs=[
{"temperature": 75.0}, # features for t+1
{"temperature": 78.0}, # features for t+2
{"temperature": 80.0}, # features for t+3
])
The length of xs must equal the specified horizon. If no exogenous features are needed, xs defaults to None.