MST0052 · Lecture 10 · Fall 2026
01
Regression: same algorithm, within-node variance; leaves predict the mean.
Keeps splitting until every leaf is pure. Error: zero.
A slightly different sample grows a wildly different tree.
02
Averaging inherits it — unchanged.
Averaging reduces it.
A row escapes all $n$ draws with probability $(1 - 1/n)^n \to e^{-1} \approx 0.37$.
The recipe · Bootstrap AGGregating
03
Each tree gets its own bootstrap sample.
The strongest features still top every tree.
m = √p
m = p / 3 (textbook) — scikit-learn's regressor defaults to all p: plain bagging unless you set max_features
max_features
25 trees · 200 fresh-data ensembles · measured at 50 test points
Formula and measurement agree within 1% — exact per test point; the gap is from averaging σ² and ρ first. Pre-tested: lecture_10_ensembles_supplement.py, on the lecture page
lecture_10_ensembles_supplement.py
No scaler — tree splits do not depend on units.
Tune with GridSearchCV — L7's machinery, unchanged.
GridSearchCV
04
Biased toward high-cardinality features — and toward whichever correlated twin got picked first.
predict_proba
Pitfall 1 · OOB is a sanity check
Free — report it alongside CV.
Still touched exactly once (L7).
Pitfall 2 · More trees never overfit — they just cost time
Pitfall 3 · Correlated features split the credit
Each looks half as important.
The importance plot is misleading.
The pattern · L7 machinery, new model
05
load_breast_cancer() · 80/20 stratified · random_state=42 · 5-fold CV · f1 (positive class = benign)
Workflow 1 · One unpruned tree
Workflow 2 · 300 bootstrap copies of the same tree
Workflow 3 · Bagging + random feature subsets
Test f1 · CV mean ± std underneath
Interpretation · two importances, two stories
06
L12 returns to ensembles: boosting swaps averaging for sequential correction.
Variance of an average · what is assumed
Even more randomness · ExtraTreesClassifier
Probabilities · CalibratedClassifierCV
Imbalance · class_weight='balanced_subsample'
Interpretation · one feature's effect
Design question · depth vs breadth
Regression · many targets, one forest