Skip to content
StackDecode
AI & ML Atlas
Machine LearningalgorithmInteractive simulation

XGBoost

A fast, regularised, engineered implementation of gradient boosting.

The idea

XGBoost uses first and second derivatives of the loss to pick tree splits, adds L1/L2 penalties and a complexity penalty per leaf, handles missing values natively, and parallelises split finding. The boosting idea is the same: each tree corrects the ensemble so far.

gain = ½[G_L²/(H_L+λ) + G_R²/(H_R+λ) − (G_L+G_R)²/(H_L+H_R+λ)] − γ

Watch it run

This is a real computation, not a drawing. Pause, step, change the settings, or try new random data.

  • data
  • ensemble prediction
  • residuals

Start with the simplest model: predict the average everywhere.

round:
0
error:
0.0545
1/25

Each round fits a tiny one-split tree to what the ensemble still gets wrong.

Step by step

  1. 1Compute gradients and Hessians of the loss for each row.
  2. 2Build a tree, choosing splits by regularised gain.
  3. 3Shrink the tree's output by the learning rate and add it.
  4. 4Repeat, with early stopping on a validation set.

Where it is used

Kaggle winners, ranking, fraud and click-through prediction.

Watch out for

Many hyper-parameters; deep trees with many rounds overfit.

Related