Simple Algorithm
Machine Learning · Convergence · 28 min

AdaBoost & the Exponential Loss

Weak learnability, the training-error bound and the statistical view.

Can an algorithm that is only slightly better than random guessing always be turned into one that is almost always right? Kearns and Valiant asked; Schapire proved that it can. This lesson proves the equivalence, uncovers the minimax theorem hidden in the weak-learning assumption, and shows that AdaBoost is coordinate descent on the exponential loss, whose minimizer is half the log-odds.

What you’ll learn

  • State weak and strong PAC learnability, and prove that AdaBoost turns a weak learner into a strong one, using the training-error bound and a VC bound for weighted votes.
  • Extend the training-error bound to real-valued (confidence-rated) base hypotheses, and derive the optimal step αt\alpha_t and the optimal leaf scores of a partition.
  • Prove with von Neumann's minimax theorem that weak learnability on a sample is equivalent to separability by a vote of base hypotheses with a positive margin.
  • Show that AdaBoost is coordinate descent with exact line search on the exponential loss, relate it to LogitBoost and Newton steps, and state when AdaBoost is consistent.

Weak and strong learnability

The clause "for every PP" is what makes the question deep: a weak learner must beat chance on every distribution, including the strange ones boosting will construct. Kearns and Valiant were the first to ask whether weak learnability implies strong learnability. Schapire (1990) proved it does, with a recursive construction that trains copies of the weak learner on filtered distributions and takes a majority vote. Freund (1995) found a far more efficient booster, but both were impractical, and AdaBoost, unlike them, needs no prior knowledge of the weak learner's accuracy. It also gives the cleanest proof.

DerivationProof sketch via AdaBoost (weak hypotheses from a class of VC dimension d)
  1. R^S(HT)≤e−2γ2T<1monceT=⌊ln⁡m2γ2⌋+1\hat R_S(H_T)\le e^{-2\gamma^2T}<\frac1m\qquad\text{once}\qquad T=\Big\lfloor\frac{\ln m}{2\gamma^2}\Big\rfloor+1

    Draw a sample SS of mm labeled examples. AdaBoost's weights DtD_t form a distribution on SS, so the weak learner, fed examples drawn from DtD_t, returns hth_t with εt≤12−γ\varepsilon_t\le\tfrac12-\gamma (with high probability, after a union bound over the rounds). By the training-error bound, after enough rounds the vote HTH_T is consistent with SS:

  2. VCdim⁡{sign⁡(∑t=1Tαtht): ht∈B, α∈RT}=O(Tdlog⁡(Td))\operatorname{VCdim}\Big\{\sign\Big(\sum_{t=1}^T\alpha_th_t\Big):\ h_t\in\mathcal B,\ \boldsymbol\alpha\in\R^T\Big\}=\order{Td\log(Td)}

    HTH_T belongs to the class of weighted votes of TT hypotheses from the weak learner's class B\mathcal B. Counting the sign patterns of TT hypotheses and of the threshold on top bounds its VC dimension (Shalev-Shwartz & Ben-David, 2014, chapter 10):

  3. P(HT(x)≠c(x))=O~(dγ2m)+O(log⁡(1/δ)m)P\big(H_T(\mathbf x)\ne c(\mathbf x)\big)=\tilde O\Big(\frac{d}{\gamma^2m}\Big)+\order{\frac{\log(1/\delta)}m}

    A hypothesis consistent with mm examples, from a class of VC dimension DD, has error O((Dlog⁡m+log⁡(1/δ))/m)\order{(D\log m+\log(1/\delta))/m} with probability at least 1−δ1-\delta (the realizable bound of VC Dimension & the Fundamental Theorem). With D=O(Tdlog⁡(Td))D=\order{Td\log(Td)} and T=O(log⁡m/γ2)T=\order{\log m/\gamma^2}, hiding logarithmic factors:

  4. So m=O~(d/(γ2ε))m=\tilde O\big(d/(\gamma^2\varepsilon)\big) examples give error ε\varepsilon: the weak learner has become a strong one. The converse is trivial, since a strong learner run with ε=12−γ\varepsilon=\tfrac12-\gamma is weak.

Think first Suppose the weak learner were guaranteed to beat chance only when the examples are weighted uniformly. Where exactly does the proof break?

