Index: The Book of Statistical Proofs ▷ General Theorems ▷ Machine learning ▷ Cross-validation ▷ Leave-one-out predictive density

Theorem: Let $y = \left\lbrace y_1, \ldots, y_n \right\rbrace$ be a data set and let $y_i$ be the observation that is left out in the $i$-th cross-validation fold, with $y_{\neg i} = y \setminus \left\lbrace y_i \right\rbrace$. Assume a generative model with model parameters $\theta$, likelihood function $p(y \vert \theta)$ and prior distribution $p(\theta)$, and assume that the observations are conditionally independent given $\theta$. Then, the leave-one-out posterior predictive density of the left-out observation is the harmonic mean of its likelihood with respect to the full posterior distribution:

\[\label{eq:lpd-hm} p(y_i \vert y_{\neg i}) = \frac{1}{\mathrm{E}_{\theta \vert y}\!\left[ \frac{1}{p(y_i \vert \theta)} \right]} \; .\]

Proof: By the definition of conditional probability, the leave-one-out predictive density is the ratio of the marginal likelihoods

\[\label{eq:lpd-def} p(y_i \vert y_{\neg i}) = \frac{p(y_i, y_{\neg i})}{p(y_{\neg i})} = \frac{p(y)}{p(y_{\neg i})} \; .\]

The marginal likelihood of the remaining observations is obtained by marginalizing over the model parameters

\[\label{eq:ml-loo} p(y_{\neg i}) = \int p(y_{\neg i} \vert \theta) \, p(\theta) \, \mathrm{d}\theta \; .\]

Because the observations are conditionally independent given $\theta$, the likelihood factorizes as $p(y \vert \theta) = p(y_i \vert \theta) \, p(y_{\neg i} \vert \theta)$, such that

\[\label{eq:ml-loo-fact} p(y_{\neg i}) = \int \frac{1}{p(y_i \vert \theta)} \, p(y \vert \theta) \, p(\theta) \, \mathrm{d}\theta \; .\]

By Bayes’ theorem, $p(y \vert \theta) \, p(\theta) = p(\theta \vert y) \, p(y)$, and since $p(y)$ does not depend on $\theta$, it can be taken out of the integral

\[\label{eq:ml-loo-post} p(y_{\neg i}) = p(y) \int \frac{1}{p(y_i \vert \theta)} \, p(\theta \vert y) \, \mathrm{d}\theta = p(y) \, \mathrm{E}_{\theta \vert y}\!\left[ \frac{1}{p(y_i \vert \theta)} \right] \; .\]

Inserting \eqref{eq:ml-loo-post} into \eqref{eq:lpd-def}, the marginal likelihood $p(y)$ cancels out

\[p(y_i \vert y_{\neg i}) = \frac{1}{\mathrm{E}_{\theta \vert y}\!\left[ \frac{1}{p(y_i \vert \theta)} \right]} \; ,\]

such that we have \eqref{eq:lpd-hm}. This completes the proof.

∎
Sources:
  • Vehtari A, Mononen T, Tolvanen V, Sivula T, Winther O (2016): "Bayesian leave-one-out cross-validation approximations for Gaussian latent variable models"; in: Journal of Machine Learning Research, vol. 17, pp. 1-38, eq. 24; URL: https://jmlr.org/papers/v17/14-540.html.

Metadata: ID: P572 | shortcut: cv-loo | author: aloctavodia | date: 2026-11-24, 09:29.