§16.5 Learning about dependencies
A good generative model must capture the distribution over the visible variables , whose elements are usually highly dependent on one another. There are two ways to model those dependencies. The traditional way is structure learning structure learning Searching (usually greedily) for a good graph structure by proposing edge add/removes and scoring accuracy vs complexity; deep learning avoids it by using latent variables instead. defined in ch. 16 — open in glossary : search — usually greedily — over graph structures, training and scoring each (accuracy minus a complexity penalty), adding and removing edges. The deep-learning way is to introduce latent latent variable A random variable that is never observed directly, like the mixture's component identity c. defined in ch. 3 — open in glossary (“hidden”) variables and connect every visible to them, so that any two visibles interact indirectly through — no direct visible–visible edges, no discrete structure search:
Latent variables earn their keep twice over. Beyond capturing cheaply, is itself an alternative representation of : as with the mixture of Gaussians (whose latent component index classifies the input) or sparse coding, the learned or makes an excellent feature vector — feature learning is latent- variable learning.
§16.6 Inference and approximate inference
We constantly need to answer questions like “given these visibles, what are the latents?” — to extract features , or to train by maximum likelihood, which needs :
Why inference is unavoidable (eq 16.9)
| the POSTERIOR over latents given the data — needed both to take the expectation and inside the bracket. Computing it is the inference problem | distribution over h | |
| the joint, which the model defines directly (e.g. via an energy). The easy part | scalar | |
| to even evaluate the log-likelihood we must average under the posterior — so a learning rule is built on inference | expectation |
For most interesting deep models this inference is intractable, even with a graph: the graphs used in deep learning are expressive but not restrictive enough to permit efficient exact inference.
Just how hard? #P-hard.
Computing the marginal probability of a general graphical model is #P-hard — the counting analogue of NP (where NP asks whether a solution exists, #P asks how many do). Encode a 3-SAT formula as a graphical model with one latent per clause and a reduction tree of “all satisfied?” latents; the marginal at the root then reports what fraction of assignments satisfy the formula. Such worst cases — and NP-hard graphs — arise in real problems, which is why we turn to approximation.
In deep learning that approximation is almost always variational inference: replace the true posterior with a tractable chosen as close to it as possible — the whole subject of chapter 19.
§16.7 The deep-learning approach to graphical models
Deep learning uses the same graphical-model tools as everyone else, but makes systematically different design choices — so different that the resulting models have their own flavor:
| Dimension | Traditional graphical models | Deep learning | |
|---|---|---|---|
| Latent variables | how many, and why | few, mostly observed variables | many — usually MORE latents than observed |
| Latent semantics | meaning of a latent | designed with a specific meaning | unspecified — the algorithm invents them |
| Connectivity | how nodes connect | few, individually designed edges | dense group-to-group via a matrix |
| Inference algorithm | how questions are answered | exact inference, or loopy belief propagation | Gibbs sampling or variational inference |
| Graph depth | what "deep" means | shallow graphs | shallow GRAPH, deep computation |
Tolerance of the unknown
The defining attitude: rather than simplify the model until everything is exactly computable, deep learning increases the model’s power until it is just barely trainable. We routinely use models whose marginals cannot be computed and are content to draw approximate samples; we train with objective functions we cannot even evaluate, as long as we can efficiently estimate their gradient. Figure out the minimum information you truly need — then approximate that, fast. Loopy belief propagation loopy belief propagation A popular approximate-inference algorithm for sparsely-connected traditional graphical models; almost never used in deep learning, whose distributed representations make graphs too dense. defined in ch. 16 — open in glossary , a staple elsewhere, is almost never used here.
§16.7.1 Example: the restricted Boltzmann machine
The restricted Boltzmann machine restricted boltzmann machine (rbm) An energy-based model with binary v, h and energy −bᵀv − cᵀh − vᵀWh, with NO intra-layer edges → factorial p(h|v) & p(v|h) with sigmoid conditionals → efficient block Gibbs sampling; the canonical deep-learning graphical model. defined in ch. 16 — open in glossary (RBM), or harmonium (Smolensky, 1986), is the quintessential deep-learning graphical model. It is not itself deep — it has a single latent layer — but it is the building block of many deeper models (chapter 20), and it exemplifies every practice above: units in layers, connectivity by a matrix, relatively dense, designed for efficient Gibbs sampling, latent semantics left to the training algorithm. It is an energy-based model energy-based model An undirected model written p̃(x)=exp(−E(x)), guaranteeing p̃>0 and allowing unconstrained learning of the energy function E. defined in ch. 16 — open in glossary with binary visible and hidden units:
The RBM energy (eq 16.10)
| visible biases: b sets each visible unit's baseline tendency to be on | b ∈ ℝⁿ_v | |
| hidden biases: c sets each hidden unit's baseline | c ∈ ℝⁿ_h | |
| the ONLY interaction term: a single weight matrix couples every visible to every hidden — and there are no v–v or h–h terms | W ∈ ℝ^{n_v×n_h} |
The energy has no visible–visible or hidden–hidden term — that is the “restricted” (a general Boltzmann machine allows arbitrary connections). Drawn as a Markov network it is bipartite:
Because no unit shares a layer with a unit it depends on, the layer-wise conditionals factorize — (eq 16.11) and likewise for (eq 16.12) — and each individual conditional is just a sigmoid:
The RBM hidden-unit conditional (eq 16.13, as printed)
| the total input to hidden unit i: the visible vector dotted with W's i-th column (unit i's incoming weights) | scalar | |
| the bias of hidden unit i. NOTE the book's local notation clash: this is the hidden bias written c in eq 16.10 — here eq 16.13 prints it as bᵢ | scalar | |
| the logistic sigmoid → a probability in (0,1). Every hidden unit turns on independently given v, so the whole layer samples at once | probability |
Worked example — one sigmoid conditional
Take hidden unit 1 with incoming weights and bias , and visibles . Then , plus the bias gives , so — a near coin-flip. Change and the probability slides; that is exactly what the sampler below computes for every unit.
Together, the factorial conditionals enable block Gibbs sampling block gibbs sampling Gibbs sampling that resamples a whole conditionally-independent group at once (all h given v, then all v given h in an RBM), exploiting the model's factorial conditionals. defined in ch. 16 — open in glossary : sample all of at once from , then all of at once from , alternating. Step it:
No hidden–hidden or visible–visible edges means every unit in a layer is conditionally independent of the rest of its layer given the other layer — so the whole block samples at once, each unit from a simple sigmoid. Alternating h, v, h, v… is block Gibbs sampling, and it is what makes the RBM cheap to train (ch18).
Finally, because the energy is linear in the parameters, its derivatives are trivial — e.g. (eq 16.15). Efficient block Gibbs sampling and efficient derivatives are exactly what make the RBM convenient to train (chapter 18 shows how undirected models are trained from such derivatives on model samples). Training induces a representation ; serves as features for .
The RBM thus distills the whole deep-learning approach to graphical models: representation learning through layers of latent variables, with efficient matrix-parametrized interactions between layers. With this language in hand, the chapters ahead describe a wide variety of deep probabilistic models.
Check yourself — latent variables, inference & the RBM
1.How does deep learning capture dependencies among visible variables, instead of using structure learning?
2.Why does maximum-likelihood training force us to confront inference?
3.Why is loopy belief propagation almost never used in deep learning?
4.What makes an RBM 'restricted', and why does it matter?
5.Predict the outcome — in BlockGibbsLab with v = (1,0,1), you click 'sample the hidden block'. What is computed for each hidden unit?