In forecasting sales or demand, the situation is different. The order of observations becomes critically important because the model must account for dynamics.
To enable an ML model to work with such data, they must be prepared:
- sorted by time,
- enriched with lags (values from previous days),
- transformed into rolling windows (e.g., weekly, bi‑weekly, monthly averages),
- supplemented with calendar features (day of week, month, holidays),
- and, if necessary, external factors (weather, marketing, competitor prices).
All the features listed above must be prepared so that they have the same time‑series structure as the target variable. For each day, we must have records of all features (factors) that help better predict the unknown value.
A concrete example: the target variable is sales; the factors are weather, day of week, holidays, promotions.