Junction Tree Algorithm Brookes Vision Reading Group Outline
Junction Tree Algorithm Brookes Vision Reading Group
Outline • Graphical Models – What are Graphical Models ? – Conditional Independence – Inference • Junction Tree Algorithm – – Moralizing a graph Junction Tree Property Creating a junction tree Inference using junction tree algorithm
Don’t we all know … • P(A) = 1 , if and only if A is certain • P(A or B) = P(A)+P(B) if and only if A and B are mutually exclusive • P(A, B) = P(A|B)P(B) = P(B|A)P(A) • Conditional Independence – A is conditionally independent of C given B – P(A|B, C) = P(A|B)
Outline • Graphical Models – What are Graphical Models ? – Conditional Independence – Inference • Junction Tree Algorithm – – Moralizing a graph Junction Tree Property Creating a junction tree Inference using junction tree algorithm
Graphical Models Compact graphical representation of joint probability. A A ‘causes’ B B P(A, B) = P(A)P(B|A)
Graphical Models Compact graphical representation of joint probability. A B ‘causes’ A B P(A, B) = P(B)P(A|B)
Graphical Models Compact graphical representation of joint probability. A B P(A, B)
A Simple Example P(A, B, C) = P(A)P(B, C | A) = P(A) P(B|A) P(C|B, A) = P(A) P(B|A) P(C|B) C is conditionally independent of A given B Graphical Representation ? ? ?
Bayesian Network Directed Graphical Model P(U) = P(Vi | Pa(Vi)) A B P(A, B, C) = P(A) P(B | A) P(C | B) C
Markov Random Fields Undirected Graphical Model A B C
Markov Random Fields Undirected Graphical Model AB B BC Clique Separator Clique P(U) = P(Clique) / P(Separator) P(A, B, C) = P(A, B) P(B, C) / P(B)
Outline • Graphical Models – What are Graphical Models ? – Conditional Independence – Inference • Junction Tree Algorithm – – Moralizing a graph Junction Tree Property Creating a junction tree Inference using junction tree algorithm
Bayesian Networks • A is conditionally independent of B given C • Bayes ball cannot reach A from B
Markov Random Fields • A, B, C - (set of) nodes • C is conditionally independent of A given B • All paths from A to C go through B
Markov Random Fields
Markov Random Fields A node is conditionally independent of all others given its neighbours.
Outline • Graphical Models – What are Graphical Models ? – Conditional Independence – Inference • Junction Tree Algorithm – – Moralizing a graph Junction Tree Property Creating a junction tree Inference using junction tree algorithm
MAP Estimation c*, s*, r*, w* = argmax P(C=c, S=s, R=r, W=w)
Computing Marginals P(W=w) = c, s, r P(C=c, S=s, R=r, W=w)
Outline • Graphical Models – What are Graphical Models ? – Conditional Independence – Inference • Junction Tree Algorithm – – Moralizing a graph Junction Tree Property Creating a junction tree Inference using junction tree algorithm
Aim • To perform exact inference efficiently • Transform the graph into an appropriate data structure • Ensure joint probability remains the same • Ensure exact marginals can be computed
Junction Tree Algorithm • Converts Bayes Net into an undirected tree – Joint probability remains unchanged – Exact marginals can be computed • Why ? ? ? – Uniform treatment of Bayes Net and MRF – Efficient inference is possible for undirected trees
Junction Tree Algorithm • Converts Bayes Net into an undirected tree – Joint probability remains unchanged – Exact marginals can be computed • Why ? ? ? – Uniform treatment of Bayes Net and MRF – Efficient inference is possible for undirected trees
Let us recap. . Shall we A B C D P(U) = P(Vi | Pa(Vi)) = a(Vi , Pa(Vi)) Potential Lets convert this to an undirected graphical model
Let us recap. . Shall we A B C D Wait a second …something is wrong here. The cliques of this graph are inconsistent with the original one. Node D just lost a parent.
Solution A B C D Ensure that a node and its parents are part of the same clique Marry the parents for a happy family Now you can make the graph undirected
Solution A B C D But we have added extra edges, haven’t we ? ? ? A few conditional independences are lost.
Outline • Graphical Models – What are Graphical Models ? – Conditional Independence – Inference • Junction Tree Algorithm – – Moralizing a graph Junction Tree Property Creating a junction tree Inference using junction tree algorithm
Moralizing a graph • Marry all unconnected parents • Drop the edge directions Ensure joint probability remains the same.
Moralizing a graph
Moralizing a graph C Clique Potentials a(Ci) Separator Potentials a(Si) Initialize a(Ci) = 1 S R W CSR a(Si) = 1 SR SRW
Moralizing a graph C Choose one node Vi Find one clique Ci containing Vi and Pa(Vi) S R Multiply a(Vi, Pa(Vi)) to a(Ci) W Repeat for all Vi CSR SR SRW
Moralizing a graph C Choose one node Vi Find one clique Ci containing Vi and Pa(Vi) S R Multiply a(Vi, Pa(Vi)) to a(Ci) W Repeat for all Vi CSR SR SRW
Moralizing a graph C Choose one node Vi Find one clique Ci containing Vi and Pa(Vi) S R Multiply a(Vi, Pa(Vi)) to a(Ci) W Repeat for all Vi CSR SR SRW
Moralizing a graph C Choose one node Vi Find one clique Ci containing Vi and Pa(Vi) S R Multiply a(Vi, Pa(Vi)) to a(Ci) W Repeat for all Vi CSR SR SRW
Moralizing a graph P(U) = a(Ci) / a(Si) Now we can form a tree with all the cliques we chose. That was easy. We’re ready to marginalize. OR ARE WE ? ? ?
A few more examples … A B C D
A few more examples … A B C D
A few more examples … AB BD AC CD Inconsistency in C AB BCD Clearly we’re missing something here
Outline • Graphical Models – What are Graphical Models ? – Conditional Independence – Inference • Junction Tree Algorithm – – Moralizing a graph Junction Tree Property Creating a junction tree Inference using junction tree algorithm
Junction Tree Property In a junction tree, all cliques in the unique path between cliques Ci and Cj must contain Ci Cj So what we want is a junction tree, right ? ? ? Q. Do all graphs have a junction tree ? ? ? A. NO
Decomposable Graphs Decomposition (A, B, C) A C Undirected graph G = (V, E) • V=A B C • All paths between A and B go through C • C is a complete subset of V B
Decomposable Graphs • A, B and/or C can be empty • A, B are non-empty in a proper decomposition
Decomposable Graphs • G is decomposable if and only if • G is complete OR • It possesses a proper decomposition (A, B, C) such that – GA C is decomposable – GB C is decomposable
Decomposable Graphs A B C D Not Decomposable A B C D Decomposable
Decomposable Graphs A A B C D E Not Decomposable
An Important Theorem: A graph G has a junction tree if and only if it is decomposable. Proof on white board.
OK. So how do I convert my graph into a decomposable one.
Time for more definitions • Chord of a cycle – An edge between two non-successive nodes • Chordless cycle – A cycle with no chords • Triangulated graph – A graph with no chordless cycles
Another Important Theorem: A graph G is decomposable if and only if it is triangulated. Proof on white board. Alright. So add edges to triangulate the graph.
Triangulating a Graph ABC A B C D BC BCD
Triangulating a Graph
Triangulating a Graph
Some Notes on Triangulation Can we ensure the joint probability remains unchanged ? ? Of course. Adding edges preserves cliques found after moralization. Use the previous algorithm for initializing potentials. Aren’t more conditional independences lost ? ? ? Yes. : -(
Some Notes on Triangulation Is Triangulation unique? ? No. Okay then. Lets find the best triangulation. Sadly, that’s NP hard. Hang on. We still have a graph. We were promised a tree. Alright. Lets form a tree then.
Outline • Graphical Models – What are Graphical Models ? – Conditional Independence – Inference • Junction Tree Algorithm – – Moralizing a graph Junction Tree Property Creating a junction tree Inference using junction tree algorithm
Creating a Junction Tree ABD CDE A BCD B D Not a junction tree ABD C E Clearly, we’re still missing something here. BCD CDE Junction tree
Yet Another Theorem: A junction tree is an MST where the weights are the cardinality of the separators. Proof on white board. Alright. So lets form an MST.
Forming an MST ABD A B D C E 2 BCD 1 2 CDE
Forming an MST ABD A B D C E 2 BCD 1 2 CDE
Forming an MST ABD A B D C E 2 BCD 1 2 CDE
Forming an MST ABD A B D C E 2 BCD 2 CDE
A Quick Recap Asia Network A S T L B E X D
A Quick Recap 1. Marry unconnected parents A S T L B E X D
A Quick Recap 2. Drop directionality of edges. A S T L B E X D
A Quick Recap 3. Triangulate the graph. A S T L B E X D
A Quick Recap 4. Find the MST clique tree. Voila. . The junction tree. SBL AT TLE BLE Whew. Done !! XE DBE But where are these marginals we were talking about ?
Outline • Graphical Models – What are Graphical Models ? – Conditional Independence – Inference • Junction Tree Algorithm – – Moralizing a graph Junction Tree Property Creating a junction tree Inference using junction tree algorithm
Inference using JTA • Modify potentials • Ensure joint probability is consistent • Ensure consistency between neighbouring cliques • Ensure clique potentials = clique marginals • Ensure separator potentials = separator marginals
Inference using JTA V S 1. a*(S) = VS a(V) 2. a*(W) = a(W) a*(S) / a(S) 3. a**(S) = WS a*(W) 4. a*(V) = a(V) a**(S) / a*(S) W VS a*(V) = a**(S) = WS a*(W) Consistency
Inference using JTA V S 1. a*(S) = VS a(V) 2. a*(W) = a(W) a*(S) / a(S) 3. a**(S) = WS a*(W) 4. a*(V) = a(V) a**(S) / a*(S) W a*(V) a*(W) / a**(S) = a(V) a(W) / a(S) Joint probability remains same
One Last Theorem (Then we can all go home) Theorem: After JTA, Potentials = Marginals Proof on white board.
Happy Marginalizing
- Slides: 73