Boosting
Turning weak learners into a strong one by focusing on mistakes.
A decision stump, one yes-or-no question about one feature, is often barely better than a coin flip. Train a second stump on data reweighted toward the first one's mistakes, then a third, and let them vote: the committee's training error falls exponentially fast. This lesson derives AdaBoost, proves that bound, and shows that the algorithm is greedy minimization of the exponential loss.
What you’ll learn
- Run AdaBoost by hand, with labels : the weighted error , the vote and the multiplicative reweighting.
- Prove that AdaBoost's training error is at most , where .
- Derive AdaBoost as forward stagewise additive modeling with the exponential loss, and identify what its score estimates.
- Contrast boosting with bagging, and explain why label noise hurts AdaBoost.
Weak learners and the boosting question
Boosting answers a question that sounds too good to be true. Suppose an algorithm can only ever produce rules slightly better than a coin flip. Can you combine its outputs into a classifier that is almost always right?
Work with two classes labeled and a training set . Give each example a weight with . A weak learner is an algorithm that, for every such weighting, returns a classifier whose weighted error is at most , for some fixed edge . The usual choice is the decision stump, a decision tree with a single split: if and otherwise, or the reverse. Finding the best stump takes one pass over each sorted feature.
Kearns and Valiant were the first to ask whether weak learnability implies strong learnability, meaning arbitrarily small error. Schapire found the first provable boosting algorithm in 1989 (published in 1990), and Freund a much more efficient one a year later, but both were awkward in practice. AdaBoost (Freund & Schapire, 1995; journal version 1997) removed the difficulties, and it is adaptive: it never needs to know . Like bagging, boosting builds an ensemble of trees, but the two work in opposite ways.
| Property | Bagging | Boosting |
|---|---|---|
| How members are trained | independently, in parallel, on bootstrap samples | one after another, each on data reweighted toward earlier mistakes |
| Typical member | deep trees: low bias, high variance | stumps or small trees: high bias, low variance |
| Combination | plain average or majority vote | weighted vote |
| Mainly reduces | variance | bias, and often variance too |
| Adding members | the test error levels off | training error keeps falling, so the number of rounds is tuned |
| Label noise | fairly robust | sensitive: weight piles up on mislabeled points |
Which of these is exactly what boosting's weak-learning assumption asks for?
- A stump that reaches 51% accuracy when all training points are weighted equally
- A deep tree that always reaches zero training error
- An algorithm that, for every weighting of the training set, returns a classifier with weighted error at most 0.45
- A classifier with 30% error on the test set
Show the answer
C. An algorithm that, for every weighting of the training set, returns a classifier with weighted error at most 0.45
Boosting will hand the weak learner many different weightings, concentrated on whatever is currently hard, so the guarantee must hold for all of them. Edge for every weighting is enough: the training-error bound in this lesson then drives the error to zero.
AdaBoost, step by step
AdaBoost keeps a weight on every training example. Each round it asks the weak learner for a classifier on the current weights, scores it, and shifts weight toward the examples that classifier got wrong:
ADABOOST(examples (x_1, y_1) ... (x_n, y_n) with y_i in {-1, +1}, rounds T)
D_1(i) = 1/n for every i # uniform weights
for t = 1..T:
h_t = WeakLearner(examples, weights D_t)
eps_t = sum_i D_t(i) * [h_t(x_i) != y_i] # weighted error, needs eps_t < 1/2
alpha_t = 0.5 * ln((1 - eps_t) / eps_t) # the vote: large when eps_t is small
for every i:
D_{t+1}(i) = D_t(i) * exp(-alpha_t * y_i * h_t(x_i)) / Z_t
# a mistake is multiplied by e^{alpha_t}, a hit by e^{-alpha_t};
# Z_t rescales the new weights to sum to 1
return H(x) = sign( sum_t alpha_t * h_t(x) )The update needs no case split: on a hit and on a mistake. A stump with gets , no vote at all. One with would get , which simply flips its predictions.
On 100 equally weighted points, the first stump misclassifies 10 of them, so . After the update, what percentage of the total weight sits on those 10 points?
Show the answer
50 %
, so each mistake's weight is multiplied by 3 and each hit's by : the mistakes carry , the hits , and . After rescaling, each misclassified point weighs , five times its old weight, and together they carry exactly half.
Think first The last answer was no accident: under the new weights , the classifier always has weighted error exactly . Why, and why is that useful?
After the update the mistakes weigh and the hits : the same amount, so each side holds half. The next round therefore gains nothing by returning again. It must find a rule that beats chance on the new weights, half of which sit on the examples got wrong, which is how AdaBoost manufactures diverse members.
Why the training error falls exponentially
Multiply the updates together. Every weight starts at and has been multiplied by each round. Since the final weights sum to 1:
A mistake (or a tie) means , where . So the exponential dominates the 0–1 loss term by term:
Each normalizer splits into hits and mistakes. It is convex in and smallest where , which is exactly AdaBoost's choice of :
Write , then use with and take square roots:
Three consequences. First, AdaBoost's is precisely the choice that greedily minimizes the bound : the algorithm is built around this proof. Second, the training error is a multiple of , so once the bound drops below the error must be exactly zero. Third, nothing requires knowing in advance; whatever edges the weak learner delivers are used. In practice the edges shrink as the weights concentrate on hard examples, so later rounds make slower progress.
The circles simulation shows the bound as its "error bound" readout: 0.40 after 10 rounds, 0.13 after 50 and 0.019 after 200. It always sits above the training error, which is already 0 at round 50: the bound is a guarantee, not a forecast.
Every stump has edge at least (weighted error at most 0.4) on training points. After how many rounds does the bound guarantee zero training error?
Show the answer
346 rounds
Zero error is guaranteed once , that is , so 346 rounds; the tighter product already gets there at 339. The rate depends on : an edge of 0.05 would need four times as many rounds.
The statistical view: stagewise fitting of the exponential loss
Friedman, Hastie & Tibshirani (2000) recast boosting in statistical terms. An additive model can be fitted by forward stagewise additive modeling: add one term at a time, choosing it to reduce the loss as much as possible, and never revisit earlier terms. With the exponential loss , this recipe reproduces AdaBoost exactly.
Stage adds to the current fit . The past enters only through fixed weights, which are AdaBoost's weights before normalization:
Split the sum into hits () and mistakes () and regroup:
For any the best minimizes the weighted error, which is the weak learner's job. With its normalized weighted error, minimizing over gives AdaBoost's vote:
The new fit and the next weights follow, and they match AdaBoost's update up to normalization:
What does the score estimate? Minimize the expected loss at each , with :
| Loss | As a function of the margin | For a badly misclassified point () |
|---|---|---|
| 0–1 | constant: every mistake costs 1 | |
| Exponential (AdaBoost) | grows exponentially | |
| Binomial deviance (LogitBoost) | grows linearly | |
| Hinge (SVM) | grows linearly | |
| Squared | grows quadratically, and also penalizes confident correct answers () |
A training point is mislabeled, so the ensemble's margin on it, , keeps getting more negative. Under which loss does that point's pull on the next fit, the size of the loss gradient, grow fastest?
- The hinge loss
- The binomial deviance
- The 0–1 loss
- The exponential loss
Show the answer
D. The exponential loss
The gradient of is , which grows without bound as . AdaBoost's weights are exactly these normalized gradients, so a few persistently misclassified points can dominate the weighted data that later stumps are fitted to.
Bias, variance and label noise
Bagging averages deep, low-bias trees and attacks their variance (Bagging & Random Forests). Boosting starts from high-bias stumps and builds an increasingly expressive additive model, so it attacks bias. Breiman had argued that voting methods work mainly by reducing variance, but Schapire, Freund, Bartlett & Lee (1998) found a counterexample in his own test problems: on "ringnorm", boosting stumps cut the error from 40.6% to 12.2% while the variance, under two common definitions for classification, did not fall at all. Boosting does more than reduce variance.
The price of chasing the hardest examples is sensitivity to label noise. A mislabeled point is one the ensemble should get wrong, so its margin keeps falling and its weight keeps growing.
from sklearn.ensemble import AdaBoostClassifier
from sklearn.tree import DecisionTreeClassifier
stump = DecisionTreeClassifier(max_depth=1)
model = AdaBoostClassifier(estimator=stump, n_estimators=500, learning_rate=0.5)
model.fit(X_train, y_train)
# accuracy on held-out data after every round: choose the number of rounds there
val_scores = list(model.staged_score(X_val, y_val))
best_rounds = 1 + max(range(len(val_scores)), key=val_scores.__getitem__)learning_rate multiplies every vote , a form of shrinkage. staged_score evaluates the ensemble after each round, so choosing the number of rounds on a validation set costs a single fit.
Key takeaways
- AdaBoost (labels ) reweights the training points each round, multiplying mistakes by and hits by , and combines its members by the weighted vote with .
- Its training error is at most : any constant edge gives zero training error once .
- AdaBoost is forward stagewise additive modeling with the exponential loss , and its score estimates half the log-odds.
- Bagging mainly reduces variance; boosting reduces bias, and often variance as well.
- The exponential loss lets mislabeled points accumulate weight, so AdaBoost is sensitive to label noise; early stopping and gentler losses help.
Check yourself
In the interactive lesson these are scored with your confidence, and what you miss comes back for review.
In round , the best stump on the current weights has weighted error exactly . What happens?
- Its vote is : it changes neither nor the weights, so boosting makes no further progress
- It gets vote , half the usual weight
- AdaBoost flips its predictions and gives it a large positive vote
- The weights of all points are reset to uniform
Show the answer
A. Its vote is : it changes neither nor the weights, so boosting makes no further progress
, so the stump adds nothing to , and leaves every weight unchanged (). The weak learner faces the same weights again: the weak-learning assumption has failed, and the Convergence lesson AdaBoost & the Exponential Loss shows what that says about the data.
Every stump has edge at least . Roughly how many rounds does the bound need to guarantee a training error below 1%?
- About 46
- About 92
- About 920
- About 9,200
Show the answer
C. About 920
Solve : . The number of rounds grows like , so weaker learners cost quadratically more.
In the population limit, which quantity does AdaBoost's score estimate?
- The probability
- The log-odds
- Half the log-odds,
- The margin of the Bayes classifier
Show the answer
C. Half the log-odds,
Minimizing over gives , so , and . Its sign is the Bayes classifier's prediction.
You flip 10% of the training labels at random and run AdaBoost for many rounds. What should you expect?
- Nothing changes, because the training-error bound still holds
- AdaBoost detects the flipped points and gives them less and less weight
- The bound becomes , so training error grows
- Weight concentrates on the flipped points, later stumps bend to fit them, and test error suffers unless you stop early
Show the answer
D. Weight concentrates on the flipped points, later stumps bend to fit them, and test error suffers unless you stop early
A flipped point disagrees with the pattern the ensemble learns, so its margin stays negative and its weight keeps growing, until later stumps bend to fit it. Fitting those points is fitting noise. Early stopping, shrinkage and gentler losses limit the damage.
Why is boosting usually run with small trees, while bagging uses deep ones?
- Small trees are faster to fit, and that is the only reason
- Averaging cuts variance, which deep trees have plenty of; boosting builds an expressive model out of high-bias pieces, and a tree that fits the weighted data perfectly leaves it nothing to correct
- Small trees are strong learners and deep trees are weak learners
- Bagging cannot be applied to stumps
Show the answer
B. Averaging cuts variance, which deep trees have plenty of; boosting builds an expressive model out of high-bias pieces, and a tree that fits the weighted data perfectly leaves it nothing to correct
Each method attacks a different error term. Bagging leaves bias alone and reduces variance, so it needs low-bias members. Boosting adds members that correct the current fit, reducing bias step by step, and stays in control because each member is simple.
Go deeper
- AdaBoost & the Exponential Loss · Weak learnability, the training-error bound and the statistical view.
- Why Boosting Resists Overfitting · Margins, and the long debate over boosting’s generalization.
- Stacking & Model Averaging · Combining different models by learning how to weight them.
Further reading
- Y. Freund & R. E. Schapire, "A decision-theoretic generalization of on-line learning and an application to boosting," Journal of Computer and System Sciences 55(1), 119–139 (1997).
- J. Friedman, T. Hastie & R. Tibshirani, "Additive logistic regression: a statistical view of boosting," Annals of Statistics 28(2), 337–407 (2000).
- T. Hastie, R. Tibshirani & J. Friedman, The Elements of Statistical Learning, 2nd ed. (Springer, 2009), chapter 10.
- R. E. Schapire & Y. Freund, Boosting: Foundations and Algorithms (MIT Press, 2012).