ContentsChapter 7 · Trees and ensembles3 of 3

7.3

Boosting

In this chapter
  1. 7.1Decision trees
  2. 7.2Bagging and random forests
  3. 7.3Boosting
Before you readYour first model predicts too high for some rows and too low for others. Could a second model learn just the correction?
Watch: Gradient Boost Part 1: Regression Main Ideas · StatQuest with Josh Starmer

Bagging trains trees separately. Boosting trains them in sequence: each new tree tries to improve the prediction made by the trees already fitted. The final model adds their contributions.

For gradient boosting with squared error, start with F0F_0 the mean target. At round mm calculate the residual ri=yi−Fm−1(xi)r_i = y_i - F_{m-1}(x_i) for each training row. Fit a small regression tree hmh_m to those residuals, not to the original targets. Then update:

Fm(x)=Fm−1(x)+ηhm(x).F_m(x) = F_{m-1}(x) + \eta h_m(x).

The learning rate η\eta controls how much of the correction to use. A positive residual means the prediction is too low; a negative one means it’s too high.

02468101234
Start at the mean: 6Predictions: 6, 6, 6, 6
The dots are targets: 2, 4, 8, 10. The pink line predicts them; dashed gaps are the residuals. At each round, a one-split tree fits the previous gaps and the model adds half its prediction on each side.

With squared error, fitting a correction means fitting residuals. For a different loss, gradient boosting instead fits that loss’s negative gradients with respect to the current predictions. Another method, AdaBoost, gives misclassified rows more weight in the next round and combines classifiers with a weighted vote. Both build on what the previous rounds got wrong.

Recall
What does the next tree fit in gradient boosting with squared error?
Recall
Why can't you fit boosting's trees separately like bagging's?
Exercise
A model predicts 88 for a row with target 55 What is its residual? If the next tree predicts −2-2 for that row and η=0.5\eta=0.5 what is the updated prediction? Give both numbers in order.
Exercise
Two rows fall in the same leaf of a tree fitted to residuals −4-4 and 22 With squared error and η=0.5\eta=0.5 how much does the ensemble add to each row's prediction?