In the first step, from round 2 on. The weights DtD_t that AdaBoost hands the weak learner are far from uniform; in fact Dt+1D_{t+1} is built so that hth_t has error exactly 12\tfrac12 under it. A learner with guarantees only near the uniform distribution may return edge-zero hypotheses there, and the bound e−2∑tγt2e^{-2\sum_t\gamma_t^2} stalls. Boosting draws its power from the distribution-free guarantee.

Confidence-rated boosting

Schapire & Singer (1999) noticed that the proof of the training-error bound never uses ht(x)∈{−1,+1}h_t(\mathbf x)\in\{-1,+1\}. Unrolling the weights and bounding the 0–1 loss by e−yFe^{-yF} works for any real-valued hth_t and αt\alpha_t, so the training error is at most ∏tZt\prod_tZ_t with Zt=∑iDt(i)e−αtyiht(xi)Z_t=\sum_iD_t(i)e^{-\alpha_ty_ih_t(\mathbf x_i)}. Each round should therefore pick hth_t and αt\alpha_t to make ZtZ_t small. Let hth_t take values in [−1,1][-1,1]: the sign is the prediction, the magnitude a confidence.

DerivationThe step size for a hypothesis with values in [−1, 1]
  1. e−αu≤1+u2e−α+1−u2eαe^{-\alpha u}\le\frac{1+u}2e^{-\alpha}+\frac{1-u}2e^{\alpha}

    Let rt=∑iDt(i) yiht(xi)r_t=\sum_iD_t(i)\,y_ih_t(\mathbf x_i), the edge under DtD_t. For u∈[−1,1]u\in[-1,1], the convex function u↦e−αuu\mapsto e^{-\alpha u} lies below its chord between u=−1u=-1 and u=+1u=+1:

  2. Zt≤1+rt2e−α+1−rt2eαZ_t\le\frac{1+r_t}2e^{-\alpha}+\frac{1-r_t}2e^{\alpha}

    Put u=yiht(xi)u=y_ih_t(\mathbf x_i) and average under DtD_t:

  3. αt=12ln⁡1+rt1−rt⟹Zt≤1−rt2≤e−rt2/2\alpha_t=\frac12\ln\frac{1+r_t}{1-r_t}\quad\Longrightarrow\quad Z_t\le\sqrt{1-r_t^2}\le e^{-r_t^2/2}

    Minimize the right side over α\alpha:

  4. For ±1\pm1-valued hth_t the chord bound is an equality and rt=1−2εt=2γtr_t=1-2\varepsilon_t=2\gamma_t, which recovers AdaBoost: αt=12ln⁡1−εtεt\alpha_t=\tfrac12\ln\frac{1-\varepsilon_t}{\varepsilon_t} and Zt=1−4γt2=2εt(1−εt)Z_t=\sqrt{1-4\gamma_t^2}=2\sqrt{\varepsilon_t(1-\varepsilon_t)}.

Partitions. When hth_t is constant on the blocks X1,…,XJ\mathcal X_1,\dots,\mathcal X_J of a partition, such as the leaves of a tree, absorb αt\alpha_t into a score cjc_j per block. With W±jW^j_\pm the total weight of examples in block jj with label ±1\pm1, Zt=∑j(W+je−cj+W−jecj)Z_t=\sum_j\big(W^j_+e^{-c_j}+W^j_-e^{c_j}\big) separates, and each block is minimized on its own:

cj=12ln⁡W+jW−j,Zt=2∑j=1JW+jW−jc_j=\frac12\ln\frac{W^j_+}{W^j_-},\qquad Z_t=2\sum_{j=1}^J\sqrt{W^j_+W^j_-}
Schapire & Singer's domain-partitioning rule, the basis of "Real AdaBoost". The best partition minimizes ∑jW+jW−j\sum_j\sqrt{W^j_+W^j_-}, a split criterion in its own right; in practice a small constant is added to each W±jW^j_\pm so that pure leaves do not get infinite scores. Gradient boosting's per-leaf Newton steps are a close cousin (Gradient Boosting as Functional Gradient Descent).
Predict before you look

A stump splits the weighted sample into two blocks. Block 1 holds positives of total weight 0.40 and negatives of weight 0.10; block 2 holds positives of weight 0.05 and negatives of weight 0.45. With the optimal confidence-rated scores, what is ZtZ_t?

