Skip to content
ML Academy

Time series and forecasting · insight-1245

Give a boosted tree the same-weekday and same-season lags explicitly

Evidence type
practitioner heuristic
Difficulty
easy
Roles
Data scientist, ML engineer
Industries
retail, logistics, aviation

Summary: situation, action, reason, boundary

  1. Situation

    A daily boosted model uses lags 1 to 7 and a rolling 7-day mean, and its Monday forecasts keep missing the Monday level after a holiday week.

  2. Action

    Add lags at the seasonal period and its multiples, such as 7, 14, 21 and 28 days, same-weekday rolling means, and a calendar block. For annual comparison use 364 days to keep the weekday, subject to the horizon rule for lags.

  3. Reason

    A seasonal lag places the observation at the same position in the cycle directly into the feature set, so the tree can use it without having to infer the cycle from a time index.

  4. Boundary

    Daily and weekly boosted-tree forecasters with a stable seasonal cycle.

Symptom or risk

Trees see only the features they are given: after a holiday week the lag-7 value is itself distorted, and a trailing seven-day average blurs the weekday pattern, so no clean same-weekday reference is in the feature set.

Exceptions

Short histories cannot support annual lags; use calendar features and a seasonal-adjusted target instead.

Trade-offs

Longer lags remove the first rows of each series from training and add correlated columns.

Pitfalls

Using lag 365 for an annual comparison, which moves the weekday by one or two each year.

Lessons and concepts