Ensemble Methods — Bagging, Random Forest, and Boosting
Prerequisite Knowledge
This lecture builds on the following concepts from earlier lectures. If any feel unfamiliar, review the linked notes before proceeding.
Previously Covered in This Subject
- Ensemble Learning — covered in Lecture 1: Introduction to Machine Learning
- Random Forest — covered in Lecture 2: Data Preprocessing for Machine Learning
- Ensemble Learning — covered in Lecture 3: Feature Engineering and Linear Regression
- Ensemble Learning — covered in Lecture 4: Linear Regression Complete Lecture Notes
- Ensemble Learning — covered in Lecture 10: Instance-Based Learning and K-Nearest Neighbors
- Ensemble Learning — covered in Lecture 11: Instance-Based Learning — Distance-Weighted KNN, Locally Weighted Regression, and Bayesian Learning Foundations
- Random Forest — covered in Lecture 11: Instance-Based Learning — Distance-Weighted KNN, Locally Weighted Regression, and Bayesian Learning Foundations
- Ensemble Learning — covered in Lecture 13: Naive Bayes Classifier and Ensemble Learning
- Bagging — covered in Lecture 13: Naive Bayes Classifier and Ensemble Learning
- Bootstrap Aggregating — covered in Lecture 13: Naive Bayes Classifier and Ensemble Learning
Ensemble Methods — Bagging, Random Forest, and Boosting
> A single decision tree is like asking one doctor for a diagnosis. An ensemble is like convening a panel of specialists — each brings a different perspective, and together they rarely misdiagnose. This lecture covers the three most important ways to build that panel.14.1 Ensemble Learning — Review and Foundations
14.1.1 What Is an Ensemble Model
14.1.2 Creating Diversity Among Base Learners
14.1.3 Combining the Votes
14.1.4 Necessary Condition for Ensemble Success
14.1.5 The Success Zone and Danger Zone (Graph Interpretation)
14.1.6 Three Main Ensemble Techniques
Three broad families manipulate the training data in different ways: 1. Bagging (Bootstrap Aggregating): Pick random rows with replacement from the full dataset. Each learner trains on a different bootstrap sample. Training is parallel — all models are independent. 2. Boosting: Models are applied sequentially. Model 2 focuses on the records Model 1 got wrong. Model 3 focuses on whatever Model 2 got wrong. The focus is on hard rows — examples that previous models misclassified. Each model's vote is weighted by its accuracy. 3. Random Forest: Uses bootstrapping (like bagging) but also randomly selects a subset of features at every split. It not only randomizes the rows but also the columns. This double randomization makes it a hybrid between manipulating the training set and manipulating the input features. Why decision trees? Most ensemble implementations use decision trees as base learners. Decision trees can handle non-linear data, are comparatively fast, and are easy to understand. But the base learner can be any model — logistic regression, neural network, linear regression, KNN. The concept is model-agnostic. Parallel vs. sequential training: Bagging trains all models in parallel — they are independent. Boosting trains sequentially — each model depends on the errors of the previous one. Conceptually, boosting is slower, but implementations like XGBoost engage all CPU cores for internal parallel processing and run very fast in practice.14.2 Bagging (Bootstrap Aggregating)
14.2.1 Definition and Concept
14.2.2 Bagging Algorithm
Let K = number of bootstrap samples (number of base learners)
For i = 1 to K:
Create bootstrap sample D_i of size N from D
(random sampling with replacement — same record can appear multiple times)
Train base classifier C_i on D_i
End For
For a new instance x:
Classification: C*(x) = argmax over classes y of Σ δ(C_i(x) = y)
where δ outputs 1 if C_i predicts class y, 0 otherwise.
Regression: ŷ = (1/K) Σ_{i=1}^{K} ŷ_i
14.2.3 Worked Example — Bagging with Decision Stumps
| 0.1 | 0.2 | 0.3 | 0.4 | 0.5 | 0.6 | 0.7 | 0.8 | 0.9 | 1.0 | |
|---|---|---|---|---|---|---|---|---|---|---|
| +1 | +1 | +1 | −1 | −1 | −1 | −1 | +1 | +1 | +1 |
| True | Round votes (+1/−1) | Sum | Prediction | Result | |
|---|---|---|---|---|---|
| 0.1 | +1 | 6 votes +1, 4 votes −1 | +2 | +1 | ✓ |
| 0.2 | +1 | 2 votes +1, 8 votes −1 | −6 | −1 | ✗ |
| 0.3 | +1 | 5 votes +1, 5 votes −1 | 0 | tie | — |
| 0.4 | −1 | 2 votes +1, 8 votes −1 | −6 | −1 | ✓ |
| 0.5 | −1 | 1 vote +1, 9 votes −1 | −8 | −1 | ✓ |
| 0.6 | −1 | 1 vote +1, 9 votes −1 | −8 | −1 | ✓ |
| 0.7 | −1 | 2 votes +1, 8 votes −1 | −6 | −1 | ✓ |
| 0.8 | +1 | 6 votes +1, 4 votes −1 | +2 | +1 | ✓ |
| 0.9 | +1 | 7 votes +1, 3 votes −1 | +4 | +1 | ✓ |
| 1.0 | +1 | 8 votes +1, 2 votes −1 | +6 | +1 | ✓ |
14.2.4 The 63.2% Problem — A Disadvantage of Bagging
14.2.5 Sensitivity to Base Classifier Stability
14.2.6 Student Q&A on Bagging
estimator parameter lets you specify the type. The default is decision tree, but you can set it to logistic regression, linear regression, KNN, or other models. However, decision trees are the most common choice because they are unstable (high variance) — exactly the property bagging is designed to fix. Using a stable base learner like logistic regression with bagging typically yields minimal improvement.
14.3 Random Forest
height_in_cm and height_in_inches? Every bagged tree will split on one or the other at the root, making all trees functionally similar despite different row samples. Random forest fixes this by also randomly restricting which columns each tree can see at each split. The result: trees that are forced to discover different patterns in the data, producing genuinely diverse opinions.
14.3.1 Definition and How It Differs from Bagging
14.3.2 Random Forest Algorithm
min_samples_split is reached).
3. For prediction on a new instance :
- Classification: majority vote across all trees.
- Regression: average of all tree predictions.
14.3.3 How Many Features Per Split
The number of features to sample at each split follows some standard heuristics: - For classification: where is the total number of features. Example: with 25 features, each split looks at about 5 features. - For regression: . Example: with 24 features, each split looks at about 8 features. These are ballpark numbers — practical rules of thumb derived from empirical studies, not mathematical certainties. In scikit-learn,max_features='sqrt' and max_features='auto' apply these defaults automatically. The algorithm also supports max_features='log2' and explicit integer values.
14.3.4 Random Forest as Dimensionality Reduction
14.3.5 Code Example Walkthrough
from sklearn.ensemble import RandomForestClassifier
from sklearn.datasets import load_iris
iris = load_iris()
X, y = iris.data, iris.target
rf = RandomForestClassifier(
n_estimators=500, # 500 trees in the forest
n_jobs=-1 # use all CPU cores for parallel training
)
rf.fit(X, y)
- n_estimators=500: 500 base learners (trees). Each tree is independent, so all 500 train in parallel.
- n_jobs=-1: Performance optimization — uses all available CPU cores.
Feature importances after fitting (Iris dataset):
| Feature | Importance |
|---|---|
| Petal length (cm) | ~0.45 |
| Petal width (cm) | ~0.42 |
| Sepal length (cm) | ~0.08 |
| Sepal width (cm) | ~0.05 |
max_features=1 is set, each split looks at exactly one randomly chosen feature. A tree might pick "redness" at the root and split on redness <= 50. Another tree might pick "size" at the root, then "redness" at the next split.
When max_features=3 (out of, say, 5 total features), at each split the tree randomly picks 3 features, computes information gain only for those 3, and splits on the best among them. The tree does not remember which features were used at previous splits — at every split it freshly samples 3 from all 5.
Key parameters:
- n_estimators: number of trees (start with 100–500).
- max_features: number of features to consider at each split (default: 'sqrt').
- max_depth: maximum depth of each tree (default: None — trees grow unpruned).
- min_samples_split: minimum records a node must have to be split (default: 2).
- bootstrap=True: enables bootstrapping (default: True).
Degenerate trees: In some bootstrap samples, all records may belong to a single class. The tree has nothing to split — the node is already pure. This is normal and expected; the other trees compensate.
14.3.6 Student Q&A on Random Forest
max_depth is hit.
max_features too high. If max_features = d (all features), random forest degrades to bagging. The whole point is to force trees to use different features. Stick to the defaults: sqrt for classification, n/3 for regression.
2. Setting max_features too low. With max_features = 1, every split is essentially random — the tree can't pick the best feature because it only sees one. Accuracy drops sharply. The sweet spot is typically 20–50% of total features.
3. Using too few trees. Random forest needs enough trees for the double randomization to work. With 10 trees, variance reduction is minimal. Start at 100 and increase until out-of-bag error stabilizes.
4. Pruning individual trees. Never prune random forest trees. The entire design relies on individual trees overfitting, then averaging away the overfit. Pruning adds bias and removes the very variance the forest is designed to cancel.
14.4 Boosting and AdaBoost
14.4.1 The Boosting Concept
14.4.2 AdaBoost (Adaptive Boosting) — The Algorithm
14.4.3 Full Worked Example — AdaBoost with 10 Data Points
Boosting Round 1: Bootstrap sample: The first stump was trained on a weighted subset. Values 0.2 and 0.3 were NOT in the training sample (they were not drawn in this bootstrap). Decision stump split: , . Prediction vs. truth:
| True | Correct? | ||
|---|---|---|---|
| 0.1 | +1 | −1 | ✗ |
| 0.2 | +1 | −1 | ✗ |
| 0.3 | +1 | −1 | ✗ |
| 0.4 | −1 | −1 | ✓ |
| 0.5 | −1 | −1 | ✓ |
| 0.6 | −1 | −1 | ✓ |
| 0.7 | −1 | −1 | ✓ |
| 0.8 | −1 | −1 | ✓ |
| 0.9 | +1 | +1 | ✓ |
| 1.0 | +1 | +1 | ✓ |
Boosting Round 2: Weighted bootstrap: Records 0.1, 0.2, 0.3 appear very frequently (high weight). Records 0.4, 0.5, 0.6, 0.7 also present. Decision stump split: , . (Since all , this stump predicts +1 for all 10 records.) Misclassified: (true −1, predicted +1). These had weight ~0.0096 from Round 1. So 4 errors. Weight update (selective examples): - Record 0.1 (was ~0.31, now correct): - Record 0.4 (was ~0.0096, now incorrect): Normalization: Sum of raw weights ≈ 1.000 (after normalizing), giving new normalized weights. Records 0.4–0.7 now carry higher weight than before.
Boosting Round 3: Decision stump split: , . (The assignment flips because, in this bootstrap sample, the left side has more +1 examples.) Misclassified: Records 0.4, 0.5, 0.6 (about, depending on exact boundary). The procedure for , , and weight update follows the same formulas.
Final Ensemble Prediction: For each record , compute: Example for (true label = −1): - (since ) - (since ) - (since ) Full voting table:
| True | Sum | Pred | Result | ||||
|---|---|---|---|---|---|---|---|
| 0.1 | +1 | −1.738 | +2.779 | +4.119 | +5.160 | +1 | ✓ |
| 0.2 | +1 | −1.738 | +2.779 | +4.119 | +5.160 | +1 | ✓ |
| 0.3 | +1 | −1.738 | +2.779 | +4.119 | +5.160 | +1 | ✓ |
| 0.4 | −1 | −1.738 | +2.779 | −4.119 | −3.078 | −1 | ✓ |
| 0.5 | −1 | −1.738 | +2.779 | −4.119 | −3.078 | −1 | ✓ |
| 0.6 | −1 | −1.738 | +2.779 | −4.119 | −3.078 | −1 | ✓ |
| 0.7 | −1 | −1.738 | +2.779 | −4.119 | −3.078 | −1 | ✓ |
| 0.8 | −1 | −1.738 | +2.779 | −4.119 | −3.078 | −1 | ✓ |
| 0.9 | +1 | +1.738 | +2.779 | −4.119 | +0.398 | +1 | ✓ |
| 1.0 | +1 | +1.738 | +2.779 | −4.119 | +0.398 | +1 | ✓ |
14.4.4 Weight Dynamics — Visual Interpretation
| Record | Round 1 Weight | Round 2 Weight | Round 3 Weight | Interpretation |
|---|---|---|---|---|
| Easy (e.g., 0.9) | 0.10 → 0.010 | → 0.005 | → 0.002 | Correctly classified every round. Weight steadily decreases. |
| Hard type A (e.g., 0.1) | 0.10 → 0.311 | → 0.019 | → 0.010 | Misclassified R1, then corrected R2–R3. Weight spiked then fell. |
| Hard type B (e.g., 0.5) | 0.10 → 0.010 | → 0.155 | → 0.350 | Correct R1, then misclassified R2–R3. Weight keeps increasing. |
14.4.5 When Boosting Fails
14.4.6 AdaBoost Properties
14.4.7 Code Example — Ensemble Methods Comparison
from sklearn.ensemble import (
BaggingClassifier,
RandomForestClassifier,
AdaBoostClassifier,
GradientBoostingClassifier
)
from sklearn.tree import DecisionTreeClassifier
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import train_test_split
from sklearn.datasets import load_breast_cancer
data = load_breast_cancer()
X, y = data.data, data.target
X_train, X_test, y_train, y_test = train_test_split(
X, y, test_size=0.3, stratify=y, random_state=42
)
scaler = StandardScaler()
X_train = scaler.fit_transform(X_train)
X_test = scaler.transform(X_test)
Baseline single decision tree: Accuracy ≈ 0.9123.
Bagging:
bag = BaggingClassifier(
estimator=DecisionTreeClassifier(),
n_estimators=50,
max_samples=0.8, # each tree sees 80% of rows
max_features=0.8 # each tree sees 80% of columns
)
bag.fit(X_train, y_train)
Accuracy ≈ 0.95 — ~4.4% improvement over baseline
Random Forest:
rf = RandomForestClassifier(
n_estimators=100,
max_depth=10,
min_samples_split=5
)
rf.fit(X_train, y_train)
Accuracy ≈ 0.9561
AdaBoost:
ada = AdaBoostClassifier(
estimator=DecisionTreeClassifier(max_depth=1),
n_estimators=50,
learning_rate=1.0 # scales α_i; 1.0 = no scaling
)
ada.fit(X_train, y_train)
Learning rate effect: Accuracy vs. learning rate followed an inverted-U shape — peaked around 1.0–1.5, then dropped as learning rate increased further. The learning rate scales , controlling how aggressively weights are updated each round.
Number of trees effect: Accuracy initially dipped (1→5 trees), then rose steadily, plateauing at ~23–24 trees. Beyond 25 trees, adding more trees gave no meaningful improvement — the ensemble had saturated.
Summary: On this relatively clean dataset, all ensemble methods performed similarly (within ~1–2% of each other). The key takeaway: ensemble methods consistently beat a single decision tree, and the choice among them often depends on data characteristics (size, noise, feature correlations) rather than one being universally "best."
14.4.8 Student Q&A on AdaBoost
DecisionTreeClassifier(max_depth=10) as the base estimator causes severe overfitting. Always use max_depth=1 (decision stump) or max_depth=2.
2. Not tuning the learning rate. The learning_rate parameter scales . Too high → aggressive weight updates, overfitting. Too low → slow convergence, needs many more estimators. Grid search over [0.1, 0.5, 1.0, 1.5, 2.0].
3. Running too many rounds on noisy data. If the data has mislabeled examples, AdaBoost will assign them exponentially growing weight. After many rounds, the ensemble chases noise. Monitor validation error and stop early.
4. Forgetting that triggers a reset. If any round produces , the algorithm resets all weights to . This is a safety valve — it means the current weighting is hopeless and the algorithm starts fresh. Don't be surprised if this happens on very noisy data.
14.5 Model Comparison and Practical Considerations
14.5.1 Summary of Three Ensemble Techniques
| Dimension | Bagging | Random Forest | Boosting (AdaBoost) |
|---|---|---|---|
| Core idea | Average over random data subsets | Bagging + random feature subsets | Sequentially focus on hard examples |
| Row randomization | Yes (bootstrap) | Yes (bootstrap) | Optional (version-dependent) |
| Feature randomization | No | Yes (at every split) | No |
| Training | Parallel | Parallel | Sequential |
| Base learners | Any model | Decision trees only | Usually decision trees (shallow) |
| Variance reduction | High | Very high | Moderate (can increase variance if overfit) |
| Bias reduction | None | None | Yes — sequential correction reduces bias |
| Overfitting risk | Low | Low | Moderate–High (sensitive to noisy data) |
| Best for | High-variance base models | Tabular data with many features | Clean data where base models are weak |
| Interpretability | Low | Medium (feature importance) | Low |
14.5.2 Practical Coding Parameters
n_estimators. Typical starting values:
| Method | Typical n_estimators range | Notes |
|---|---|---|
| Bagging | 50–200 | Fewer needed if base model is strong |
| Random Forest | 100–500 | More trees = smoother decision boundary |
| AdaBoost | 50–200 | Stop when validation error plateaus |
| Gradient Boosting | 100–1000 | Need more than AdaBoost due to learning rate scaling |
14.5.3 Gradient Boosting and XGBoost
14.5.4 Student Discussion — Exam Format and Course Logistics
Exam Guidance Summary
Concept Questions (Ensemble Foundations)
- Two core challenges: Know that every ensemble method must solve (1) creating diversity among base learners and (2) combining their votes. - Four diversity strategies: Be able to list and give an example of each — different algorithms, different hyperparameters, different input representations, different training sets. - Necessary condition: for every base classifier. Be able to explain why — because combining models that are wrong more often than right amplifies errors. - Success/danger zone graph: Know the x-axis (base classifier error), y-axis (ensemble error), the diagonal baseline, and which side is which zone. Be able to sketch and label it.Bagging Problems
- Format: You will be given a dataset (typically 10 points, one feature, binary labels), a set of bootstrap samples with their split points, and the split rules for each round. - What you must do: For each test record, compute what each stump predicts, aggregate the votes (sum or majority), and determine the final ensemble prediction. - Key skill: Tallying votes correctly and handling degenerate classifiers (stumps that predict the same class regardless of input). - Study: Work through the Section 14.2.3 example until you can do it without looking.Random Forest (Conceptual)
- Know the difference from bagging: random forest adds feature randomization at every split. - Know why trees are unpruned: individual overfitting is cancelled by averaging. - Know the ballpark rules: features per split for classification, for regression. - You will not be asked to compute information gain for random forest problems on the exam — split points are given.AdaBoost Numerical Problems
- Format: Similar to bagging but with sequential rounds and dynamic weights. You'll be given split points for each round. - What you must compute (for each round): 1. Error rate: 2. Classifier importance: 3. Weight updates: (correct) or (incorrect) 4. Normalize: divide by - Final prediction: - Common mistake: Forgetting to normalize weights after each round. The weights must sum to 1 before computing the next round's error. - Study: Work through the Section 14.4.3 three-round example. Then try it with different split points to build fluency.What Is NOT on This Exam
- You will not need to compute information gain / entropy for ensemble method problems. Split points are provided. - You will not be tested on gradient boosting or XGBoost details — coverage is conceptual only. - Naive Bayes problems (mentioned by the professor) are from a different lecture — they may appear on the same exam but are separate from ensemble methods.Study Strategy
The professor emphasized: "Minimum 3 problems are included per concept in the slides. Study those." The worked examples in Sections 14.2.3 and 14.4.3 are your primary study material for numerical questions. For conceptual questions, know the comparison table in Section 14.5.1 cold.Key Industry Applications
Where Ensemble Methods Are Used Today
- Random Forest and XGBoost: The two most commonly deployed ensemble methods in production ML systems. Random forest is preferred when interpretability and stability matter; XGBoost when raw predictive power is the priority. - XGBoost in competitions: Dominates Kaggle competitions — used in over 50% of winning solutions for structured data problems. Its speed comes from parallelizing the split-finding within each tree (evaluating all candidate splits simultaneously across CPU cores), even though trees are built sequentially. LightGBM (Microsoft) and CatBoost (Yandex) are strong alternatives with different speed/accuracy trade-offs. - Decision trees as base learners: Preferred across all ensemble methods. They handle both linear and non-linear relationships without feature engineering. They are fast to train compared to neural networks. They work naturally with bootstrap and reweighting frameworks. And they produce interpretable rules when needed.Python Libraries and Tools
- scikit-learn (sklearn.ensemble): The standard library for ensemble methods in Python. Provides BaggingClassifier, BaggingRegressor, RandomForestClassifier, RandomForestRegressor, AdaBoostClassifier, AdaBoostRegressor, GradientBoostingClassifier, GradientBoostingRegressor. The estimator parameter in bagging can be set to any scikit-learn model.
- XGBoost (xgboost): Standalone library with its own API (xgboost.XGBClassifier, xgboost.XGBRegressor). Supports GPU acceleration, early stopping, and built-in cross-validation.
- LightGBM (lightgbm): Microsoft's gradient boosting framework. Uses histogram-based splitting for faster training on large datasets. Particularly good for high-dimensional data.
- CatBoost (catboost): Yandex's gradient boosting library. Handles categorical features natively without one-hot encoding. Often the best out-of-the-box performance with default hyperparameters.
Real-World Datasets and Benchmarks
- Breast Cancer Wisconsin dataset: Built into scikit-learn (sklearn.datasets.load_breast_cancer). 569 samples, 30 features, binary classification. Commonly used for demonstrating ensemble methods.
- Wine dataset: Also in scikit-learn. 178 samples, 13 features, 3-class classification. Good for showing multi-class ensemble behavior.
- Iris dataset: 150 samples, 4 features, 3-class classification. Used in the Random Forest code walkthrough (Section 14.3.5).
Feature Importance in Practice
Random forest and gradient boosting both provide feature importance scores automatically. In industry, these are used to: - Feature selection: Drop low-importance features to reduce model complexity and training time. - Model interpretability: Show stakeholders which factors drive predictions (e.g., "credit score is the #1 predictor of loan default"). - Debugging: Identify data leakage — if a suspicious feature (like a customer ID) has abnormally high importance, something is wrong with the data pipeline. The importance is computed by aggregating the impurity reduction (Gini or entropy) each feature produces across all trees in the forest. Features that consistently produce large impurity reductions get high importance scores.ML Lecture 14 notes · Ensemble Methods — Bagging, Random Forest, and Boosting
Sections Breakdown
Core ensemble concepts: diversity, combining votes, the E < 0.5 rule, success vs. danger zones
Bootstrap sampling, parallel training, the 63.2% problem, bias-variance decomposition
Double randomization (rows + columns), feature importance, unpruned trees, code walkthrough
Sequential training, AdaBoost algorithm, weight dynamics, worked example with 10 data points
Comparison table, practical coding parameters, gradient boosting and XGBoost preview
Exam format, bagging and AdaBoost numerical problems, study strategy
Real-world usage, Python libraries, feature importance in practice
Exam Revision Notes
Below is the distilled, exam-ready core of this lecture. Every entry is built from the full textbook notes above. Use this section for rapid review — but if something doesn't make sense, go back to the full explanation in the main content.
Ensemble Learning Foundations
Must-know: An ensemble combines multiple diverse base classifiers, each with error rate , to produce a prediction more accurate than any single member. Two necessary conditions: (1) base classifiers must be approximately independent, (2) every classifier must beat random guessing ().
Top pitfall: Assuming any ensemble beats any single model. If base models are already near-perfect (99% accuracy), ensembling adds complexity with negligible gain.
Self-check: Why does the ensemble error drop below the individual error rate when ?
Connects to: Bagging, Random Forest, Boosting, Bias-Variance Decomposition
Bagging (Bootstrap Aggregating)
Must-know: Bagging trains models in parallel on bootstrap samples (random sampling with replacement). It reduces variance (not bias) and works best with unstable base learners like deep decision trees. Final prediction: majority vote (classification) or average (regression).
Top pitfall: Each bootstrap sample contains only ~63.2% of unique records. Using too few estimators (e.g., 5-10) means significant data loss per model.
Self-check: In the bagging worked example, why does a degenerate classifier (predicting all +1) occur?
Connects to: Bootstrapping, Random Forest, Bias-Variance Tradeoff
Random Forest
Must-know: Random Forest = bagging + feature randomization. At every split, each tree randomly samples features from the total . Defaults: for classification, for regression. Trees are unpruned \u2014 individual overfitting is cancelled by averaging. Provides feature importance scores as a side benefit.
Top pitfall: Setting max_features = d (all features) degrades random forest to plain bagging. Never prune individual trees.
Self-check: How does the double randomization (rows + columns) make random forest trees more decorrelated than bagging?
Connects to: Bagging, Feature Importance, Dimensionality Reduction
Boosting and AdaBoost
Must-know: AdaBoost trains classifiers sequentially, each focusing on misclassified examples from the previous round. Key formulas: weighted error , classifier importance , weight update , final prediction . Works best with weak learners (decision stumps, depth 1).
Top pitfall: Using deep trees as base learners (depth > 2) causes severe overfitting. AdaBoost is designed for weak learners. Also, forgetting to normalize weights after each round.
Self-check: Walk through one AdaBoost round: compute error rate, alpha, update weights for correct and incorrect records, and normalize.
Connects to: Gradient Boosting, XGBoost, Ensemble Diversity
Model Comparison
Must-know: Bagging reduces variance (parallel, any base model). Random Forest reduces variance more via feature randomization (decision trees only, parallel). Boosting reduces both bias and variance (sequential, weak learners). For modern applications: XGBoost/LightGBM for maximum accuracy, Random Forest for strong no-tuning baseline.
Top pitfall: Blindly defaulting to XGBoost for everything. For N < 1000, random forest is often more stable with less tuning.
Self-check: When would you choose bagging over random forest, and when would you choose boosting over both?
Connects to: Bias-Variance Decomposition, Gradient Boosting, XGBoost
Was this lecture useful?
BitsNotes AI Assistant
Subject Notes AssistantConfigure AI Chat
Choose how to access the chatbotSigned in as
Powered by BitsNotes — 20 messages per day. No API key needed. Want unlimited access? Use "Bring Your Own Key" mode.
Sign in to use AI Chat
Get 20 free AI messages per day to ask questions about your lecture notes. Sign in with Google or GitHub — it takes 5 seconds.
Sign In to BitsNotesSwitch to "Bring Your Own Key" tab above for unlimited access with any OpenAI-compatible provider.