A learning algorithm sees a finite sample but is judged on new examples. Let S contain N independent examples from one fixed distribution D, and let the loss lie in [0,1]. Population risk R(h) is expected loss under D; empirical risk is the average loss on S. This distinction matters because selecting a model using its training error makes that error an optimistic estimate.
Realizable and agnostic learning
In realizable binary classification, assume some hypothesis in H labels the population without error. PAC learning asks for an algorithm that, with probability at least 1 − δ over the training sample, returns a hypothesis with population error at most ε. The guarantee must hold for every allowed distribution and target. Sample complexity specifies how many examples suffice. Computational efficiency is an additional requirement; a statistical guarantee alone does not supply an efficient algorithm.
In the agnostic case, perfect prediction need not exist. The target becomes risk at most ε above the infimum risk within H. Neither definition is simply a bound on the difference between training and population error: that difference is a generalization gap, which can help prove a learning guarantee.
Deriving a finite-class bound
For a fixed hypothesis and bounded independent losses, Hoeffding's inequality bounds the probability of an absolute gap larger than a by 2 exp(−2Na²). Taking a union bound over a finite, pre-specified H gives a simultaneous statement for every hypothesis, including one selected using S. Solving 2|H| exp(−2Na²) ≤ δ yields N ≥ log(2|H|/δ)/(2a²).
If an empirical risk minimizer has empirical risk no larger than any comparator, apply the gap bound twice: once to the selected hypothesis, once to the best comparator. Its excess population risk is then at most 2a. Set a = ε/2 to obtain an agnostic excess-risk guarantee. Do not relabel the gap tolerance a as excess error ε without this factor.
For a consistent learner in the realizable finite-class case, a different argument is sharper. A hypothesis with error greater than ε survives N independent examples with probability at most (1−ε)^N ≤ exp(−Nε). A union bound gives N ≥ log(|H|/δ)/ε. This is a sufficient bound under those assumptions, not the minimum dataset size for every real task.
Worked comparison
For |H| = 100, δ = 0.05, and a gap tolerance of 0.1, the two-sided Hoeffding bound needs 415 samples after rounding upward. To guarantee agnostic excess error 0.1 by this argument, use gap tolerance 0.05 and obtain 1,659. For realizable consistent classification with error tolerance 0.1, the other bound gives 77. Different answers reflect different assumptions and guarantees, not contradictory arithmetic.
The i.i.d. assumption fails when duplicates cross the split, patients occur in both sets, or future information leaks backward. A larger row count does not repair those failures. Define the deployment unit and split by that unit before invoking a statistical bound.