foundations of computational agents
The third edition of Artificial Intelligence: foundations of computational agents, Cambridge University Press, 2023 is now available (including full text).
Rather than just studying different learning algorithms that happen to work well, computational learning theory investigates general principles that can be proved to hold for classes of learning algorithms.
Some relevant questions that we can ask about a theory of computational learning include the following:
Is the learner guaranteed to converge to the correct hypothesis as the number of examples increases?
How many examples are required to identify a concept?
How much computation is required to identify a concept?
In general, the answer to the first question is “no,” unless it can be guaranteed that the examples always eventually rule out all but the correct hypothesis. An adversary out to trick the learner could choose examples that do not help discriminate correct hypotheses from incorrect hypotheses. If an adversary cannot be ruled out, a learner cannot guarantee to find a consistent hypothesis. However, given randomly chosen examples, a learner that always chooses a consistent hypothesis can get arbitrarily close to the correct concept. This requires a notion of closeness and a specification of what is a randomly chosen example.
Consider a learning algorithm that chooses a hypothesis consistent with all of the training examples. Assume a probability distribution over possible examples and that the training examples and the test examples are chosen from the same distribution. The distribution does not have to be known. We will prove a result that holds for all distributions.
The error of hypothesis $h\in \mathscr{H}$ on instance space $I$, written $error(I,h)$, is defined to be the probability of choosing an element $i$ of $I$ such that $h(i)\ne Y(i)$, where $h(i)$ is the predicted value of target variable $Y$ on possible example $i$, and $Y(i)$ is the actual value of $Y$ on example $i$. That is,
$$error(I,h)=P(h(i)\ne Y(i)\mid i\in I).$$ |
An agent typically does not know $P$ or $Y(i)$ for all $i$ and, thus, does not actually know the error of a particular hypothesis.
Given $\u03f5>0$, hypothesis $h$ is approximately correct if $error(I,h)\le \u03f5$.
We make the following assumption.
The training and test examples are chosen independently from the same probability distribution as the population.
It is still possible that the examples do not distinguish hypotheses that are far away from the concept. It is just very unlikely that they do not. A learner that chooses a hypothesis consistent with the training examples is probably approximately correct if, for an arbitrary number $\delta $ ($$), the algorithm is not approximately correct in at most $\delta $ of the cases. That is, the hypothesis generated is approximately correct at least $1-\delta $ of the time.
Under the preceding assumption, for arbitrary $\u03f5$ and $\delta $, we can guarantee that an algorithm that returns a consistent hypothesis will find a hypothesis with error less than $\u03f5$, in at least $1-\delta $ of the cases. Moreover, this result does not depend on the probability distribution.
Given Assumption 7.3, if a hypothesis is consistent with at least
$$\frac{1}{\u03f5}\left(\mathrm{ln}\left|\mathscr{H}\right|+\mathrm{ln}\frac{1}{\delta}\right)$$ |
training examples, it has error at most $\u03f5$, at least $\mathrm{1}\mathrm{-}\delta $ of the time.
Suppose $\u03f5>0$ and $\delta >0$ are given. Partition the hypothesis space $\mathscr{H}$ into
${\mathscr{H}}_{0}=$ | $\mathrm{\{}h\in \mathscr{H}:error(I,h)\le \u03f5\}$ | ||
${\mathscr{H}}_{1}=$ | $\mathrm{\{}h\in \mathscr{H}:error(I,h)>\u03f5\}.$ |
We want to guarantee that the learner does not choose an element of ${\mathscr{H}}_{1}$ in more than $\delta $ of the cases.
Suppose $h\in {\mathscr{H}}_{1}$, then
$P(h\text{is wrong for a single example})\ge \u03f5$ | ||
$P(h\text{is correct for a single example})\le 1-\u03f5$ | ||
$P(h\text{is correct for}m\text{random examples})\le {(1-\u03f5)}^{m}.$ |
Therefore,
$P({\mathscr{H}}_{1}\text{contains a hypothesis that is correct for}m\text{random examples})$ | ||
$\mathrm{}\mathit{\hspace{1em}\hspace{1em}\u2006}\le \left|{\mathscr{H}}_{1}\right|{(1-\u03f5)}^{m}$ | ||
$\mathrm{}\mathit{\hspace{1em}\hspace{1em}\u2006}\le \left|\mathscr{H}\right|{(1-\u03f5)}^{m}$ | ||
$\mathrm{}\mathit{\hspace{1em}\hspace{1em}\u2006}\le \left|\mathscr{H}\right|{e}^{-\u03f5m}$ |
using the inequality $(1-\u03f5)\le {e}^{-\u03f5}$ if $0\le \u03f5\le 1$.
If we ensure that $\left|\mathscr{H}\right|{e}^{-\u03f5m}\le \delta $, we guarantee that ${\mathscr{H}}_{1}$ does not contain a hypothesis that is correct for $m$ examples in more than $\delta $ of the cases. So ${H}_{0}$ contains all of the correct hypotheses in all but $\delta $ of the cases.
Solving for $m$ gives
$$m\ge \frac{1}{\u03f5}\left(\mathrm{ln}\left|\mathscr{H}\right|+\mathrm{ln}\frac{1}{\delta}\right)$$ |
which proves the proposition. ∎
The number of examples required to guarantee this error bound is called the sample complexity. The number of examples required according to this proposition is a function of $\u03f5$, $\delta $, and the size of the hypothesis space.
Suppose the hypothesis space ${\mathrm{H}}$ is the set of conjunctions of literals on ${n}$ Boolean variables. In this case ${\mathrm{\left|}}{\mathrm{H}}{\mathrm{\right|}}{\mathrm{=}}{{\mathrm{3}}}^{{n}}{\mathrm{+}}{\mathrm{1}}$ because, for each conjunction, each variable is in one of three states: (1) it is unnegated in the conjunction, (2) it is negated, or (3) it does not appear; the “${\mathrm{+}}{\mathrm{1}}$” is needed to represent false, which is the conjunction of any atom and its negation. Thus, the sample complexity is $\frac{{\mathrm{1}}}{{\u03f5}}{\mathit{}}{\mathrm{\left(}}{n}{\mathit{}}{\mathrm{ln}}{\mathit{}}{\mathrm{3}}{\mathrm{+}}{\mathrm{ln}}{\mathit{}}\frac{{\mathrm{1}}}{{\delta}}{\mathrm{\right)}}$ examples, which is polynomial in ${n}$, $\frac{{\mathrm{1}}}{{\u03f5}}$, and ${\mathrm{ln}}{\mathit{}}\frac{{\mathrm{1}}}{{\delta}}$.
If we want to guarantee at most a ${\mathrm{5}}{\mathrm{\%}}$ error ${\mathrm{99}}{\mathrm{\%}}$ of the time and have ${\mathrm{30}}$ Boolean variables, then ${\u03f5}{\mathrm{=}}{\mathrm{1}}{\mathrm{/}}{\mathrm{20}}$, ${\delta}{\mathrm{=}}{\mathrm{1}}{\mathrm{/}}{\mathrm{100}}$, and ${n}{\mathrm{=}}{\mathrm{30}}$. The bound says that we can guarantee this performance if we find a hypothesis that is consistent with ${\mathrm{20}}{\mathrm{*}}{\mathrm{(}}{\mathrm{30}}{\mathit{}}{\mathrm{ln}}{\mathit{}}{\mathrm{3}}{\mathrm{+}}{\mathrm{ln}}{\mathit{}}{\mathrm{100}}{\mathrm{)}}{\mathrm{\approx}}{\mathrm{752}}$ examples. This is much fewer than the number of possible instances, which is ${{\mathrm{2}}}^{{\mathrm{30}}}{\mathrm{=}}{\mathrm{1}}{\mathrm{,}}{\mathrm{073}}{\mathrm{,}}{\mathrm{741}}{\mathrm{,}}{\mathrm{824}}$, and the number of hypotheses, which is ${{\mathrm{3}}}^{{\mathrm{30}}}{\mathrm{+}}{\mathrm{1}}{\mathrm{=}}{\mathrm{205}}{\mathrm{,}}{\mathrm{891}}{\mathrm{,}}{\mathrm{132}}{\mathrm{,}}{\mathrm{094}}{\mathrm{,}}{\mathrm{650}}$.
If the hypothesis space ${\mathrm{H}}$ is the set of all Boolean functions on ${n}$ variables, then ${\mathrm{\left|}}{\mathrm{H}}{\mathrm{\right|}}{\mathrm{=}}{{\mathrm{2}}}^{{{\mathrm{2}}}^{{n}}}$; thus, we require $\frac{{\mathrm{1}}}{{\u03f5}}{\mathit{}}{\mathrm{\left(}}{{\mathrm{2}}}^{{n}}{\mathit{}}{\mathrm{ln}}{\mathit{}}{\mathrm{2}}{\mathrm{+}}{\mathrm{ln}}{\mathit{}}\frac{{\mathrm{1}}}{{\delta}}{\mathrm{\right)}}$ examples. The sample complexity is exponential in ${n}$.
If we want to guarantee at most a ${\mathrm{5}}{\mathrm{\%}}$ error ${\mathrm{99}}{\mathrm{\%}}$ of the time and have ${\mathrm{30}}$ Boolean variables, then ${\u03f5}{\mathrm{=}}{\mathrm{1}}{\mathrm{/}}{\mathrm{20}}$, ${\delta}{\mathrm{=}}{\mathrm{1}}{\mathrm{/}}{\mathrm{100}}$, and ${n}{\mathrm{=}}{\mathrm{30}}$. The bound says that we can guarantee this performance if we find a hypothesis consistent with ${\mathrm{20}}{\mathrm{*}}{\mathrm{(}}{{\mathrm{2}}}^{{\mathrm{30}}}{\mathit{}}{\mathrm{ln}}{\mathit{}}{\mathrm{2}}{\mathrm{+}}{\mathrm{ln}}{\mathit{}}{\mathrm{100}}{\mathrm{)}}{\mathrm{\approx}}{\mathrm{14}}{\mathrm{,}}{\mathrm{885}}{\mathrm{,}}{\mathrm{222}}{\mathrm{,}}{\mathrm{452}}$ examples.
Consider the third question raised at the start of this section, namely, how quickly can a learner find the probably approximately correct hypothesis. First, if the sample complexity is exponential in the size of some parameter (e.g., $n$ above), the computational complexity must be exponential because an algorithm must at least consider each example. To show an algorithm with polynomial complexity, you need to find a hypothesis space with polynomial sample complexity and show that the algorithm uses polynomial time for each example.