Directed Graphical Models
Page 806 established that a probabilistic model is its joint distribution. That settled what the object is and left a problem: the book’s own words, “the joint distribution by itself can be quite complicated, and it does not tell us anything about structural properties of the probabilistic model. For example, the joint distribution does not tell us anything about independence relations.”
This page is the notation that fixes that. You draw the model, and then you read facts off the drawing that would otherwise require algebra. Measured: all four of Example 8.9’s conditional-independence claims come out correct on four million samples, and the factorization they encode replaces free parameters with .
What you’ll learn
Section titled “What you’ll learn”- The two rules that turn a factorization into a graph, and Equation 8.31 that turns it back.
- Why the compression matters: parameters become on five binary variables, and become on a hundred.
- Plate notation, and why a plate is literally a product.
- d-separation: the three-case rule for reading conditional independence off a picture.
- All four of Example 8.9’s claims, measured: , , , .
- The one rule that runs backwards — conditioning on a collider creates a dependence. Measured: goes from to with no change to the model at all.
- Why the book cautions that “the graph layout depends on the choice of factorization” — the same joint admits graphs pointing opposite ways.
Intuition: a picture you can compute with
Section titled “Intuition: a picture you can compute with”Most diagrams in a paper are illustrations. This one is not. It is a lossless encoding of a factorization, and every property you can see in it is a property the distribution provably has.
Two things make it worth learning:
It compresses. A joint over binary variables has free numbers — more than there are atoms in a galaxy. Assert that each variable depends on at most two others and it becomes . That is not an approximation; it is a statement about which dependencies exist, and the graph is how you write that statement down.
It answers questions without algebra. Is independent of once I know ? You could integrate. Or you could trace paths in a picture and apply three rules. The picture is the book’s “simple language for describing complex interdependence”.
The one trap: the third rule runs the opposite way from the other two. Observing something can make two variables dependent that were independent before — and the page measures exactly how much.
flowchart TD F["a FACTORIZATION of the joint
p(x1)p(x5)p(x2|x5)p(x3|x1,x2)p(x4|x2)"] F -->|"node per variable,
arrow from each parent"| G["the GRAPH"] G -->|"Equation 8.31"| F G --> C1["COUNT: 31 parameters become 10
(2^100 - 1 becomes 395 at K=100)"] G --> C2["READ: d-separation gives
conditional independence by inspection"] C2 --> R1["head-to-tail at a node IN C: blocked"] C2 --> R2["tail-to-tail at a node IN C: blocked"] C2 --> R3["head-to-head: blocked UNLESS the node
or a descendant is in C"] R3 --> W["the rule that runs backwards:
corr(a,c) goes 0.000079 to 0.237939"]
§8.5.1 Graph semantics
Section titled “§8.5.1 Graph semantics”Nodes are random variables. Directed links (arrows) between two nodes indicate conditional probabilities. The arrow carries .
From a factorization to a graph — Example 8.7
Section titled “From a factorization to a graph — Example 8.7”Given
the factorization already says everything: ” depends directly on and ; depends directly on ; depends neither on nor on .” That is Figure 8.9(a).
The general construction is two rules:
- Create a node for all random variables.
- For each conditional distribution, add a directed link to the graph from the nodes corresponding to the variables on which the distribution is conditioned.
From a graph to a factorization — Example 8.8
Section titled “From a graph to a factorization — Example 8.8”Run it backwards on Figure 8.9(b), using two properties:
- the joint is “the product of a set of conditionals, one for each node in the graph” — five nodes, five conditionals;
- “each conditional depends only on the parents of the corresponding node.”
and in general, Equation 8.31:
where means “the parent nodes of ” — the nodes with arrows pointing into .
Plates, and the Bernoulli example
Section titled “Plates, and the Bernoulli example”For a Bernoulli experiment repeated times,
which is a product “because the experiments are independent” — and the book connects that straight back to §6.4.5: statistical independence means that the distribution factorizes.
Drawing this needs one new convention: “we make the distinction between unobserved/latent variables and observed variables. Graphically, observed variables are denoted by shaded nodes.” Figure 8.10(a) draws once with an arrow to every — “the single parameter is the same for all as the outcomes are identically distributed.”
Figure 8.10(b) replaces the repetition with a plate: “the plate (box) repeats everything inside (in this case, the observations ) times. Therefore, both graphical models are equivalent, but the plate notation is more compact.”
Figure 8.10(c) then adds a hyperprior — “a second layer of prior distributions on the parameters of the first layer of priors” — a on . And a convention worth remembering: “if we treat and as deterministic parameters, i.e., not random variables, we omit the circle around it.”
§8.5.2 Conditional independence and d-separation
Section titled “§8.5.2 Conditional independence and d-separation”Directed graphical models “allow us to find conditional independence relationship properties of the joint distribution only by looking at the graph.” The concept is d-separation (Pearl, 1988).
For arbitrary nonintersecting sets of nodes , , , we want to know whether
is implied by the graph. The procedure: consider all possible trails — “paths that ignore the direction of the arrows” — from any node in to any node in . A trail is blocked if it contains a node where either holds:
The arrows on the path meet either head to tail or tail to tail at the node, and the node is in the set .
The arrows meet head to head at the node, and neither the node nor any of its descendants is in the set .
“If all paths are blocked, then is said to be d-separated from by , and the joint distribution over all of the variables in the graph will satisfy .”
The three meetings, in a table
Section titled “The three meetings, in a table”| meeting | shape | blocked when | the plain reading |
|---|---|---|---|
| head to tail | a relay; observing the middle cuts the wire | ||
| tail to tail | a common cause; observing it explains the shared part | ||
| head to head | and no descendant of is in | a collider; observing it opens the wire |
Two of the three rules say conditioning blocks. The third says conditioning opens. Every mistake with this notation lives in that third row.
Example 8.9, measured
Section titled “Example 8.9, measured”Figure 8.11’s edge structure is not in the PDF’s text layer. I recovered it from the vector layer — the line segments and arrowheads themselves — and got
That reconstruction is independently confirmed by the book’s own four claims: all four are correct for this DAG and at least one fails for every other edge set I considered. The book states them with a single sentence of justification — “Visual inspection gives us” — so here they are, checked on four million samples of a linear-Gaussian model on that DAG, where a zero partial correlation is exactly conditional independence:
The collider, isolated
Section titled “The collider, isolated”8.36 and 8.38 differ by one variable in the conditioning set. Nothing about the model changes:
The book closes the section with the payoff and a forward pointer: this representation “allows us to factorize the respective probabilistic models into expressions that are easier to optimize”, and the picture “allows us to visually see the impact of design choices we have made on the structure of the model” — choices which “affect the prediction performance, but cannot be selected directly using the approaches we have seen so far”. Choosing structure is §8.6.
§8.5.3 Further reading
Section titled “§8.5.3 Further reading”Three main families, all shown in Figure 8.12:
| family | also called | edges |
|---|---|---|
| directed graphical models | Bayesian networks | directed |
| undirected graphical models | Markov random fields | undirected |
| factor graphs | — | bipartite, factors and variables |
Bishop (2006, chapter 8) introduces them; Koller and Friedman (2009) give the extensive treatment. The practical payoff the book names is “graph-based algorithms for inference and learning, e.g., via local message passing”, with applications “from ranking in online games and computer vision (image segmentation, semantic labeling, image denoising, image restoration) to coding theory, solving linear equation systems, and iterative Bayesian state estimation in signal processing.”
Two topics flagged as important and out of scope: structured prediction (Bakir et al., 2007), for “predictions that are structured, for example sequences, trees, and graphs”, and the “renewed interest in graphical models due to their applications to causal inference” (Pearl, 2009; Peters et al., 2017).
Worked example by hand
Section titled “Worked example by hand”Take Figure 8.11 and answer a question the graph makes easy and the algebra makes tedious: is independent of given ?
Step 1: write the factorization from the graph. Equation 8.31, one factor per node, each conditioned on its parents:
Step 2: enumerate the trails from to . Ignoring arrow direction, every path:
| trail | nodes it passes through |
|---|---|
| , | |
| , |
Step 3: apply the rules with .
| trail | meeting at the node in | blocked? |
|---|---|---|
| at : is head to tail, and | ✅ blocked | |
| at : is head to tail, and | ✅ blocked |
Step 4: conclude. Every trail is blocked, so .
Step 5: sanity-check it against the structure. ’s only parent is , so once you know , nothing upstream can add information about — is a noisy copy of and nothing else. Any node is independent of the whole graph given its parents and children’s parents, and this is the simplest instance.
Step 6: notice what changes if you drop . With the first trail meets tail to tail at with — open. So unconditionally. Knowing tells you about , which tells you about , which tells you about . The conditioning set is not a detail; it is half the question.
See it move
Section titled “See it move”From scratch
Section titled “From scratch”import itertools
import numpy as np
# --- Equation 8.31 on Figure 8.9(b) --------------------------------------
# p(x1..x5) = p(x1) p(x5) p(x2|x5) p(x3|x1,x2) p(x4|x2)
p1 = np.array([0.3, 0.7])
p5 = np.array([0.6, 0.4])
p2_5 = np.array([[0.8, 0.2], [0.35, 0.65]])
p4_2 = np.array([[0.25, 0.75], [0.9, 0.1]])
p3_12 = np.array([[[0.5, 0.5], [0.1, 0.9]],
[[0.85, 0.15], [0.4, 0.6]]])
joint = np.zeros((2,) * 5)
for a, b, c, d, e in itertools.product(range(2), repeat=5):
joint[a, b, c, d, e] = (p1[a] * p5[e] * p2_5[e, b]
* p3_12[a, b, c] * p4_2[b, d])
print("=== 1. Equation 8.31 rebuilds the joint from the picture ===")
print(f"the factorized joint sums to {joint.sum():.12f}")
S = 4_000_000
rng = np.random.default_rng(5)
x1 = (rng.random(S) < p1[1]).astype(int)
x5 = (rng.random(S) < p5[1]).astype(int)
x2 = (rng.random(S) < p2_5[x5, 1]).astype(int)
x3 = (rng.random(S) < p3_12[x1, x2, 1]).astype(int)
x4 = (rng.random(S) < p4_2[x2, 1]).astype(int)
emp = np.zeros((2,) * 5)
np.add.at(emp, (x1, x2, x3, x4, x5), 1.0)
emp /= S
print(f"max |empirical - factorized| over 32 cells: "
f"{np.abs(emp - joint).max():.6f} ({S:,} samples)")
print("\nfree parameters:")
print(f" full joint over 5 binary variables : {2 ** 5 - 1}")
print(f" the Figure 8.9(b) factorization : {1 + 1 + 2 + 4 + 2}")
print(" p(x1):1 p(x5):1 p(x2|x5):2 p(x3|x1,x2):4 p(x4|x2):2")
print(f"\n{'K binary vars':>14} {'full joint':>13} {'2 parents each':>16} "
f"{'ratio':>12}")
for K in (5, 10, 20, 50, 100):
f_, c_ = 2.0 ** K - 1, 1 + 2 + 4 * (K - 2)
print(f"{K:>14} {f_:>13.4g} {c_:>16} {f_ / c_:>12.4g}")
print("this is the entire reason graphical models exist.")
# --- the layout depends on the factorization -----------------------------
print("\n=== 2. one joint, two legal graphs ===")
pab = np.array([[0.12, 0.28], [0.33, 0.27]])
pa, pb = pab.sum(1), pab.sum(0)
fwd = pa[:, None] * (pab / pa[:, None]) # p(a) p(b | a)
bwd = pb[None, :] * (pab / pb[None, :]) # p(b) p(a | b)
print("p(a, b) =")
for row in np.round(pab, 6):
print(" ", row.tolist())
print(f"a -> b, as p(a)p(b|a): max error {np.abs(fwd - pab).max():.2e}")
print(f"b -> a, as p(b)p(a|b): max error {np.abs(bwd - pab).max():.2e}")
print("both graphs are correct and they point opposite ways.")
# --- d-separation on Figure 8.11 -----------------------------------------
print("\n=== 3. Example 8.9's four claims, measured ===")
print("Figure 8.11: a -> b, a -> d, b -> c, c -> d, d -> e")
N = 4_000_000
r = np.random.default_rng(2024)
a = r.standard_normal(N)
b = 0.9 * a + r.standard_normal(N)
c = 0.8 * b + r.standard_normal(N)
d = 0.7 * a + 0.6 * c + r.standard_normal(N)
e = 1.1 * d + r.standard_normal(N)
V = {"a": a, "b": b, "c": c, "d": d, "e": e}
def partial_corr(u, v, given):
"""Zero iff u and v are conditionally independent, for Gaussians."""
U, W = V[u].copy(), V[v].copy()
if given:
Z = np.column_stack([V[g] for g in given] + [np.ones(N)])
U -= Z @ np.linalg.lstsq(Z, U, rcond=None)[0]
W -= Z @ np.linalg.lstsq(Z, W, rcond=None)[0]
else:
U -= U.mean(); W -= W.mean()
return float(U @ W / np.sqrt((U @ U) * (W @ W)))
claims = (("8.35", "b", "d", ["a", "c"], True),
("8.36", "a", "c", ["b"], True),
("8.37", "b", "d", ["c"], False),
("8.38", "a", "c", ["b", "e"], False))
print(f"\n{'eq':>6} {'claim':>20} {'book says':>12} {'partial corr':>14} "
f"{'measured':>12} {'':>9}")
for eq, u, v, g, indep in claims:
pc = partial_corr(u, v, g)
got = "independent" if abs(pc) < 0.002 else "dependent"
want = "independent" if indep else "dependent"
print(f"{eq:>6} {u + ' vs ' + v + ' | ' + ','.join(g):>20} {want:>12} "
f"{pc:>14.6f} {got:>12} {'ok' if got == want else 'MISMATCH':>9}")
# --- the collider, isolated ----------------------------------------------
print("\n=== 4. conditioning on a collider CREATES dependence ===")
print(f"{'conditioning set':>20} {'corr(a, c)':>13} what it is")
for g, note in ((["b"], "independent, Equation 8.36"),
(["b", "d"], "d is the collider itself"),
(["b", "e"], "e is only a DESCENDANT of d")):
print(f"{','.join(g):>20} {partial_corr('a', 'c', g):>13.6f} {note}")
print("nothing about a or c changed. Only what we looked at changed.")
# --- Equation 8.33: the plate is a factorization -------------------------
print("\n=== 5. Equation 8.33: a plate IS a product ===")
mu, Nf, T = 0.3, 6, 4_000_000
r2 = np.random.default_rng(8)
flips = (r2.random((T, Nf)) < mu).astype(int)
codes = flips @ (2 ** np.arange(Nf))
counts = np.bincount(codes, minlength=2 ** Nf) / T
pred = np.array([np.prod([mu if (k >> i) & 1 else 1 - mu for i in range(Nf)])
for k in range(2 ** Nf)])
print(f"mu = {mu}, all {2 ** Nf} sequences of {Nf} flips, {T:,} samples")
print(f"{'sequence':>10} {'measured':>12} {'product of Ber':>16} {'rel err':>10}")
for k in (0, 1, 21, 42, 63):
seq = "".join(str((k >> i) & 1) for i in range(Nf))
print(f"{seq:>10} {counts[k]:>12.6f} {pred[k]:>16.6f} "
f"{abs(counts[k] - pred[k]) / pred[k]:>9.3%}")
print(f"max absolute error over all {2 ** Nf} sequences: "
f"{np.abs(counts - pred).max():.6f}")
print(f"the predicted probabilities sum to {pred.sum():.10f}")
print("the plate says 'repeat N times'; Equation 8.33 says the joint is a")
print("product of Bernoullis. They are the same statement.")=== 1. Equation 8.31 rebuilds the joint from the picture ===
the factorized joint sums to 1.000000000000
max |empirical - factorized| over 32 cells: 0.000124 (4,000,000 samples)
free parameters:
full joint over 5 binary variables : 31
the Figure 8.9(b) factorization : 10
p(x1):1 p(x5):1 p(x2|x5):2 p(x3|x1,x2):4 p(x4|x2):2
K binary vars full joint 2 parents each ratio
5 31 15 2.067
10 1023 35 29.23
20 1.049e+06 75 1.398e+04
50 1.126e+15 195 5.774e+12
100 1.268e+30 395 3.209e+27
this is the entire reason graphical models exist.
=== 2. one joint, two legal graphs ===
p(a, b) =
[0.12, 0.28]
[0.33, 0.27]
a -> b, as p(a)p(b|a): max error 0.00e+00
b -> a, as p(b)p(a|b): max error 5.55e-17
both graphs are correct and they point opposite ways.
=== 3. Example 8.9's four claims, measured ===
Figure 8.11: a -> b, a -> d, b -> c, c -> d, d -> e
eq claim book says partial corr measured
8.35 b vs d | a,c independent -0.000320 independent ok
8.36 a vs c | b independent -0.000079 independent ok
8.37 b vs d | c dependent 0.272172 dependent ok
8.38 a vs c | b,e dependent -0.146064 dependent ok
=== 4. conditioning on a collider CREATES dependence ===
conditioning set corr(a, c) what it is
b -0.000079 independent, Equation 8.36
b,d -0.237939 d is the collider itself
b,e -0.146064 e is only a DESCENDANT of d
nothing about a or c changed. Only what we looked at changed.
=== 5. Equation 8.33: a plate IS a product ===
mu = 0.3, all 64 sequences of 6 flips, 4,000,000 samples
sequence measured product of Ber rel err
000000 0.117807 0.117649 0.134%
100000 0.050480 0.050421 0.118%
101010 0.009223 0.009261 0.413%
010101 0.009263 0.009261 0.019%
111111 0.000735 0.000729 0.823%
max absolute error over all 64 sequences: 0.000158
the predicted probabilities sum to 1.0000000000
the plate says 'repeat N times'; Equation 8.33 says the joint is a
product of Bernoullis. They are the same statement.On real data
Section titled “On real data”Reading the plot
Section titled “Reading the plot”The first figure is the notation and its justification side by side. The two left panels are Figure 8.9’s graphs with their factorizations printed underneath, and the mapping is mechanical in both directions: an arrow into a node is a variable in that node’s conditioning bar, and Equation 8.31 turns the picture back into a product. Checked against four million samples, the empirical joint matches the factorized one to across all thirty-two cells.
The right panel is why anyone bothers. The full joint over binary variables has free numbers. At that is already a million; at it is . Assert that each variable has at most two parents and the count becomes — a ratio of .
This is not compression in the lossy sense. The factorized model is exactly correct if the independence assertions hold. The graph is how you write down which ones you are asserting, and the parameter count is the measure of how much they buy. Figure 8.9(b)‘s own numbers — down to — are modest because five variables is a toy. Past about the unfactorized joint cannot be stored at all, so the graph stops being a convenience and becomes the only representation there is.
The second figure is the section’s central claim put to a test the book does not run. Figure 8.11’s edges are not in the PDF’s text layer — the text layer carries the five node labels and nothing about what connects them. Recovering them from the vector layer gives , , , , , and that reconstruction is independently confirmed by Example 8.9 itself: all four claims hold for this DAG, and I could not find another edge set where they all do.
The bars are four partial correlations on four million samples of a linear-Gaussian model, where zero partial correlation is exactly conditional independence rather than a proxy for it. Two come out at and ; two come out at and . The book justifies all four with the phrase “visual inspection gives us”, and visual inspection turns out to be right.
The third figure isolates the rule that catches people out. Equations 8.36 and 8.38 differ by one symbol in the conditioning set, and the three panels are the same four million samples with three different sets removed.
Given alone, the cloud is circular and the correlation is — and carry no information about each other. Add the collider and the cloud tilts: . Add only , which is not the collider but merely its child, and it still tilts: .
Nothing about or changed. The model is identical in all three panels; only what we looked at changed. The mechanism is arithmetic: is a weighted sum of and , so fixing forces the parts to trade — a high with a low implies a high . Observing instead is a blurred observation of , which is why is the weaker of the two and why the rule has to say “nor any of its descendants” rather than just naming the node.
Every other d-separation rule says conditioning blocks a path. This one says conditioning opens one, and it is the reason a graphical model cannot be read as a simple “information flows along arrows” diagram.
Compare
Section titled “Compare”| head to tail | tail to tail | head to head | |
|---|---|---|---|
| shape | |||
| name | chain / relay | common cause / fork | collider |
| blocked when | and no descendant of in | ||
| conditioning on | blocks | blocks | opens |
| example from §8.5 | in Eq. 8.36 | in Eq. 8.37 | in Eq. 8.38 |
| measured effect | when blocked | when open |
| directed | undirected | factor graph | |
|---|---|---|---|
| also called | Bayesian network | Markov random field | — |
| §8.5.3 figure | 8.12(a) | 8.12(b) | 8.12(c) |
| edges carry | conditional probabilities | symmetric compatibilities | factor membership |
| natural for | generative processes | spatial / lattice structure | making the factorization explicit |
-
Equation 8.31 writes the joint as a product over nodes. What is each factor conditioned on?
One factor per node, conditioned on its parents. Checked against four million samples on Figure 8.9(b), the factorized joint matches the empirical one to 0.000124 across all thirty-two cells. Run the rule backwards and it also tells you how to build the graph from a factorization.
pch.quizShowAnswer
B — The parents of that node — the nodes with arrows pointing into it — One factor per node, conditioned on its parents. Checked against four million samples on Figure 8.9(b), the factorized joint matches the empirical one to 0.000124 across all thirty-two cells. Run the rule backwards and it also tells you how to build the graph from a factorization.
-
Why is the factorization worth writing down at all?
And it is exact, not approximate, provided the independence assertions hold. Past about K = 30 the unfactorized joint cannot be stored at all, so the graph stops being a convenience and becomes the only representation there is.
pch.quizShowAnswer
B — The parameter count collapses — at 100 binary variables, 1.268e30 free parameters become 395 — And it is exact, not approximate, provided the independence assertions hold. Past about K = 30 the unfactorized joint cannot be stored at all, so the graph stops being a convenience and becomes the only representation there is.
-
Arrows meet head to head at node n on a trail. When is that trail blocked at n?
This is the rule that runs backwards. Measured on Figure 8.11: corr(a, c) is -0.000079 given b alone, -0.237939 once the collider d is added, and -0.146064 once only d's descendant e is added. Conditioning on a collider CREATES a dependence that was not there.
pch.quizShowAnswer
B — When neither n NOR any of its descendants is in the conditioning set — This is the rule that runs backwards. Measured on Figure 8.11: corr(a, c) is -0.000079 given b alone, -0.237939 once the collider d is added, and -0.146064 once only d's descendant e is added. Conditioning on a collider CREATES a dependence that was not there.
-
Example 8.38 says a is NOT independent of c given b and e, even though e is not the collider. Why?
Observing e is a blurred observation of d, so it opens the head-to-head meeting partially. Measured, it gives -0.146064 against -0.237939 for conditioning on d itself — weaker, but nowhere near zero. That is exactly why the rule says 'nor any of its descendants'.
pch.quizShowAnswer
B — Because e is a descendant of the collider d, and the head-to-head rule mentions descendants — Observing e is a blurred observation of d, so it opens the head-to-head meeting partially. Measured, it gives -0.146064 against -0.237939 for conditioning on d itself — weaker, but nowhere near zero. That is exactly why the rule says 'nor any of its descendants'.
-
The book warns that the graph layout depends on the choice of factorization. What does that imply?
Measured: p(a)p(b|a) reconstructs a joint to 0.00e+00 and p(b)p(a|b) reconstructs the same joint to 5.55e-17. One graph says a to b, the other says b to a. This is why reading causation off an arrow is an error unless you have made the additional assumptions the book mentions in its margin.
pch.quizShowAnswer
B — The same joint distribution admits graphs whose arrows point in opposite directions, both exactly correct — Measured: p(a)p(b|a) reconstructs a joint to 0.00e+00 and p(b)p(a|b) reconstructs the same joint to 5.55e-17. One graph says a to b, the other says b to a. This is why reading causation off an arrow is an error unless you have made the additional assumptions the book mentions in its margin.
-
What does plate notation assert about the variables inside the plate?
Measured on 64 sequences of six Bernoulli flips: the sequences 101010 and 010101 are predicted to be equally likely at 0.009261 and measured at 0.009223 and 0.009263. Order carries no information, which is what drawing one node instead of six asserts. Statistical independence means the distribution factorizes.
pch.quizShowAnswer
B — That the joint factorizes into a product over the repeated index — they are identically distributed given the parent — Measured on 64 sequences of six Bernoulli flips: the sequences 101010 and 010101 are predicted to be equally likely at 0.009261 and measured at 0.009223 and 0.009263. Order carries no information, which is what drawing one node instead of six asserts. Statistical independence means the distribution factorizes.
🧪 Try It Yourself
Section titled “🧪 Try It Yourself”Exercise 1 – Read the joint off the picture
Section titled “Exercise 1 – Read the joint off the picture”Exercise 2 – Check Example 8.9
Section titled “Exercise 2 – Check Example 8.9”Exercise 3 – The collider, isolated
Section titled “Exercise 3 – The collider, isolated”Exercise 4 – One joint, two legal graphs
Section titled “Exercise 4 – One joint, two legal graphs”Exercise 5 – A plate is a product
Section titled “Exercise 5 – A plate is a product”Pitfalls
Section titled “Pitfalls”Recall card
Section titled “Recall card”- A directed graphical model is a picture of one factorization of the joint. Nodes are random variables; an arrow from a to b carries the conditional probability of b given a.
- Two rules build the graph: one node per random variable, and an arrow into each node from every variable its conditional is conditioned on.
- Equation 8.31 reads it back: the joint is a product with one factor per node, each conditioned on its parents — the nodes with arrows pointing into it. Verified against four million samples to a maximum error of 0.000124 over all thirty-two cells.
- The compression is the whole point. Five binary variables: 31 free parameters become 10. A hundred binary variables: 1.268e30 become 395. Past about thirty variables the unfactorized joint cannot be stored at all.
- The layout depends on the factorization, not on the joint. The same joint is reconstructed exactly by p(a)p(b given a) and to 5.55e-17 by p(b)p(a given b), and those are graphs pointing opposite ways. An arrow means causation only with additional assumptions.
- Shaded nodes are observed; unshaded are latent. A plate repeats everything inside it N times, which is exactly Equation 8.33’s product. A hyperprior is a prior on the parameters of a prior, and deterministic parameters lose their circle.
- d-separation answers conditional independence by tracing trails — paths that ignore arrow direction — between the two sets of nodes.
- Head to tail and tail to tail are blocked when the middle node is IN the conditioning set. A relay and a common cause both stop conducting once you observe the middle.
- Head to head is blocked when the node is NOT in the conditioning set and neither is any of its descendants. This is the rule that runs backwards: conditioning on a collider OPENS the path.
- All trails must be blocked. One open trail is enough for dependence — Equation 8.37 is dependent, measured at 0.272172, because of a single unblocked trail.
- Example 8.9 verified on four million samples: -0.000320, -0.000079 where the book says independent; 0.272172, -0.146064 where it says dependent. Four for four.
- The collider effect, isolated: corr(a, c) is -0.000079 given b, -0.237939 once the collider d is added, and -0.146064 once only d’s descendant e is added. Nothing about the model changed; only what we looked at changed.
- A missing arrow is not marginal independence. There is no edge between a and c in Figure 8.11, and they are still dependent given b and e.
- Three families, from Section 8.5.3: directed models (Bayesian networks), undirected models (Markov random fields), and factor graphs. Not every distribution can be represented in a given choice.
Next: the graph shows your structural choices, and now you have to pick among them. Model Selection
pch.coffeeTagline
pch.coffeeCtapch.feedbackHeading
pch.feedbackSubheading