Chapter 2 Graphical models and approximate posterior inference
Graphical Models - Inference -
description
Transcript of Graphical Models - Inference -
Graphical Models- Inference -
Wolfram Burgard, Luc De Raedt, Kristian Kersting, Bernhard Nebel
Albert-Ludwigs University Freiburg, Germany
PCWP CO
HRBP
HREKG HRSAT
ERRCAUTERHRHISTORY
CATECHOL
SAO2 EXPCO2
ARTCO2
VENTALV
VENTLUNG VENITUBE
DISCONNECT
MINVOLSET
VENTMACHKINKEDTUBEINTUBATIONPULMEMBOLUS
PAP SHUNT
ANAPHYLAXIS
MINOVL
PVSAT
FIO2PRESS
INSUFFANESTHTPR
LVFAILURE
ERRBLOWOUTPUTSTROEVOLUMELVEDVOLUME
HYPOVOLEMIA
CVP
BP
Mainly based on F. V. Jensen, „Bayesian Networks and Decision Graphs“, Springer-Verlag New York, 2001.
AdvancedI WS 06/07
Junction Tree
Bayesian Networks
Bayesian Networks
AdvancedI WS 06/07 Outline
• Introduction • Reminder: Probability theory• Basics of Bayesian Networks• Modeling Bayesian networks• Inference (VE, Junction tree)• Excourse: Markov Networks• Learning Bayesian networks• Relational Models
Bayesian Networks
Bayesian Networks
AdvancedI WS 06/07 Why Junction trees ?
• Multiple inference, e.g.,
• For each i do variable elimination?
No, instead reuse information resp.
computations
- Infe
rence
(Junct
ion Tr
ee)
- Infe
rence
(Junct
ion Tr
ee)
Bayesian Networks
Bayesian Networks
AdvancedI WS 06/07
A potential A over a set of variables A is a function that maps each configuration into a non-negative real number.
domA=A (domain of A )
Potentials
Examples: Conditional probability distribution and joint probability distributions are special cases of potentials
- Infe
rence
(Junct
ion Tr
ee)
- Infe
rence
(Junct
ion Tr
ee)
Bayesian Networks
Bayesian Networks
AdvancedI WS 06/07
Ex: A potential A,B,C over the set of variables {A,B,C}. A has four states, and B and C has three states. domA,B,C ={A,B,C}
Potentials
- Infe
rence
(Junct
ion Tr
ee)
- Infe
rence
(Junct
ion Tr
ee)
Bayesian Networks
Bayesian Networks
AdvancedI WS 06/07
Let be a set of potentials (e.g. CPDs), and let X
be a variable. X is eliminated from
1. Remove all potentials in with X in the domain. Let X that set.
2. Calculate
3. Add to 4. Iterate
VE using Potentials
Potential where X is not amember of the domain
- Infe
rence
(Junct
ion Tr
ee)
- Infe
rence
(Junct
ion Tr
ee)
Bayesian Networks
Bayesian Networks
AdvancedI WS 06/07 Domain Graph
A1
A3
A4
A2
A5 A6
A1
A3
A4
A2
A5 A6
Bayesian Network
Moralizing
Domain Graph(Moral Graph)
moral linkLet nbe potentials over UmwithdomiDi. The domain graph for is the undirected graphwith variables of U as nodes and with a link between pairs of variables being members of the same Di.
- Infe
rence
(Junct
ion Tr
ee)
- Infe
rence
(Junct
ion Tr
ee)
Bayesian Networks
Bayesian Networks
AdvancedI WS 06/07 Moralizing
A1
A3
A4
A2
A5 A6
A1
A3
A4
A2
A5 A6
Bayesian Network
Moralizing
Domain Graph(Moral Graph)
- Infe
rence
(Junct
ion Tr
ee)
- Infe
rence
(Junct
ion Tr
ee)
Bayesian Networks
Bayesian Networks
AdvancedI WS 06/07 Moralizing
A1
A3
A4
A2
A5 A6
A1
A3
A4
A2
A5 A6
Bayesian Network
Moralizing
Domain Graph(Moral Graph)
- Infe
rence
(Junct
ion Tr
ee)
- Infe
rence
(Junct
ion Tr
ee)
CPDs
Bayesian Networks
Bayesian Networks
AdvancedI WS 06/07 Moralizing
A1
A3
A4
A2
A5 A6
A1
A3
A4
A2
A5 A6
Bayesian Network
Moralizing
Domain Graph(Moral Graph)
- Infe
rence
(Junct
ion Tr
ee)
- Infe
rence
(Junct
ion Tr
ee)
CPDs
CPD=potential
Bayesian Networks
Bayesian Networks
AdvancedI WS 06/07 Moralizing
A1
A3
A4
A2
A5 A6
A1
A3
A4
A2
A5 A6
Bayesian Network
Moralizing
Domain Graph(Moral Graph)
- Infe
rence
(Junct
ion Tr
ee)
- Infe
rence
(Junct
ion Tr
ee)
CPDs
CPD=potential
Potentials induceundirected edges
Bayesian Networks
Bayesian Networks
AdvancedI WS 06/07 Moralizing
A1
A3
A4
A2
A5 A6
A1
A3
A4
A2
A5 A6
Bayesian Network
Moralizing
Domain Graph(Moral Graph)
- Infe
rence
(Junct
ion Tr
ee)
- Infe
rence
(Junct
ion Tr
ee)
CPDs
CPD=potential
moral linkPotentials induceundirected edges
Bayesian Networks
Bayesian Networks
AdvancedI WS 06/07 Elimination Sequence
A1
A3
A4
A2
A5 A6
A1
A3
A4
A2
A5 A6
Bayesian Network
Moralizing
Moral GraphA1
A4
A2
A5 A6
Elimina
ting A
3
- Infe
rence
(Junct
ion Tr
ee)
- Infe
rence
(Junct
ion Tr
ee)
Bayesian Networks
Bayesian Networks
AdvancedI WS 06/07 Elimination Sequence
A1
A3
A4
A2
A5 A6
A1
A3
A4
A2
A5 A6
Bayesian Network
Moralizing
Moral GraphA1
A4
A2
A5 A6
Elimina
ting A
3
- Infe
rence
(Junct
ion Tr
ee)
- Infe
rence
(Junct
ion Tr
ee)
Bayesian Networks
Bayesian Networks
AdvancedI WS 06/07 Reminder: Markov Networks
• Undirected Graphs• Nodes = random variables• Cliques = potentials (~ local jpd)
VE on potentials
works
for Markov networks
- Infe
rence
(Junct
ion Tr
ee)
- Infe
rence
(Junct
ion Tr
ee)
Bayesian Networks
Bayesian Networks
AdvancedI WS 06/07 Elimination Sequence
A1
A3
A4
A2
A5 A6
A1
A3
A4
A2
A5 A6
Bayesian Network
Moralizing
Moral GraphA1
A4
A2
A5 A6
fill-ins: work with a potential over a domain that was not present originally
Elimina
ting A
3
GOAL:Elimination sequence that does not introduce fill-ins
- Infe
rence
(Junct
ion Tr
ee)
- Infe
rence
(Junct
ion Tr
ee)
Bayesian Networks
Bayesian Networks
AdvancedI WS 06/07 Perfect Elimination Sequence ...
A1
A3
A4
A2
A5 A6
A6
- Infe
rence
(Junct
ion Tr
ee)
- Infe
rence
(Junct
ion Tr
ee)
Bayesian Networks
Bayesian Networks
AdvancedI WS 06/07 Perfect Elimination Sequence ...
A1
A3
A4
A2
A5 A6
A1
A3
A4
A2
A5
A6 A5
- Infe
rence
(Junct
ion Tr
ee)
- Infe
rence
(Junct
ion Tr
ee)
Bayesian Networks
Bayesian Networks
AdvancedI WS 06/07 Perfect Elimination Sequence ...
A1
A3
A4
A2
A5 A6
A1
A3
A4
A2
A5
A6 A5 A1
A3
A4
A2
A3
- Infe
rence
(Junct
ion Tr
ee)
- Infe
rence
(Junct
ion Tr
ee)
Bayesian Networks
Bayesian Networks
AdvancedI WS 06/07 Perfect Elimination Sequence ...
A1
A3
A4
A2
A5 A6
A1
A3
A4
A2
A5
A1
A4
A2
A6 A5 A1
A3
A4
A2
A3 A1
- Infe
rence
(Junct
ion Tr
ee)
- Infe
rence
(Junct
ion Tr
ee)
Bayesian Networks
Bayesian Networks
AdvancedI WS 06/07 Perfect Elimination Sequence ...
A1
A3
A4
A2
A5 A6
A1
A3
A4
A2
A5
A1
A4
A2 A4
A2
A6 A5
A2
A1
A3
A4
A2
A3 A1
- Infe
rence
(Junct
ion Tr
ee)
- Infe
rence
(Junct
ion Tr
ee)
Bayesian Networks
Bayesian Networks
AdvancedI WS 06/07 Perfect Elimination Sequence ...
A1
A3
A4
A2
A5 A6
A1
A3
A4
A2
A5
A1
A4
A2 A4
A2
A4
A6 A5
A2
A1
A3
A4
A2
A3 A1
- Infe
rence
(Junct
ion Tr
ee)
- Infe
rence
(Junct
ion Tr
ee)
Bayesian Networks
Bayesian Networks
AdvancedI WS 06/07 Perfect Elimination Sequence ...
A1
A3
A4
A2
A5 A6
... do not introduce fill-insA1
A3
A4
A2
A5
A1
A4
A2 A4
A2
A4
A6 A5
A2
A1
A3
A4
A2
A3 A1There are several perfectelimination sequencesending in A4But they have different
complexities
- Infe
rence
(Junct
ion Tr
ee)
- Infe
rence
(Junct
ion Tr
ee)
Bayesian Networks
Bayesian Networks
AdvancedI WS 06/07
• Characterized by the set of domains• Set of domains of potentials produced during
the elimination (potentials that are subsets of other potentials are removed).
• A6,A5,A3,A1,A2,A4: {{A6,A3},{A2,A3,A5},{A1,A2,A3},{A1,A2},{A2,A4}}
Complexity of Elimination Sequence
- Infe
rence
(Junct
ion Tr
ee)
- Infe
rence
(Junct
ion Tr
ee)
Bayesian Networks
Bayesian Networks
AdvancedI WS 06/07
Complexity of Elimination Sequence
A1
A3
A4
A2
A5 A6
A1
A3
A4
A2
A5
A1
A4
A2 A4
A2
A4
A6 A5
A2
A1
A3
A4
A2
A3 A1
- Infe
rence
(Junct
ion Tr
ee)
- Infe
rence
(Junct
ion Tr
ee)
{A3,A6} {A2,A3,A5} {A1,A2,A3}
{A1,A2} {A2,A4}
Bayesian Networks
Bayesian Networks
AdvancedI WS 06/07
• All perfect elimination sequences produce the same domain set, namely the set of cliques of the domain
• Any perfect elimination sequence ending
with A is optimal with respect to computing P(A)
Complexity of Elimination Sequence
- Infe
rence
(Junct
ion Tr
ee)
- Infe
rence
(Junct
ion Tr
ee)
Bayesian Networks
Bayesian Networks
AdvancedI WS 06/07 Triangulated Graphs and Join Trees
• An undirected graph with complete elimination sequence is called a triangulated graph
A1
A3
A4
A2
A5
A1
A3
A4
A2
A5
triangulated nontriangulated
- Infe
rence
(Junct
ion Tr
ee)
- Infe
rence
(Junct
ion Tr
ee)
Bayesian Networks
Bayesian Networks
AdvancedI WS 06/07 Triangulated Graphs and Join Trees
A1
A3
A4
A2
A5
Neighbours of A5
A1
A3
A4
A2
A5
Family of A5
• Complete neighbour set = simplicial node• X is simplicial iff family of X is a clique
A1
A3
A4
A2
A5
Family of A3, i.e. A3 is simplicial
- Infe
rence
(Junct
ion Tr
ee)
- Infe
rence
(Junct
ion Tr
ee)
Bayesian Networks
Bayesian Networks
AdvancedI WS 06/07
Let G be a triangulated graph,
and let X be a simplicial node.
Let G´be the graph resulting from eliminating X from G. Then G´is a triangulated
graph
A1
A3
A4
A2
A5
X
Eliminating X
A1
A3
A4
A2
A5
Triangulated Graphs and Join Trees
- Infe
rence
(Junct
ion Tr
ee)
- Infe
rence
(Junct
ion Tr
ee)
Bayesian Networks
Bayesian Networks
AdvancedI WS 06/07 Triangulated Graphs and Join Trees
• A triangulated graph with at least two nodes has at least two simplicial nodes
• In a triangulated graph, each variable A has a perfect elimination sequence ending with A
• Not all domain graphs are triangulated: An undirected graph is triangulated iff all nodes can be eliminated by successively eliminating a simplicial node
- Infe
rence
(Junct
ion Tr
ee)
- Infe
rence
(Junct
ion Tr
ee)
Bayesian Networks
Bayesian Networks
AdvancedI WS 06/07 Join Trees
Let G be the set of cliques from
an undirected graph, and let the cliques of G be organized
in a tree. • T is a join tree if for any
pair of nodes V, W all nodes on the path between V an W contain the intersection VW
BCDE
ABCD DEFI
BCDG
CHGJ
BCDE
ABCD DEFI
BCDG
CHGJ
- Infe
rence
(Junct
ion Tr
ee)
- Infe
rence
(Junct
ion Tr
ee)
Bayesian Networks
Bayesian Networks
AdvancedI WS 06/07 Join Trees
Let G be the set of cliques from
an undirected graph, and let the cliques of G be organized
in a tree. • T is a join tree if for any
pair of nodes V, W all nodes on the path between V an W contain the intersection VW
BCDE
ABCD DEFI
BCDG
CHGJ
BCDE
ABCD DEFI
BCDG
CHGJ
join tree
not a join tree
- Infe
rence
(Junct
ion Tr
ee)
- Infe
rence
(Junct
ion Tr
ee)
Bayesian Networks
Bayesian Networks
AdvancedI WS 06/07 Join Trees
• If the cliques of an undirected graph G can be organized into a join tree, then G is triangulated
• If the undirected graph is triangulated, then the cliques of G can be organizes into a join tree
- Infe
rence
(Junct
ion Tr
ee)
- Infe
rence
(Junct
ion Tr
ee)
Bayesian Networks
Bayesian Networks
AdvancedI WS 06/07
Triangulated, undirected Graph -> Join trees
A E
F
I
D
J
GH
B
C
• Simplicial node X• Family of X is a clique• Eliminate nodes from
family of X which have only neighbours in the family of X
• Give family of X is number according to the number of nodes eliminated
• Denote the set of remaining nodes Si
- Infe
rence
(Junct
ion Tr
ee)
- Infe
rence
(Junct
ion Tr
ee)
Bayesian Networks
Bayesian Networks
AdvancedI WS 06/07
Triangulated, undirected Graph -> Join trees
A E
F
I
D
J
GH
B
C
X
ABCDV1
BCDS1 separator
• Simplicial node X• Family of X is a clique• Eliminate nodes from
family of X which have only neighbours in the family of X
• Give family of X a number i according to the number of nodes eliminated
• Denote the set of remaining nodes Si
- Infe
rence
(Junct
ion Tr
ee)
- Infe
rence
(Junct
ion Tr
ee)
Bayesian Networks
Bayesian Networks
AdvancedI WS 06/07
• Simplicial node X• Family of X is a clique• Eliminate nodes from
family of X which have only neighbours in the family of X
• Give family of X a number i according to the number of nodes eliminated
• Denote the set of remaining nodes Si
Triangulated, undirected Graph -> Join trees
A E
F
I
D
J
GH
B
C
X
ABCDV1
BCDS1 separator
A{A,B,C,D}
{B,C,D}
1
S1
- Infe
rence
(Junct
ion Tr
ee)
- Infe
rence
(Junct
ion Tr
ee)
Bayesian Networks
Bayesian Networks
AdvancedI WS 06/07
Triangulated, undirected Graph -> Join trees
E
F
I
D
J
GH
B
C
ABCDV1
BCDS1
X
DEFIV3
DES3
X
• Simplicial node X• Family of X is a clique• Eliminate nodes from
family of X which have only neighbours in the family of X
• Give family of X is number according to the number of nodes eliminated
• Denote the set of remaining nodes Si
- Infe
rence
(Junct
ion Tr
ee)
- Infe
rence
(Junct
ion Tr
ee)
Bayesian Networks
Bayesian Networks
AdvancedI WS 06/07
• Simplicial node X• Family of X is a clique• Eliminate nodes from
family of X which have only neighbours in the family of X
• Give family of X is number according to the number of nodes eliminated
• Denote the set of remaining nodes Si
Triangulated, undirected Graph -> Join trees
E
F
I
D
J
GH
B
C
ABCDV1
BCDS1
X
DEFIV3
DES3
X
{D,E,F,I}
E
{D,E}
3
S3
- Infe
rence
(Junct
ion Tr
ee)
- Infe
rence
(Junct
ion Tr
ee)
Bayesian Networks
Bayesian Networks
AdvancedI WS 06/07
Triangulated, undirected Graph -> Join trees
ABCDV1
BCDS1
DEFIV3
DES3
CGHJV5
CGS5
BCDGV6
BCDS6
BCDEV10
• Simplicial node X• Family of X is a clique• Eliminate nodes from
family of X which have only neighbours in the family of X
• Give family of X is number according to the number of nodes eliminated
• Denote the set of remaining nodes Si
- Infe
rence
(Junct
ion Tr
ee)
- Infe
rence
(Junct
ion Tr
ee)
Bayesian Networks
Bayesian Networks
AdvancedI WS 06/07
Triangulated, undirected Graph -> Join trees
• Connect each separator Si to a clique Vj, j>i, such that Si is a subset of Vj
ABCDV1
BCDS1
DEFIV3
DES3
CGHJV5
CGS5
BCDGV6
BCDS6
BCDEV10
- Infe
rence
(Junct
ion Tr
ee)
- Infe
rence
(Junct
ion Tr
ee)
Bayesian Networks
Bayesian Networks
AdvancedI WS 06/07 Join Tree
ABCDV1
BCDS1
DEFIV3
DES3
CGHJV5
CGS5
BCDGV6
BCDS6
BCDEV10
- Infe
rence
(Junct
ion Tr
ee)
- Infe
rence
(Junct
ion Tr
ee)
The potential representation of a join tree (aka clique tree) is the product of the clique potentials, dived by the product of the separator potentials.
Bayesian Networks
Bayesian Networks
AdvancedI WS 06/07 Yet Another Example
A1
A3
A4
A2
A5 A6
A1
A3
A4
A2
A5 A6
A3,A6V1
A3S1
A2,A3,A5V2
A2,A3S2
A2,A4V6
A2S4
A1,A2,A3V4
- Infe
rence
(Junct
ion Tr
ee)
- Infe
rence
(Junct
ion Tr
ee)
Bayesian Networks
Bayesian Networks
AdvancedI WS 06/07 Junction Trees
• Let be a set of potentials with a triangulated domain graph. A junction tree for is join tree for G with– Each potential in is
associated to a clique containing dom(
– Each link has separator attached containing two mailboxes, one for each direction
A1
A3A4
A2
A5 A6
- Infe
rence
(Junct
ion Tr
ee)
- Infe
rence
(Junct
ion Tr
ee)
Bayesian Networks
Bayesian Networks
AdvancedI WS 06/07 Propagation on a Junction Tree
• Node V can send exactly one message to a neighbour W, and it may only be sent when V has received a message from all of its other neighbours
• Choose one clique (arbitrarily) as a root of the tree; collect message to this node and then distribute messages away from it.
• After collection and distribution phases, we have all we need in each clique to compute potential for variables.
- Infe
rence
(Junct
ion Tr
ee)
- Infe
rence
(Junct
ion Tr
ee)
Bayesian Networks
Bayesian Networks
AdvancedI WS 06/07 Junction Trees - Collect Evidence
- Infe
rence
(Junct
ion Tr
ee)
- Infe
rence
(Junct
ion Tr
ee)
• P(A4) ?• Find clique containing
A4• V6 temporary root• Send messages from leaves to root• V4 assembles the
incoming messages, potential
Bayesian Networks
Bayesian Networks
AdvancedI WS 06/07
• Propagation/message passing between two adjacent cliques C1, C2 (S0 is their seperator)
– Marginalize C1’s potential to get new potential for S0
– Update C2’s potential
– Update S0’s potential to its new potential
Junction Tree - Messages
∑=01
1
\
*
SCCSo φφ
0
022
**
S
SCC φ
φφφ =
Bayesian Networks
Bayesian Networks
AdvancedI WS 06/07 Junction Trees - Collect Evidence
- Infe
rence
(Junct
ion Tr
ee)
- Infe
rence
(Junct
ion Tr
ee)
• P(A4) ?• Find clique containing
A4• V6 temporary root• Send messages from leaves to root• V4 assembles the
incoming messages, potential
Bayesian Networks
Bayesian Networks
AdvancedI WS 06/07 Junction Trees - Collect Evidence
- Infe
rence
(Junct
ion Tr
ee)
- Infe
rence
(Junct
ion Tr
ee)
• P(A4) ?
• All marginals?
Bayesian Networks
Bayesian Networks
AdvancedI WS 06/07
Junction Trees - Distribute Evidence
- Infe
rence
(Junct
ion Tr
ee)
- Infe
rence
(Junct
ion Tr
ee)
• All marginals?
Bayesian Networks
Bayesian Networks
AdvancedI WS 06/07 Nontriangulated Domain Graphs• Embed domain graph in a traingulated graph• Use ist junction tree• Simple idea:
– Eliminate variables in some order– If you wish to eliminate a node with non-complete
neighbour set, make it complete by adding fill-ins
AE
FI
D
JG
H
B C AE
FI
D
JG
H
B C
A,C,H,I,J,B,G,D,E,F- Infe
rence
(Junct
ion Tr
ee)
- Infe
rence
(Junct
ion Tr
ee)
Bayesian Networks
Bayesian Networks
AdvancedI WS 06/07 Summary JTA
• Convert Bayesian network into JT
• Initialize potentials and separators
• Incorporate Evidence (set potentials accordingly)
• Collect and distribute evidence
• Obtain clique marginals by marginalization/normalization
- Infe
rence
(Junct
ion Tr
ee)
- Infe
rence
(Junct
ion Tr
ee)
Image fromCecil Huang
Bayesian Networks
Bayesian Networks
AdvancedI WS 06/07 Inference Engines
• (Commercial) HUGIN : http://www.hugin.com• (Commercial) NETICA: http://www.norsys.com• Bayesian Network Toolbox for Matlab
www.cs.ubc.ca/~murphyk/Software/BNT/bnt.html• GENIE/SMILE (JAVA) http://www2.sis.pitt.edu/~genie/• MSBNx, Microsoft, http://research.microsoft.com/adapt/MSBNx/• Profile Toolbox
http://www.informatik.uni-freiburg.de/~kersting/profile/
- Infe
rence
(Junct
ion Tr
ee)
- Infe
rence
(Junct
ion Tr
ee)