§16.2.4–16.2.5Energy-Based Models · Separation and D-Separation

Part III DL pp. 569–575 · ~7 min read

  • energy-based model
  • energy function
  • boltzmann distribution
  • boltzmann machine
  • product of experts
  • free energy
  • separation
  • d-separation
  • active path
  • explaining away
  • v-structure (collider)
  • context-specific independence

§16.2.4 Energy-based models

Many useful theoretical results about undirected models require that p~(x)>0\tilde{p} (\boldsymbol{x}) > 0 everywhere. The cleanest way to guarantee it is to write the unnormalized probability as the exponential of a negated energy function — an energy-based model (EBM):

The energy-based model (eq 16.7)

p~(x)=exp ⁣(E(x))\tilde{p}(\boldsymbol{x}) = \exp\!\left(-E(\boldsymbol{x})\right)
E(x)E(\boldsymbol{x})the energy function — LOW energy = HIGH probability. Any real-valued function works; you are free to choose itscalar
exp(E)\exp(-E)exp is positive for every input, so p̃ can approach 0 but never reach it — the ∀x, p̃(x)>0 condition holds automaticallyscalar > 0
-the minus sign is pure physics convention (E = physical energy there); Smolensky called −E the "harmony". It carries no machine-learning contentsign

Learning an energy function is easier than learning clique potentials directly: because any EE already gives a positive p~\tilde{p}, training is unconstrained optimization rather than constrained (we never have to manually enforce a minimum probability). Any distribution of this exponential form is a Boltzmann distribution , and for that reason many energy-based models are called Boltzmann machines (Fahlman et al., 1983; Ackley et al., 1985; Hinton and Sejnowski, 1986). The terminology has drifted: the name once meant a purely binary model, but today real-valued variants exist (e.g. the mean–covariance RBM), and “Boltzmann machine” now usually designates a model with latent variables — without them, the same object is more often called a Markov random field or log-linear model.

Energy terms are cliques. Since exp(a)exp(b)=exp(a+b)\exp(a)\exp(b) = \exp(a+b), a product of clique potentials becomes a sum of per-clique energies: each additive term of EE corresponds to one clique. Reading an energy off a graph is therefore just reading its cliques, with ϕC=exp(EC)\phi_{C} = \exp(-E_{C}):

Fig 16.5 — the same graph as fig 16.4, read as an energy. Each pairwise clique contributes one additive energy term; click a node to see which terms it enters. φ_{a,b} = exp(−E_{a,b}).
abcdef
E(a,,f)=E(a,\ldots,f) =Ea,b(a,b)E_{a,b}(a,b)+ Eb,c(b,c)+\ E_{b,c}(b,c)+ Ea,d(a,d)+\ E_{a,d}(a,d)+ Eb,e(b,e)+\ E_{b,e}(b,e)+ Ee,f(e,f)+\ E_{e,f}(e,f)

click a node to see which factors mention it

An EBM is a product of experts

Each energy term can be read as an expert (Hinton, 1999) that enforces one soft constraint on a low-dimensional slice of the variables. Combined by multiplying probabilities (adding energies), the experts jointly enforce a complicated high-dimensional constraint — a product of experts . Unlike a mixture (where one component must explain the whole example), every expert must be satisfied at once, so a state is probable only if it pleases them all.

When a model has latent variables h\boldsymbol{h}, some algorithms are phrased in terms of the free energy — the energy of x\boldsymbol{x} after marginalizing them out:

Free energy (eq 16.8)

F(x)=loghexp ⁣(E(x,h))F(\boldsymbol{x}) = -\log \sum_{\boldsymbol{h}} \exp\!\left(-E(\boldsymbol{x}, \boldsymbol{h})\right)
hexp(E(x,h))\sum_{\boldsymbol{h}} \exp(-E(\boldsymbol{x},\boldsymbol{h}))marginalize the latents: sum the joint p̃(x,h) over all h to get p̃(x)scalar > 0
log()-\log(\cdot)take the negative log, putting the marginal back into "energy" units so F(x) plays the role of an energy for x alonescalar
F(x)F(\boldsymbol{x})the free energy; p̃(x) = exp(−F(x)). This book usually prefers the more general log p̃(x) formulationscalar

