Level 0: Foundation
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.Boosting with a random half
Gradient boosting fits every tree to all the data, so consecutive trees can latch onto the same noisy points. Stochastic gradient boosting shows each new tree only a random fraction of the examples, often 50%. Each tree is a little noisier, but they no longer all chase the same quirks, and the ensemble generalises better. It also trains faster, since each tree sees less data.
Row subsampling (subsample in XGBoost and LightGBM, bagging_fraction) is one of the most effective regularisers in practice, along with the learning rate and early stopping. It also speeds up training on large telemetry datasets. Knowing that out-of-bag stopping tends to stop early saves you from underfit models.
- 1. Stochastic gradient boosting fits each tree on…
- 2. Subsampling mainly…
- 3. In the demo, out-of-bag stopping tends to…
Level 1: Beginner
★★☆☆☆ Basic⏱ 25 minSecondary-school mathematics: arithmetic and elementary algebra.Subsampling arithmetic
Subsample. With n = 300 and η = 0.5, each tree is fitted to 150 randomly chosen points, drawn without replacement and freshly each round. The other 150 are out of bag for that round.
Cost. Tree fitting with sorting costs about m log m for m points:
- η = 0.5, n = 1000: 500·log 500/(1000·log 1000) = 0.5·0.900 = 0.45 of the full cost;
- η = 0.1: about 0.067, so 15× cheaper per tree.
Out-of-bag improvement. For one round, OOB gain = MSE of the OOB points before the step − MSE after the step. Example: OOB residuals (1.0, −0.5) with a step of (0.4, −0.1) give
(1.0² + 0.5²)/2 − (0.6² + 0.4²)/2 = 0.625 − 0.26 = 0.365.
Summing gains over rounds and stopping at the peak is the OOB stopping rule.
The steps in plain English:
- Each round, draw a fraction η of the training points without replacement.
- Compute pseudo-residuals for all points, but fit the tree only on the subsample.
- Add ν times the tree to the model for every point. Record the OOB improvement on the left-out points.
- Tune η (0.5–0.8 is typical) with ν and the number of trees. Prefer a validation set over OOB for stopping.
- 1. OOB points per round for n = 300, η = 0.5?
- 2. Relative cost for η = 0.5 and n = 1000?
- 3. Subsampling is done…
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 30 minUndergraduate students and practising engineers.Why subsampling helps
Variance reduction. As in bagging, averaging trees fitted to different subsamples reduces their correlation. In boosting, the “average” is the sequential sum, but the effect is similar: later trees are less dominated by the noise that earlier trees fitted. Friedman (2002) found η ≈ 0.5 typically best, with larger gains on small, noisy datasets.
Regularisation interplay. Subsampling, shrinkage (ν) and tree size all regularise. Smaller η usually wants smaller ν, and the number of trees must be tuned jointly (early stopping).
Column subsampling. Sampling features per tree or per split (colsample_bytree and colsample_bynode in XGBoost, feature_fraction in LightGBM) adds random-forest-style decorrelation and speed. It is very effective with many correlated features.
OOB estimates. The OOB gain of round m is measured on points not used to fit tree m, but those points were used by earlier trees. Each round’s gain is therefore an underestimate of the true improvement, and the cumulative peak tends to come too early. scikit-learn warns that OOB estimates are pessimistic. Exercise 2: OOB stopping chose about 42 rounds where the test optimum was 181.
from sklearn.ensemble import GradientBoostingRegressor
gbr = GradientBoostingRegressor(subsample=0.5, learning_rate=0.05, n_estimators=2000,
n_iter_no_change=50, validation_fraction=0.15).fit(X, y)- 1. Friedman found the best subsample fraction is often about…
- 2. Column subsampling adds…
- 3. OOB stopping estimates are…
Level 3: Advanced
★★★★☆ Advanced⏱ 30 minGraduate level, with full derivations and proofs.Theory
A randomised regulariser. Subsampling injects noise into the functional gradient. That is stochastic gradient descent in function space: the gradient at each round is estimated from a random subset. As in SGD, the noise helps escape over-fitting directions, and the expected step remains the true gradient direction.
Too small an η. With η = 0.1 each tree sees only 30 of 300 points. The trees become poor gradient estimates (high variance, few splits), and more rounds are needed. Exercise 2: η = 0.1 was worst at both noise levels.
Noise level. With more noise, overfitting comes sooner (best round 74 against 181 at η = 0.5), and the regularisation from subsampling matters more. Its best fraction stayed near 0.5 in this experiment.
Interview questions.
- What does
subsampledo in XGBoost, and what value would you start with? It is the fraction of rows sampled for each tree. Start at 0.7–0.8, try 0.5 on small noisy data, and tune with ν and early stopping. - Why not use OOB improvement to stop? It is pessimistic and stops early. Use a held-out validation set or cross-validation.
- 1. Stochastic gradient boosting is analogous to…
- 2. With η = 0.1 on 300 points each tree sees…
- 3. Higher noise moved the best round…
Level 4: Expert
★★★★★ Expert⏱ 25 minResearchers: original papers and open problems.How much to subsample, and when to stop
History.
- Friedman (2002) introduced stochastic gradient boosting.
- Breiman (1999) and Bühlmann and Yu explored randomised boosting.
- XGBoost (2016) added row and column subsampling.
- LightGBM (2017) replaced uniform row subsampling with gradient-based one-side sampling (GOSS, next pages).
- Minimal variance sampling (Ibragimov and Gusev, 2019) in CatBoost refined sampling weights.
Exercise 1.
- Over 300 rounds, the best test MSE was 3.241 with η = 1 and 2.889 with η = 0.5.
- The OOB improvement per round fell from 0.927 (first 20 rounds) to about 0 (last 50).
- The cumulative OOB gain peaked at round 34.
Exercise 2. Setup: Friedman #1, n = 300, depth-3 trees, ν = 0.1, 200 rounds, 2 repetitions. Each cell shows the best test MSE against the noise-free target, with the round where it occurred.
| σ | η = 0.1 | η = 0.25 | η = 0.5 | η = 1.0 | OOB-chosen round (η = 0.5) | test-optimal round |
|---|---|---|---|---|---|---|
| 1 | 2.83 (176) | 2.01 (186) | 1.81 (181) | 2.31 (189) | 42 | 181 |
| 3 | 4.44 (55) | 3.74 (47) | 3.35 (74) | 3.96 (97) | 30 | 74 |
- Half-sampling beat no subsampling by about 0.5–0.6 MSE at both noise levels. η = 0.1 was worst: too few points per tree.
- More noise meant earlier optimal stopping (74 against 181 rounds).
- OOB stopping chose 42 and 30 rounds, less than half the test-optimal number, confirming that it is pessimistic. Use validation data instead.
Stochastic boosting in AI, robotics and aerospace
- Large telemetry datasets: subsampling cuts training time roughly in proportion.
- Noisy labels and measurements: an extra regulariser alongside early stopping.
- Hyperparameter defaults in production boosting pipelines (subsample around 0.8, colsample around 0.8).
References
- J. H. Friedman (2002). “Stochastic gradient boosting.” Computational Statistics and Data Analysis 38(4).
- T. Chen, C. Guestrin (2016). “XGBoost: a scalable tree boosting system.” KDD.
- G. Ke et al. (2017). “LightGBM: a highly efficient gradient boosting decision tree.” NeurIPS.
- B. Ibragimov, G. Gusev (2019). “Minimal variance sampling in stochastic gradient boosting.” NeurIPS.
- T. Hastie, R. Tibshirani, J. Friedman (2009). The Elements of Statistical Learning, 2nd ed., section 10.12. Springer.