We discuss a toy model of probably approximately correct (PAC) learning [1].
The setting focuses on a d-dimension Boolean hypercube {0,1}d and a set of functions H={h:{0,1}d→{0,1}}.
A function h∈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∗∈H, from a dataset, which consists of n points X1,X2,…,Xn∈{0,1}n sampled independently from an unknown distribution D (over the hypercube), as well as their labels Y1=h∗(X1),Y2=h∗(X2),…,Yn=h∗(Xn).
We can state the algorithm for PAC learning in just one sentence.
Output any hypothesis h′∈H that is consistent with the sampled dataset, i.e.,
h′(Xi)=Yi,∀i∈[n]
Such an hypothesis always exists, as h∗ satisfies this constraint.
We have the classic PAC learning theorem.
Theorem. Let X∈{0,1}n be a random point sampled from the unknown distribution, then for a given δ∈(0,1),
Pr[h′(X)=h∗(X)]≥2nlog∣H∣+logδ1
with probability at most δ.
The PAC learning theorem states that the probability that h′ mislabels a point is bounded by 2nlog∣H∣+log(1/δ).
Proof. Consider some fixed h∈H. For convenience, we rewrite
Pr[h(X)=h∗(X)]=μh.
Denote Zi the indicator variable of whether h mislabels Xi, i.e.,
Zi={0, if h(Xi)=Yi1, if h(Xi)=Yi
By definition, E[Zi] is an unbiased estimator of μh. Further, denote μ^h the empirical mean of Zi's
μ^h≐n1i∈[n]∑Zi.
Note that for the outputted h′, μ^h′=0.
By Hoeffding inequality, for any δ′>0,
Pr[μ^h≤μh−2nlog(1/δ′)]≤δ′.
By union bound, the probability that
∃h∈H,μ^h≥μh−2nlog(1/δ′)
is bounded by ∣H∣δ′. By setting δ′=∣H∣δ, it is guaranteed that with probability at most δ,
0=μ^h′≤μh′−2nlog∣H∣+log(1/δ).
■
The previous theorem can be improved with the ⋅ removed. The key here is that the selected h′ is error-free on the samples.
Theorem. Let X∈{0,1}n be a random point sampled from the unknown distribution, then for a given δ∈(0,1),
Pr[h′(X)=h∗(X)]≥nlog∣H∣+logδ1
with probability at most δ.
Proof. Consider some fixed h∈H. For convenience, we rewrite
Pr[h(X)=h∗(X)]=μh.
We will prove that if μh≥nlog∣H∣+logδ1, then h's probability of being selected is very low.
Denote Zi the indicator variable of whether h mislabels Xi, i.e.,
Taking union bound over all possible h gives the desired result.
■
Caveat.In both theorem, we see a logH 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′, Z1,…,Zn are i.i.d samples. Therefore, the probability of all of them being 0 is give by
(1−μh′)n≤exp(−μh′n).
Bounding this probability by δ gives μh′≤nlog(1/δ).
The argument is wrong. For the outputted h′, the Z1,…,Zn are not i.i.d samples, as h′ is selected according to Z1,…,Zn and depends on them.
To make it more concrete, suppose that there is an h, such that μh=nlog(1/δ). Consider the following experiment
Sample n points independently the distribution D.
Pick an h′ that makes no prediction error on the samples.
If we repeat the experiment N times for some positive integer N, then the fixed h makes no mistake in roughly (1−δ)N of the experiments and constitutes an candidate of h′. However, on the other roughly δN experiments, where h makes prediction error, it is no longer considered as the candidate of h′. The selection procedure of h′ ignores bad event of h automatically.
We could also investigate the following example. Let h∗=h0. There are also other two hypothesis h1 and h2. Let S be the sample space. It holds that
Moreover, Pr[Sh1]=Pr[Sh2]=δ. How, if we get a sample in Sh1, then we can output h′ as h0 or h1, since both of them make no error when x∈Sh1. Similarly, if x∈Sh2, we can output either h0 or h2. We call Sh1 and Sh2 the bad areas. When x 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