§16.2.5 Separation and d-separation

Edges tell us which variables interact directly. We usually also want to know which variables are conditionally independent — and crucially, some indirect interactions can be switched on or off by observing other variables.

In an undirected graph this is called separation : a set AA is separated from BB given SS if every path between them passes through an observed variable. A path through only unobserved variables is an active path (the endpoints stay dependent); a path containing an observed variable is inactive (blocked). We shade observed variables in.

For directed graphs the same idea is called d-separation (“d” for dependence), but deciding whether a path is active is subtler. Every length-2 path falls into one of four patterns — and the collider behaves backwards from the rest. Explore all four: click the middle variable ss (and, in the last case, the child cc) to observe or un-observe it, and watch independence flip:

Fig 16.8 — the four active-path patterns. In a chain or common-cause fork, observing s BLOCKS the path (a ⊥ b | s). In a collider a→s←b the opposite holds: observing s (or any descendant c) ACTIVATES the path — the explaining-away effect.
absunobserved
path ACTIVE — a, b dependent
a ⊥̸ b |
NOT d-separated

The relay-race pattern. Observing the middle variable s blocks the flow between a and b.

Click s to toggle observation (shaded = observed). a and b are the query endpoints.

Explaining away, in words

Your colleague is absent (ss). She might be sick (aa) or on vacation (bb) — a priori independent causes. Learn nothing and a,ba, b stay independent. But observe the absence and they become dependent: if you then learn she is on vacation, that explains away the absence and makes “sick” less likely. This is why the V-structure (collider) is the one pattern activated by observation — and it fires even if only a descendant of ss (a report you didn’t receive) is observed. The only way to block a collider is to observe none of its descendants.

Reading these rules off a larger graph is mechanical. Take the book’s fig 16.9 (a and b both parents of c; c the parent of d and e) and click through it:

Fig 16.9 — a directed model to read d-separations from. a and b collide at c; c is the common cause of d and e.
abcde
p(a,b,c,d,e)=p(a,b,c,d,e) =p(a)p(a)p(b)p(b)p(ca,b)p(c \mid a,b)p(dc)p(d \mid c)p(ec)p(e \mid c)

click a node to see which factors mention it

Reading fig 16.9. Click a row for the rule that makes it true.
Claimd-separated?
a, b given ∅a ⊥ b | ∅yes — collider blocks
a, e given ca ⊥ e | cyes — chain blocked by c
d, e given cd ⊥ e | cyes — fork blocked by c
a, b given ca ⊥̸ b | cNO — collider opened by c
a, b given da ⊥̸ b | dNO — descendant opens collider
Dotted-underlined cells have explanations — click one.

Two cautions close the section. A graph never implies an independence that is false — but it may fail to encode one that is true. When a=0a=0 makes bb and cc independent while a=1a=1 forces b=cb=c, that context-specific independence cannot be drawn as graph structure (the edge needed for a=1a=1 hides the independence at a=0a=0). And in the worst case the complete graph — every possible edge — represents any distribution at all, precisely because it implies no independences. The art is to imply as many true independences as possible, and no false ones.

Next: converting between the two graph languages, factor graphs, sampling, and why structure helps.

Check yourself — energy-based models & (d-)separation

1.Why write an undirected model as p̃(x) = exp(−E(x)) instead of learning the clique potentials φ directly?

2.How do the additive terms of an energy function relate to the graph?

3.In a chain a → s → b, what happens to the a–b path when you observe s?

4.Predict the outcome — in DSeparationLab you select the collider (a → s ← b) and click s to observe it. What does the readout show?

5.A collider a → c ← b has a descendant d (c → d). What blocks the a–b path?

5 questions