We discuss a toy model of probably approximately correct (PAC) learning [1]. The setting focuses on a dd-dimension Boolean hypercube {0,1}d\{0, 1\}^d and a set of functions H={h:{0,1}d→{0,1}}\mathcal{H} = \{ h : \{0, 1\}^d \rightarrow \{0, 1 \} \}. A function h∈Hh \in \mathcal{H} is called a hypothesis or a concept, which assigns each vertex in the hypercube a label 0 or 1.

The goal of PAC learning is to learn an unknown hypothesis, denoted as h∗∈Hh^* \in \mathcal{H}, from a dataset, which consists of nn points X1,X2,…,Xn∈{0,1}nX_1, X_2, \ldots, X_n \in \{0, 1\}^n sampled independently from an unknown distribution DD (over the hypercube), as well as their labels Y1=h∗(X1),Y2=h∗(X2),…,Yn=h∗(Xn)Y_1 = h^*(X_1), Y_2 = h^*(X_2), \ldots, Y_n = h^*(X_n).

We can state the algorithm for PAC learning in just one sentence.

Output any hypothesis h′∈Hh' \in \mathcal{H} that is consistent with the sampled dataset, i.e.,

h′(Xi)=Yi,∀i∈[n] h'(X_i) = Y_i, \qquad \forall i \in [n]

Such an hypothesis always exists, as h∗h^* satisfies this constraint. We have the classic PAC learning theorem.

Theorem. Let X∈{0,1}nX \in \{0, 1\}^n be a random point sampled from the unknown distribution, then for a given δ∈(0,1)\delta \in (0, 1),

