This part built three genuinely different ways to fight overfitting: average many overfit trees, chain weak learners toward the gradient, and vote by similarity in a kernel space. Run all three on the exact same data — and on their own naive settings — who actually wins?
This is the same 25-point noisy training set and 24-point clean validation set from the trees chapters, unchanged. Switch models and watch the fitted regions redraw completely, even though nothing about the data did.
Every model here answers the same question — where's the boundary at ? — but each one combines evidence its own way:
- — the model's final predicted label at input .
- — round 's stump prediction, for the boosted ensemble.
- — the kernel's bandwidth: how quickly similarity falls off with distance.
- Random Forest
Twenty bagged, individually-overfit depth-6 trees, majority-voted (Chapter 3).
- XGBoost-style booster
A squared-loss, Newton-boosted stump ensemble — five rounds, split by the exact gain formula from Chapter 6 — run once with no regularization and once with .
- Kernel SVM (simplified)
Every training point votes with an RBF-kernel-weighted sign, run once with a too-narrow bandwidth () and once tuned (). A real SVM solves for a sparse set of support-vector weights; this keeps the essential mechanism — similarity-weighted, non-linear voting — at toy scale.
| Model | Train | Validation |
|---|---|---|
| Random Forest (20 bagged trees) | 88% | 92% |
| XGBoost-style (5 rounds, λ=0) | 84% | 96% |
| XGBoost-style (5 rounds, λ=1) | 80% | 100% |
| Kernel SVM (γ=1, too narrow) | 100% | 79% |
| Kernel SVM (γ=0.1, tuned) | 80% | 100% |
The too-narrow kernel SVM () tops the training column at 100% — and comes in dead last on validation at 79%. It memorized the training set's five mislabeled points instead of the boundary between them. Random Forest can't out-train it (88%) but comfortably out-generalizes it (92%). Only the two regularized configurations — XGBoost with , and the kernel tuned to — reach a perfect 100% validation, and both do it by explicitly damping how far a single point is allowed to move the decision.
- XGBoost round 1 finds the exact boundary, with clean numbers
Splitting at (every point's toy Hessian is 1):
- Left leaf: 10 points, , , so at :
- Right leaf: 15 points, , , so
- Gain: , beating every other candidate threshold outright
- Regularization pulls both leaf values toward zero
With instead: and — both leaves take a smaller step. Small enough, across five rounds, that the ensemble never chases the noise into a wrong answer, landing at 100% validation instead of the unregularized version's 96%.
- A too-narrow kernel gets fooled by exactly one point
At the clean validation point (true label B), 's kernel score comes out to — negative, predicting A — because the single nearby mislabeled training point at dominates a kernel that's too narrow to look past its immediate neighbor.
- Widening the kernel fixes it, the same way weighting by shard size fixed averaging
At , the same point's score is — solidly positive, predicting B correctly — because a wider kernel pools evidence from the many genuine B points surrounding that one noisy A, instead of trusting its nearest neighbor alone.
Pick whichever model reaches the best validation accuracy on the scoreboard — 100%. More than one row can be right, and the highest training accuracy is a trap.
| Model | Train | Validation |
|---|---|---|
| Random Forest (20 bagged trees) | 88% | 92% |
| XGBoost-style (5 rounds, λ=0) | 84% | 96% |
| XGBoost-style (5 rounds, λ=1) | 80% | 100% |
| Kernel SVM (γ=1, too narrow) | 100% | 79% |
| Kernel SVM (γ=0.1, tuned) | 80% | 100% |
The scoreboard's real lesson isn't which mechanism wins — every one of them is capable of reaching the true boundary, and every one of them is also capable of memorizing noise instead. Random Forest fights overfitting by averaging away disagreement, gradient boosting fights it by explicitly regularizing how far each round is allowed to step, and a kernel method fights it by choosing how wide a neighborhood counts as "similar." Three different knobs, one shared failure mode underneath, and the win was never "pick the fancier technique" — it was "use whichever knob this technique gives you correctly." This closes Part V. The next part turns to problems with no labels at all: clustering, dimensionality reduction, and time series.