Salta al contenuto
Note per Studenti PAC Learning and Hoeffding's Inequality Report

PAC Learning and Hoeffding's Inequality

In questa pagina 4

Source note. The word "PAC" appears in the course source only in the Moodle chapter pointers (Understanding Machine Learning, PAC learning and Hoeffding); the handwritten lecture shows one result, the finite-hypothesis bound, with the probability tools needed to obtain it. This note contains exactly that, and nothing of the general PAC definition.

Context: The Statistical Learning Framework and Empirical Risk MinimizationA hypothesis is judged by an error function computed pointwise on the data and averaged: the in-sample (empirical) error E_in(h) = (1/N) sum of e(f(x_i), h(x_i)); with squared differences it is the sum of squared errors. The learning algorithms of the course all search the hypothesis set for the h with small in-sample error, but what matters is the error on new inputs drawn from the same input distribution, so the data must cover the regions where the inputs live, and part of the data must be held back to check the result.The Statistical Learning Framework and Empirical Risk Minimization → defines the in-sample error EinE_{\text{in}}; here we ask when it can be trusted as an estimate of the error on all inputs, EoutE_{\text{out}}.

1. The result

The page opens with the claim (with a question mark: it is the goal of the derivation) that, for a hypothesis set with MM hypotheses and NN samples,

P( ∣Ein(g)−Eout(g)∣>ε )  ≤  2M e−2ε2N.P\big(\,|E_{\text{in}}(g)-E_{\text{out}}(g)|>\varepsilon\,\big)\;\le\;2M\,e^{-2\varepsilon^{2}N}.

Reading of the symbols: gg is the hypothesis returned by the learning algorithm, Ein(g)E_{\text{in}}(g) its error on the NN samples, Eout(g)E_{\text{out}}(g) its error over the whole input distribution, ε>0\varepsilon>0 the tolerated gap. The handwriting of the first error term is ambiguous (subscript "in" or "N"); it is read as EinE_{\text{in}}, the only reading consistent with the rest of the notes.

2. Probability tools used

Events. The sample space is Ω\Omega. A simple event eie_i is a single outcome; a compound event EiE_i is a set of outcomes. For two simple events (they cannot happen together)

P(e1∪e2)=P(e1)+P(e2).P(e_1\cup e_2)=P(e_1)+P(e_2).

For two compound events, which can share outcomes (the hatched overlap in the drawing),

P(E1∪E2)=P(E1)+P(E2)−P(E1∩E2)  ≤  P(E1)+P(E2).P(E_1\cup E_2)=P(E_1)+P(E_2)-P(E_1\cap E_2)\;\le\;P(E_1)+P(E_2).

The last inequality holds because P(E1∩E2)≥0P(E_1\cap E_2)\ge0. Extended to many events this is the union bound:

P(E1∪E2∪⋯∪EM)  ≤  P(E1)+P(E2)+⋯+P(EM).P(E_1\cup E_2\cup\dots\cup E_M)\;\le\;P(E_1)+P(E_2)+\dots+P(E_M).

The union bound is an equality when the events are disjoint (the first sketch of Ω\Omega with four separate regions E1,…,E4E_1,\dots,E_4), and it overestimates the probability when the events overlap strongly (the second sketch, with four heavily overlapping regions).

Hoeffding's inequality (one hypothesis). The notes picture four "bins" e1,…,e4e_1,\dots,e_4 filled with green and red marbles, one for each hypothesis. For a single bin let μ\mu be the true fraction of one colour and ν\nu the fraction observed in a sample of NN marbles. Then, for every ε>0\varepsilon>0,

P(∣ν−μ∣>ε)≤2e−2ε2N.P\big(|\nu-\mu|>\varepsilon\big)\le 2e^{-2\varepsilon^{2}N}.

Translated to learning: a fixed hypothesis hh plays the role of a bin, "marble of the bad colour" means "hh errs on this input", ν\nu is Ein(h)E_{\text{in}}(h) measured on the samples and μ\mu is Eout(h)E_{\text{out}}(h). (This identification is my reading of the sketch: the page writes the two symbols next to the bins and then the error bound.) The inequality is stated, not proved, in the notes; it belongs to the family of tail bounds of Markov and Chebyshev InequalitiesFor a nonnegative random variable P(X >= a) is at most E(X)/a (Markov), and for any random variable with finite mean and variance P(|X - E(X)| >= eps) is at most var(X)/eps^2 (Chebyshev); both bounds are loose but universal, valid whatever the distribution.Markov and Chebyshev Inequalities →.

3. From one hypothesis to MM hypotheses

The algorithm chooses gg after looking at the data, so gg may be any of the MM hypotheses and the bound for a single fixed hh is not enough. Let EmE_m be the "bad" event

Em={ ∣Ein(hm)−Eout(hm)∣>ε },m=1,…,M.E_m=\big\{\,|E_{\text{in}}(h_m)-E_{\text{out}}(h_m)|>\varepsilon\,\big\},\qquad m=1,\dots,M .

If the gap for gg exceeds ε\varepsilon, then at least one of E1,…,EME_1,\dots,E_M has happened, so by the union bound

P(gap of g>ε)≤P(E1∪⋯∪EM)≤∑m=1MP(Em)≤M⋅2e−2ε2N=2M e−2ε2N.P(\text{gap of }g>\varepsilon)\le P(E_1\cup\dots\cup E_M)\le\sum_{m=1}^{M}P(E_m)\le M\cdot 2e^{-2\varepsilon^{2}N}=2M\,e^{-2\varepsilon^{2}N}.

In the handwritten page the final expression is rewritten from 2e−2ε2N2e^{-2\varepsilon^2N} to 2 M e−2ε2N2\,M\,e^{-2\varepsilon^2N}, circling the factors "2" and "M". The sketch of two lines h1,h2h_1,h_2 with the thin wedge between them shows why the bound is loose: two similar hypotheses make their bad events almost the same event, so counting both (the factor MM) is pessimistic.

4. What the formula says

Read directly from the bound (these remarks are mine, not on the page):

  • the probability of a large gap shrinks exponentially in NN: more samples make EinE_{\text{in}} a reliable estimate;
  • it grows only linearly in MM: a bigger hypothesis set weakens the guarantee slowly;
  • to have the right-hand side equal to a chosen δ\delta one needs N≥12ε2ln⁡2MδN\ge \dfrac{1}{2\varepsilon^{2}}\ln\dfrac{2M}{\delta} (solve 2Me−2ε2N=δ2Me^{-2\varepsilon^2N}=\delta for NN).

The bound applies to a finite hypothesis set. The hypothesis sets of the later notes (all lines wTxw^Tx, all parabolas) are infinite; for them the notes do not give a bound, and the practical tool becomes the test-set estimate of Model Selection and Validation - Hold-Out, k-Fold and Statistical TestsTo decide which of two models is better, fix their hyper-parameters, train each on a training set (this fits the parameters, the vector w or theta) and measure a performance score such as F1 on a separate test set; one split is too fragile, so the hold-out is repeated K times (or K-fold cross-validation is used) and the paired scores of the two models are compared with a statistical test. The null hypothesis H0 is that the two models perform equally; the significance level alpha is fixed before the experiment, and the p-value is the probability of observing the obtained differences under H0. Parametric test: t-test; non-parametric: Wilcoxon.Model Selection and Validation - Hold-Out, k-Fold and Statistical Tests →.

Versione ripasso

Teoria collegata