NB On the website I can only provide a high-level sneak preview of the tutorial for brevity. For the full version, which is still quite short, but includes the proofs and fills in the missing details, see PAC-BayesMiniTutorial.pdf.

I will start by outlining the Cramér-Chernoff method, from which Hoeffding’s and Bernstein’s inequalities and many others follow. This method is incredibly well explained in Appendix A of the textbook by Cesa-Bianchi and Lugosi [3], but I will have to change the presentation a little to easily connect with the PAC-Bayesian bounds later on.

Let $D =((X_1,Y_1),\ldots,(X_n,Y_n))$ be *independent, identically distributed* (i.i.d.) examples, and let $h$ be a *hypothesis* from a set of hypotheses $\mathcal{H}$, which gets loss $\ell(X_i,Y_i,h)$ on the $i$-th example. For example, we might think of the squared loss $\ell(X_i,Y_i,h) = (Y_i – h(X_i))^2$. We also define the *empirical error*^{1} of $h$

\begin{equation*}

R_n(D,h) = \frac{1}{n} \sum_{i=1}^n \ell(X_i,Y_i,h),

\end{equation*}

and our goal is to prove that the empirical error is close to the *generalisation error*

\begin{equation*}

R(h) = \E[\ell(X,Y,h)]

\end{equation*}

with high probability. To do this, we define the function

\begin{equation*}

M_\eta(h)

= -\tfrac{1}{\eta} \ln \E\Big[e^{-\eta \ell(X,Y,h)}\Big]

\qquad \text{for $\eta > 0$,}

\end{equation*}

which will act as a surrogate for $R(h)$. Now the Cramér-Chernoff method tells us that:

**Lemma 1** *For any $\eta > 0$, $\delta \in (0,1]$,
\begin{equation}\label{eqn:chernoff}
M_\eta(h) \leq R_n(h,D) + \frac{1}{\eta n}\ln \frac{1}{\delta}
\end{equation}with probability at least $1-\delta$.*

Many standard concentration inequalities can then be derived by first relating $M_\eta(h)$ to $R(h)$, and then optimizing $\eta$. This includes, for example, Hoeffding’s inequality and inequalities involving the variance like Bernstein’s inequality. See the full version of this post for details.

Now suppose we use an estimator $\hat{h} \equiv \hat{h}(D) \in \mathcal{H}$ to pick a hypothesis based on the data, for example using empirical risk minimization: $\hat{h} = \argmin_{h \in \mathcal{H}} R_n(D,h)$. To get a bound for $\hat{h}$ instead of a fixed $h$, we want \eqref{eqn:chernoff} to hold for all $h \in \mathcal{H}$ simultaneously. If $\mathcal{H}$ is countable, this can be done using the union bound, which leads to:

**Lemma 4** Suppose $\mathcal{H}$ is countable. For $h \in \mathcal{H}$, let $\pi(h)$ be any numbers such that $\pi(h) \geq 0$ and $\sum_h \pi(h)= 1$. Then, for any $\eta > 0$, $\delta \in (0,1]$, \begin{equation}

M_\eta(\hat{h}) \leq R_n(D,\hat{h}) + \frac{1}{\eta n}\ln

\frac{1}{\pi(\hat{h})\delta}

\end{equation} with probability at least $1-\delta$.

In this context, the function $\pi$ is often referred to as a *prior distribution*, even though it need not have anything to do with prior beliefs.

Just like for Lemma 1, we can then again relate $M_\eta(h)$ to $R(h)$ to obtain a bound on the generalisation error. This shows, in a nutshell, how one can combine the Cramér-Chernoff method with the union bound to obtain concentration inequalities for estimators $\hat{h}$. The use of the union bound, however, is quite crude when there are multiple hypotheses in $\mathcal{H}$ with very similar losses, and the current proof breaks down completely if we want to extend it to continuous classes $\mathcal{H}$. This is where PAC-Bayesian bounds come to the rescue: in the next section I will explain the PAC-Bayesian generalisation of Lemma 4 to continuous hypothesis classes $\mathcal{H}$, which will require replacing $\hat{h}$ by a randomized estimator.