Show the answer

0.7

Zt=2(0.40⋅0.10+0.05⋅0.45)=2(0.20+0.15)=0.70Z_t=2\big(\sqrt{0.40\cdot0.10}+\sqrt{0.05\cdot0.45}\big)=2(0.20+0.15)=0.70. The plain ±1\pm1 stump on the same split errs on weight 0.10+0.05=0.150.10+0.05=0.15, so Zt=20.15⋅0.85≈0.714Z_t=2\sqrt{0.15\cdot0.85}\approx0.714. Confidence ratings shrink the bound a little more per round: block 2 is purer than block 1, and its score 12ln⁡(0.05/0.45)≈−1.10\tfrac12\ln(0.05/0.45)\approx-1.10 is larger in magnitude than block 1's 12ln⁡4≈0.69\tfrac12\ln4\approx0.69.

Weak learning is a margin condition

Fix the sample and a finite base class H\mathcal H closed under negation (h∈H⇒−h∈Hh\in\mathcal H\Rightarrow-h\in\mathcal H); on nn points, stumps realize only finitely many labelings, so finiteness costs nothing. Form the matrix Mih=yih(xi)∈{−1,+1}M_{ih}=y_ih(\mathbf x_i)\in\{-1,+1\} and read it as a zero-sum game, the view developed by Breiman (1999) and by Freund and Schapire. The data player picks a distribution DD over examples. The hypothesis player picks a distribution λ\boldsymbol\lambda over H\mathcal H, that is, a vote fλ=∑hλhhf_{\boldsymbol\lambda}=\sum_h\lambda_hh. The hypothesis player's payoff is D⊤Mλ=∑iD(i) yifλ(xi)D^\top M\boldsymbol\lambda=\sum_iD(i)\,y_if_{\boldsymbol\lambda}(\mathbf x_i).

DerivationProof
  1. ∑iD(i) yih(xi)=(1−εD(h))−εD(h)=1−2εD(h)\sum_iD(i)\,y_ih(\mathbf x_i)=\big(1-\varepsilon_D(h)\big)-\varepsilon_D(h)=1-2\varepsilon_D(h)

    For a ±1\pm1-valued hh, the edge and the weighted error are tied, so "error at most 12−γ\tfrac12-\gamma" means "edge at least 2γ2\gamma":

  2. max⁡hD⊤Meh=max⁡λD⊤Mλ,min⁡iyifλ(xi)=min⁡i (Mλ)i=min⁡DD⊤Mλ\max_hD^\top M\mathbf e_h=\max_{\boldsymbol\lambda}D^\top M\boldsymbol\lambda,\qquad\min_iy_if_{\boldsymbol\lambda}(\mathbf x_i)=\min_i\,(M\boldsymbol\lambda)_i=\min_DD^\top M\boldsymbol\lambda

    The payoff is linear in each player's distribution, and a linear function on a simplex is extremal at a vertex. So best responses can be pure on both sides:

  3. min⁡Dmax⁡λD⊤Mλ=max⁡λmin⁡DD⊤Mλ\min_D\max_{\boldsymbol\lambda}D^\top M\boldsymbol\lambda=\max_{\boldsymbol\lambda}\min_DD^\top M\boldsymbol\lambda

    Von Neumann's minimax theorem for finite zero-sum games lets the players move in either order. Chaining the three displays proves the identity, and the first step translates it into errors:

Three consequences:

  • The assumption can fail for visible reasons. If two training examples share an input but have opposite labels, the distribution putting weight 12\tfrac12 on each makes every hypothesis a coin flip, so ρ∗≤0\rho^*\le0. In general, weak learning holds on a sample exactly when some vote of base hypotheses separates it with positive margin.
  • AdaBoost is a dynamic in this game. Freund & Schapire (1997) derived AdaBoost from Hedge, a multiplicative-weights algorithm for online allocation (Online Learning & Regret): the data player updates its weights multiplicatively and the weak learner best-responds. If the weak learner returns the best hypothesis each round, every edge satisfies rt≥ρ∗r_t\ge\rho^*, so the training error vanishes whenever ρ∗>0\rho^*>0.
  • Margins enter. AdaBoost is guaranteed a minimum margin of roughly ρ∗/2\rho^*/2 when ρ∗\rho^* is small, and it need not reach ρ∗\rho^* (Rudin, Daubechies & Schapire, 2004). Why margins matter for test error is the subject of Why Boosting Resists Overfitting.
