Gradient boosting combines decision trees in sequence: each new tree focuses on what the existing model still predicts poorly. Together, the trees form a stronger learner. section 12.1 section 12.4
For regression, the fitting process works like this:
- Start with a simple prediction: under mean squared error, the first tree predicts the average label. section 12.4
- Calculate residuals—the differences between labels and current predictions—and fit the next tree to them. section 12.4
- Add the new tree’s predictions, scaled by the learning rate, to the ensemble. Repeat using the updated residuals. section 12.4
Predicting app engagement
Using users’ ages to predict days of weekly app use, the first tree predicts the average label, 4. Later trees fit residuals; with a learning rate of 0.8, their scaled predictions are added to the ensemble. section 12.4
Figure 12.19 The plot of the user engagement dataset from table 12.3. The horizontal axis represents the age of the users, and the vertical axis represents the days per week that the user uses our app.
Plots user age against weekly app-engagement days, the example dataset fitted by gradient boosting. section 12.4
Trees can have depth greater than one, unlike the depth-one weak learners used in the AdaBoost comparison. Gradient boosting also supports classification, with adjustments to the regression procedure. XGBoost is a related implementation that uses similarity scores to build trees and prunes splits that fail its threshold. section 12.4 section 12.5
Scikit-Learn provides gradient-boosting regressor and classifier APIs. A classifier can be trained on Titanic data and compared with other models using measures such as accuracy and F1-score. section 13.4