Let $\hat{\pi} \equiv \hat{\pi}(D)$ be a distribution on $\mathcal{H}$ that depends on the data $D$, which we will interpret as a randomized estimator: instead of choosing $\hat{h}$ deterministically, we will sample $h \sim \hat{\pi}$ randomly. The distribution $\hat{\pi}$ is often called the PAC-Bayesian *posterior distribution*. Now the result that the PAC-Bayesians have, may be expressed as follows:

**Lemma 6** Let $\pi$ be a (prior) distribution on $\mathcal{H}$ that does not depend on $D$, and let $\hat{\pi}$ be a randomized estimator that is allowed to depend on $D$. Then, for any $\eta > 0$, $\delta \in (0,1]$, \begin{equation}\label{eqn:pacbayes}

\E_{h \sim \hat{\pi}}[M_\eta(h)] \leq \E_{h \sim \hat{\pi}}[R_n(D,h)] +

\frac{1}{\eta n}\Big(D(\hat{\pi}\|\pi) + \ln \frac{1}{\delta}\Big)

\end{equation} with probability at least $1-\delta$. Moreover, \begin{equation}\label{eqn:pacbayesexp}

\E_D \E_{h \sim \hat{\pi}}[M_\eta(h)] \leq \E_D\Big[ \E_{h \sim \hat{\pi}}[R_n(D,h)] +

\frac{1}{\eta n}D(\hat{\pi}\|\pi)\Big].

\end{equation}

Here $D(\hat{\pi}\|\pi) = \int \hat{\pi}(h) \ln \frac{\hat{\pi}(h)}{\pi(h)} \mathrm{d} h$ denotes the Kullback-Leibler divergence of $\hat{\pi}$ from $\pi$.

To see that Lemma 6 generalises Lemma 4, suppose that $\hat{\pi}$ is a point-mass on $\hat{h}$. Then $D(\hat{\pi}\|\pi) = \ln (1/\pi(\hat{h}))$, and we recover Lemma 4 as a special case of \eqref{eqn:pacbayes}. An important difference with Lemma 4, however, is that Lemma 6 does not require $\mathcal{H}$ to be countable, and in fact in many PAC-Bayesian applications it is not.

We have seen how PAC-Bayesian inequalities naturally extend standard concentration inequalities based on the Cramér-Chernoff method by generalising the union bound to a continuous version. I’m afraid that’s all that will reasonably fit into a single blog post on my website. If you want more, simply continue with the full version, which covers several more issues, including:

- How to relate $M_\eta(h)$ to $R(h)$ to obtain, for example, Hoeffding’s inequality.
- How to optimize $\eta$, which comes “for free” in Lemma 4, but requires an additional union bound in the general PAC-Bayesian case of Lemma 6.
- How the PAC-Bayesians choose their prior $\pi$ and posterior $\hat{\pi}$. (There’s an unexpected trick called
*localisation*.) - Proofs
- Literature references

Called the empirical