Check your understanding

At round 40, under the current weights, the best stump has weighted error exactly 12\tfrac12. What does the minimax theorem tell you about the training sample?

  1. AdaBoost has converged to the maximum-margin vote
  2. No weighted vote of stumps classifies every training example with a positive margin
  3. The vote αt\alpha_t was too large in earlier rounds
  4. The stumps have started to overfit
Show the answer

B. No weighted vote of stumps classifies every training example with a positive margin

Some distribution, the current D40D_{40}, gives every stump edge 00, so min⁡Dmax⁡h(edge)≤0\min_D\max_h(\text{edge})\le0 and therefore ρ∗≤0\rho^*\le0: no vote separates the sample with positive margin, and AdaBoost with stumps cannot reach zero training error on it.

AdaBoost is coordinate descent on the exponential loss

Let H={h1,…,hN}\mathcal H=\{h_1,\dots,h_N\} be finite and write any vote as Fλ=∑jλjhjF_{\boldsymbol\lambda}=\sum_j\lambda_jh_j with λ∈RN\boldsymbol\lambda\in\R^N. The empirical exponential loss L(λ)=1n∑ie−yiFλ(xi)L(\boldsymbol\lambda)=\frac1n\sum_ie^{-y_iF_{\boldsymbol\lambda}(\mathbf x_i)} is convex in λ\boldsymbol\lambda, and AdaBoost minimizes it one coordinate at a time (Breiman, 1999; Mason, Baxter, Bartlett & Frean, 2000; Friedman, Hastie & Tibshirani, 2000).

DerivationEach AdaBoost round is a coordinate-descent step
  1. ∂L∂λj=−1n∑iyihj(xi)e−yiFλ(xi)=−L(λ)∑iD(i) yihj(xi)=−L(λ)(1−2εD(hj))\frac{\partial L}{\partial\lambda_j}=-\frac1n\sum_iy_ih_j(\mathbf x_i)e^{-y_iF_{\boldsymbol\lambda}(\mathbf x_i)}=-L(\boldsymbol\lambda)\sum_iD(i)\,y_ih_j(\mathbf x_i)=-L(\boldsymbol\lambda)\big(1-2\varepsilon_D(h_j)\big)

    Differentiate along coordinate jj. The factor that appears is AdaBoost's current distribution, D(i)∝e−yiFλ(xi)D(i)\propto e^{-y_iF_{\boldsymbol\lambda}(\mathbf x_i)}:

  2. L(λ+αej)=L(λ)[(1−ε)e−α+εeα]⟹α=12ln⁡1−εεL(\boldsymbol\lambda+\alpha\mathbf e_j)=L(\boldsymbol\lambda)\big[(1-\varepsilon)e^{-\alpha}+\varepsilon e^{\alpha}\big]\quad\Longrightarrow\quad\alpha=\frac12\ln\frac{1-\varepsilon}{\varepsilon}

    So the steepest coordinate is the base hypothesis with the smallest weighted error, which is what the weak learner returns. Exact line search along it gives AdaBoost's vote:

  3. L(λT)=∏t=1TZt ≥ 1n∑i=1n1[yiFλT(xi)≤0]L(\boldsymbol\lambda_T)=\prod_{t=1}^TZ_t\ \ge\ \frac1n\sum_{i=1}^n\mathbf 1\big[y_iF_{\boldsymbol\lambda_T}(\mathbf x_i)\le0\big]

    Each round multiplies the loss by Zt=2εt(1−εt)Z_t=2\sqrt{\varepsilon_t(1-\varepsilon_t)}, and L(0)=1L(\mathbf 0)=1. The training-error bound of the Descent lesson is the exponential loss itself:

The greedy view explains AdaBoost's long-run behavior. Greedy procedures of this kind drive the loss to its infimum over the span of H\mathcal H (Zhang & Yu, 2005 analyze boosting in this generality). If some vote separates the sample (ρ∗>0\rho^*>0), that infimum is 00 and is never attained: ∥λt∥1→∞\norm{\boldsymbol\lambda_t}_1\to\infty, and only the direction λt/∥λt∥1\boldsymbol\lambda_t/\norm{\boldsymbol\lambda_t}_1 matters for the classifier, just as for logistic regression on separable data (The Implicit Bias of Gradient Descent). Statistically, the exponential loss and the binomial deviance share the population minimizer F∗=12ln⁡p1−pF^*=\tfrac12\ln\frac p{1-p}, whose sign is the Bayes classifier: both are classification-calibrated, so driving their risk to its minimum drives the 0–1 risk to the Bayes error (Soft Margins & Surrogate Losses).

AlgorithmLossEach round adds
Discrete AdaBoostexponential e−yFe^{-yF}a ±1\pm1 classifier with exact line search: one coordinate step
Real AdaBoostexponentialthe real-valued score 12ln⁡pw(x)1−pw(x)\tfrac12\ln\frac{p_w(\mathbf x)}{1-p_w(\mathbf x)}, from class probabilities pwp_w estimated on the weighted data
Gentle AdaBoostexponentiala Newton step: a weighted least-squares fit of yy, with weights e−yFe^{-yF}
LogitBoostbinomial deviance ln⁡(1+e−2yF)\ln(1+e^{-2yF})a Newton step on the log-likelihood: weighted least squares on z=y∗−pp(1−p)z=\frac{y^*-p}{p(1-p)} with weights p(1−p)p(1-p), where y∗=1+y2y^*=\frac{1+y}2; then F←F+12fF\leftarrow F+\tfrac12f
All four are in Friedman, Hastie & Tibshirani (2000). A Newton step fits the base learner by weighted least squares, the device behind XGBoost's second-order objective (XGBoost, LightGBM & CatBoost).

Key takeaways

  • Weak and strong PAC learnability are equivalent (Schapire 1990). AdaBoost with a γ\gamma-weak learner is consistent with mm examples after O(log⁡m/γ2)\order{\log m/\gamma^2} rounds, and a VC bound for votes turns that into error O~(d/(γ2m))\tilde O\big(d/(\gamma^2m)\big).
  • For any real-valued base hypotheses, the training error is at most ∏tZt\prod_tZ_t. With edge rtr_t, the step αt=12ln⁡1+rt1−rt\alpha_t=\tfrac12\ln\frac{1+r_t}{1-r_t} gives Zt≤1−rt2Z_t\le\sqrt{1-r_t^2}; on a partition, the optimal scores are 12ln⁡(W+j/W−j)\tfrac12\ln(W_+^j/W_-^j).
  • By the minimax theorem, weak learnability with edge γ\gamma on a sample is equivalent to separability by a convex combination of base hypotheses with margin 2γ2\gamma.
  • AdaBoost is coordinate descent with exact line search on the exponential loss, L(λT)=∏tZtL(\boldsymbol\lambda_T)=\prod_tZ_t; Real AdaBoost, Gentle AdaBoost and LogitBoost replace its step by real-valued or Newton steps.
  • AdaBoost stopped after n1−ϵn^{1-\epsilon} rounds is consistent (Bartlett & Traskin 2007), yet every convex-potential booster can be defeated by random label noise (Long & Servedio 2010).

Check yourself

In the interactive lesson these are scored with your confidence, and what you miss comes back for review.

Question 1

Why must a weak learner beat chance under every distribution over the examples, rather than just the uniform one?

  1. Because PAC learning requires polynomial running time
  2. Because otherwise the VC dimension of the vote would be infinite
  3. Because the uniform distribution is never used by AdaBoost
  4. Because boosting hands it reweighted distributions concentrated on hard examples, and without a guarantee there the edges γt\gamma_t can vanish
Show the answer

D. Because boosting hands it reweighted distributions concentrated on hard examples, and without a guarantee there the edges γt\gamma_t can vanish

The training-error bound exp⁡(−2∑tγt2)\exp(-2\sum_t\gamma_t^2) is only as good as the edges on the distributions DtD_t that boosting actually creates, and those are built to be hard: Dt+1D_{t+1} makes hth_t a coin flip.

Question 2

