Linear Factor Models
The simplest generative models share one template: a latent variable drawn from a fixed prior, run through a linear decoder, plus noise. Probabilistic PCA, factor analysis, independent component analysis, and sparse coding are all this template with a different prior on the latents and a different noise model.
╌╌╌╌
A generative model proposes a process for how the data was made and then fits that process to the data. The simplest such process is linear: a small set of hidden causes , drawn from a fixed prior, with each observation a linear mix of those causes plus noise. Every model in this lesson (probabilistic PCA, factor analysis, independent component analysis, sparse coding) instantiates this process; they differ only in the prior and the noise.1
The shared template
A linear factor model posits a latent vector and an observed vector related by a linear decoder:
where is the factor-loading matrix, the mean, and the noise is independent of . The columns of are the factors: reads each observation as a weighted sum of a fixed set of directions, the weights being the latents.
The dependency structure is directed: the latent causes generate the observations, never the reverse. Each fans out through column to influence every coordinate of .
Fixing the prior to a standard Gaussian and the decoder to be linear makes the whole joint distribution tractable, because affine maps of Gaussians stay Gaussian. That is the regime of the first two models.
Probabilistic PCA and factor analysis
Take the latent prior to be a unit Gaussian and the noise to be Gaussian as well. Factor analysis allows the noise to have a different variance on each coordinate; probabilistic PCA forces one shared variance. Both write
with the noise covariance diagonal. The two models are the two choices of :
The marginal over the data
Because is an affine function of the jointly Gaussian pair , the marginal is Gaussian, and we only need its mean and covariance. Using and , independence of and the noise:
So the model says the data is a Gaussian whose covariance is low-rank plus diagonal:
The columns of supply a rank- chunk of the covariance, the shared, correlated structure, while mops up the per-coordinate residual. This is the whole content of the models: explain the correlations in with few factors, and dump everything left over into independent noise.2
Classical PCA is therefore the corner of this family: a deterministic projection onto the leading eigenvectors, with no noise model at all. The probabilistic version adds back a likelihood, which is what lets it generate new samples and handle missing data.3
The geometric difference between PPCA and FA is the shape of the noise. Isotropic noise (PPCA) is a round blur identical on every axis. Diagonal noise (FA) is an axis-aligned blur that can be wider on some coordinates than others.
Both models are fit by maximum likelihood — closed-form for PCA, by expectation-maximization for general FA and PPCA, alternating between inferring the posterior over and re-estimating .
A worked covariance decomposition
For example, take observed coordinates and latent factor, with a factor-loading vector and diagonal noise
The model predicts . The rank-one outer product is
and adding to the diagonal gives the full model covariance
Read the structure directly off the matrix. The off-diagonal entries come entirely from : coordinates and co-vary at because both load positively on the factor, while coordinate anti-correlates () because it loads negatively. The single hidden cause explains every correlation among the three observations. The diagonal splits into a shared part and a private part: variance of is (from the factor) plus (its own noise). A fit with factors would explain the covariance with numbers here ( plus ) instead of the free entries of a full covariance — the compression that makes the model useful grows as climbs and stays small.
The posterior over the latent given an observation follows from the same Gaussian algebra. For a point with , the posterior mean is . Here , and , so
The point is best explained by a factor firing at about ; multiplying back through gives the reconstruction , and the gap is what the noise model absorbs.
Independent component analysis
Gaussian latents are convenient but they throw away information: a Gaussian is rotationally symmetric, so is only identifiable up to an orthogonal rotation, and you cannot tell which factor is which. Independent component analysis (ICA) abandons the Gaussian prior precisely to recover the individual sources. It assumes the latents are statistically independent and non-Gaussian, and the decoder is (in the basic form) noise-free and square:
The canonical setting is the cocktail-party problem: microphones record speakers talking at once, each microphone picking up a different linear mixture. ICA recovers the original voices (blind source separation) knowing only the mixtures, not the mixing matrix.4
Why non-Gaussianity is required
The identifiability argument is sharp. Suppose the sources were Gaussian: . For any orthogonal (), the rotated latent is also — the standard Gaussian is rotation-invariant. Then the mixing produces an identical data distribution:
so and are indistinguishable from the data alone, for every rotation . The sources are recoverable only up to an arbitrary rotation, exactly the non-identifiability that FA inherits. Non-Gaussian sources break this symmetry: a non-Gaussian distribution is not rotation-invariant, so only the true unmixing makes the recovered components independent.
Practically, ICA maximizes a non-Gaussianity contrast (kurtosis or negentropy) of the recovered components , since by the central limit theorem a mixture of independent signals is more Gaussian than its parts, so the most non-Gaussian projections are the un-mixed sources.5
For example, suppose two independent sources are mixed by
Given the mixtures , ICA searches for the unmixing matrix ; inverting the (determinant ) gives
For a specific sample , applying the estimated unmixing recovers — the original source amplitudes, up to the scale and sign freedoms in the theorem. In practice is not handed to the algorithm; it is found by rotating the whitened data until the two output coordinates are maximally non-Gaussian, at which point their scatter looks like the pinned square on the right above rather than the ambiguous round blob on the left.
Sparse coding
The previous models keep the latent dimension small. Sparse coding goes the other way: it uses an overcomplete dictionary (, more factors than data dimensions) but insists that each observation uses only a few of them. The prior on is sharply peaked at zero (a Laplace, equivalently an penalty), so most components are exactly zero.
Inference is an optimization
There is no closed-form posterior. For a fixed dictionary , the code for an input is the MAP estimate: minimize reconstruction error plus the penalty that comes from the Laplace prior:
This is the LASSO: convex in , with a non-smooth term that drives most coordinates to exactly zero. Learning alternates between this sparse inference and a dictionary update on .
- 1initialize dictionary randomly, columns unit-norm
- 2repeat
- 3for each input in the batch dosparse inference (LASSO)
- 4
- 5dictionary update
- 6renormalize each column of to unit lengthprevent blow-up
- 7until converged
- 8return
Geometrically, the input is reconstructed as a sparse weighted sum: out of a large dictionary, only a handful of atoms switch on, each scaled by its (nonzero) code.
Learned dictionaries are Gabor-like
Trained on natural image patches, the learned atoms reliably become localized, oriented, band-pass edge detectors, the discrete analogue of Gabor filters and a close match to the receptive fields of simple cells in the primary visual cortex. Sparsity is doing the work: forcing each patch to be explained by few atoms pushes the dictionary toward a basis of elementary edges that compose efficiently.6
The family, side by side
All four models are one template, , distinguished by the prior on , the noise, and what structure they recover.
| model | prior | noise | dimension | recovers |
|---|---|---|---|---|
| probabilistic PCA | isotropic | principal subspace | ||
| factor analysis | diagonal | shared correlations | ||
| ICA | independent, non-Gaussian | none (or small) | independent sources | |
| sparse coding | Laplace / (sparse) | Gaussian | (overcomplete) | sparse edge dictionary |
Gaussian priors (PPCA, FA) give tractability at the cost of identifiability; ICA drops the Gaussian to make individual sources identifiable; sparse coding drops the small latent dimension for an overcomplete, interpretable basis. Each is a different answer to the same question: what simple hidden causes, linearly combined, produced this data?
Linear factors in the deep era
The linear decoder looks primitive next to a neural network, yet each model in this lesson has a direct descendant in current practice, and the reasons they were introduced still hold.
Sparse coding survives as dictionary learning and regularization. Olshausen and Field's original result — that a sparsity prior on natural image patches yields Gabor-like edge filters — was the first computational account of why V1 simple cells look the way they do, and it remains the standard reference for sparse dictionary methods.7 The same penalty reappears everywhere a model should use few active units: LASSO regression, sparse attention, and the sparse autoencoders now used to pull interpretable features out of large language models are the same objective with a learned nonlinear encoder in place of the LASSO solve.
ICA is still the default for blind source separation. The FastICA algorithm, which maximizes negentropy by a fixed-point iteration, made ICA fast enough for routine use and is the tool of choice for removing eye-blink and heartbeat artifacts from EEG and MEG recordings, where the independent sources are literally distinct physical generators.8 The non-Gaussianity argument from this lesson explains why it works: neural and muscular sources are heavy-tailed, so their independent directions are identifiable.
The template itself became the encoder–decoder. Replacing the linear map with a deep network, and the closed-form Gaussian posterior with an amortized neural approximation, turns factor analysis into the variational autoencoder of Kingma and Welling — same latent-variable-and-decoder graph, same Gaussian prior, now nonlinear and trained by stochastic gradients.9 Read this way, the rest of the chapter is one long answer to a question the linear models raised and could not fully answer: how to keep the latent-variable structure when the decoder is an arbitrary neural network.
Footnotes
- Goodfellow, Deep Learning, Ch. 13 — linear factor models as the common template , with the prior and noise model distinguishing each member. ↩
- Goodfellow, Deep Learning, §13.1 — factor analysis: a Gaussian latent prior and diagonal noise give the data a low-rank-plus-diagonal covariance . ↩
- Goodfellow, Deep Learning, §13.1 — probabilistic PCA as factor analysis with isotropic noise , recovering classical PCA in the limit. ↩
- Goodfellow, Deep Learning, §13.2 — independent component analysis and blind source separation: independent, non-Gaussian latents and a (near-)noiseless mixing. ↩
- Goodfellow, Deep Learning, §13.2 — why a Gaussian prior leaves identifiable only up to rotation, and how non-Gaussianity (kurtosis/negentropy contrasts) pins the sources down. ↩
- Goodfellow, Deep Learning, §13.4 — sparse coding with an overcomplete dictionary and an /Laplace prior, and the Gabor-like atoms it learns on natural image patches. ↩
- Olshausen & Field,
Emergence of simple-cell receptive field properties by learning a sparse code for natural images,
Nature 381 (1996) — sparse coding on natural image patches yields localized, oriented, band-pass filters matching V1 simple cells. ↩ - Hyvärinen & Oja,
Independent Component Analysis: Algorithms and Applications,
Neural Networks 13 (2000) — the FastICA fixed-point algorithm maximizing negentropy, and its use in EEG/MEG artifact removal. ↩ - Kingma & Welling,
Auto-Encoding Variational Bayes,
ICLR 2014 — the variational autoencoder: factor analysis's latent-variable template with a deep decoder and an amortized approximate posterior. ↩
╌╌ END ╌╌