1. University MCA (AI/ML) Semester 2
  2. CAB212
  3. Unit 4

CAB212 · Unit 4: Ensemble learning

Bagging and random forests

8 practice questions

Key points

  • Bootstrap = sample with replacement
  • ~63.2% unique in-bag, ~36.8% OOB
  • Random forest adds random feature subsets
  • Bagging reduces variance

Ensemble learning combines many models to get better accuracy than one.

Bagging (bootstrap aggregating): train each model on a bootstrap sample (n draws with replacement from n samples), then average (regression) or vote (classification). It mainly reduces variance.

A bootstrap sample contains about 63.2% of the distinct original samples; the remaining ~36.8% are out-of-bag (OOB) and give a free validation estimate. (Probability a sample is never picked = (1 - 1/n)^n, which tends to 1/e = 0.368.)

Random forest = bagging of decision trees plus random feature subsets at each split (commonly sqrt(d) features for classification). This decorrelates trees, so averaging reduces variance further. Trees are grown deep, unpruned.

Strengths: strong default accuracy, handles mixed features, gives feature importance. Weaknesses: less interpretable, larger and slower than one tree.

Exam pitfall: bagging reduces variance; it does not reduce bias much.

Try two questions

Question 1 · Tier 3, Apply

A typical number of features considered per split in a random forest classifier with d features is:

  1. Always all d features at every split
  2. Always exactly one feature at every split
  3. About sqrt(d)
  4. d squared features at every split
Show the answer

C. A common default.

Question 2 · Tier 2, Understand

Bagging mainly reduces:

  1. Bias
  2. Number of features
  3. Variance
  4. Dataset size
Show the answer

C. Averaging many high-variance models stabilises predictions.