Log inStart free
LESSON 4.24 · 6 STAGES · 3 CONTROLS · 3 CHECKSPRO · PREVIEW

Gradient boosting

Watch small trees add up, each one fitting the errors the others left.


Pro lesson. Stage 1 is free to watch. Pro opens all 6 stages, 3 controls and 3 checks, in this lesson and every other.

Go Pro · $8.25/mo
EXPLAINER · 4.24 · BOOSTING BAYF₀ = 0 · P = 0.5 · LOSS 0.693
01
Stage 1 of 6 · Start flat
Gradient boosting starts from one constant F₀, the log-odds of the share of dots. Half are dots, so F₀ = 0.
Explain it simply

You see the two moons: dots are class 1 and squares are class 0. The model gives each spot a score F, and the sigmoid turns F into p, the chance of a dot. 20 of the 40 points are dots, so the first guess is p of 0.5. The chart shows what that costs one point: 0.693.

Forty points of two moons, 20 dots and 20 squares. The first model F zero is 0 everywhere, so p is 0.5 for every point. The log loss is 0.693.

points: dot = class 1, square = class 0the model's p and each tree's leavesresiduals and the losscuts, gains and the learning rate νbins and categories
two moons and the model's ploss of one point−1012−101x₁x₂p = 0.5 everywherep = σ(F₀) = σ(0) = 0.5 for every point−202123Fℓa dot, y = 1a square, y = 0F₀ = 0, p = 0.5ℓ = −ln 0.5 = 0.693two moons and the model's ploss of one point−1012−101x₁x₂p = 0.5 everywherep = σ(F₀) = σ(0) = 0.5 for every point−202123Fℓa dot, y = 1a square, y = 0F₀ = 0, p = 0.5ℓ = −ln 0.5 = 0.693
Toy: two moons, 40 points · log loss · trees of up to 4 leaves · 30 rounds
STAGE 1 / 6
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
F0=ln⁡n1n0,p=σ(F),ℓ=−yln⁡p−(1−y)ln⁡(1−p)\sy{F}{out}{F_0} = \ln\frac{n_1}{n_0},\quad \sy{p}{out}{p} = \sigma(\sy{F}{out}{F}),\quad \sy{L}{grad}{\ell} = -\sy{y}{data}{y}\ln \sy{p}{out}{p} - (1 - \sy{y}{data}{y})\ln(1 - \sy{p}{out}{p})
F0=ln⁡2020=0,p=σ(0)=0.5,ℓ=−ln⁡0.5=0.693F_0 = \ln\tfrac{20}{20} = 0,\quad p = \sigma(0) = 0.5,\quad \ell = -\ln 0.5 = 0.693

The first score is the log-odds of class 1; the loss is the log loss.

Common mix-ups

MYTHEach new tree predicts y on its own.

The fix, and 1 more mix-up with the diagram to show them, come with Pro.

Predict, then reveal
3 CHECKS · PRO
Q01With ν = 0.1 instead of 0.3, how many rounds until the loss drops below 0.3?

Make your guess, then test it in the diagram. All 3 checks come with Pro.

PRO LESSON · YOU WATCHED STAGE 1 OF 6
Unlock the full explainer
  • 5 more stages and 3 live controls
  • 2 mix-up cards and 3 predict-then-reveal checks
  • Watch it as a narrated video, in three voices
  • Every Pro lesson and capstone · 656 in total

$99 a year, or $15 a month. Cancel any time.