Section 1
Single Tree Baseline
One decision tree can fit nonlinear data, but it can also overfit and vary a lot with small data changes. Establishing this baseline motivates why ensembles help.
Move the depth slider to see flexibility vs variance.
Section 2 · Bagging
Random Forest Builder
Random forest trains many trees independently on bootstrapped samples and averages their predictions. The averaging reduces variance and usually makes the result more robust than a single tree.
More trees → lower variance of the average prediction.
Section 3 · Boosting
Gradient Boosting Builder
Gradient boosting builds trees sequentially. Each new tree learns a correction to the current model's residual error, so the final prediction is a sum of many small refinements.
Higher learning rate → larger jumps per stage; lower → slower, smoother improvement.
Section 4
Side-by-Side Comparison
On the same training data, compare a single tree against a random forest and a gradient boosting model. The shapes of their predictions reveal what each method is doing.
- Parallel trees, trained independently
- Bootstrap samples create diverse training subsets
- Final prediction is the average across trees
- Mainly fights variance & instability
Averaging smooths out individual tree noise.
- Sequential trees built in order
- Each new tree fits the residual error
- Final prediction is an additive sum of corrections
- Mainly improves fit / bias step by step
Each stage chips away at the remaining error.
Section 5
Key Differences Summary
A concise side-by-side after you've explored both ensembles.
| Concept | Random Forest bagging | Gradient Boosting boosting |
|---|---|---|
| Build style | Parallel | Sequential |
| Data usage | Bootstrap resampling | Residual fitting on the same training set |
| Combination | Average predictions | Add scaled corrections |
| Main effect | Reduce variance | Reduce residual error step by step |
| Typical weakness | Larger model, less interpretable | Can overfit if too aggressive |
| Key control | Number / depth of trees | Learning rate + number of stages |
One-line takeaway. Random forest improves stability by averaging many imperfect models. Gradient boosting improves fit by repeatedly correcting mistakes.
Sources
- Slides/ML_Lecture3Sp26_ML_Review.pdf pp. 14–15 — random forest regression alongside decision trees
- Slides/ML_Lecture3Sp26_ML_Review.pdf pp. 20–24 — gradient boosting concept & sequential residual-correction steps
- Slides/ML_Lecture3Sp26_ML_Review.pdf p. 26 — iterative process of gradient boosting
- Slides/ML_Lecture3Sp26_ML_Review.pdf p. 27 — learning-rate effect
- Slides/ML_Lecture3Sp26_ML_Review.pdf p. 28 — random forest bagging / bootstrap aggregation / averaging
- Slides/ML_Lecture3Sp26_ML_Review.pdf p. 29 — random forest example
- Slides/ML_Lecture3Sp26_ML_Review.pdf p. 68 — random forest steps, strengths, and tradeoffs