Skip to content
ML Academy

Time series and forecasting · insight-0234

Detrend or difference the target before using tree models on trending series

Evidence type
documented fact
Difficulty
medium
Roles
Data scientist, ML engineer
Industries
saas, retail, telecom

Summary: situation, action, reason, boundary

  1. Situation

    A gradient-boosted forecast of a growing subscription base flattens at the highest level seen in training.

  2. Action

    Predict differences, growth rates or ratios to a recent level, or remove the trend with a simple model and let the trees learn the residual, then backtest across origins with new highs.

  3. Reason

    Regression trees partition the input space and predict a constant within each region, so a tree ensemble cannot continue a trend beyond the feature and target ranges it saw.

  4. Boundary

    Growing or declining series modelled with random forests, XGBoost, LightGBM or CatBoost.

Symptom or risk

Tree predictions are piecewise constant over training targets, so they cannot extrapolate a trend beyond the observed range and under-forecast growth.

Exceptions

Stationary series, or series normalised by a recent level, rarely need this.

Trade-offs

Differenced targets accumulate errors when integrated back over long horizons.

Pitfalls

Adding a time index feature and assuming the trees will extrapolate it.

Lessons and concepts

Claims and their sources