Gradient Boosting
Decision trees, one correction at a time
Mikhail Mikhasenko · Lecture 2B
Continues Lecture 2A, which introduced trees, bagging and AdaBoost. This lecture builds gradient-boosted decision trees (BDTs) for regression with MSE and for classification with binary cross-entropy. Three questions guide the lecture: how a split is chosen, how leaf values are computed, and how the trees are combined.
AdaBoost recap
Iterative error correction with weak learners.
Each new tree sees the same events , reweighted.
Misclassified events get larger weights .
The final model is a weighted vote of all trees.
Sensitive to outliers and label noise: they keep growing in weight.
Famous use: the Viola–Jones face detector (2001).
Today: gradient boosting
Instead of reweighting events, each new tree is trained on what is still missing :
new target = residual = y − current prediction . \text{new target}=\text{residual}=y-\text{current prediction}.
The same idea works for any differentiable loss , which covers regression and classification.
AdaBoost changes the event weights; gradient boosting changes the targets. Later we show that gradient boosting with the exponential loss reproduces AdaBoost’s weights, so the two are members of one family. Viola–Jones: https://en.wikipedia.org/wiki/Viola%E2%80%93Jones_object_detection_framework
A gradual approach: crocodile and turtle
Ask the two questions before revealing the answers. ln(0.05)/ln(0.95) = 58.4, so 59 days. The linear approximation etad would give 19 days and is wrong here because eta d is not small. If a tree fitted the residual perfectly, the residual after m rounds would be (1-eta)^m times the initial one. Illustration from the original Lecture 2B slides.
Notation
i = 1 , … , N i=1,\ldots,N
training events, with features x i = ( x i 1 , … , x i n ) ∈ ℝ n x_i=(x_{i1},\ldots,x_{in})\in\mathbb R^n and label y i y_i
F ( x ) F(x)
model output (“score”) for an event with features x x
L ( y , F ) L(y,F)
loss of one event; training minimizes ∑ i = 1 N L ( y i , F ( x i ) ) \sum_{i=1}^N L\big(y_i,F(x_i)\big)
m = 1 , … , M m=1,\ldots,M
boosting round; F m F_m is the model after m m trees, F 0 F_0 a constant
γ m ( x ) \gamma_m(x)
output of tree m m ; its leaves are regions R m j R_{mj} , j = 1 , … , J m j=1,\ldots,J_m , with values γ m j \gamma_{mj}
η ∈ ( 0 , 1 ] \eta\in(0,1]
learning rate (“shrinkage”): the fraction of each tree that is added
Keep this slide visible when deriving formulas later. Leaves are called terminal regions in Friedman’s paper. Every event falls into exactly one leaf of each tree.
Start with regression
Features x ∈ ℝ n x\in\mathbb R^n , label y ∈ ℝ y\in\mathbb R .
Squared-error loss per event:
L ( y , F ) = 1 2 ( y − F ) 2 . L(y,F)=\tfrac12\,\big(y-F\big)^2 .
Its average over events is (half) the MSE . The factor 1 2 \tfrac12 only simplifies derivatives.
The residual of event i i is what the model still misses:
r i = y i − F ( x i ) . r_i=y_i-F(x_i).
It is also minus the slope of the loss:
r i = − ∂ L ( y i , F ) ∂ F | F = F ( x i ) . r_i=-\frac{\partial L(y_i,F)}{\partial F}\bigg|_{F=F(x_i)}.
This second form generalizes to other losses.
Regression first because residuals have an obvious meaning: a distance to the target. The derivative identity is the bridge to gradient boosting for arbitrary losses.
Reaching the target in steps
Each tree is a function of x x . The model is their sum:
γ 1 ( x ) \gamma_1(x) : fit to y − F 0 y-F_0
γ 2 ( x ) \gamma_2(x) : fit to y − F 1 y-F_1
F M ( x ) = F 0 + η ∑ m = 1 M γ m ( x ) , F m ( x ) = F m − 1 ( x ) + η γ m ( x ) . F_M(x)=F_0+\eta\sum_{m=1}^{M}\gamma_m(x),\qquad F_m(x)=F_{m-1}(x)+\eta\,\gamma_m(x).
Tree m m is trained on the residuals left over by the previous m − 1 m-1 trees.
Blue squares are internal nodes (a feature and a cut), orange squares are leaves (a number). Trees are small and different: each one corrects a different remaining pattern. Unlike bagging, the trees are not interchangeable; their order matters.
Algorithm for squared error
Start with a constant: F 0 = y ‾ = 1 N ∑ i y i F_0=\bar y=\frac1N\sum_i y_i .
For m = 1 , … , M m=1,\ldots,M :
residuals r i = y i − F m − 1 ( x i ) r_{i}=y_i-F_{m-1}(x_i) for every event;
grow a regression tree γ m \gamma_m that predicts r i r_i from x i x_i ;
update F m ( x ) = F m − 1 ( x ) + η γ m ( x ) F_m(x)=F_{m-1}(x)+\eta\,\gamma_m(x) .
Predict y ̂ ( x ) = F M ( x ) \hat y(x)=F_M(x) .
Step 2b hides the two technical questions: which regions R m j R_{mj} (splitting) and which values γ m j \gamma_{mj} (leaves).
Why a constant y ‾ \bar y ? It is the best single number:
∂ ∂ c ∑ i 1 2 ( y i − c ) 2 = 0 ⇒ c = y ‾ . \frac{\partial}{\partial c}\sum_i\tfrac12(y_i-c)^2=0\;\Rightarrow\;c=\bar y.
Why η < 1 \eta<1 ? Small steps average over many trees and fit the noise more slowly.
J. H. Friedman, “Greedy Function Approximation: A Gradient Boosting Machine”, Ann. Stat. 29 (2001) 1189.
The algorithm is literally “fit the residual, add a fraction of the fit, repeat”. The next slides open step 2b.
A tree is a piecewise-constant function
Tree m m cuts feature space into J m J_m disjoint leaves R m 1 , … , R m J m R_{m1},\ldots,R_{mJ_m} . In each leaf it returns a constant γ m j \gamma_{mj} :
γ m ( x ) = ∑ j = 1 J m γ m j 𝟏 [ x ∈ R m j ] , \gamma_m(x)=\sum_{j=1}^{J_m}\gamma_{mj}\,\mathbf 1\big[x\in R_{mj}\big],
where 𝟏 [ ⋅ ] = 1 \mathbf 1[\cdot]=1 if the condition holds and 0 0 otherwise.
So the update reads
F m ( x ) = F m − 1 ( x ) + η ∑ j = 1 J m γ m j 𝟏 [ x ∈ R m j ] . F_m(x)=F_{m-1}(x)+\eta\sum_{j=1}^{J_m}\gamma_{mj}\,\mathbf 1\big[x\in R_{mj}\big].
tree
m = 4 m=4 ,
J 4 = 4 J_4=4 leaves
yes
R 41 R_{41} γ 41 = 2.9 \gamma_{41}=2.9 R 42 R_{42} γ 42 = − 1.9 \gamma_{42}=-1.9
no
R 43 R_{43} γ 43 = 0.3 \gamma_{43}=0.3 R 44 R_{44} γ 44 = 0.7 \gamma_{44}=0.7
Leaf values from the original slide. The cuts are illustrative. Every event lands in exactly one leaf, so exactly one indicator is 1 for each x.
How leaf values are computed
Take the regions R m j R_{mj} as given. Choose each leaf value to minimize the loss of the events in that leaf :
γ m j = arg min γ ∑ i : x i ∈ R m j L ( y i , F m − 1 ( x i ) + γ ) . \gamma_{mj}=\arg\min_{\gamma}\sum_{i:\,x_i\in R_{mj}}L\big(y_i,\,F_{m-1}(x_i)+\gamma\big).
Leaves do not interact: every leaf is a separate one-number problem.
For L = 1 2 ( y − F ) 2 L=\tfrac12(y-F)^2 , with N j N_{j} events in the leaf:
∂ ∂ γ ∑ i ∈ R m j 1 2 ( r i − γ ) 2 = 0 ⇒ γ m j = 1 N j ∑ i ∈ R m j r i . \frac{\partial}{\partial\gamma}\sum_{i\in R_{mj}}\tfrac12\big(r_i-\gamma\big)^2=0
\;\Rightarrow\;
\gamma_{mj}=\frac1{N_{j}}\sum_{i\in R_{mj}}r_i .
The leaf value is the mean residual in the leaf.
Example: residuals 1.2 , 0.8 , 1.0 1.2,\,0.8,\,1.0 give γ = 1.0 \gamma=1.0 ; with η = 0.3 \eta=0.3 these events move up by 0.3 0.3 .
Here r_i = y_i - F_{m-1}(x_i) is fixed during round m. For MSE the argmin is a sample mean, the same leaf rule as the regression trees of Lecture 2A, now applied to residuals. For other losses the argmin is not a mean; we will approximate it with one Newton step.
How a split is chosen
A node holds events I I . A candidate split uses feature k k and cut c c : I L = { i ∈ I : x i k < c } I_L=\{i\in I:\,x_{ik}<c\} , I R = I \ I L I_R=I\setminus I_L .
With the optimal leaf value (the mean), a node’s loss is ∑ i ∈ I 1 2 ( r i − r ‾ I ) 2 = 1 2 ∑ i ∈ I r i 2 − 1 2 ( ∑ i ∈ I r i ) 2 N I . \;\sum_{i\in I}\tfrac12(r_i-\bar r_I)^2=\tfrac12\sum_{i\in I}r_i^2-\tfrac12\frac{(\sum_{i\in I}r_i)^2}{N_I}. The ∑ r i 2 \sum r_i^2 terms cancel in the loss reduction:
Gain ( k , c ) = 1 2 [ ( ∑ i ∈ I L r i ) 2 N L + ( ∑ i ∈ I R r i ) 2 N R − ( ∑ i ∈ I r i ) 2 N I ] ≥ 0 . \text{Gain}(k,c)=\frac12\left[\frac{\big(\sum_{i\in I_L}r_i\big)^2}{N_L}+\frac{\big(\sum_{i\in I_R}r_i\big)^2}{N_R}-\frac{\big(\sum_{i\in I}r_i\big)^2}{N_I}\right]\;\ge 0 .
For each feature k k , sort the events by x i k x_{ik} ; candidate cuts are midpoints between neighbouring distinct values.
Scan left to right, updating ∑ I L r i \sum_{I_L}r_i and N L N_L with running sums: all cuts in 𝒪 ( N ) \mathcal O(N) after sorting.
Take the ( k , c ) (k,c) with the largest gain; recurse into both children until the depth limit, a minimum leaf size, or no positive gain.
This is exactly variance reduction, the regression-tree criterion from Lecture 2A, applied to residuals. The gain is non-negative because splitting can never increase the training loss. That is why a stopping rule (depth, min leaf size, minimum gain) is needed. Real libraries often bin features into histograms (e.g. 256 bins) instead of sorting all values.
Other losses: pseudo-residuals
For MSE the residual is minus the gradient. For any differentiable loss define the pseudo-residual
r i m = − [ ∂ L ( y i , F ) ∂ F ] F = F m − 1 ( x i ) . r_{im}=-\left[\frac{\partial L(y_i,F)}{\partial F}\right]_{F=F_{m-1}(x_i)} .
Treat the N N values F ( x 1 ) , … , F ( x N ) F(x_1),\ldots,F(x_N) as parameters. − ∂ L / ∂ F -\partial L/\partial F is the direction of steepest descent. The tree generalizes that direction to all x x .
Gradient boosting = gradient descent in function space.
1 2 ( y − F ) 2 \tfrac12(y-F)^2
y − F y-F
| y − F | \lvert y-F\rvert
sign ( y − F ) \operatorname{sign}(y-F)
Huber, width δ \delta
y − F y-F , clipped to [ − δ , δ ] [-\delta,\delta]
BCE, y ∈ { 0 , 1 } y\in\{0,1\}
y − σ ( F ) y-\sigma(F)
σ ( F ) = 1 / ( 1 + e − F ) \sigma(F)=1/(1+e^{-F}) is defined on the classification slides.
Friedman’s recipe: fit a least-squares regression tree to the pseudo-residuals, then set each leaf value by the leaf-wise argmin of the true loss (a line search). The next slide replaces this line search with a second-order Taylor expansion, as in XGBoost, which also gives a split criterion for any loss.
Leaf values for any loss
Expand each event’s loss around the current prediction, to second order in the small update γ \gamma :
L ( y i , F m − 1 ( x i ) + γ ) ≈ L ( y i , F m − 1 ( x i ) ) + g i γ + 1 2 h i γ 2 , g i = ∂ L ∂ F | F m − 1 ( x i ) , h i = ∂ 2 L ∂ F 2 | F m − 1 ( x i ) . L\big(y_i,F_{m-1}(x_i)+\gamma\big)\approx L\big(y_i,F_{m-1}(x_i)\big)+g_i\,\gamma+\tfrac12 h_i\,\gamma^2,
\qquad
g_i=\frac{\partial L}{\partial F}\bigg|_{F_{m-1}(x_i)},\;\;
h_i=\frac{\partial^2 L}{\partial F^2}\bigg|_{F_{m-1}(x_i)} .
In leaf j j sum the derivatives: G j = ∑ i ∈ R m j g i G_j=\sum_{i\in R_{mj}}g_i , H j = ∑ i ∈ R m j h i \;H_j=\sum_{i\in R_{mj}}h_i . Add a penalty 1 2 λ γ 2 \tfrac12\lambda\gamma^2 (λ ≥ 0 \lambda\ge0 ) against large leaf values:
leaf objective = G j γ + 1 2 ( H j + λ ) γ 2 → ∂ / ∂ γ = 0 γ m j * = − G j H j + λ , loss change = − 1 2 G j 2 H j + λ . \text{leaf objective}\;=\;G_j\gamma+\tfrac12\big(H_j+\lambda\big)\gamma^2
\quad\xrightarrow{\;\partial/\partial\gamma=0\;}\quad
\gamma_{mj}^{*}=-\frac{G_j}{H_j+\lambda},
\qquad\text{loss change}=-\frac12\,\frac{G_j^2}{H_j+\lambda}.
This is one Newton step per leaf. Check with MSE: g i = F − y i = − r i g_i=F-y_i=-r_i , h i = 1 h_i=1 , so γ m j * = ∑ r i / ( N j + λ ) \gamma^*_{mj}=\sum r_i/(N_j+\lambda) , the mean residual for λ = 0 \lambda=0 .
T. Chen, C. Guestrin, “XGBoost: A Scalable Tree Boosting System”, KDD 2016, arXiv:1603.02754.
g is the gradient and h the curvature (Hessian) of the per-event loss with respect to the model output. For MSE the expansion is exact. Large curvature means a confident, well-determined leaf; small curvature allows a larger step. lambda shrinks leaf values toward zero, most strongly in leaves with small H.
Split gain for any loss
Insert the best leaf values into the objective. Splitting node I I into I L I_L and I R I_R reduces the loss by
Gain = 1 2 [ G L 2 H L + λ + G R 2 H R + λ − G I 2 H I + λ ] − τ , \text{Gain}=\frac12\left[\frac{G_L^2}{H_L+\lambda}+\frac{G_R^2}{H_R+\lambda}-\frac{G_I^2}{H_I+\lambda}\right]-\tau ,
with G L = ∑ i ∈ I L g i G_L=\sum_{i\in I_L}g_i , H L = ∑ i ∈ I L h i H_L=\sum_{i\in I_L}h_i , and likewise for I R I_R and the parent I I .
G 2 H + λ \dfrac{G^2}{H+\lambda}
how much a node could lower the loss with its best single value
λ ≥ 0 \lambda\ge0
leaf-value penalty: shrinks γ * \gamma^* , disfavours leaves with little curvature H H
τ ≥ 0 \tau\ge0
cost of one extra leaf: split only if the improvement exceeds τ \tau (gamma in XGBoost)
Same search as before: sort, scan cuts with running sums G L , H L G_L,H_L , keep the best. For MSE with λ = τ = 0 \lambda=\tau=0 this is the gain of the regression slide.
The original slide used the same letter gamma for the split cost and for the leaf values. Here the split cost is called tau to avoid the clash; XGBoost calls it gamma and calls leaf values w. With lambda = 0 and MSE, G = -sum r and H = N, so G^2/H = (sum r)^2 / N.
The general algorithm
F 0 = arg min c ∑ i L ( y i , c ) F_0=\arg\min_c\sum_i L(y_i,c) .
For m = 1 , … , M m=1,\ldots,M :
compute g i g_i and h i h_i at F m − 1 ( x i ) F_{m-1}(x_i) for every event;
grow a tree: at each node choose the ( k , c ) (k,c) with the largest Gain \text{Gain} ; stop at the depth limit or if no gain is positive;
leaf values γ m j = − G j / ( H j + λ ) \gamma_{mj}=-G_j/(H_j+\lambda) ;
update F m ( x ) = F m − 1 ( x ) + η ∑ j γ m j 𝟏 [ x ∈ R m j ] F_m(x)=F_{m-1}(x)+\eta\sum_j\gamma_{mj}\mathbf 1[x\in R_{mj}] .
Output F M ( x ) F_M(x) , or p ( x ) = σ ( F M ( x ) ) p(x)=\sigma\big(F_M(x)\big) for classification.
Only g i g_i and h i h_i depend on the loss.
Changing the task means changing two derivatives , not the tree code.
The trees in round m m never see the labels directly, only g i g_i and h i h_i .
This is the loop implemented in widgets/gb.js (about 40 lines) and in the Pluto notebook. Newton mode uses h from the loss; gradient mode sets h_i = 1, which fits the pseudo-residuals by least squares and uses their mean as the leaf value.
Classification: the score is a log-odds
The original slide showed the log-likelihood y F - log(1 + e^F), which is maximized; the loss is its negative. Boosting p directly would be awkward because a sum of trees can leave [0, 1]. A wrong but confident prediction is penalized roughly linearly in |F|, a correct one costs almost nothing.
BCE: gradients and leaf values
With p i = σ ( F m − 1 ( x i ) ) p_i=\sigma\big(F_{m-1}(x_i)\big) , using d σ d F = σ ( 1 − σ ) \frac{d\sigma}{dF}=\sigma(1-\sigma) :
g i = ∂ L ∂ F = p i − y i , h i = ∂ 2 L ∂ F 2 = p i ( 1 − p i ) . g_i=\frac{\partial L}{\partial F}=p_i-y_i,\qquad h_i=\frac{\partial^2 L}{\partial F^2}=p_i(1-p_i).
Pseudo-residual: r i = y i − p i r_i=y_i-p_i , the probability still missing .
Newton leaf value:
γ m j = ∑ i ∈ R m j ( y i − p i ) ∑ i ∈ R m j p i ( 1 − p i ) + λ . \gamma_{mj}=\frac{\sum_{i\in R_{mj}}(y_i-p_i)}{\sum_{i\in R_{mj}}p_i(1-p_i)+\lambda}.
Start: F 0 = log y ‾ 1 − y ‾ F_0=\log\dfrac{\bar y}{1-\bar y} , the log-odds of the signal fraction y ‾ \bar y .
Worked example. Balanced sample, so F 0 = 0 F_0=0 and all p i = 1 2 p_i=\tfrac12 . One leaf holds y = 1 , 1 , 1 , 0 y=1,1,1,0 :
g = − 1 2 , − 1 2 , − 1 2 , + 1 2 ⇒ G = − 1 g=-\tfrac12,-\tfrac12,-\tfrac12,+\tfrac12\Rightarrow G=-1
h = 1 4 h=\tfrac14 each ⇒ H = 1 \Rightarrow H=1
λ = 0 \lambda=0 : γ = 1 \gamma=1 (leaf log-odds log 3 = 1.10 \log3=1.10 )
η = 0.3 \eta=0.3 : F = 0.3 F=0.3 , p = σ ( 0.3 ) = 0.57 p=\sigma(0.3)=0.57
Derivation: d/dF log(1+e^F) = eF/(1+e F) = p, so g = p - y; h = dp/dF = p(1-p). One Newton step lands close to the leaf’s own log-odds. With gradient-mode leaves (h = 1) the same leaf would get gamma = mean(y - p) = 0.25, a much smaller step. Near-pure leaves have tiny H; lambda (and XGBoost’s min_child_weight, a minimum H) keeps their values finite.
One algorithm, two losses
Label and output
y ∈ ℝ y\in\mathbb R , prediction F F
y ∈ { 0 , 1 } y\in\{0,1\} , log-odds F F , p = σ ( F ) p=\sigma(F)
Loss L ( y , F ) L(y,F)
1 2 ( y − F ) 2 \tfrac12(y-F)^2
log ( 1 + e F ) − y F \log(1+e^{F})-yF
Start F 0 F_0
y ‾ \bar y
log ( y ‾ / ( 1 − y ‾ ) ) \log\big(\bar y/(1-\bar y)\big)
Gradient g i g_i
F m − 1 ( x i ) − y i F_{m-1}(x_i)-y_i
p i − y i p_i-y_i
Curvature h i h_i
1 1
p i ( 1 − p i ) p_i(1-p_i)
Leaf value γ m j \gamma_{mj}
∑ ( y i − F m − 1 ( x i ) ) N j + λ \dfrac{\sum(y_i-F_{m-1}(x_i))}{N_j+\lambda}
∑ ( y i − p i ) ∑ p i ( 1 − p i ) + λ \dfrac{\sum(y_i-p_i)}{\sum p_i(1-p_i)+\lambda}
Split gain
1 2 [ G L 2 / ( H L + λ ) + G R 2 / ( H R + λ ) − G I 2 / ( H I + λ ) ] − τ \tfrac12\big[G_L^2/(H_L{+}\lambda)+G_R^2/(H_R{+}\lambda)-G_I^2/(H_I{+}\lambda)\big]-\tau
same formula
Prediction
F M ( x ) F_M(x)
p ( x ) = σ ( F M ( x ) ) p(x)=\sigma\big(F_M(x)\big) , cut on p p
The summary slide students should be able to reconstruct. Sums in the leaf-value row run over events in leaf j. The classifier output is a probability-like score; choose the working point on p with the ROC curve from Lecture 2A.
Regularization
A boosted ensemble can always lower its training loss. These controls keep the validation loss low:
Shrinkage η \eta
small steps; smaller η \eta needs more trees M M but usually generalizes better
Tree depth (1–5 typical)
depth D D allows interactions among up to D D features; shallow trees are weak learners
Subsampling
each tree sees a random fraction of events (stochastic gradient boosting)
Leaf penalties λ \lambda , τ \tau , minimum H H per leaf
limit leaf values and forbid tiny or uninformative leaves
Early stopping
stop at the M M with the lowest validation loss
Friedman (2002) introduced stochastic gradient boosting with subsampling fraction around 0.5 to 0.8. Early stopping requires a validation sample that is not the final test sample. Shrinkage and number of trees trade off: roughly, eta times M sets how far the model can move.
Huber loss: robust regression
Friedman chooses delta adaptively as a quantile (e.g. 90%) of the current absolute residuals. For |r| > delta the second derivative is zero, so Newton leaves need care; Friedman uses a robust leaf estimate (median plus a clipped mean correction).
Other losses for classification
Binomial deviance,
y ∈ { − 1 , + 1 } y\in\{-1,+1\}
L ( y , F ) = log ( 1 + e − 2 y F ) , r = − ∂ L ∂ F = 2 y 1 + e 2 y F . L(y,F)=\log\big(1+e^{-2yF}\big),\qquad
r=-\frac{\partial L}{\partial F}=\frac{2y}{1+e^{2yF}} .
Friedman’s convention. It is the BCE of the previous slides with labels 1 + y 2 ∈ { 0 , 1 } \tfrac{1+y}{2}\in\{0,1\} and score 2 F 2F , so F = 1 2 log p 1 − p F=\tfrac12\log\frac p{1-p} .
Exponential loss,
y ∈ { − 1 , + 1 } y\in\{-1,+1\}
L ( y , F ) = e − y F , g i = − y i e − y i F ( x i ) . L(y,F)=e^{-yF},\qquad g_i=-y_i\,e^{-y_iF(x_i)} .
The factor e − y i F ( x i ) e^{-y_iF(x_i)} is exactly the AdaBoost event weight : boosting with this loss reproduces AdaBoost.
It grows exponentially for badly misclassified events, hence the noise sensitivity.
Friedman, Hastie, Tibshirani, “Additive logistic regression: a statistical view of boosting”, Ann. Stat. 28 (2000) 337. The derivative of log(1+e^{-2yF}) is -2y e{-2yF}/(1+e {-2yF}) = -2y/(1+e^{2yF}); the pseudo-residual is its negative. Compare the losses at large negative margin yF: deviance grows linearly, exponential loss exponentially.
Libraries and their parameter names
M M
n_estimators
NTrees
η \eta
learning_rate (eta)
Shrinkage
depth
max_depth
MaxDepth
subsample
subsample
BaggedSampleFraction
λ \lambda
reg_lambda
—
τ \tau
gamma
—
loss
objective
BoostType=Grad
Also: LightGBM, CatBoost; in Julia XGBoost.jl, EvoTrees.jl, JLBoost.jl.
import xgboost as xgb
clf = xgb.XGBClassifier(
objective= "binary:logistic" , # BCE
n_estimators= 500 , learning_rate= 0.1 ,
max_depth= 3 , reg_lambda= 1.0 ,
subsample= 0.8 , early_stopping_rounds= 20 )
clf.fit(X_train, y_train,
eval_set= [(X_val, y_val)])
p = clf.predict_proba(X_test)[:, 1 ]
Regression: XGBRegressor withobjective="reg:squarederror".
XGBoost (C++) has Python, R and Julia interfaces. TMVA’s BDT also offers AdaBoost and bagging via BoostType; UseBaggedBoost enables subsampling. TMVA users guide: https://root.cern.ch/download/doc/tmva/TMVAUsersGuide.pdf. Early stopping monitors the last entry of eval_set.
Impact of boosted trees
State of the art on tabular data. Of 29 winning Kaggle solutions published in 2015, 17 used XGBoost; 8 used it alone.
Industry: risk modelling in finance, click-through-rate prediction, insurance, customer modelling. Accurate, fast, and comparatively interpretable.
High-energy physics: for years the most common architecture for signal/background separation at the LHC, e.g. in the Higgs discoveries and flavour tagging.
Kaggle statistic: Chen & Guestrin, arXiv:1603.02754.
Boosted decision trees remain strong baselines for tabular data even where neural networks are used, and are often combined with them in ensembles.
BDT playground
Tasks
Reach a test loss below 0.05 on every dataset.
Which datasets need depth ≥ 2 \ge2 ? Why?
Fix η M \eta M and compare η = 1 \eta=1 with η = 0.1 \eta=0.1 .
Compare Newton and gradient updates at equal M M .
The Pluto notebook offers six datasets, rotations, depth, learning rate, subsampling, Newton/gradient updates, and per-tree contribution maps. The static preview needs Pluto’s CDN; live controls need the launcher.
End
Thank you for the attention