Skip to content

ML Forecasting & Evaluation

Feature Engineering for Time

9 min+85 XPStep 1/11

The series becomes a dataframe

Most ML models can't read a sequence — they read a table. So build one: each row is a moment in time, the target is the value you're predicting, and the features describe the past available at that moment.

The features that carry the signal:

  • Lags: y_{t−1}, y_{t−7}, y_{t−14} — raw history at the offsets that matter (lag 7 captures the weekly beat)
  • Rolling statistics: 7-day mean, 14-day standard deviation, 30-day max — smoothed summaries of recent behavior
  • Deltas: how much yesterday differed from the week before — momentum in feature form

Once history is a dataframe, any regressor can forecast — the problem becomes supervised learning wearing a disguise.

analogy

Feature engineering converts 'predict the next frame of the movie' into 'describe the last few frames in columns' — a format every model already knows how to eat.