2.3.6 · D4Tree-Based & Instance Methods

Exercises — Bagging and bootstrap aggregating

2,218 words10 min readBack to topic

Related vault topics you may want open: Decision Trees, Random Forests, Bias-Variance Tradeoff, Bootstrap (statistics), Out-of-Bag Error, Ensemble Methods, Boosting.


Level 1 — Recognition

Recall Solution L1.1

Bagging = Bootstrap Aggregating.

  • Bootstrap — build many training sets by ==sampling points with replacement== from the original -point dataset. This manufactures diversity from one dataset.
  • Aggregating — combine the trained models into one output: average for regression, majority vote for classification.
Recall Solution L1.2

Variance only. From Step 1 of the parent derivation, expectation is linear, so The ensemble mean equals a single model's mean , so bias is untouched. All the benefit lives in the variance term.

Recall Solution L1.3
  • — the -dependent term; it as (adding trees).
  • — the floor; it has no in it, so more trees can never remove it. To lower the floor you must lower .

Level 2 — Application

Recall Solution L2.1

Plug in : The variance dropped by a factor of exactly (). This is the best case — no correlation floor to stop it.

Recall Solution L2.2

The floor is . Even with infinite trees you stop at , not . Correlation caps the win.

Recall Solution L2.3

The limiting value is . Even at the tiny size we are already close to ; the convergence is fast.

Recall Solution L2.4

Ensemble is correct if or are right — a binomial with , : Accuracy rose — the classic majority-vote lift, valid only because the votes were independent.


Level 3 — Analysis

Recall Solution L3.1

Floor . We need Left side . So Minimum . Notice the requirement depends only on and the tolerance, not on (it cancels).

Recall Solution L3.2

(from the term ).

Figure — Bagging and bootstrap aggregating

Look at the curve: the drop from is huge (), from modest, and past almost flat. Message: returns diminish fast — pick where the curve flattens (where OOB error plateaus), not arbitrarily large.

Recall Solution L3.3

If the three votes are identical, the majority is whatever the single classifier said. The ensemble accuracy collapses back to — no gain at all. Lesson: the entire majority-vote benefit came from independence (diversity). Correlation makes the ensemble a copy of one model — exactly the floor in the variance formula. This is the analysis-level twin of L2.4.


Level 4 — Synthesis

Recall Solution L4.1

Team A: Team B: Team B wins by — nearly 3× lower variance with fewer trees. Synthesis: lowering the floor dominates piling on trees. This is precisely why Random Forests add feature subsampling on top of bagging — to attack , not .

Recall Solution L4.2

A given point is OOB for a fraction of trees. So Because those trees never trained on , their prediction on it is like a test prediction. Averaging them and repeating for every point gives the Out-of-Bag Error — a validation estimate that needs no held-out set. See also Bootstrap (statistics).

Recall Solution L4.3

Best case () . A single model had , so bagging cut variance from to only — a 3 % reduction for the compute. Comment: stable learners barely change across resamples (), so bagging is nearly useless here. This is the quantitative form of the parent's "don't bag stable models" mistake.


Level 5 — Mastery

Recall Solution L5.1

The single-model variance is (set : ✓). The floor is . Halfway between them is Set the ensemble equal to this and solve for : Divide by and subtract : Therefore , i.e. . Insight: independent of , the very first extra tree () already carries you halfway from a single model to the floor. Bagging's biggest single gain is the second tree; everything after is cleanup.

Recall Solution L5.2

Ensemble correct at least of the are correct: For (), , need : This matches the parent's . As with , the sum (Condorcet's Jury Theorem) — but again only for independent votes.

Recall Solution L5.3

As the correlated ensemble reaches variance . An independent ensemble of models has variance (set in the formula). Match them: For : . So an infinite forest with pairwise correlation behaves like just 4 independent trees. Correlation is a hard ceiling on how much diversity you actually own — the deep reason Random Forests fight to lower .


Recall One-screen summary of every result
  • L2.1 ; L2.2 (floor ); L2.3 ; L2.4 .
  • L3.1 ; L3.2 table ; L3.3 .
  • L4.1 Team B vs A ; L4.2 trees; L4.3 (floor ).
  • L5.1 ; L5.2 ; L5.3 , at .