Skip to content
Lambdian

AdaBoost

Boosting weak learners: reweight the mistakes, add a new stump, combine them by weighted vote.

Animated explanation

The idea

Bagging trains models in parallel and averages them to reduce variance. Boosting trains them in sequence, each one concentrating on what the ensemble so far gets wrong, to reduce bias.

AdaBoost keeps a weight on every training example. After each weak learner (typically a decision stump, a tree with one question) is trained, the examples it misclassified get heavier and the correct ones lighter. The next stump, trained on the reweighted data, is pushed towards the hard cases. Finally all stumps vote, each with a say α\alpha that grows with its accuracy. Dozens of barely-better-than-chance stumps combine into a strong classifier.

What it is really optimising

AdaBoost is forward stagewise additive modelling under the exponential loss e−yF(x)e^{-yF(\mathbf{x})}: each round adds the stump and weight that most reduce that loss given everything already in the model. The weights wiw_i are exactly the current losses of each example. This view connects AdaBoost to gradient boosting, which generalises it to any differentiable loss.

Practical behaviour

AdaBoost often keeps improving test error even after training error hits zero, because it keeps enlarging the margins yF(x)yF(\mathbf{x}). But the exponential loss punishes mislabelled points enormously, so with noisy labels AdaBoost can chase outliers. Use a learning rate below 1, limit the rounds by validation, or prefer gradient boosting with a robust loss.

The algorithm, step by step

  1. 1
    Initialise weights wi=1/nw_i = 1/n; labels yi∈{−1,+1}y_i\in\{-1,+1\}.
  2. 2
    For m=1..Mm = 1..M: fit a stump hmh_m minimising the weighted error εm\varepsilon_m.
  3. 3
    Set αm=12ln⁡1−εmεm\alpha_m = \frac12\ln\frac{1-\varepsilon_m}{\varepsilon_m}.
  4. 4
    Update wi←wie−αmyihm(xi)w_i \leftarrow w_i e^{-\alpha_m y_i h_m(\mathbf{x}_i)} and renormalise.
  5. 5
    Predict sign⁡∑mαmhm(x)\operatorname{sign}\sum_m\alpha_mh_m(\mathbf{x}).

The maths

Learner weight

αm=12ln⁡1−εmεm\alpha_m = \tfrac12\ln\frac{1-\varepsilon_m}{\varepsilon_m}

Example reweighting

wi(m+1)=wi(m)exp⁡(−αmyihm(xi))Zmw_i^{(m+1)} = \frac{w_i^{(m)}\exp(-\alpha_m y_i h_m(\mathbf{x}_i))}{Z_m}

Training error bound

1n∑i1[F(xi)≠yi]≤∏m2εm(1−εm)\frac1n\sum_i\mathbb{1}[F(\mathbf{x}_i)\ne y_i] \le \prod_m 2\sqrt{\varepsilon_m(1-\varepsilon_m)}
If every learner beats chance by a margin, training error falls exponentially fast.

Strengths and weaknesses

Strengths

  • Turns very weak learners into a strong classifier
  • Few hyperparameters (rounds, learning rate)
  • Theoretical guarantees on training error and margins

Weaknesses

  • Sensitive to label noise and outliers (exponential loss)
  • Sequential: cannot parallelise rounds
  • Usually beaten by gradient boosting libraries in practice

Reach for it when…

Clean, moderately sized classification problems, and as the conceptual bridge to gradient boosting.

Check your understanding

Question 1

Q1After a round, what happens to the weight of a misclassified example?

Question 2

Q2A weak learner has weighted error 0.5. Its vote α is…

Question 3

Q3Boosting mainly reduces…

Lambdian Lab

AdaBoost with decision stumps

Labels are ±1.

  • fit_stump(X, y, w): search features, thresholds (the data values) and polarity ±1 for the lowest weighted error; a stump predicts polarity · (+1 if x[f] > t else −1). Return (f, t, polarity, error).
  • stump_predict(X, stump).
  • fit_adaboost(X, y, M): return a list of (alpha, stump).
  • predict(X, model): sign of the weighted vote (0 counts as +1).
Open the labPython + NumPy runs in your browser. Sign-in keeps your code and attempts.