*risk*in statistics; hence the notation with `R’. ↩

In the 1990’s, people familiar with the work of Vovk called these
special loss functions *mixable losses*, but nowadays the notion
of mixability appears to be mostly forgotten, and the geometric
concept of *exp-concavity* has taken its place. This raises the
question of how the two are related, which strangely does not appear
to be answered in very much detail in the literature. As I have been
studying mixability quite a bit in my recent work, I was wondering
about this, so here are some thoughts. **Update:** In particular, I will construct a parameterization of the squared loss in
which it is $1/2$-exp-concave instead of only $1/8$-exp-concave like
in its usual parameterization.

This post is also available as FromExpConcavityToMixability.pdf.

Suppose we predict an outcome $y \in \mathcal{Y}$ by specifying a
prediction $a \in \mathcal{A}$. The better our prediction, the smaller
our loss $\ell(y,a)$. (I will assume $\ell(y,a)$ is nonnegative, but
that does not really matter.) For example, if $y$ and $a$ both take
values in $\{0,1\}$, then the *$0/1$-loss* $\ell(y,a) = |y-a|$ is
$0$ if we predict correctly and $1$ otherwise. Alternatively, if $y$ and
$a$ are both real-valued, then the *squared loss* is $\ell(y,a) =
(y-a)^2$. And finally, if $a$ specifies a probability density $f_a$ on
$\mathcal{Y}$, then our loss may be the *log loss* $\ell(y,a) =
-\ln f_a(y)$.

For $\eta > 0$, a loss function is called *$\eta$-mixable* [1] if for
any probability distribution $\pi$ on $\mathcal{A}$ there exists a
prediction $a_\pi \in \mathcal{A}$ such that

The constant in the $O(1)$ overhead compared to the best expert is proportional to $1/\eta$, so the bigger $\eta$ the better.

For $\eta > 0$, a loss function is called $\eta$-exp-concave if for any distribution $\pi$ on $\mathcal{A}$ the prediction $a_\pi = \int a \,\pi(\mathrm{d} a)$ satisfies \eqref{eqn:mixable}. So exp-concavity is just mixability with $a_\pi$ fixed to be the mean.

This choice is appropriate in the case of log loss. In this case, for
$\eta = 1$, the numbers $e^{-\eta \ell(y,a)} = f_a(y)$ just equal
probability densities and \eqref{eqn:mixable} holds with equality. For squared loss, however, the appropriate choice for $a_\pi$ is not the
mean. Suppose that $y$ and $a$ both take values in $[-1,+1]$. Then,
while the squared loss is $1/2$-mixable for $a_\pi = \frac{h_{1/2}(-1) –
h_{1/2}(1)}{4}$ with $h_\eta(y) = \frac{-1}{\eta} \ln \int e^{-\eta
(y-a)^2} \pi(\mathrm{d} a)$, it is only $1/8$-exp-concave when parameterized
by $a$. (See [2, 3].) This does not
rule out, however, that the squared loss might be $1/2$-exp-concave in a
different parameterization. As we shall see, such a parameterization
indeed exists ~~if we restrict $y$ to take only two values $\{-1,+1\}$,
but I have not been able to find a suitable reparameterization in
general~~.

Clearly, exp-concavity implies mixability: it just makes the choice for $a_\pi$ explicit. What is not so obvious, is when the implication also goes the other way. It turns out that in some cases it actually does if we reparameterize our predictions in a clever (one might also say: complicated) way by the elements of a certain set $\mathcal{B}_\eta$.

**Theorem**
*Suppose a loss $\ell \colon \mathcal{Y} \times \mathcal{A} \to
[0,\infty]$ satisfies Conditions 1 and
2 below for some $\eta > 0$. Then $\ell$ is $\eta$-mixable
if and only if it can be parameterized in such a way that it is
$\eta$-exp-concave.*

The technical conditions I need are the following:

- All predictions in $\mathcal{A}$ should be admissible.
- For any element $g$ on the north-east boundary of the set $\mathcal{B}_\eta$, there should exist a prediction $a \in \mathcal{A}$ such that $g(y) = e^{-\eta \ell(y,a)}$ for all $y$.

Condition 1 is the easiest of the two. I will call a
prediction $a \in \mathcal{A}$ *admissible* if there exists no
other prediction $b \in \mathcal{A}$ that is always at least as good in
the sense that $\ell(y,b) \leq \ell(y,a)$ for all $y \in \mathcal{Y}$.
If $a$ is inadmissible, then we could just remove it from the set of
available predictions $\mathcal{A}$, because predicting $b$ is always at
least as good anyway. So admissibility seems more of an administrative
requirement (get rid of all predictions that make no sense) than a real
restriction.

To explain the second condition, we define the new parameterization $\mathcal{B}_\eta$ as the set of functions \begin{equation*} \mathcal{B}_\eta = \{g \colon \mathcal{Y} \to [0,1] \mid \text{for some distribution $\pi$: } g(y) = \int e^{-\eta \ell(y,a)} \pi(\mathrm{d} a)\ \forall y\}. \end{equation*} Note that the set $\mathcal{B}_\eta$ is convex by construction.

Let $\mathbb{1}(y) = 1$ be the constant function that is $1$ on all $y \in
\mathcal{Y}$, and for any $g \in \mathcal{B}_\eta$ let $c(g) = \sup \{c
\geq 0 \mid (g + c \cdot \mathbb{1}) \in \mathcal{B}_\eta\}$. By the
*north-east boundary* of $\mathcal{B}_\eta$, I mean the set of points
$\{g + c(g) \mid g \in \mathcal{B}_\eta \}$. That is, if we move
`south-east’ from any point in this set (in the direction of $-\mathbb{1}$),
we are inside $\mathcal{B}_\eta$, but if we move further `north-east’ (in
the direction of $\mathbb{1}$) we are outside.

Condition 2 implies that the north-east boundary of $\mathcal{B}_\eta$ should be equal to the set $\{e^{-\eta \ell(\cdot,a)} \mid a \in \mathcal{A}\}$, which appears to be quite typical if $\dim(A) = |\mathcal{Y}| – 1$, but not in general.

As we have already seen that $\eta$-exp-concavity trivially implies $\eta$-mixability, it remains to construct the parameterization in which $\ell$ is $\eta$-exp-concave given that it is $\eta$-mixable.

The parameterization we choose is indexed by the elements of $\mathcal{B}_\eta$, which we map onto $\mathcal{A}$, with multiple elements in $\mathcal{B}_\eta$ mapping to the same element of $\mathcal{A}$. So let $g$ be an arbitrary element of $\mathcal{B}_\eta$. How do we map it to a prediction $a \in \mathcal{A}$? We do this by choosing the prediction $a$ such that $g(y) + c(g) = e^{-\eta \ell(y,a)}$ for all $y$. As $g + c(g)\cdot \mathbb{1}$ lies on the north-east boundary of $\mathcal{B}_\eta$, such a prediction exists by Condition 2.

Our construction ensures there exists a $g \in \mathcal{B}_\eta$ that maps to $a$ for any $a \in \mathcal{A}$. To see this, suppose there was an $a$ for which this was not the case, and let $g_a = e^{-\eta \ell(\cdot,a)}$. Then we must have $c(g_a) > 0$, because otherwise we would have $c(g) = 0$ and $g_a$ would map to $a$. But then the prediction $b \in \mathcal{A}$ such that $e^{-\eta \ell(\cdot,b)} = g + c(g) \cdot \mathbb{1}$ would satisfy $e^{-\eta \ell(y,b)} > e^{-\eta \ell(y,a)}$ for all $y$, and hence $\ell(y,b) < \ell(y,a)$ for all $y$, so that $a$ would be inadmissible, which we have ruled out by assumption.

We are now ready to prove that the loss is $\eta$-exp-concave in our parameterization. To show this, let $\pi$ be an arbitrary probability distribution on $\mathcal{B}_\eta$. Then we need to show that \begin{equation*} e^{-\eta \ell(y,g_\pi)} \geq \int e^{-\eta \ell(y,g)} \pi(\mathrm{d} g) \qquad \text{for all $y \in \mathcal{Y}$,} \end{equation*} where $g_\pi = \int g\ \pi(\mathrm{d} g)$. To this end, observe that \begin{equation*} \int e^{-\eta \ell(\cdot,g)} \pi(\mathrm{d} g) = \int (g + c(g)\cdot \mathbb{1})\ \pi(\mathrm{d} g) = g_\pi + c_\pi\cdot \mathbb{1}, \end{equation*} where $c_\pi = \int c(g)\ \pi(\mathrm{d} g)$. Now convexity of $\mathcal{B}_\eta$ ensures that $\int e^{-\eta \ell(\cdot,g)} \pi(\mathrm{d} g) \in \mathcal{B}_\eta$, so that we must have $c_\pi \leq c(g_\pi)$. But then \begin{equation*} e^{-\eta \ell(y,g_\pi)} = g_\pi(y) + c(g_\pi) \geq g_\pi(y) + c_\pi = \int e^{-\eta \ell(y,g)} \pi(\mathrm{d} g) \end{equation*} for all $y$, which was to be shown.

So how do things play out for the squared loss? We know that it is $1/2$-mixable, so we would like to find a parameterization in which it is also $1/2$-exp-concave. Suppose first that $a$ takes values in $[-1,+1]$ and $y$ takes only two values $\{-1,+1\}$. Then Condition 1 is clearly satisfied. The set $\mathcal{B}_{1/2}$ consists of all the functions $g \colon \{-1,+1\} \to [e^{-2},1]$ such that \begin{equation}\label{eqn:newparam} g(y) = \int e^{-\frac{1}{2} (y-a)^2} \pi(\mathrm{d} a) \qquad \text{for $y \in \{-1,+1\}$} \end{equation} for some distribution $\pi$ on $\mathcal{A}$. So to verify Condition 2, we need to check that for any $g \in \mathcal{B}_{1/2}$ there exists a prediction $a_g \in \mathcal{A}$ that satisfies \begin{equation}\label{eqn:squaredlosstosolve} g(y) + c(g) = e^{-\frac{1}{2}(y-a_g)^2} \qquad \text{for $y \in \{-1,+1\}$.} \end{equation} Solving this we find that $a_g$ indeed exists and equals \begin{equation}\label{eqn:backtoorig} a_g = f^{-1}\big(g(1)-g(-1)\big), \end{equation} where $f^{-1}$ is the inverse of $f(\alpha) = e^{-\frac{1}{2}(1-\alpha)^2} – e^{-\frac{1}{2}(\alpha+1)^2}$ (see the figure below). The existence of $a_g$ for all $g$ implies that Condition 2 is satisfied, and by Theorem 1 we have found a parameterization in which the squared loss is $1/2$-exp-concave, provided that $y$ only takes the values $\{-1,+1\}$.

So what happens if we allow $y$ to vary over the whole range $[-1,+1]$?
In this case I believe that no choice of $a_g$ will satisfy
\eqref{eqn:squaredlosstosolve} for all $y$, and consequently
Condition 2 does not hold. **Update:** However, it
turns out that any parametrization that is $\eta$-exp-concave for $y \in
\{-1,+1\}$ is also $\eta$-exp-concave for the whole range $y \in
[-1,+1]$. This is a special property, proved by Haussler, Kivinen and
Warmuth [2, Lemma 4.1], [3, Lemma 3], that only holds
for certain loss functions, including the squared loss. Thus we have
found a parameterization of the squared loss with $y \in [-1,+1]$ in
which it is $1/2$-exp-concave (instead of only $1/8$-exp-concave like in
the standard parameterization): parameterize by the functions $g$
defined in \eqref{eqn:newparam}, and map them to original parameters via
the mapping $a_g$ defined in \eqref{eqn:backtoorig}.

We have seen that exp-concavity trivially implies mixability. Conversely, mixability also implies exp-concavity roughly when the dimensionality of the set of predictions $\dim(\mathcal{A})$ equals the number of outcomes $|\mathcal{Y}|$ minus one. In general, however, it remains unknown whether any $\eta$-mixable loss can be reparameterized to make it $\eta$-exp-concave with the same $\eta$.

As exp-concavity is a stronger requirement than mixability and introduces these complicated reparameterization problems, one might ask: why bother with it at all? One answer to this is that taking $a_\pi$ to be the mean reduces the requirement \eqref{eqn:mixable} to ordinary concavity, which has a nice geometrical interpretation. Nevertheless, the extra flexibility offered by mixability can make it easier to satisfy (for example, for the squared loss), so in general mixability would appear to be the most convenient of the two properties.

It seems the proof of Theorem 1 would still work if we replaced $\mathbb{1}$ by any other positive function. I wonder whether this extra flexibility might make Condition 2 easier to satisfy.

**Update:** I would like to thank Sébastien Gerchinovitz for
pointing me to Lemma 4.1 of Haussler, Kivinen and Warmuth.

- N. Cesa-Bianchi and G. Lugosi.
*Prediction, learning, and games.*Cambridge University Press, 2006. - D. Haussler, J. Kivinen, and M. K. Warmuth.
*Sequential prediction of individual sequences under general loss functions.*IEEE Transactions on Information Theory, 44(5):1906–1925, 1998. - V. Vovk.
*Competitive on-line statistics.*International Statistical Review, 69(2):213–248, 2001.

It turns out that the two are more or less equivalent, but while Sanov’s theorem has the nicest information theoretic interpretation, the Cramér-Chernoff theorem seems to introduce the fewest measure-theoretic complications. Let me explain…

The *empirical distribution* $P_n$ of $X_1, \ldots, X_n$ gives probability $P_n(A) = \frac{1}{n}\sum_{i=1}^n {\bf 1}_{\{X_i \in A\}}$ to any event $A$, which is the fraction of variables taking their value in $A$. If the distribution of the variables is $P^*$, then asymptotically we would expect $P_n$ to be close to $P^*$. So then if $\mathcal{P}$ is a set of distributions that is far away from $P^*$ in some sense, the probability that $P_n \in \mathcal{P}$ should be small. This intuition is quantified by *Sanov’s theorem* [2, 3].

Csiszár [2, p.790] has an elegant information theoretic proof of the upper bound. He also works out sufficient measure-theoretic conditions for the theorem to hold in continuous spaces, which are quite clean, but still require considerable care to verify.

One may extend Sanov’s theorem to non-convex sets $\mathcal{P}$ by a union bound argument. For example, Cover and Thomas [3] take a union bound over all possible values for $P_n$, which they call types. By discretization arguments one may further extend the theorem to infinite spaces [4], but then things get a bit too asymptotic for my taste.

It remains to evaluate $D(Q^* \| P^*)$ in this case, which can be done as follows:

1.Chaining everything together we exactly recover the Cramér-Chernoff theorem, and we see that the upper bounds have exactly the same constants.

One may also view things the other way around. The Cramér-Chernoff theorem bounds the probability that the value of the empirical mean $\frac{1}{n} \sum_{i=1}^n X_i$ lies in the set $A = [a,\infty)$. As discussed by Van der Vaart [1, pp. 208-210], both the notion of empirical mean and the set $A$ can be generalized. In particular, one may regard the empirical distribution $P_n$ as the mean of $n$ point-masses (i.e. Dirac measures) on the points $X_1, \ldots, X_n$. Van der Vaart then presents Sanov’s theorem as just one instance of such generalized Cramér-Chernoff theorems.

We have seen the close similarities between the Cramér-Chernoff theorem and Sanov’s theorem. For me Sanov’s theorem seems easier to interpret, but in continuous spaces one has to deal with the more complicated measure-theoretic conditions of Csiszár [2]. For technical reasons it may therefore be preferable to use the Cramér-Chernoff result.

It turns out that the upper bound in the Cramér-Chernoff theorem does leave some slack in the order of $1/\sqrt{n}$, which is negligible compared to the term in the exponent. See the lecture notes by Venugopal Veeravalli for details.

0. N. Cesa-Bianchi, G. Lugosi, *Prediction, Learning and Games*, Cambridge University Press, 2006

1. A.W. van der Vaart, *Asymptotic Statistics*, Cambridge University Press, 2000

2. I. Csiszár, *Sanov property, generalized I-projection and a conditional limit theorem*, The Annals of Probability, 1984, Vol. 12, No. 3, pp. 768-793

3. T.M. Cover, J.A. Thomas, *Elements of Information Theory*, Wiley, 1991

4. F. den Hollander, *Large Deviations*, Vol. 14 of Fields Institute Monographs, 2000