Trace a residual stump, recompute losses after shrinkage, and distinguish loss gradients, binary logits, and regularized Newton leaf weights.
ConceptCore MLFoundations
Published ·10 min read·Core·Foundation
Visual quick review
Trace one squared-error boosting round from the current ensemble prediction, through signed residual targets, to a shrunken tree correction that moves every prediction toward its target.
One boosting round
A squared-error gradient-boosting residual update
Read it this way: start at the flat prediction five. Under half-squared loss, target gaps are the next tree's negative-gradient labels. The stump predicts −3 and +3; shrinkage adds −1.5 and +1.5. Each remaining gap halves, while SSE falls from 36 to 9. Sources: Friedman and the XGBoost tutorial.
Check: Why does the first tree predict -3 and +3 rather than the original targets 2 and 8?
Sources and provenance
Full explanation 10 min read
Summary
Gradient boosting adds a learner to an existing prediction function.
Its training targets are negative loss gradients at current predictions, not generally the original labels.
Shrinkage scales the new contribution before addition.
Task: ordered features are x=[1,2,3,4], targets y=[2,2,8,8], and current prediction F0=5.
Use per-example loss (y−F)2/2 and learning rate η=0.5.
Fit one residual stump, update all predictions, and recompute total loss.
This is a training fixture, not a held-out improvement claim.
Initialize F0=argminc∑iL(yi,c).
For half-squared loss this is the mean; for Bernoulli loss it is finite log-odds when both classes occur.
Then repeat:
Compute the negative gradient (pseudo-residuals) at each training point:
ri,t=−[∂F(xi)∂L(yi,F(xi))]F=Ft−1.
Fit a regression tree ht to {(xi,ri,t)}.
If required, optimize leaf values against the original objective; squared-error residual means already supply its reference correction.
Update: Ft=Ft−1+η⋅ht.
Our gradients F0−y=[3,3,−3,−3] give pseudo-residuals [−3,−3,3,3].
A stump at x=2.5 fits leaf values −3 and 3.
Adding ηh=[−1.5,−1.5,1.5,1.5] gives F1=[3.5,3.5,6.5,6.5].
SSE falls from 4(32)=36 to 4(1.52)=9; summed half-squared loss falls from 18 to 4.5.
This split is the diagram’s “sample ≤ 2” rule for these ordered features.
Learning objective: trace one squared-error boosting round from the current prediction, through signed residual targets, to the learning-rate-scaled correction.
One boosting round
Fit current negative loss gradients, shrink the new learner, and recompute the objective
Read it this way:Boosting fits negative gradients of the current loss, not the original labels again. Half-squared loss gives signed residuals; this stump fits minus three and three. Shrinkage halves those corrections, reducing training loss from eighteen to 4.5. Smaller steps change the update, not the first fitted stump. Logistic loss uses probability residuals and updates logits. Newton leaf weights also depend on curvature and regularization. Training improvement is not held-out generalization. Does logistic boosting reuse the regression gaps?
Reference drawing
One boosting round
Fit current negative loss gradients, shrink the new learner, and recompute the objective
Derivation
Read it this way: start at the flat prediction five. Under half-squared loss, target gaps are the next tree's negative-gradient labels. The stump predicts −3 and +3; shrinkage adds −1.5 and +1.5. Each remaining gap halves, while SSE falls from 36 to 9. Sources: Friedman and the XGBoost tutorial.
Check: Why does the first tree predict -3 and +3 rather than the original targets 2 and 8?
Read it this way:Boosting fits negative gradients of the current loss, not the original labels again. Half-squared loss gives signed residuals; this stump fits minus three and three. Shrinkage halves those corrections, reducing training loss from eighteen to 4.5. Smaller steps change the update, not the first fitted stump. Logistic loss uses probability residuals and updates logits. Newton leaf weights also depend on curvature and regularization. Training improvement is not held-out generalization. Does logistic boosting reuse the regression gaps?
Change the step size
New task: use η=0.25 with the same first stump.
Keep its fit and scale the corrections to −0.75 and 0.75.
Check: predictions become [4.25,4.25,5.75,5.75] and SSE becomes 4(2.252)=20.25.
Use when: smaller updates are desired and extra rounds remain affordable.
Later rounds must recompute gradients at their changed ensemble predictions.
Change the objective
New task: use labels [0,0,1,1], Bernoulli cross-entropy, and initial raw logits F=0.
Probabilities are p=σ(F)=0.5, so negative gradients y−p are [−0.5,−0.5,0.5,0.5].
Check: they are not the regression gaps [−3,−3,3,3] or the raw labels.
Use when: fitting probabilities instead of numeric responses; trees update logits before the sigmoid.
Newton boosting (xgboost)
For logistic loss, gi=pi−yi and curvature hi=pi(1−pi).
In one fixed leaf, the quadratic approximation with L2 leaf penalty is
Gw+21(H+λ)w2,G=i∑gi,H=i∑hi.
With positive denominator, differentiating gives w=−G/(H+λ).
For the two negative labels above, G=1, H=0.5, and λ=1, hence w=−2/3.
This Newton weight differs from the first-order leaf mean −0.5.
Split structure scoring, leaf optimization, and learning-rate shrinkage are separate operations.
Curvature does not guarantee faster convergence or better generalization on every workload.
Why it works
When ∑iriht(xi)>0, the learner points downhill locally in prediction space.
A finite step still needs suitable scale; approximate fitting is not a guaranteed useful correction on new data.
Each tree depends on the current ensemble, unlike independent averaging of separately fitted trees.
Failure: a flexible tree can fit label noise, lowering training loss while validation loss rises.
Choose early stopping on validation and restore the selected ensemble; selecting on test outcomes leaks evaluation information.
Reconstruct: what does the first reference update produce at η=1?
Answer
Predictions equal [2,2,8,8], giving zero reference training SSE.
That exact fit says nothing about unseen points.
The four implementations
Library
Distinction to inspect in the chosen version
XGBoost
Regularized second-order objectives, split methods, and sparse/missing-value routing.
LightGBM
Histogram construction, leaf-wise growth, and declared categorical features.
CatBoost
Ordered boosting and ordered categorical statistics with their leakage controls.
sklearn GradientBoostingClassifier
Stagewise gradient boosting; compare separately with its histogram-based estimators.
Benchmark actual data, hardware, objective, category policy, and quality constraints rather than ranking libraries universally.
Hyperparameters that matter
Control
What changes
Learning rate and rounds
Update magnitude and number of dependent corrections.
Depth or leaf count
Each learner’s partition complexity.
Minimum leaf support or Hessian weight
Which candidate regions are admissible.
Row and feature sampling
Observations and candidate predictors used during fitting.
L1/L2 leaf penalties
Leaf optimization and associated split scoring.
Names and defaults differ by library.
Learning rate and round count interact, but halving one and doubling the other is not an exact equivalence.
When GBDT wins
It can be a useful candidate for heterogeneous features and threshold-based interactions.
Measure probability quality, task metrics, latency, and maintenance cost against meaningful alternatives.
When GBDT loses
Raw unstructured inputs may need a different representation; tiny or shifted datasets can invalidate apparent gains.
Pairwise/listwise ranking needs its own objective and query grouping, not an ordinary regression interpretation.
Common pitfalls
Fit preprocessing and target-based encodings without validation or test leakage.
Compare learning curves and restore best validated weights; neither fixed rounds nor early stopping automatically prevents overfitting.
See decision trees for weighted split mechanics and logistic regression for Bernoulli probabilities.