Gradient Boosting and Random Forest both combine many small decision trees — but the trees play completely different roles. Step through each side to see how a single tree fits into its ensemble, using the same six points and only depth-1 trees (stumps).
| P1 | P2 | P3 | P4 | P5 | P6 | |
|---|---|---|---|---|---|---|
| x | 1 | 2 | 3 | 4 | 5 | 6 |
| y | 2 | 2 | 6 | 6 | 10 | 10 |
A three-level staircase. One stump can only make one cut — so no single tree can fit it. Mean of y = 6.
Both panels treat "fit one tree" as an atomic step. This section opens that box. A depth-1 tree (stump) is fully described by three numbers — a threshold t, a left-leaf value, a right-leaf value — and fitting one is the same brute-force search everywhere, whether the tree lives in a boosting ensemble, a forest, or stands alone:
The recipe is a template. Steps 2 and 3 have two standard instantiations, depending on what the target is:
Leaf value: the mean of the side's targets — the constant minimizing squared error. Impurity: SSE = Σ(target − leaf mean)², so the search maximizes variance reduction.
Worked through on boosting round 1, where the targets are the residuals (−4, −4, 0, 0, 4, 4):
| threshold t | left targets | left mean | right targets | right mean | SSE after split |
|---|---|---|---|---|---|
| 1.5 | −4 | −4 | −4, 0, 0, 4, 4 | 0.8 | 44.8 |
| 2.5 | −4, −4 | −4 | 0, 0, 4, 4 | +2 | 16.0 ✓ |
| 3.5 | −4, −4, 0 | −2.67 | 0, 4, 4 | +2.67 | 21.3 |
| 4.5 | −4, −4, 0, 0 | −2 | 4, 4 | +4 | 16.0 (tie) |
| 5.5 | −4, −4, 0, 0, 4 | −0.8 | 4, 4 | +4 | 44.8 |
t = 2.5 and t = 4.5 genuinely tie at SSE 16; ties break leftmost, so T₁ = (t = 2.5, leaves −4 | +2) — exactly the stump in the boosting panel. Sequentiality makes the tie harmless: with 2.5 taken, round 2's residuals make 4.5 the clear winner. The forest trees run the identical search on raw y from their own bootstrap samples — which is why Tree A (never drew P3/P4) lands on t = 3.5 while B and C land on 4.5. Real forests add one more twist: each split considers only a random subset of features; with a single feature here there's nothing to randomize.
Leaf value: the side's majority class (or its class proportions, if you want probabilities). Impurity: entropy H = −Σ pᶜ·log₂ pᶜ over class proportions, so the search maximizes information gain — this is ID3/C4.5; CART's Gini index is a cheaper stand-in with the same intent.
Our toy y takes only three values (2, 6, 10), so the same six points double as a 3-class problem: parent entropy for 2+2+2 points of three classes is H = log₂3 ≈ 1.585 bits. Scoring the same five thresholds:
| threshold t | H(left) | H(right) | weighted H after | information gain |
|---|---|---|---|---|
| 1.5 | 0 | 1.522 | 1.268 | 0.317 |
| 2.5 | 0 (pure: all "2") | 1.0 | 0.667 | 0.918 ✓ |
| 3.5 | 0.918 | 0.918 | 0.918 | 0.667 |
| 4.5 | 1.0 | 0 (pure: all "10") | 0.667 | 0.918 (tie) |
| 5.5 | 1.522 | 0 | 1.268 | 0.317 |
Identical ranking, identical 2.5 / 4.5 tie as the regression table — both criteria reward carving off a pure, homogeneous chunk. That's no coincidence: variance is to numbers what entropy is to classes (a Gaussian's entropy, ½·log(2πeσ²), grows monotonically with variance, so minimizing SSE is entropy minimization under a Gaussian view of each leaf). The panels above use the regression form because their targets are continuous — boosting's round-4 residuals like −0.875 have no class proportions to take logs of. Everything downstream of this section is unchanged by the choice: boosting still sums leaf outputs, the forest still averages them (majority-votes, in classification).
The tables above score one split. A real tree repeats that search inside every impure leaf until nothing is mixed anymore. Step through the full construction on the six points — and flip the criterion to see SSE and entropy steer the very same tree.
Every row below refers to the numbers you stepped through above — not generic textbook claims.
| Gradient Boosting | Random Forest | |
|---|---|---|
| Each tree is trained on… | The residuals of the current ensemble — a different target every round. T₁ saw (−4,−4,0,0,4,4); by round 4 the target had shrunk to (−0.875,−0.875,0.125,0.125,0.75,0.75). | The original y values (2,2,6,6,10,10), every time — but each tree sees a different bootstrap sample of the rows (Tree A never saw P3 or P4 at all). |
| Dependency between trees | Strictly sequential. T₂'s training target (−2,−2,−1,−1,3,3) literally does not exist until F₀ + 0.5·T₁ has been computed. Delete T₁ and every later tree is wrong. | None. Trees A, B, C were fit independently against the same y. Delete Tree B and the other two are unchanged — you'd just average 10 and 6 instead. |
| How trees combine | Shrinkage-weighted sum: F(x) = 6 + 0.5·T₁ + 0.5·T₂ + 0.5·T₃ + 0.5·T₄. Each term is a small correction added on top of the rest. | Plain average: (10 + 5 + 6) / 3 = 7. Each tree is a full standalone prediction; the forest is their mean. |
| Growing the ensemble mainly improves… | Bias. One stump can't fit a 3-step staircase, but stacked corrections drove the SSE 64 → 28 → 7.75 → 2.69 → 0.96. More rounds keep bending the model toward the data (and eventually overfit). | Variance. Individual trees swung wildly at x = 4 (predicting 10, 5, 6) depending on which rows their bootstrap happened to contain. Averaging smoothed that to a stable 7. More trees stabilize — they don't make the average more expressive. |