Module 5 · Machine Learning for Time Series Forecasting

Boosting the Airline Passengers

Start from a dumb forecast: last month plus average growth. Then add small trees one at a time, each one trained on the errors the model still makes. On this data the first job the trees learn is the seasonal shape, summer up and November down. Train on 1950 to 1958, forecast 1959 and 1960 one month ahead.

Target
Weak learner · tree depth
Each tree's correction is shrunk by η.
Split finding16 bins
Rows per tree
GOSS uses the top_rate and other_rate set in the GOSS panel below.
Try

Forecast after 60 rounds one month ahead

Actual passengers Round 0: last month + average growth Boosted forecast

What the next tree sees training residuals

Model too low Model too high Next tree's fit to them

–

Error vs boosting rounds RMSE, thousands

Training months Test: 1959 to 1960 Best test round Seasonal naive

Training error keeps falling because every tree is built to shrink it. Test error falls while the trees learn real structure, then flattens or creeps back up once they start fitting noise. In practice you hold out a validation window and stop at its best round. That is early stopping.

Test RMSE–after 60 rounds
Training RMSE–on 1950 to 1958
Best round–lowest test error
Seasonal naive–same month last year
–

Inside one split

How LightGBM finds splits faster

Every tree has to search for its best split. Both panels below use the real residuals of the model above at round 60, so move the rounds slider and watch them change. For a cleaner toy version, see Histogram vs GOSS Splitting.

Exact vs histogram fewer thresholds to test

8
Splits to test–
Best split, exact vs histogram–
Gain the histogram keeps–
Best exact split Best histogram split Residual sum per bin

Exact search sorts the rows and tries every gap between neighbors. The histogram drops each row into a bin once, adds up residuals per bin, and only tries the bin edges. With a decent number of bins it usually keeps nearly all of the gain.

GOSS fewer rows per tree

0.20 0.10
Rows used–
Weight on sampled rows–
Error mass in the sample, GOSS–
Error mass in the sample, random–
Always kept Sampled, upweighted Skipped this round

Rows with big residuals are where the model is most wrong, so GOSS always keeps them. From the rest it takes a small random sample and scales it up by (1 − a)/b, so totals stay roughly right. The error mass tiles show what share of all the absolute residual the sampled rows carry, GOSS against a plain random sample of the same size. GOSS pays off most when a few rows hold most of the error, which is common in large, messy data. Airline residuals are spread fairly evenly, so here the gain is modest.

Histogram vs GOSS two different savings

HistogramGOSS
What it cutsCandidate thresholdsRows per tree
HowBucket feature values, test only the bin edgesKeep the large residual rows, sample and upweight the rest
In LightGBMAlways on, max_bin defaults to 255Optional, the default strategy is bagging
RiskToo few bins blur a fine split. Try 4 bins on calendar month above.Upweighted small rows add noise and can overfit on small data
Pays off onAny data sizeLarge data, where cutting 70% of rows per tree saves real time
import lightgbm as lgb
model = lgb.LGBMRegressor(max_bin=255, data_sample_strategy="goss", top_rate=0.2, other_rate=0.1)

Older LightGBM versions turned GOSS on with boosting_type="goss" instead.

1 · Start from the average

Round 0 predicts the average target for every row. Here that is last month's passengers grown by the average monthly change, which lags the seasonal swings badly.

2 · Fit what's left

Each new tree is trained on the current residuals, the negative gradient of squared error. Its answer is shrunk by η and added on. Small trees and a small η make many careful steps instead of a few big ones.

3 · Stop early

Training error only goes down. Test error does not. Choose the number of rounds on a validation window that comes after the training data, never by looking at training error.

4 · Boosting vs bagging

Boosting adds shallow trees in sequence to cut bias, so stumps work well here. Bagging averages deep trees in parallel to cut variance, where stumps barely help. Neither can extrapolate a trend, so both need a stationary target.