Skip to content
ML Academy

Introduced on day 24

Lag feature

The value of the target (or a driver) from a fixed number of steps earlier, used as a model input; for a forecast h steps ahead the shortest legitimate lag is h.

In detail

A lag is built per entity by shifting the series, so that row t carries the value from t minus the lag. In a direct model for horizon h every lag must be at least h, because the newer values do not exist at the cutoff. Seasonal lags use multiples of the period (7, 14, 21 days for weekly data). In recursive forecasting shorter lags are allowed but are then filled with the model's own earlier predictions.