Log inStart free
LESSON 4.C1 · 6 STAGES · 3 CONTROLS · 3 CHECKSPRO · PREVIEW

Ensembles on one dataset

Watch one tree, a forest and two boosters split the same two moons.


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.C1 · ENSEMBLE BAYTREE · DEPTH 3 · 7 LEAVES · TEST 84%
01
Stage 1 of 6 · Grow a tree
A decision tree splits the plane on one feature at a time. Each split lowers the Gini impurity most.
Explain it simply

You see 40 points from two moons. Dots are class 1 and squares are class 0. A decision tree asks one yes-or-no question at a time, like x₂ ≤ −0.14. It picks the question that leaves each side least mixed, and the blue part is where it says class 1.

A plane with 40 points in two moons. A tree of depth 3 has 7 leaves. It gets 37 of 40 training points and 84% of 1000 test points right.

points: dot class 1, square class 0class 1 side and the boundaryclass 0 sidethresholds, weights and αwrong points, residuals, errorscut branches, left-out points
two moons · 40 training points · 1000 test pointstree · depth 3 · level 3 of 34.20 · 4.21x₂ = −0.14x₁ →↑ x₂train 37 of 40 right · 3 wrongtest 840 of 1000 right (84%) · 160 wrong7 leaves · depth 30·91·00·4x₂ ≤ −0.33x₂ ≤ −0.364·02·6x₁ ≤ −0.293·110·0x₂ ≤ 0.87x₂ ≤ 0.53x₂ ≤ −0.14leaf: class 0 · class 1 pointsnode: 40 points · 20 class 0 · 20 class 1G = 1 − 0.50² − 0.50² = 0.500split: left 14 (G 0.133) · right 26 (G 0.393)drop = 0.500 − 14/40 · 0.133 − 26/40 · 0.393 = 0.198two moons · 40 training points · 1000 test pointstree · depth 3 · level 3 of 34.20 · 4.21x₂ = −0.14x₁ →↑ x₂train 37 of 40 right · 3 wrongtest 840 of 1000 right (84%) · 160 wrong7 leaves · depth 30·91·00·4x₂ ≤ −0.33x₂ ≤ −0.364·02·6x₁ ≤ −0.293·110·0x₂ ≤ 0.87x₂ ≤ 0.53x₂ ≤ −0.14leaf: class 0 · class 1 pointsnode: 40 points · 20 class 0 · 20 class 1G = 1 − 0.50² − 0.50² = 0.500split: left 14 (G 0.133) · right 26 (G 0.393)drop = 0.500 − 14/40 · 0.133 − 26/40 · 0.393 = 0.198
Toy: two moons · 40 training points · 1000 test points · CART trees
STAGE 1 / 6
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
G=1−p02−p12\sy{G}{grad}{G} = 1 - \sy{p}{data}{p_0}^2 - \sy{p}{data}{p_1}^2
G(root)=1−0.502−0.502=0.500,drop 0.198G(\text{root}) = 1 - 0.50^2 - 0.50^2 = \sy{G}{grad}{0.500},\quad \text{drop } 0.198

Gini impurity is 0 for a pure node and 0.5 for an even mix.

Common mix-ups

MYTHA deeper tree always predicts better.

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

Predict, then reveal
3 CHECKS · PRO
Q01With full-depth trees, how many rounds does AdaBoost keep?

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.