Where We Are
Random Forests reduce variance by training many varied trees and combining their votes. The trees mostly work in parallel.
Boosting asks a different question:
What if tree 2 studies tree 1’s mistakes, tree 3 studies the remaining mistakes, and the ensemble improves one small correction at a time?
1. Learn the residual
Suppose the true house prices are
y = [100, 150, 200]
pred_0 = [150, 150, 150]
residual= [-50, 0, 50]
The first model is simply the mean, 150. A small tree is then trained to predict the residuals.
If it predicts [-40, 0, 40] and our learning rate is ,
so
pred_1 = [150,150,150] + 0.5*[-40,0,40]
= [130,150,170]
The errors got smaller.
2. Why “gradient” is in the name
For squared error
The negative gradient points toward a better prediction:
Up to a constant factor, that is exactly the residual. So fitting a tree to residuals is a special case of fitting the direction that reduces loss.
This turns boosting into a beautiful idea:
gradient descent, but the thing being updated is a function, not one scalar weight.
3. The additive model
After rounds,
Each is usually a shallow tree. A single tree is weak; the sequence can be extremely strong.
4. Learning rate trades speed for caution
A large learning rate lets each tree make a big correction. Training improves quickly, but the ensemble can overfit.
A smaller learning rate usually needs more trees but makes gentler corrections.
large eta: correction ━━━━━━━━━▶
small eta: correction ━━━▶ ━━━▶ ━━━▶
5. From scratch mental model
pred = np.full_like(y, y.mean(), dtype=float)
for _ in range(M):
residual = y - pred
tree.fit(X, residual)
pred += learning_rate * tree.predict(X)
Real implementations generalize this from residuals to gradients of arbitrary differentiable loss functions.
6. XGBoost, LightGBM and CatBoost
These systems are engineered descendants of gradient boosting. They add regularization, efficient split finding, missing-value handling, histogram methods and other optimizations. The central story remains: add a learner that improves the current ensemble.
Break It
Train too many deep trees with a large learning rate on a small dataset. Watch training loss keep falling while validation loss eventually rises. That is Chapter 56 waiting for us.
What to Remember
- Random Forests mostly average independent trees.
- Gradient boosting builds trees sequentially.
- Each new learner follows a loss-reducing direction.
- Learning rate controls the size of each correction.
- Many weak corrections can form a very strong model.
Next → Support Vector Machines: boosting combines many flexible rules; can geometry instead find one boundary with the safest possible margin?