Probabilistic PCA: a line, blurred

Background notes (after Tipping and Bishop, 1999) · Foundations

In one paragraph

Ordinary PCA finds a flat, low-dimensional sheet that sits close to the data. It does not say what kind of data that sheet would produce. Probabilistic PCA (PPCA) tells a story: a short hidden vector z is drawn from a bell curve, it is carried into the full data space along a few fixed directions, and then every coordinate gets a little independent noise of the same size. The data is the blurred sheet. Fitting this story by maximum likelihood gives back the same subspace as PCA, and it also gives a noise level (the average of the variances PCA throws away) and, for any point, a bell-curve answer for where it sits on the sheet. Having a likelihood is the point: it allows missing values, a fast EM algorithm that never builds the big covariance, comparison between different numbers of components, mixtures, and sampling.

1. The picture to hold

Take two measurements per point, but suppose they are really governed by one hidden quantity (say a person’s overall size driving both their height and their arm length). Points then lie near a line. They do not lie on it, because each measurement also has its own small wobble.

PPCA is exactly this, with a bell curve for the hidden quantity and equal wobble in every direction. The first widget of the interactive page lets you build such a cloud and fit it back.

2. The model

The data are vectors x\in\mathbb R^d. We look for a hidden vector z\in\mathbb R^q with q<d:

z\sim\mathcal N(0,I_q),\qquad x=Wz+\mu+\epsilon,\qquad \epsilon\sim\mathcal N(0,\sigma^2 I_d).

Symbol by symbol:

Equivalently, in terms of the conditional distribution, x\mid z\sim\mathcal N(Wz+\mu,\sigma^2I).

3. What the data look like: a Gaussian with a special covariance

We never see z, so what matters is the distribution of x alone. A sum of independent Gaussians is Gaussian, so x is Gaussian, and we only need its mean and covariance.

x\sim\mathcal N(\mu,\,C),\qquad C=WW^\top+\sigma^2 I.

Read C geometrically: the ellipse of the data is long along the columns of W (the noise adds \sigma^2 on top of what W contributes) and is a round blur of radius \sigma in every other direction. The solid ellipses in the first widget are exactly this.

A general Gaussian in d dimensions has about d^2/2 free numbers in its covariance. C has about dq. So PPCA is a Gaussian with a deliberately restricted covariance: a few strong directions plus a flat floor. That is a useful assumption when d is large and the data really are low-dimensional, and it is exactly the kind of structure PCA already assumes.

4. Why W is not pinned down: the rotation freedom

Replace W by WR for any q\times q rotation (or reflection) R. Then WR(WR)^\top=WRR^\top W^\top=WW^\top, so C is unchanged and the data distribution is identical. The reason is that rotating the latent coordinates changes nothing about the standard bell curve for z.

So the data determine the sheet (the span of the columns) and the scale along it, but not which axes inside the sheet you call “first” and “second”. PCA fixes the axes by also demanding they be ordered by variance. PPCA does not, and if you want PCA’s axes you apply one more rotation at the end.

5. Fitting by maximum likelihood

Collect N points and let S be the sample covariance. The log-likelihood of the Gaussian depends on the data only through S:

\ell=-\frac N2\Bigl\{d\ln 2\pi+\ln|C|+\operatorname{tr}(C^{-1}S)\Bigr\}.

Now use the structure of C. Write W=U\,L\,R with U having orthonormal columns, L=\mathrm{diag}(s_j) and R a rotation. Then C has the columns of U as eigenvectors with eigenvalues s_j^2+\sigma^2, and every direction perpendicular to them has eigenvalue exactly \sigma^2.

Setting the gradient to zero, the stationary points have U made of any q eigenvectors of S, with matching eigenvalues \lambda_j, and s_j^2=\lambda_j-\sigma^2 . So each kept direction is stretched until the model’s variance along it, s_j^2+\sigma^2, equals the data’s \lambda_j. That is the matching you would expect, and it is only possible when \lambda_j\ge\sigma^2.

Two choices remain: which q eigenvectors, and what \sigma^2.

The result: W_{\mathrm{ML}}=U_q\,(\Lambda_q-\sigma^2_{\mathrm{ML}}I)^{1/2}R .

Three things to read from it, all on the third widget of the interactive page:

  1. The subspace is the PCA subspace. The columns of U_q are the top eigenvectors of S.
  2. The scale is not the PCA scale. Each direction is shortened to \sqrt{\lambda_j-\sigma^2}, because the noise accounts for \sigma^2 of the variance along it. The columns of W_{\mathrm{ML}} are not unit vectors, and they are not the eigenvectors.
  3. The noise is the discarded variance. The larger the pieces PCA throws away, the larger the noise the model believes in.

6. From a point to its hidden coordinate: the posterior

Given an observed x, what do we believe about z? Since z and x are jointly Gaussian, the conditional is Gaussian too (Bayes’ rule for Gaussians):

z\mid x\sim\mathcal N\!\bigl(M^{-1}W^\top(x-\mu),\;\sigma^2M^{-1}\bigr),\qquad M=W^\top W+\sigma^2 I_q .

The second widget draws this for one hidden coordinate: the PCA foot, the shrunken posterior centre and the two-standard-deviation bar, with sliders for the noise and the arrow length.

7. What having a likelihood buys you

8. Fitting without forming the covariance: EM

The latent z is hidden, which is exactly the EM setting. Each round:

Every quantity is a d\times q or q\times q table, so a round costs about N\,d\,q operations and the d\times d sample covariance never has to be built. This is why PPCA’s EM is attractive when d is large and q small. The likelihood of this model has no bad local maxima: the only maxima are the ones in §5 (all choices of eigenvectors other than the top q are saddles), so EM converges to the PCA subspace.

9. Relatives

10. Where it reappears

Questions and doubts

Takeaways

Reference

M. E. Tipping and C. M. Bishop, “Probabilistic Principal Component Analysis”, Journal of the Royal Statistical Society, Series B 61(3), 611–622, 1999 (technical report NCRG/97/010, 1997/1998).