🔥Limited Offer: Get 50% OFFon AI & Full Stack Courses🔥
Back to Machine Learning Notes
Topic #168

AdaBoost

AdaBoost (Adaptive Boosting) trains a sequence of weak learners, giving progressively more weight to the training points previous learners got wrong — literally "adapting" its focus round by round.

The Algorithm, As Explicit Steps

StepWhat Happens
1Initialize equal weights for every training point: \(w_i = 1/n\)
2Train a weak learner using the current weights
3Compute the weak learner's weighted error rate \(\varepsilon\)
4Compute its voting weight: \(\alpha = \frac{1}{2}\ln\left(\frac{1-\varepsilon}{\varepsilon}\right)\)
5Update point weights: increase weight for misclassified points, decrease for correctly classified ones
6Normalize weights to sum to 1, repeat from step 2
7Final prediction: weighted vote across all rounds, using each round's \(\alpha\)

Worked Example — One Full Round

4 training points, initial weights \(w=[0.25, 0.25, 0.25, 0.25]\). A weak learner misclassifies exactly 1 of the 4 points.

\[ \varepsilon = \sum_{\text{misclassified}} w_i = 0.25 \] \[ \alpha = \frac{1}{2}\ln\left(\frac{1-0.25}{0.25}\right) = \frac{1}{2}\ln(3) \approx 0.549 \]

Update weights: misclassified point's weight is multiplied by \(e^{\alpha}\approx 1.732\); correctly classified points' weights are multiplied by \(e^{-\alpha}\approx 0.577\).

PointBeforeUpdateAfter (unnormalized)After (normalized)
Misclassified0.25× 1.7320.4330.500
Correct #10.25× 0.5770.1440.167
Correct #20.25× 0.5770.1440.167
Correct #30.25× 0.5770.1440.167

The misclassified point's weight doubles (from 0.25 to 0.50) — the next weak learner will now weight that point twice as heavily, directly forcing more focus on the mistake.

import numpy as np

weights = np.array([0.25, 0.25, 0.25, 0.25])
misclassified = np.array([True, False, False, False])

epsilon = weights[misclassified].sum()
alpha = 0.5 * np.log((1 - epsilon) / epsilon)

weights = np.where(misclassified, weights * np.exp(alpha), weights * np.exp(-alpha))
weights = weights / weights.sum()   # normalize
print(alpha, weights)   # 0.5493  [0.5, 0.1667, 0.1667, 0.1667]

Python Implementation

from sklearn.ensemble import AdaBoostClassifier
from sklearn.tree import DecisionTreeClassifier

model = AdaBoostClassifier(
    estimator=DecisionTreeClassifier(max_depth=1),   # a decision stump -- the classic weak learner
    n_estimators=100,
    learning_rate=1.0,
    random_state=42,
)
model.fit(X_train, y_train)
print(model.score(X_test, y_test))

What the Alpha Formula Actually Encodes

A weak learner that's only slightly better than random guessing (\(\varepsilon\) close to 0.5) gets a small \(\alpha\) — it barely counts in the final weighted vote. A weak learner that's very accurate (\(\varepsilon\) close to 0) gets a large \(\alpha\) — it dominates the final vote. This is why AdaBoost's final prediction is a weighted combination, not a plain average — better-performing rounds earn more say.

Practical Use Cases

  • Binary classification problems with moderate-sized tabular data, where boosting's accuracy gains are valuable
  • Historically one of the first practically successful boosting algorithms, still used and taught as the clearest introduction to the boosting idea

Common Mistakes

  • Using AdaBoost on data with significant label noise — mislabeled points keep getting more weight round after round, since the algorithm has no way to distinguish "genuinely hard" from "actually mislabeled."
  • Setting n_estimators very high without monitoring validation performance, risking overfitting in later rounds.

Interview Relevance

Q: "Why is AdaBoost particularly sensitive to noisy or mislabeled data?" Misclassified points get exponentially increasing weight each round — a genuinely mislabeled point can never be "correctly" classified, so its weight keeps growing round after round, eventually forcing later weak learners to distort their fit trying to accommodate what is actually bad data.

Practice Question

A weak learner achieves a weighted error of \(\varepsilon=0.1\) (very accurate). Compute its \(\alpha\), and compare it to the \(\alpha=0.549\) computed above for \(\varepsilon=0.25\).

Want to go beyond the notes?

Join CodingNow 2.0's Machine Learning course — live mentorship, real projects, and 100% placement support.

Enroll Now — Free Demo Available

AdaBoost – FAQs

Quick answers about learning AdaBoost in Machine Learning.

This free note from CodingNow 2.0 explains AdaBoost in Machine Learning — concept, syntax and worked code examples you can copy, run and revise before interviews.
Yes. Every Machine Learning topic on CodingNow 2.0, including AdaBoost, is 100% free with no signup required.
With focused practice, most students grasp AdaBoost in 1–3 days from these notes; pairing it with CodingNow 2.0's mentor-led course takes you to job-ready depth faster.
Use the code examples in this note, then ask doubts for free on the CodingNow 2.0 Community (/community) — expert instructors answer within 24 hours.
WhatsApp
Call NowEnroll Now