Lensa ML
Lensa ML

Gradient Boosting

Step 1 of 6

Start with a Constant

The initial prediction

Initial prediction0.08
-3-2-10123-2-1012xy
PREDICTION
0.08
MSE
1.483
RESIDUAL RANGE
-1.6 .. 1.6
# POINTS
25

Gradient boosting starts with a simple prediction — usually the mean of the targets. You're close to the mean — a good starting point that minimizes the initial squared error.

Step 1 of 6: Start with a Constant

The initial prediction

Initial prediction0.08
-3-2-10123-2-1012xy
PREDICTION
0.08
MSE
1.483
RESIDUAL RANGE
-1.6 .. 1.6
# POINTS
25

Gradient boosting starts with a simple prediction — usually the mean of the targets. You're close to the mean — a good starting point that minimizes the initial squared error.

Step 2 of 6: Fit the Residuals

A tree learns the errors

Round 1
Prediction vs Dataf(x)Residuals (what the next tree learns)0-3-2-10123
ROUND
1
MSE BEFORE
1.483
MSE AFTER
0.825
IMPROVEMENT
44.4%

The green curve (top) shows the ensemble's current prediction. The pink dots (bottom) are the residuals — errors the ensemble hasn't captured yet. The coloured step function is the new tree fitted to those errors.

Step 3 of 6: Learning Rate

Small steps, big results

Learning rate η0.30
Round1
1. Tree fitted to residuals-1.091.18× η = 0.302. Scaled update (η × tree)-0.3270.355add to ensemble ↓3. Updated prediction-3-1013
η
0.30
ROUND
1
MSE BEFORE
1.483
MSE AFTER
0.825

η=0.30 scales each tree's contribution to 30% of its raw values. This balances learning speed with stability.

Step 4 of 6: Building Sequentially

The ensemble grows

R1
-3-2-10123-2-1012xy
# TREES
1
TRAIN MSE
0.825
TEST MSE
0.721
RESID STD
0.908

Each tree corrects the ensemble's mistakes — predictions improve incrementally. Early rounds capture the big patterns in the data.

Step 5 of 6: Trees × Learning Rate

The tradeoff

-3-2-10123-2-1012xy
η
0.30
# TREES
20
TRAIN MSE
0.192
TEST MSE
0.252

Low learning rate + many trees ≈ high learning rate + few trees, but the former generalizes better. Adjust both sliders to see how they interact.

Step 6 of 6: Loss Landscape

Watching loss descend

R1
01020304050Rounds0.00.20.40.60.8bestTrainTest
ROUND
1
TRAIN LOSS
0.918
TEST LOSS
0.804
GAP
-0.115

Train loss always decreases; watch the test loss — when it rises, you're overfitting. Both losses are dropping. The best test loss is at round 8.