§13.0 Part III begins: probabilistic models with latent variables
Much of the research frontier of deep learning is about building a probabilistic model of the input, . Such a model can, in principle, use probabilistic inference to predict any variable in its environment given any of the others. Most of these models carry latent variables latent variable A random variable that is never observed directly, like the mixture's component identity c. defined in ch. 3 — open in glossary , with — the latents provide a distributed representation of the data, with all the advantages we saw representation learning bring to feedforward and recurrent nets.
This chapter starts Part III with the simplest such models: linear factor models. They were among the first latent-variable models to be studied extensively, they still serve as building blocks of mixture models (Hinton et al. 1995; Ghahramani & Hinton 1996; Roweis et al. 2002) and of larger deep probabilistic models (Tang et al. 2012), and they exhibit — in miniature — most of the design questions the advanced generative models of chapters 16–20 will face.
A linear factor model linear factor model A simple latent-variable probabilistic model with a stochastic LINEAR decoder: sample factors h from a factorial prior, then generate x = Wh + b + noise. Probabilistic PCA, factor analysis, ICA, and sparse coding differ only in the noise and prior choices. defined in ch. 13 — open in glossary is defined by a stochastic, linear decoder: generate by adding noise to a linear transformation of . The data-generation recipe is:
The linear factor generative process (eqs 13.1–13.2)
| a factorial prior — the explanatory factors are independent of one another, so sampling them is trivial (one draw per factor) | d independent draws | |
| the factor loadings: column j says how factor hⱼ expresses itself across every observed dimension | n × d | |
| a bias — the mean of x when all factors are zero | n | |
| typically Gaussian and DIAGONAL (independent across the n dimensions) — everything the factors do not explain | n |
What this really says
A few independent hidden causes, mixed linearly, plus sensor noise. Every model in this chapter — factor analysis factor analysis A linear factor model with prior h~N(0,I) and DIAGONAL (per-variable) Gaussian noise ψ=diag(σ²), so x~N(b, WWᵀ+ψ). The latents capture dependencies between the observed variables. defined in ch. 13 — open in glossary , probabilistic PCA, ICA — is exactly this recipe with a different answer to two questions: what distribution do the factors follow? and what does the noise look like? The simple joint distribution over is the point: we want to discover explanatory factors whose interactions are easy to reason about.
Worked example — one draw from a linear factor model
Let factors generate observations, with , . Sample the factors independently: . Then ; add a small noise draw to get . Note how mixes both causes — observing correlations among is how the model will infer the hidden factors.
The corresponding directed graphical model (§3.14) is the shared family portrait — every can influence every , and the observed variables are conditionally independent given the factors:
click a node to see which factors mention it
§13.1 Probabilistic PCA and factor analysis
Probabilistic PCA probabilistic pca A linear factor model with prior h~N(0,I) and ISOTROPIC Gaussian noise, giving x~N(b, WWᵀ+σ²I). Fit by EM; as σ→0 it becomes ordinary PCA (the posterior mean of h is the orthogonal projection onto Ws columns). defined in ch. 13 — open in glossary , factor analysis and other linear factor models are all special cases of eqs 13.1–13.2 that differ only in the noise distribution and the prior over .
In factor analysis (Bartholomew 1987; Basilevsky 1994) the prior is the unit Gaussian, and each observed gets its own noise variance:
Factor analysis (eqs 13.3–13.4)
| unit-variance Gaussian prior on the factors — chosen because it keeps every downstream computation in closed form | prior | |
| the covariance CONTRIBUTED BY the shared latent factors — this is the only place cross-variable dependencies come from | n × n, rank ≤ d | |
| per-variable noise variances σ²₁ … σ²ₙ — the x_i are conditionally independent given h, so ψ is diagonal | n × n diagonal | |
| marginalizing the Gaussian latents out of a linear-Gaussian model leaves x exactly multivariate normal | closed form |
The latents own the correlations; ψ mops up the rest
Every off-diagonal entry of the covariance of comes from — from factors shared between variables. The diagonal noise can only add per-variable scatter. So the role of the latent variables is precisely to capture the dependencies between the observed : whatever co-varies must do so through the factors.
Worked example — one factor, two sensors
(one factor, two sensors), . Then and the marginal covariance is . The off-diagonal exists only because both sensors watch the same factor — the implied correlation is , even though the noise on the two sensors is completely independent.
To cast PCA in this probabilistic framework, make one small change: force all the conditional variances to be equal, a single scalar :
Probabilistic PCA (eqs 13.5–13.6)
| ISOTROPIC noise — one shared residual variance instead of factor analysis's per-variable ψ. This is the entire difference between the two models | scalar × I | |
| standard Gaussian noise, scaled by σ — the equivalent per-sample form of the same model | n | |
| estimated together by an iterative EM algorithm (Tipping & Bishop 1999) | learned |
Most of the variance, up to a small residual
Probabilistic PCA bets that the latents capture most variation in the data, leaving only a small shared residual . As it becomes classical PCA principal components analysis Lossy linear compression: encode c = Dᵀx, decode Dc; optimal D = top-l eigenvectors of XᵀX. defined in ch. 2 — open in glossary : the conditional expectation becomes an orthogonal projection of onto the space spanned by the columns of — exactly the projection you found by hand in the PCALab of §2.12.
But the limit has a sting. As the density concentrates ever more sharply around the -dimensional subspace spanned by ‘s columns — and any data point not near that hyperplane is assigned vanishingly low likelihood:
§13.2 Independent component analysis (ICA)
Independent component analysis independent component analysis (ica) A linear factor model that separates an observed signal into fully INDEPENDENT (not just decorrelated) underlying signals — e.g. the cocktail-party problem or removing heart/eye artifacts from EEG. Requires a non-Gaussian prior p(h) for W to be identifiable; typically learns sparse features. defined in ch. 13 — open in glossary is among the oldest representation-learning algorithms (Hérault & Ans 1984; Jutten & Hérault 1991; Comon 1994; Hyvärinen 1999). Its goal: separate an observed signal into underlying signals that were scaled and added together — and make the recovered signals fully independent, not merely decorrelated (the crucial distinction of §3.8).
The variant closest to our generative framing (Pham et al. 1992) is fully parametric: the user fixes the prior ahead of time, the model generates deterministically (no added noise), and a nonlinear change of variables (eq 3.47) yields for maximum-likelihood training. Choosing an independent is the lever: it forces the recovered factors to be as close to independent as possible.
This is used less for abstract causal factors than for low-level signal separation. Each training example is one moment in time; each is one sensor’s reading of the mixed signals; each is one recovered source. The classic cocktail-party problem: people speak simultaneously into microphones placed at different spots — ICA separates the voices so each contains one speaker, clearly. In neuroscience, EEG electrodes on the scalp record brain activity mixed with far stronger heartbeat and eye-blink artifacts; ICA separates the heart’s electrical signature from the brain’s, and brain regions from one another. Open the box and do the separation yourself:
Drag θ (or snap): whitening fixed the second-order statistics, so every rotation is equally decorrelated — but only one rotation makes the channels fully independent. The Σ|kurtosis| readout climbs as you approach it.
Beyond this variant, “ICA” names a whole family. Some members add generation noise; most drop maximum likelihood and instead directly push toward independence. Since eq 3.47 needs — expensive and numerically unstable — many variants constrain to be orthogonal. Two facts organize the family:
- All variants require a non-Gaussian . With an independent Gaussian prior, is not identifiable — many different produce the same , because a rotated Gaussian is still the same Gaussian. This is the opposite of probabilistic PCA and factor analysis, which want Gaussian priors for their closed forms. In the maximum-likelihood approach the user typically picks — and such choices put larger peaks near 0 than a Gaussian, so most ICA implementations effectively learn sparse features.
- Many variants are not generative models in our sense: they can transform between and but represent neither nor . For instance, maximizing the sample kurtosis of drives non-Gaussianity (as in the widget) without ever writing down a density — fine for ICA’s usual role as an analysis tool rather than a sampler.
Generalizations. Just as PCA generalizes to the nonlinear autoencoders of chapter 14, ICA generalizes to nonlinear ICA nonlinear ica A generative generalization of ICA using a nonlinear encoder/decoder; NICE (Dinh 2014) stacks invertible transforms whose Jacobian determinants are cheap, enabling exact likelihood and easy sampling. defined in ch. 13 — open in glossary (Hyvärinen & Pajunen 1999), with successful ensemble-learning applications (Roberts & Everson 2001; Lappalainen et al. 2000). NICE (Dinh et al. 2014) stacks invertible encoder stages whose Jacobian determinants are cheap to compute, giving exact likelihood — and since the decoder is the encoder’s perfect inverse, sampling is as easy as drawing and decoding. Relaxing full independence instead: independent subspace analysis independent subspace analysis An ICA generalization that learns non-overlapping GROUPS of features, allowing statistical dependence within a group but discouraging it between groups. defined in ch. 13 — open in glossary allows dependence within non-overlapping feature groups while discouraging it between groups; and topographic ICA topographic ica An ICA variant giving hidden units spatial coordinates and forming overlapping groups of neighbors, so nearby features share orientation/location/frequency; on images it learns Gabor filters and pooling gives translation invariance. defined in ch. 13 — open in glossary gives each unit a spatial coordinate with overlapping neighbor groups, so nearby units learn similar features. Trained on natural images, it learns Gabor filters gabor function A Gaussian gate × oriented cosine (eq 9.16) describing V1 simple-cell weights: it responds to a specific spatial frequency of brightness in a specific direction at a specific location; countless learning algorithms learn Gabor-like first-layer filters. defined in ch. 9 — open in glossary whose neighbors share orientation, location or frequency — and pooling over each small region yields translation invariance, echoing the complex-cell story of §9.10.
§13.3 Slow feature analysis
Slow feature analysis slow feature analysis (sfa) A linear factor model applying the slowness principle in closed form: learn features that vary as slowly as possible over a time sequence, subject to zero mean, unit variance, and mutual decorrelation. Features come ordered slowest-first; nonlinear via a basis expansion. defined in ch. 13 — open in glossary (Wiskott & Sejnowski 2002) is a linear factor model that uses information from time signals to learn invariant features. It rests on the slowness principle slowness principle The idea that important characteristics of a scene change SLOWLY compared with raw measurements (a zebras stripes flicker a pixel fast, but zebra present does not) — so regularize features to change slowly over time (penalty λΣₜ L(f(x⁽ᵗ⁺¹⁾),f(x⁽ᵗ⁾))). defined in ch. 13 — open in glossary : the important characteristics of a scene change slowly compared with the raw measurements describing it. Watch a zebra cross an image: any individual pixel flips black ↔ white rapidly as stripes pass over it, the feature “the zebra’s position” changes slowly, and “is a zebra present” does not change at all. So: regularize the model to learn features that change slowly.
The principle predates SFA (Hinton 1989; Földiák 1989; Mobahi et al. 2009; Bergstra & Bengio 2009) and can be added to any differentiable model trained by gradient descent, as a cost term:
The slowness penalty (eq 13.7)
| hyperparameter setting how strongly slowness is enforced relative to the rest of the cost | scalar | |
| the index into a TIME SEQUENCE of examples — the principle only applies to temporal data | sequence index | |
| the feature extractor being regularized | model | |
| a distance between consecutive feature values — commonly the mean squared difference | loss |
SFA is the especially efficient special case: apply the principle to a linear feature extractor , and the optimum has a closed-form solution — no gradient descent at all. (Like the non-generative ICA variants, SFA defines a map from input to feature space but no prior over features, hence no .) The problem:
The SFA problem (eqs 13.8–13.11)
| zero mean (eq 13.9) — without it, adding any constant to a solution gives another solution with the same slowness: needed for UNIQUENESS | constraint | |
| unit variance (eq 13.10) — forbids the pathological "perfectly slow" solution where every feature collapses to the constant 0 | constraint | |
| decorrelation (eq 13.11) — otherwise every learned feature would capture the SAME slowest signal; forces diversity, and is what makes the closed form possible (other diversification mechanisms, like reconstruction error, would lose it) | constraint | |
| the reason it all reduces to linear algebra — solvable exactly by a standard package, and the features come out ORDERED, slowest first (like PCA's components) | model class |
Three fences around a trivial optimum
The objective alone is minimized by any constant — total collapse. Unit variance fences that off; zero mean makes the answer unique; decorrelation stops feature #2 from being a copy of feature #1. What survives inside the fences is the slowest non-trivial, non-redundant direction — try to find it yourself below, then let the closed form snap to it.
Slowness 𝔼ₜ[(Δf)²] = 0.221 (optimum 0.009) · alignment with the true slow factor |corr| = 47%. This direction still passes stripe flicker through to f. Slide α (or snap): because SFA is linear, the slowest direction has a closed-form solution — no gradient descent needed.
Deep and nonlinear SFA. SFA learns nonlinear features by applying a nonlinear basis expansion first — commonly quadratic, replacing with the vector of all products — and then running linear SFA. Stacking (linear SFA → expansion → linear SFA → …) yields deep slow feature extractors. Trained on natural video patches, quadratic SFA learns features with the hallmarks of complex cells complex cell A V1 cell responding like a simple cell but invariant to small position shifts — the inspiration for pooling units; ≈ the L² norm of a quadrature pair of simple cells. defined in ch. 9 — open in glossary in V1 (Berkes & Wiskott 2005); trained on random 3-D camera motion, deep SFA learns features resembling the navigation cells of rat brains (Franzius et al. 2007) — a reasonably biologically plausible model.
A distinctive advantage: SFA’s output is theoretically predictable even in the deep nonlinear setting. Knowing how the environment’s underlying factors change (e.g. the distribution over camera position and velocity), one can solve analytically for the optimal features — and deep SFA experiments do recover the predicted functions, where most learning algorithms’ outcomes depend inscrutably on pixel-level details of the cost. It has also been used for object recognition and pose estimation (Franzius et al. 2008). Yet the slowness principle has powered no state-of-the-art application so far. One speculation: the prior is too strong — demanding features be approximately constant punishes the position of a fast-moving object, when what we really want is features that are easy to predict from one step to the next. An object’s position is useful whether its velocity is high or low.
Next: a linear factor model whose encoder is an optimization problem — sparse coding, and the manifold view of PCA.
Check yourself — linear factor models, probabilistic PCA, ICA & SFA
1.What defines the linear factor model family?
2.The ONLY difference between factor analysis and probabilistic PCA is…
3.Why must p(h) be non-Gaussian for ICA to work?
4.Predict the outcome — in the ICALab, switch on "Gaussian sources" and sweep the rotation θ. What happens to the Σ|kurtosis| readout?
5.Predict the outcome — delete SFA's unit-variance constraint 𝔼ₜ[f²] = 1 (eq 13.10). What now minimizes the slowness objective?
6.What happens to probabilistic PCA as σ → 0?