Skip to main content

Boosting & AdaBoost

Source: Unit 3 §3

Boosting: the core idea

Boosting trains learners sequentially, each one learning from the mistakes of the previous one, and combines them with weights derived from accuracy or variance.

FactsThe mechanics in four lines
  • Let a hypothesis h1h_1 misclassify some instances. The next learner h2h_2 is told "get h1h_1's misclassified instances right" - by increasing the weights of the misclassified samples and decreasing the weights of the correctly classified ones.
  • All sample weights must sum to 1.
  • The weak learner is often a decision stump: one node, a single binary split. Boosting learns slowly and incrementally.
  • The final classifier is a weighted summation of all the individual classifiers.
round 1stumpε₁ = 0.30 → α₁ = 0.42round 2stumpε₂ = 0.21 → α₂ = 0.65round 3stumpε₃ = 0.32 → α₃ = 0.38H(x) = sign(α₁h₁ + α₂h₂ + α₃h₃ + …)red ring = misclassified, so it grows next round · amber arrow = the re-weighted data moving on
Each round re-weights the training set so the next stump is forced to look at what the last one got wrong. The points literally grow. The six points are schematic: each ε shown is the source's own value for that round, not a count of the red rings.

Boosting vs bagging

BaggingBoosting
SamplingEvery element has an equal probabilityObservations are weighted, so some appear more often
LearnersParallel, independentSequential, each learns from the previous
GoalReduce varianceReduce bias (and variance)
Popular exampleRandom ForestAdaBoost

AdaBoost: the algorithm

AdaBoost uses two sets of weights: instance weights (one per data point) and hypothesis weights α\alpha (one per learner).

StepsThe AdaBoost loop
  1. Start from ONE dataset. Initialize every instance weight to w=1/Nw = 1/N, where NN is the number of instances.
  2. For a binary classifier, encode the labels as +1 (true) and −1 (false).
  3. Build many decision stumps and choose the one with the lowest error rate; call it h1(x)h_1(x).
  4. Compute the error rate εm\varepsilon_m, the weighted percentage of misclassified examples.
  5. Compute the hypothesis weight αm\alpha_m.
  6. Update the instance weights: up-weight the misclassified, down-weight the correct, then normalize so they sum to 1.
  7. Repeat, so the next stump focuses on the previous stump's errors.
  8. Finish with a weighted vote of all the hypotheses.

The formulas

Error of the mm-th classifier, where I(a,b)=1I(a,b) = 1 if aba \neq b and 0 otherwise:

εm=nwn(m)I(prediction,actual)\varepsilon_m = \sum_n w_n^{(m)} \cdot I(\text{prediction}, \text{actual})

Hypothesis weight, also called the stump weight:

αm=12ln ⁣(1εmεm)\alpha_m = \frac{1}{2} \ln\!\left( \frac{1 - \varepsilon_m}{\varepsilon_m} \right)

Instance weight update, then normalize by NN so the weights sum to 1:

wi+1=wiexp ⁣(αactualipredictioni)w_{i+1} = w_i \cdot \exp\!\left( -\alpha \cdot \text{actual}_i \cdot \text{prediction}_i \right)
FactsWhich way the exponent pushes
  • Correctly classified - actualprediction=+1\text{actual} \cdot \text{prediction} = +1, so multiply by eαe^{-\alpha} and the weight decreases.
  • Misclassified - actualprediction=1\text{actual} \cdot \text{prediction} = -1, so multiply by e+αe^{+\alpha} and the weight increases.

Final hypothesis:

H(x)=sign ⁣(mαmhm(x))H(x) = \operatorname{sign}\!\left( \sum_m \alpha_m \cdot h_m(x) \right)

Worked arithmetic

StepsTurning an error rate into a stump weight
  1. Suppose the total weighted error is ε=0.3\varepsilon = 0.3.
  2. α=12ln ⁣[(10.3)/0.3]\alpha = \tfrac{1}{2} \ln\!\left[ (1 - 0.3) / 0.3 \right].
  3. (10.3)/0.3=2.333(1 - 0.3)/0.3 = 2.333.
  4. 12ln(2.333)=12×0.847=0.42\tfrac{1}{2} \ln(2.333) = \tfrac{1}{2} \times 0.847 = \mathbf{0.42}.
  5. The next round from the slides: ε=0.21α=0.65\varepsilon = 0.21 \Rightarrow \alpha = \mathbf{0.65}.
GotchaThe slide rounds the second alpha down

The slide gives ε=0.21α=0.65\varepsilon = 0.21 \Rightarrow \alpha = 0.65, but the formula gives 12ln(0.79/0.21)=12×1.3250=0.6625\tfrac{1}{2}\ln(0.79 / 0.21) = \tfrac{1}{2} \times 1.3250 = \mathbf{0.6625}, which is 0.66. The method is unaffected and the four-round example below still comes out positive either way - 1.23751.2375 instead of 1.251.25 - but quote 0.66 if you are asked to compute it yourself. The slide's 0.65 is kept below only because that is the number its worked example carries.

StepsThe final prediction over 4 rounds
  1. The four hypothesis weights are α=0.42, 0.65, 0.38, 1.1\alpha = 0.42,\ 0.65,\ 0.38,\ 1.1.
  2. The four stumps vote +1, 1, +1, +1+1,\ -1,\ +1,\ +1 on this instance.
  3. Weighted sum: 0.42×1+0.65×(1)+0.38×1+1.1×1=1.250.42 \times 1 + 0.65 \times (-1) + 0.38 \times 1 + 1.1 \times 1 = 1.25.
  4. sign(1.25)=+1\operatorname{sign}(1.25) = +1, so the instance is labelled true and is correctly classified.

Alpha versus error

00.5121-1-20ε → 0 gives α → +∞ε = 0.5 gives α = 0ε → 1 gives α → −∞ε, the weighted error rate of the stumpα, the stump's weightlower error, higher weightthe curve only crosses zero at ε = 0.5
A perfect stump gets infinite weight, a coin-toss stump gets none, and a consistently wrong stump gets a negative weight so its vote is flipped.
Error rate εStump weight αWhat it means
0+∞A perfect classifier gets a huge weight
0.50A coin toss is useless, so it gets zero weight
1−∞Always wrong, so its vote is strongly negated
Exam cueWhere α comes from

The stump weight α\alpha is derived by taking the partial derivative of the error with respect to the error. The shape that falls out is the one plotted above: better classifiers, meaning lower ε\varepsilon, get higher weight.

GotchaBoosting can overfit; bagging does not

Unlike bagging, boosting can overfit. That is exactly why the hypothesis weights α1,α2,α3,\alpha_1, \alpha_2, \alpha_3, \ldots exist: they temper how much each learner is allowed to contribute to the final vote.