§16.2.6 Converting between directed and undirected graphs
No probabilistic model is inherently directed or undirected — a model is just more easily described one way or the other. We commonly call RBMs undirected and sparse coding directed, but either language can represent any distribution: in the worst case a complete graph does it (a directed complete graph orders the variables and gives each all its predecessors as parents; an undirected complete graph is one clique over everything). Such graphs are useless precisely because they imply no independences. The whole game is to pick the graph that implies as many true independences as possible — and directed and undirected graphs can each express independences the other cannot.
A directed model can hold an immorality immorality A directed sub-structure — two unconnected co-parents of a child — that no undirected graph can represent perfectly; converting to undirected requires 'moralizing' it. defined in ch. 16 — open in glossary — two unconnected parents of a shared child — which no undirected graph captures. To go directed → undirected we moralize moralized graph The undirected graph obtained from a directed one by connecting all co-parents ('marrying' them) and dropping arrow directions; may add many edges and thus lose independences. defined in ch. 16 — open in glossary : “marry” the co-parents with an edge, then drop the arrows. An undirected model can hold a chordless loop of length > 3, which no directed model captures; to go undirected → directed we triangulate triangulated (chordal) graph An undirected graph whose loops of length >3 all have a chord; a loop must be triangulated (chords added) before its undirected model can be converted to a directed one. defined in ch. 16 — open in glossary (add chords) and orient the edges without creating a cycle. Step through both:
11 · A directed immorality
a and b are both parents of c, with no edge between them. The V-structure encodes a ⊥ b (they are independent a priori) — an independence no undirected graph can reproduce exactly.
§16.2.7 Factor graphs
Standard undirected notation is ambiguous: a clique of three connected nodes might carry one factor over all three, or three pairwise factors — the graph looks identical, yet the two cost very differently to represent and compute. A factor graph factor graph A bipartite drawing of an undirected model with explicit square factor nodes joined to their variable (circle) nodes, resolving the ambiguity of which cliques carry which factors. defined in ch. 16 — open in glossary removes the ambiguity by drawing the factors explicitly. It is bipartite: round nodes are variables, square nodes are factors , and an edge joins a variable to a factor iff that variable is one of the factor’s arguments (never variable–variable or factor–factor):
§16.3 Sampling from graphical models
Directed models support a simple, fast procedure: ancestral sampling ancestral sampling Draw a sample from a directed model by sampling the variables in topological (parents-first) order from their local conditionals; fast and exact, but directed-only. defined in ch. 16 — open in glossary .
- 1Sort the variables into a topological order ⓘ
- 2for to :
- 3sample ⓘ
- 4return ⓘ
Ancestral sampling is fast and convenient, but it has two limits: it works only for directed models, and it cannot easily draw conditional samples unless the conditioning variables happen to come first in the ordering (otherwise you would need the model’s posterior, which is usually not available). Undirected models have no such parents-first order, so we fall back on Gibbs sampling gibbs sampling Sample an undirected model by repeatedly resampling each xᵢ from p(xᵢ | its neighbors); a multi-pass process whose distribution only converges to p(x) asymptotically (ch17). defined in ch. 16 — open in glossary : repeatedly resample each variable given its neighbors. Crucially, one sweep is not a fair sample — only after many sweeps does the chain approach , and asymptotically at that. Compare the two:
Each node is drawn from p(xᵢ | parents) — and its parents are already sampled, so a single sweep yields an exactsample. Fast and convenient, but works only for directed models.
§16.4 Advantages of structured modeling
| Benefit | Where it comes from | |
|---|---|---|
| Cheaper representation | fewer parameters to store | omitted edges = interactions we choose not to model |
| Cheaper learning | less data, less compute to fit | small factors ⇒ few parameters ⇒ statistically efficient |
| Cheaper inference | faster marginals/conditionals | the graph localizes the computation |
| Faster sampling (directed) | ancestral sampling in one pass | topological order + easy local conditionals |
| Separates knowledge from inference | modular design & debugging | representation of knowledge ⟂ learning/inference |
The mechanism behind every row is the same: graphical models convey information by leaving edges out. Every absent edge is a declared assumption that a direct interaction is unnecessary — and that is what buys the cheaper representation, learning, inference, and (for directed models) sampling. Next: how deep learning captures dependencies with latent variables, the intractability of inference, and the RBM.
Check yourself — conversions, factor graphs & sampling
1.To convert a directed model with an immorality (a → c ← b, no a–b edge) into an undirected model, what must you do, and what is lost?
2.Why can't the undirected 4-loop a–b–c–d–a be converted to a directed model as-is?
3.What ambiguity does a factor graph resolve?
4.Predict the outcome — in SamplingLab you run ancestral sampling on the directed chain, then switch to Gibbs on the undirected loop and click 'sweep' once. What does each show?
5.What is the single underlying mechanism behind ALL the advantages of structured modeling?