Pr⁡[h′(X)≠h∗(X)]≥log⁡∣H∣+log⁡1δ2n \Pr[ h'(X) \neq h^*(X)] \ge \sqrt{ \log |\mathcal{H}| + \log \frac{ 1 }{ \delta } \over 2n}

with probability at most δ\delta.

The PAC learning theorem states that the probability that h′h' mislabels a point is bounded by log⁡∣H∣+log⁡(1/δ)2n\sqrt{ \log |\mathcal{H}| + \log ( 1 / \delta ) \over 2n}.

Proof. Consider some fixed h∈Hh \in \mathcal{H}. For convenience, we rewrite

Pr⁡[h(X)≠h∗(X)]=μh. \Pr[ h(X) \neq h^*(X)] = \mu_h.

Denote ZiZ_i the indicator variable of whether hh mislabels XiX_i, i.e.,

Zi={0, if h(Xi)=Yi1, if h(Xi)≠Yi Z_i = \begin{cases} 0, \qquad \text{ if } h(X_i) = Y_i \\ 1, \qquad \text{ if } h(X_i) \neq Y_i \end{cases}

By definition, E[Zi]\mathbb{E}[Z_i] is an unbiased estimator of μh\mu_h. Further, denote μ^h\hat \mu_h the empirical mean of ZiZ_i's

μ^h≐1n∑i∈[n]Zi. \hat \mu_h \doteq \frac{1}{n} \sum_{i \in [n] } Z_i.

Note that for the outputted h′h', μ^h′=0\hat \mu_{h'} = 0.

By Hoeffding inequality, for any δ′>0\delta' > 0,

Pr⁡[μ^h≤μh−log⁡(1/δ′)2n]≤δ′. \Pr \left[ \hat \mu_h \le \mu_h - \sqrt{ \frac{ \log ( 1 / \delta') }{2n} } \right] \le \delta'.

By union bound, the probability that

∃h∈H,μ^h≥μh−log⁡(1/δ′)2n \exists h \in \mathcal{H}, \hat \mu_h \ge \mu_h - \sqrt{ \frac{ \log ( 1 / \delta') }{2n} }

is bounded by ∣H∣δ′| \mathcal{H} | \delta'. By setting δ′=δ∣H∣\delta' = \frac{\delta}{ | \mathcal{H} | }, it is guaranteed that with probability at most δ\delta,

0=μ^h′≤μh′−log⁡∣H∣+log⁡(1/δ)2n. 0 = \hat \mu_{h' } \le \mu_{h'} - \sqrt{ \log |\mathcal{H}| + \log ( 1 / \delta) \over 2n}.

■\blacksquare

The previous theorem can be improved with the ⋅\sqrt{ \cdot } removed. The key here is that the selected h′h' is error-free on the samples.

Theorem. Let X∈{0,1}nX \in \{0, 1\}^n be a random point sampled from the unknown distribution, then for a given δ∈(0,1)\delta \in (0, 1),

Pr⁡[h′(X)≠h∗(X)]≥log⁡∣H∣+log⁡1δn \Pr[ h'(X) \neq h^*(X)] \ge { \log |\mathcal{H}| + \log \frac{ 1 }{ \delta } \over n}

with probability at most δ\delta.

Proof. Consider some fixed h∈Hh \in \mathcal{H}. For convenience, we rewrite

Pr⁡[h(X)≠h∗(X)]=μh. \Pr[ h(X) \neq h^*(X)] = \mu_h.

We will prove that if μh≥log⁡∣H∣+log⁡1δn\mu_h \ge { \log |\mathcal{H}| + \log \frac{ 1 }{ \delta } \over n}, then hh's probability of being selected is very low.

Denote ZiZ_i the indicator variable of whether hh mislabels XiX_i, i.e.,

Zi={0, if h(Xi)=Yi1, if h(Xi)≠Yi Z_i = \begin{cases} 0, \qquad \text{ if } h(X_i) = Y_i \\ 1, \qquad \text{ if } h(X_i) \neq Y_i \end{cases}

By definition, Pr⁡[Zi=1]=μh\Pr[Z_i = 1] = \mu_h. Therefore,

Pr⁡[Z1=0∧Z2=0∧…∧Zn=0]=(1−μh)n≤exp⁡(−μhn)=δ∣H∣ \begin{aligned} \Pr[ Z_1 = 0 \wedge Z_2 = 0 \wedge \ldots \wedge Z_n = 0] = (1 - \mu_h)^n \le \exp(- \mu_h n) = \frac{\delta}{ |\mathcal{H} | } \end{aligned}

Taking union bound over all possible hh gives the desired result.

■\blacksquare

Caveat. In both theorem, we see a log⁡H\log \mathcal{H} term in the failure probability, which is due to the use of union bound and can be roughly considered as the complexity of the hypothesis family. It is tempting to think that this could be avoid as follows.

For the outputted h′h', Z1,…,ZnZ_1, \ldots, Z_n are i.i.d samples. Therefore, the probability of all of them being 00 is give by

(1−μh′)n≤exp⁡(−μh′n). (1 - \mu_{h'} )^n \le \exp( - \mu_{h'} n).

Bounding this probability by δ\delta gives μh′≤log⁡(1/δ)n\mu_{h'} \le \frac{ \log ( 1 / \delta ) } {n}.

The argument is wrong. For the outputted h′h', the Z1,…,ZnZ_1, \ldots, Z_n are not i.i.d samples, as h′h' is selected according to Z1,…,ZnZ_1, \ldots, Z_n and depends on them.

To make it more concrete, suppose that there is an hh, such that μh=log⁡(1/δ)n\mu_h = \frac{ \log ( 1 / \delta ) } {n}. Consider the following experiment

  1. Sample nn points independently the distribution DD.
  2. Pick an h′h' that makes no prediction error on the samples.

If we repeat the experiment NN times for some positive integer NN, then the fixed hh makes no mistake in roughly (1−δ)N(1 - \delta) N of the experiments and constitutes an candidate of h′h'. However, on the other roughly δN\delta N experiments, where hh makes prediction error, it is no longer considered as the candidate of h′h'. The selection procedure of h′h' ignores bad event of hh automatically.

We could also investigate the following example. Let h∗=h0h^* = h_0. There are also other two hypothesis h1h_1 and h2h_2. Let SS be the sample space. It holds that

∣h1(x)−h∗(x)∣={2ϵ,∀x∈S∖Sh10,  ∀x∈Sh1 |h_1(x) - h^*(x) | = \begin{cases} 2 \epsilon, \forall x \in S \setminus S_{h_1} \\ 0,\ \ \forall x \in S_{h_1} \end{cases} ∣h2(x)−h∗(x)∣={2ϵ,∀x∈S∖Sh20,  ∀x∈Sh2 |h_2(x) - h^*(x) | = \begin{cases} 2 \epsilon, \forall x \in S \setminus S_{h_2} \\ 0,\ \ \forall x \in S_{h_2} \end{cases}

Moreover, Pr⁡[Sh1]=Pr⁡[Sh2]=δ\Pr[S_{h_1}] = \Pr[S_{h_2} ] = \delta. How, if we get a sample in Sh1S_{h_1}, then we can output h′h' as h0h_0 or h1h_1, since both of them make no error when x∈Sh1x \in S_{h_1}. Similarly, if x∈Sh2x \in S_{h_2}, we can output either h0h_0 or h2h_2. We call Sh1S_{h_1} and Sh2S_{h_2} the bad areas. When xx is in the bad area of any hypothesis, we can't distinguish this hypothesis from the true hypothesis. That is why we need to use union bound to bound the total probabilities of these bad areas.

Reference

[1] Leslie G. Valiant. A theory of the learnable. Communications of the ACM, 27(11):1134-1142, 1984. 6