Gradient boosting for binary classification uses the log loss with F(x) as the log-odds. The data are x=1,2,3,4,5 with labels y=1,1,0,0,0. Start from the best constant, grow a stump that splits between x=2 and x=3, and use Newton leaf values with learning rate 0.5. What are the new probabilities?

Supervised learning, Gradient boosting for classification
Level L3 Intermediate. Length Long. Nature Mat Mathematical.

What's being asked

Whether you can carry out one round of boosting with a non-squared loss, using residual y−p and the Newton leaf value ∑(y−p)/∑p(1−p).

Key idea

For log loss with p=σ(F), the negative gradient is y−p and the second derivative is p(1−p). The leaf value is γ=∑i∈leaf(yi−pi)/∑i∈leafpi(1−pi).

Steps

  1. Initial constant. Two of five labels are positive, so p0=0.4 and F0=ln⁡(0.4/0.6)=−0.4055. Every point starts with p=0.4.
  2. Residuals y−p: 0.6,0.6,−0.4,−0.4,−0.4. These are the negative gradients of the log loss with respect to F. The weights p(1−p)=0.24 for every point.
  3. The stump has two leaves. Left leaf {1,2}: the sum of residuals is 1.2 and the sum of weights is 2×0.24=0.48, so γL=1.2/0.48=2.5.
  4. Right leaf {3,4,5}: the sum of residuals is −1.2 and the sum of weights is 3×0.24=0.72, so γR=−1.2/0.72=−1.667.
  5. Update with learning rate ν=0.5. Left: F=−0.4055+0.5⋅2.5=0.8445. Right: F=−0.4055+0.5⋅(−1.667)=−1.2388.
  6. Convert with the sigmoid: left p=1/(1+e−0.8445)=0.699; right p=1/(1+e1.2388)=0.225. The positives move from 0.4 to 0.70 and the negatives from 0.4 to 0.22.
  7. Check the direction: the log loss falls. The model is now confident and correct in both leaves. The next round fits the new residuals y−p (now 0.30,0.30,−0.22,−0.22,−0.22).

Common mistakes

How long your answer should be

One page with a small table; 7 minutes.

Last checked on 4 December 2026.

Read this

Previous in Supervised learning: The pinball (quantile) loss for level τ∈(0,1) is ρτ(r)=τr if r≥0 and (τ−1)r if r<0, with r=y−c. Show that the constant c minimising E ρτ(Y−c) is the τ-quantile of Y. How do you check it numerically for τ=0.7 on {1,2,3,4,10}?
Next in Supervised learning: A hard-margin linear SVM is trained on (0,0) with label −1 and on (3,0), (0,3) and (4,4) with label +1. Find w, b, the margin and the dual variables αi. Which points are support vectors?