Mehmet Emre Tiryaki
Back to Notes

Directed Graphical Models

Factorization

Let G=(V,E)G = (V, E) be a DAG and XvX_v, v∈Vv \in V, random variables. A probability distribution PP factorizes according to GG if

P(XV)=∏v∈VP(Xv ∣ Xpa(v))P(X_V) = \prod_{v \in V} P\big(X_v \,\big|\, X_{\mathrm{pa}(v)}\big)

The factors are local probability models.

Sprinkler example XX is the season (0 dry, 1 wet), SS the sprinkler, RR rain, WW wet grass, with edges X→SX \to S, X→RX \to R, S→WS \to W, R→WR \to W.

P(X,S,R,W)=P(W∣S,R) P(S∣X) P(R∣X) P(X)P(X, S, R, W) = P(W | S, R)\, P(S | X)\, P(R | X)\, P(X)

Independence

A DAG G=(V,E)G = (V, E) encodes, for all v∈Vv \in V,

Xv⊥XSv ∣ Xpa(v),Sv=({v}∪desc(v)∪pa(v))c=ancestors (other than parents)∪incomparable nodesX_v \perp X_{S_v} \,\big|\, X_{\mathrm{pa}(v)}, \qquad S_v = \big(\{v\} \cup \mathrm{desc}(v) \cup \mathrm{pa}(v)\big)^c = \text{ancestors (other than parents)} \cup \text{incomparable nodes}

PP factorizes over GG iff it satisfies these independence assertions.

d-Separation

For three nodes on a path through BB:

  • Causal chain A→B→CA \to B \to C or A←B←CA \leftarrow B \leftarrow C: knowing BB blocks the path, A⊥C∣BA \perp C \mid B.
  • Common cause A←B→CA \leftarrow B \to C: knowing the shared parent BB blocks the path, A⊥C∣BA \perp C \mid B.
  • Collision A→B←CA \to B \leftarrow C: the path is blocked when nothing is known, so A⊥CA \perp C, but knowing BB or any descendant of BB unblocks it, A⊥̸C∣BA \not\perp C \mid B.

If all paths between XX and YY are blocked given ZZ, then X⊥Y∣ZX \perp Y \mid Z.

Compactness

For nn random variables with support {1,…,r}\{1, \ldots, r\}, the full joint needs rn−1=O(rn)r^n - 1 = O(r^n) parameters. If it factors with maximum in-degree dd, it needs at most nrd(r−1)=O(nrd+1)n r^d (r-1) = O(n r^{d+1}). If d≪nd \ll n, factorization is much better.

Examples of Factorization

Markov chain Xk+1⊥X1,…,Xk−1∣XkX_{k+1} \perp X_1, \ldots, X_{k-1} \mid X_k, so

P(x1,…,xn)=P(x1)∏i=2nP(xi∣xi−1)P(x_1, \ldots, x_n) = P(x_1) \prod_{i=2}^{n} P(x_i | x_{i-1})

Naive Bayes Xk⊥X1,…,Xk−1,Xk+1,…,Xn∣ClassX_k \perp X_1, \ldots, X_{k-1}, X_{k+1}, \ldots, X_n \mid \text{Class}, so

P(c,x1,…,xn)=P(c)∏i=1nP(xi∣c)P(c, x_1, \ldots, x_n) = P(c) \prod_{i=1}^{n} P(x_i | c)

Mixture model

zi∼Categorical(π1,…,πK)    (class),xi∼N(μzi,Σzi)    (observed),∑k=1Kπk=1z_i \sim \mathrm{Categorical}(\pi_1, \ldots, \pi_K) \;\; (\text{class}), \qquad x_i \sim \mathcal{N}(\mu_{z_i}, \Sigma_{z_i}) \;\; (\text{observed}), \qquad \sum_{k=1}^{K} \pi_k = 1