Skip to content

Gradient Boosting

Builds an ensemble of small trees one at a time, each trained to correct the remaining errors of all trees before it.

Also GBM · gradient boosted trees · XGBoost · LightGBM · CatBoost

Fig. / How it works
+++REMAINING ERROReach new tree fixes the last ones’ mistakes
Role · kind
Models and algorithmsModel
Level
Intermediate

Friedman, 2001

You throw a dart and miss a bit to the left. Your second throw only tries to fix that miss. Your third fixes what is still off. Many small corrections add up to a bullseye.

Where it fits

+All relationships as a list

See it on the full map

How it works

Start with a very simple guess, such as the average house price. It is wrong for most houses. Compute each house’s residual (true price minus guess). Now train a small decision tree to predict those residuals, and add a fraction of its output to the guess. Repeat.

After hundreds of rounds, the sum of all those small trees is a very accurate model.

Why “gradient”? For squared error, the residuals are exactly the negative gradient of the loss with respect to the predictions. Fitting trees to the negative gradient works for any differentiable loss, so the same algorithm handles regression, classification and ranking. It is gradient descent, but in the space of functions instead of weights.

The learning rate (shrinkage) scales each tree’s contribution. Smaller steps need more trees but generalize better.

The mathFm(x)=Fm−1(x)+η hm(x),hm≈−∂L(y,F)∂F∣F=Fm−1(x)F_m(x) = F_{m-1}(x) + \eta \, h_m(x), \qquad h_m \approx -\frac{\partial L(y, F)}{\partial F}\bigg|_{F = F_{m-1}(x)}

where hmh_m is the tree fitted at round mm and η\eta the learning rate.

Everyday use cases

  • Case 01

    Card fraud detection

    Scoring each card transaction in milliseconds for signs of fraud.

  • Case 02

    Search and ad ranking

    Boosted trees have long powered ranking models in search engines and ad systems.

  • Case 03

    Credit scoring

    Predicting default risk from tabular applicant data.

Famous examples

Strengths, weaknesses and when to use it

Strengths

  • Often the most accurate model for tabular data.
  • Mature, fast libraries (XGBoost, LightGBM, CatBoost) with missing-value handling built in.

Weaknesses

  • More hyperparameters to tune than a random forest.
  • Can overfit if you add too many trees with a high learning rate.

When to use itWhen you want top accuracy on structured, spreadsheet-like data and can spend a little time tuning.

Compare with

Check yourself

  1. Q01

    What does each new tree in gradient boosting try to predict?

    Show answer

    B: The errors (residuals) the current ensemble still makes

  2. Q02

    How does gradient boosting differ from a random forest?

    Show answer

    A: Trees are built sequentially to fix errors, instead of independently and averaged

Go deeper

Learn first