XGBoost is an optimized implementation of gradient boosting that combines decision trees into a stronger learner. Each new tree focuses on the residual errors left by earlier trees, helping the ensemble improve predictions for regression and classification. section 12.1 section 12.5
A typical XGBoost training cycle works like this:
- Start with an initial prediction, such as 0.5 for every example. section 12.5
- Fit the next decision tree to the current residuals rather than directly repeating the original labels. section 12.5
- Choose splits using a similarity score, then prune branches whose similarity gain does not exceed the minimum split-loss threshold. section 12.5
- Add the new tree’s prediction after scaling it by the learning rate, and repeat with the smaller residuals. section 12.5
A small engagement model
For users aged 10–80, the first learner predicts 0.5 for everyone. Later trees refine those predictions from residuals such as 6.5, 4.5, and 0.5. A Python model can use XGBRegressor with three estimators, depth two, learning rate 0.7, and minimum split loss 1. section 12.5
Figure 12.1 Ensemble methods consist of joining several weak learners to build a strong learner.
Visualize how several weak learners join together to form a stronger ensemble. section 12.1