A real-valued weak hypothesis with values in [−1,1][-1,1] has edge rt=0.6r_t=0.6 under DtD_t. Which step αt\alpha_t minimizes the bound on ZtZ_t, and what is the bound?

  1. αt=0.6\alpha_t=0.6, and Zt≤0.4Z_t\le0.4
  2. αt=ln⁡4\alpha_t=\ln4, and Zt≤0.64Z_t\le0.64
  3. αt=12ln⁡4≈0.69\alpha_t=\tfrac12\ln4\approx0.69, and Zt≤0.8Z_t\le0.8
  4. αt=12ln⁡1.5≈0.20\alpha_t=\tfrac12\ln1.5\approx0.20, and Zt≤0.98Z_t\le0.98
Show the answer

C. αt=12ln⁡4≈0.69\alpha_t=\tfrac12\ln4\approx0.69, and Zt≤0.8Z_t\le0.8

αt=12ln⁡1+0.61−0.6=12ln⁡4\alpha_t=\tfrac12\ln\frac{1+0.6}{1-0.6}=\tfrac12\ln4 and Zt≤1−0.36=0.8Z_t\le\sqrt{1-0.36}=0.8. For a ±1\pm1 classifier, edge 0.60.6 means weighted error 0.20.2, and the same numbers come out of AdaBoost's formulas.

Question 3

At a point x\mathbf x, AdaBoost's score is F(x)=1.1F(\mathbf x)=1.1. If FF were the population minimizer of the exponential loss, what would P(y=+1∣x)P(y=+1\mid\mathbf x) be?

  1. About 0.75
  2. About 0.90
  3. About 0.63
  4. About 0.99
Show the answer

B. About 0.90

F∗=12ln⁡p1−pF^*=\tfrac12\ln\frac p{1-p} inverts to p=1/(1+e−2F)=1/(1+e−2.2)≈0.90p=1/(1+e^{-2F})=1/(1+e^{-2.2})\approx0.90.

Question 4

On a fixed training sample, every distribution over the examples admits a base hypothesis with weighted error at most 12−γ\tfrac12-\gamma. This is equivalent to which statement?

  1. Some convex combination of base hypotheses has margin yif(xi)≥2γy_if(\mathbf x_i)\ge2\gamma on every training example
  2. Some single base hypothesis has error at most 12−γ\tfrac12-\gamma under the uniform distribution
  3. The sample is linearly separable in the original input space
  4. The base class has finite VC dimension
Show the answer

A. Some convex combination of base hypotheses has margin yif(xi)≥2γy_if(\mathbf x_i)\ge2\gamma on every training example

By von Neumann's minimax theorem, min⁡Dmax⁡h∑iD(i)yih(xi)=max⁡λmin⁡iyifλ(xi)\min_D\max_h\sum_iD(i)y_ih(\mathbf x_i)=\max_{\boldsymbol\lambda}\min_iy_if_{\boldsymbol\lambda}(\mathbf x_i). The left side is at least 2γ2\gamma exactly when every distribution has a hypothesis with edge 2γ2\gamma, that is, error at most 12−γ\tfrac12-\gamma.

Question 5

Bartlett & Traskin (2007) proved that AdaBoost is consistent, meaning its risk converges to the Bayes risk. Under which stopping rule?

  1. Run until the training error reaches zero
  2. Stop when the weighted error εt\varepsilon_t first exceeds 0.45
  3. Stop after about n1−ϵn^{1-\epsilon} rounds, for some ϵ∈(0,1)\epsilon\in(0,1)
  4. Never stop: AdaBoost run to convergence is always consistent
Show the answer

C. Stop after about n1−ϵn^{1-\epsilon} rounds, for some ϵ∈(0,1)\epsilon\in(0,1)

The number of rounds acts as a regularization parameter, and it must grow with nn, but not too fast. With noisy labels, running indefinitely lets the vote fit the noise.

Further reading

  • R. E. Schapire, "The strength of weak learnability," Machine Learning 5(2), 197–227 (1990).
  • R. E. Schapire & Y. Singer, "Improved boosting algorithms using confidence-rated predictions," Machine Learning 37(3), 297–336 (1999).
  • J. Friedman, T. Hastie & R. Tibshirani, "Additive logistic regression: a statistical view of boosting," Annals of Statistics 28(2), 337–407 (2000).
  • P. L. Bartlett & M. Traskin, "AdaBoost is consistent," Journal of Machine Learning Research 8, 2347–2368 (2007).
  • R. E. Schapire & Y. Freund, Boosting: Foundations and Algorithms (MIT Press, 2012).