message passing and junction tree algorithms · message passing and junction tree algorithms kayhan...

55
Message Passing and Junction Tree Algorithms Kayhan Batmanghelich 1

Upload: others

Post on 24-Jun-2020

14 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Message Passing and Junction Tree Algorithms · Message Passing and Junction Tree Algorithms Kayhan Batmanghelich 1. Review 2. Review 3. Great Ideas in ML: Message Passing 7 here

Message Passing and

Junction Tree AlgorithmsKayhan Batmanghelich

1

Page 2: Message Passing and Junction Tree Algorithms · Message Passing and Junction Tree Algorithms Kayhan Batmanghelich 1. Review 2. Review 3. Great Ideas in ML: Message Passing 7 here

Review

2

Page 3: Message Passing and Junction Tree Algorithms · Message Passing and Junction Tree Algorithms Kayhan Batmanghelich 1. Review 2. Review 3. Great Ideas in ML: Message Passing 7 here

Review

3

Page 4: Message Passing and Junction Tree Algorithms · Message Passing and Junction Tree Algorithms Kayhan Batmanghelich 1. Review 2. Review 3. Great Ideas in ML: Message Passing 7 here

Great Ideas in ML: Message Passing

7 here

3 here

11 here(= 7+3+1)

1 of me

Each soldier receives reports from all branches of tree

4adapted from MacKay (2003) textbook

Slides adapted from Matt Gormley (2016)

Page 5: Message Passing and Junction Tree Algorithms · Message Passing and Junction Tree Algorithms Kayhan Batmanghelich 1. Review 2. Review 3. Great Ideas in ML: Message Passing 7 here

Great Ideas in ML: Message Passing

3 here

3 here

7 here(= 3+3+1)

Each soldier receives reports from all branches of tree

5adapted from MacKay (2003) textbook

Slides adapted from Matt Gormley (2016)

Page 6: Message Passing and Junction Tree Algorithms · Message Passing and Junction Tree Algorithms Kayhan Batmanghelich 1. Review 2. Review 3. Great Ideas in ML: Message Passing 7 here

Great Ideas in ML: Message Passing

7 here

3 here

11 here(= 7+3+1)

Each soldier receives reports from all branches of tree

6adapted from MacKay (2003) textbook

Slides adapted from Matt Gormley (2016)

Page 7: Message Passing and Junction Tree Algorithms · Message Passing and Junction Tree Algorithms Kayhan Batmanghelich 1. Review 2. Review 3. Great Ideas in ML: Message Passing 7 here

Great Ideas in ML: Message Passing

7 here

3 here

3 here

Belief:Must be14 of us

Each soldier receives reports from all branches of tree

7adapted from MacKay (2003) textbook

Slides adapted from Matt Gormley (2016)

Page 8: Message Passing and Junction Tree Algorithms · Message Passing and Junction Tree Algorithms Kayhan Batmanghelich 1. Review 2. Review 3. Great Ideas in ML: Message Passing 7 here

Great Ideas in ML: Message PassingEach soldier receives reports from all branches of tree

7 here

3 here

3 here

Belief:Must be14 of us

wouldn't work correctly

with a 'loopy' (cyclic) graph

8adapted from MacKay (2003) textbook

Slides adapted from Matt Gormley (2016)

Page 9: Message Passing and Junction Tree Algorithms · Message Passing and Junction Tree Algorithms Kayhan Batmanghelich 1. Review 2. Review 3. Great Ideas in ML: Message Passing 7 here

Review

E F

H

A

E F

B A

C

E

G

A

DC

E

A

DC

B A A

hmgm

emfm

bmcm

dm

å=e

fg

e

eamemdcepdcam

),()(),|(),,(

© Eric Xing @ CMU, 2005-2015 9

Message from one C1 to C2:Multiply all incoming messages with the local factor and sum over variables that are not shared

Page 10: Message Passing and Junction Tree Algorithms · Message Passing and Junction Tree Algorithms Kayhan Batmanghelich 1. Review 2. Review 3. Great Ideas in ML: Message Passing 7 here

Message passing (Belief Propagation) on

singly connected graph

10

Page 11: Message Passing and Junction Tree Algorithms · Message Passing and Junction Tree Algorithms Kayhan Batmanghelich 1. Review 2. Review 3. Great Ideas in ML: Message Passing 7 here

Remember this: Factor Graph?

• A factor graph is a graphical model representation that unifies directed and undirected models • It is an undirected bipartite graph with two kinds of nodes.

• Round nodes represent variables, • Square nodes represent factors

and there is an edge from each variable to every factor that mentions it. • We are going to study messages passing between nodes.

Random variables

Factors

x1x2

x3

x4 f(x2, x4)

f(x1, x3)

f(x1, x2)

11

Page 12: Message Passing and Junction Tree Algorithms · Message Passing and Junction Tree Algorithms Kayhan Batmanghelich 1. Review 2. Review 3. Great Ideas in ML: Message Passing 7 here

How General Are Factor Graphs?

• Factor graphs can be used to describe– Markov Random Fields (undirected graphical models)

• i.e., log-linear models over a tuple of variables

– Conditional Random Fields– Bayesian Networks (directed graphical models)

• Inference treats all of these interchangeably.– Convert your model to a factor graph first.– Pearl (1988) gave key strategies for exact inference:• Belief propagation, for inference on acyclic graphs• Junction tree algorithm, for making any graph acyclic

(by merging variables and factors: blows up the runtime)

Page 13: Message Passing and Junction Tree Algorithms · Message Passing and Junction Tree Algorithms Kayhan Batmanghelich 1. Review 2. Review 3. Great Ideas in ML: Message Passing 7 here

Factor Graph Notation

13

• Variables:

• Factors:

Joint DistributionX1

ψ1

ψ2 X2

ψ3

X3

ψ5

X4

ψ7

ψ8 X5

ψ9

time likeflies an arrow

X6

ψ10

X8

X7

X9

ψ{1,8,9}

ψ1

ψ{1,8,9}

ψ2

ψ1

ψ{1,8,9}

ψ3

ψ2

ψ1

ψ{1,8,9}

ψ3

ψ2

ψ1

ψ{1,8,9}

ψ5ψ3

ψ2

ψ1

ψ{1,8,9}

ψ7ψ5ψ3

ψ2

ψ1

ψ{1,8,9}

ψ9ψ7ψ5ψ3

ψ2

ψ1

ψ{1,8,9}

ψ8

ψ9ψ7ψ5ψ3

ψ2

ψ1

ψ{1,8,9}

ψ10

ψ8

ψ9ψ7ψ5ψ3

ψ2

ψ1

ψ{1,8,9}

ψ10

ψ8

ψ7ψ5ψ3

ψ2

ψ1

ψ{1,8,9}

ψ{3}ψ{2}

ψ{1,2}

ψ{1}

ψ{1,8,9}

ψ{2,7,8}

ψ{3,6,7}

ψ{2,3} ψ{3,4}

Page 14: Message Passing and Junction Tree Algorithms · Message Passing and Junction Tree Algorithms Kayhan Batmanghelich 1. Review 2. Review 3. Great Ideas in ML: Message Passing 7 here

X1

ψ1

ψ2 X2

ψ3

X3

ψ5

X4

ψ7

ψ8 X5

ψ9

time likeflies an arrow

X6

ψ10

X8

X7

X9

ψ{1,8,9}

ψ1

ψ{1,8,9}

ψ2

ψ1

ψ{1,8,9}

ψ3

ψ2

ψ1

ψ{1,8,9}

ψ3

ψ2

ψ1

ψ{1,8,9}

ψ5ψ3

ψ2

ψ1

ψ{1,8,9}

ψ7ψ5ψ3

ψ2

ψ1

ψ{1,8,9}

ψ9ψ7ψ5ψ3

ψ2

ψ1

ψ{1,8,9}

ψ8

ψ9ψ7ψ5ψ3

ψ2

ψ1

ψ{1,8,9}

ψ10

ψ8

ψ9ψ7ψ5ψ3

ψ2

ψ1

ψ{1,8,9}

ψ10

ψ8

ψ7ψ5ψ3

ψ2

ψ1

ψ{1,8,9}

ψ{3}ψ{2}

ψ{1,2}

ψ{1}

ψ{1,8,9}

ψ{2,7,8}

ψ{3,6,7}

ψ{2,3} ψ{3,4}

Factors are Tensors

14

• Factors:

v 3n 4p 0.1d 0.1

v n p dv 1 6 3 4n 8 4 2 0.1p 1 3 1 3d 0.1 8 0 0

s vppp …s 0 2 .3vp 3 4 2pp .1 2 1…

s vppp …s 0 2 .3vp 3 4 2pp .1 2 1…

s vppp …s 0 2 .3vp 3 4 2pp .1 2 1…s

vppp

Slides adapted from Matt Gormley (2016)

Page 15: Message Passing and Junction Tree Algorithms · Message Passing and Junction Tree Algorithms Kayhan Batmanghelich 1. Review 2. Review 3. Great Ideas in ML: Message Passing 7 here

An Inference Example

15

Page 16: Message Passing and Junction Tree Algorithms · Message Passing and Junction Tree Algorithms Kayhan Batmanghelich 1. Review 2. Review 3. Great Ideas in ML: Message Passing 7 here

Message Passing in Belief Propagation

16

X Ψ…

My other factors think I’m a noun

But my other variables and I

think you’re a verb

v 1n 6a 3

v 6n 1a 3

v 6n 6a 9

Both of these messages judge the possible values of variable X.Their product = belief at X = product of all 3 messages to X.

Slides adapted from Matt Gormley (2016)

Page 17: Message Passing and Junction Tree Algorithms · Message Passing and Junction Tree Algorithms Kayhan Batmanghelich 1. Review 2. Review 3. Great Ideas in ML: Message Passing 7 here

Sum-Product Belief Propagation

17

Belie

fsMes

sage

s

Variables Factors

X2

ψ1X1 X3X1

ψ2

ψ3ψ1

X1

ψ2

ψ3ψ1

X2

ψ1X1 X3

Slides adapted from Matt Gormley (2016)

Page 18: Message Passing and Junction Tree Algorithms · Message Passing and Junction Tree Algorithms Kayhan Batmanghelich 1. Review 2. Review 3. Great Ideas in ML: Message Passing 7 here

X1

ψ2

ψ3ψ1

v 0.1n 3p 1

Sum-Product Belief Propagation

18

v 1n 2p 2

v 4n 1p 0

v .4n 6p 0

Variable Belief

Slides adapted from Matt Gormley (2016)

Page 19: Message Passing and Junction Tree Algorithms · Message Passing and Junction Tree Algorithms Kayhan Batmanghelich 1. Review 2. Review 3. Great Ideas in ML: Message Passing 7 here

X1

ψ2

ψ3ψ1

Sum-Product Belief Propagation

19

v 0.1n 6p 2

Variable Message

v 0.1n 3p 1

v 1n 2p 2

Slides adapted from Matt Gormley (2016)

Page 20: Message Passing and Junction Tree Algorithms · Message Passing and Junction Tree Algorithms Kayhan Batmanghelich 1. Review 2. Review 3. Great Ideas in ML: Message Passing 7 here

Sum-Product Belief Propagation

20

Factor Belief

ψ1X1 X3

v 8n 0.2

p 4d 1n 0

v np 0.1 8d 3 0n 1 1

v np 3.2 6.4d 24 0n 0 0

Slides adapted from Matt Gormley (2016)

Page 21: Message Passing and Junction Tree Algorithms · Message Passing and Junction Tree Algorithms Kayhan Batmanghelich 1. Review 2. Review 3. Great Ideas in ML: Message Passing 7 here

Sum-Product Belief Propagation

21

Factor Belief

ψ1X1 X3

v np 3.2 6.4d 24 0n 0 0

Slides adapted from Matt Gormley (2016)

Page 22: Message Passing and Junction Tree Algorithms · Message Passing and Junction Tree Algorithms Kayhan Batmanghelich 1. Review 2. Review 3. Great Ideas in ML: Message Passing 7 here

Sum-Product Belief Propagation

22

ψ1X1 X3

v 8n 0.2

v np 0.1 8d 3 0n 1 1

p 0.8 + 0.16d 24 + 0n 8 + 0.2

Factor Message

Slides adapted from Matt Gormley (2016)

Page 23: Message Passing and Junction Tree Algorithms · Message Passing and Junction Tree Algorithms Kayhan Batmanghelich 1. Review 2. Review 3. Great Ideas in ML: Message Passing 7 here

Sum-Product Belief PropagationFactor Message

23

ψ1X1 X3

matrix-vector product(for a binary factor)

Slides adapted from Matt Gormley (2016)

Page 24: Message Passing and Junction Tree Algorithms · Message Passing and Junction Tree Algorithms Kayhan Batmanghelich 1. Review 2. Review 3. Great Ideas in ML: Message Passing 7 here

Summary of the Messages

24

Page 25: Message Passing and Junction Tree Algorithms · Message Passing and Junction Tree Algorithms Kayhan Batmanghelich 1. Review 2. Review 3. Great Ideas in ML: Message Passing 7 here

Input: a factor graph with no cyclesOutput: exact marginals for each variable and factor

Algorithm:1. Initialize the messages to the uniform distribution.

1. Choose a root node.2. Send messages from the leaves to the root.

Send messages from the root to the leaves.

1. Compute the beliefs (unnormalized marginals).

2. Normalize beliefs and return the exact marginals.

Sum-Product Belief Propagation

25

Page 26: Message Passing and Junction Tree Algorithms · Message Passing and Junction Tree Algorithms Kayhan Batmanghelich 1. Review 2. Review 3. Great Ideas in ML: Message Passing 7 here

Sum-Product Belief Propagation

26

Belie

fsMes

sage

s

Variables Factors

X2

ψ1X1 X3X1

ψ2

ψ3ψ1

X1

ψ2

ψ3ψ1

X2

ψ1X1 X3

Slides adapted from Matt Gormley (2016)

Page 27: Message Passing and Junction Tree Algorithms · Message Passing and Junction Tree Algorithms Kayhan Batmanghelich 1. Review 2. Review 3. Great Ideas in ML: Message Passing 7 here

Sum-Product Belief Propagation

27

Belie

fsMes

sage

s

Variables Factors

X2

ψ1X1 X3X1

ψ2

ψ3ψ1

X1

ψ2

ψ3ψ1

X2

ψ1X1 X3

Slides adapted from Matt Gormley (2016)

Page 28: Message Passing and Junction Tree Algorithms · Message Passing and Junction Tree Algorithms Kayhan Batmanghelich 1. Review 2. Review 3. Great Ideas in ML: Message Passing 7 here

(Acyclic) Belief Propagation

28

In a factor graph with no cycles: 1. Pick any node to serve as the root.2. Send messages from the leaves to the root.3. Send messages from the root to the leaves.A node computes an outgoing message along an edge

only after it has received incoming messages along all its other edges.

X1

ψ1

X2

ψ3

X3

ψ5

X4

ψ7

X5

ψ9

time likeflies an arrow

X6

ψ10

X8

ψ12

X7

ψ11

X9

ψ13

Slides adapted from Matt Gormley (2016)

Page 29: Message Passing and Junction Tree Algorithms · Message Passing and Junction Tree Algorithms Kayhan Batmanghelich 1. Review 2. Review 3. Great Ideas in ML: Message Passing 7 here

(Acyclic) Belief Propagation

29

X1

ψ1

X2

ψ3

X3

ψ5

X4

ψ7

X5

ψ9

time likeflies an arrow

X6

ψ10

X8

ψ12

X7

ψ11

X9

ψ13

In a factor graph with no cycles: 1. Pick any node to serve as the root.2. Send messages from the leaves to the root.3. Send messages from the root to the leaves.A node computes an outgoing message along an edge

only after it has received incoming messages along all its other edges.

Slides adapted from Matt Gormley (2016)

Page 30: Message Passing and Junction Tree Algorithms · Message Passing and Junction Tree Algorithms Kayhan Batmanghelich 1. Review 2. Review 3. Great Ideas in ML: Message Passing 7 here

A note on the implementation

To avoid numerical precision issue, use log message ( ):

30

Page 31: Message Passing and Junction Tree Algorithms · Message Passing and Junction Tree Algorithms Kayhan Batmanghelich 1. Review 2. Review 3. Great Ideas in ML: Message Passing 7 here

How about other queries?(MPA, Evidence)

31

Page 32: Message Passing and Junction Tree Algorithms · Message Passing and Junction Tree Algorithms Kayhan Batmanghelich 1. Review 2. Review 3. Great Ideas in ML: Message Passing 7 here

Example

32

Page 33: Message Passing and Junction Tree Algorithms · Message Passing and Junction Tree Algorithms Kayhan Batmanghelich 1. Review 2. Review 3. Great Ideas in ML: Message Passing 7 here

The Max Product Algorithm

33

Page 34: Message Passing and Junction Tree Algorithms · Message Passing and Junction Tree Algorithms Kayhan Batmanghelich 1. Review 2. Review 3. Great Ideas in ML: Message Passing 7 here

Can I use BP in a multiply connected graph?

34

Page 35: Message Passing and Junction Tree Algorithms · Message Passing and Junction Tree Algorithms Kayhan Batmanghelich 1. Review 2. Review 3. Great Ideas in ML: Message Passing 7 here

Loops the trouble makers

• One needs to account for the fact that the structure of the graph changes.• The junction tree algorithm deals with this by combining variables to make a new singly

connected graph for which the graph structure remains singly connected under variable elimination.

35

Page 36: Message Passing and Junction Tree Algorithms · Message Passing and Junction Tree Algorithms Kayhan Batmanghelich 1. Review 2. Review 3. Great Ideas in ML: Message Passing 7 here

Clique Graph• Def (Clique Graph): A clique graph consists of a set of potentials, !" #" ,⋯ , !&(#&) each defined on a set of variables #". For neighboring cliques on the graph, defined on sets of variables #"and #*, the intersection #+ = #- ∩ #*is called the separator and has a corresponding potential !+(#+). A clique graph represents the function

Example

36

Page 37: Message Passing and Junction Tree Algorithms · Message Passing and Junction Tree Algorithms Kayhan Batmanghelich 1. Review 2. Review 3. Great Ideas in ML: Message Passing 7 here

Clique Graph• Def (Clique Graph): A clique graph consists of a set of potentials, !" #" ,⋯ , !&(#&) each defined on a set of variables #". For neighboring cliques on the graph, defined on sets of variables #"and #*, the intersection #+ = #- ∩ #*is called the separator and has a corresponding potential !+(#+). A clique graph represents the function

ExampleDon’t confuse it with Factor Graph!

37

Page 38: Message Passing and Junction Tree Algorithms · Message Passing and Junction Tree Algorithms Kayhan Batmanghelich 1. Review 2. Review 3. Great Ideas in ML: Message Passing 7 here

Example: probability density

38

Page 39: Message Passing and Junction Tree Algorithms · Message Passing and Junction Tree Algorithms Kayhan Batmanghelich 1. Review 2. Review 3. Great Ideas in ML: Message Passing 7 here

Junction Tree• Idea: form a new representation of the graph in which variables are

clustered together, resulting in a singly-connected graph in the cluster variables.• Insight: distribution can be written as product of marginal

distributions, divided by a product of the intersection of the marginal distributions.• Not a remedy to the intractability.

39

Page 40: Message Passing and Junction Tree Algorithms · Message Passing and Junction Tree Algorithms Kayhan Batmanghelich 1. Review 2. Review 3. Great Ideas in ML: Message Passing 7 here

Let’s learn by an example….Coherence

Difficulty Intelligence

SATGrades

HappyJob

Letter

Coherence

Difficulty Intelligence

SATGrades

HappyJobLetter

Moralization 40

Page 41: Message Passing and Junction Tree Algorithms · Message Passing and Junction Tree Algorithms Kayhan Batmanghelich 1. Review 2. Review 3. Great Ideas in ML: Message Passing 7 here

Let’s learn by an example….

Coherence

Difficulty Intelligence

SATGrades

HappyJobLetter

Let’s pick an ordering for the variable eliminationC, D, I, H, G, S, L

41

Page 42: Message Passing and Junction Tree Algorithms · Message Passing and Junction Tree Algorithms Kayhan Batmanghelich 1. Review 2. Review 3. Great Ideas in ML: Message Passing 7 here

Let’s learn by an example….

Coherence

Difficulty Intelligence

SATGrades

HappyJobLetter

Let’s pick an ordering for the variable eliminationC, D, I, H, G, S, L

42

Page 43: Message Passing and Junction Tree Algorithms · Message Passing and Junction Tree Algorithms Kayhan Batmanghelich 1. Review 2. Review 3. Great Ideas in ML: Message Passing 7 here

Let’s learn by an example….

Coherence

Difficulty Intelligence

SATGrades

HappyJobLetter

Let’s pick an ordering for the variable eliminationC, D, I, H, G, S, L

43

Page 44: Message Passing and Junction Tree Algorithms · Message Passing and Junction Tree Algorithms Kayhan Batmanghelich 1. Review 2. Review 3. Great Ideas in ML: Message Passing 7 here

Let’s learn by an example….

Coherence

Difficulty Intelligence

SATGrades

HappyJobLetter

Let’s pick an ordering for the variable eliminationC, D, I, H, G, S, L

44

Page 45: Message Passing and Junction Tree Algorithms · Message Passing and Junction Tree Algorithms Kayhan Batmanghelich 1. Review 2. Review 3. Great Ideas in ML: Message Passing 7 here

Let’s learn by an example….

Coherence

Difficulty Intelligence

SATGrades

HappyJobLetter

Let’s pick an ordering for the variable eliminationC, D, I, H, G, S, L

45

Page 46: Message Passing and Junction Tree Algorithms · Message Passing and Junction Tree Algorithms Kayhan Batmanghelich 1. Review 2. Review 3. Great Ideas in ML: Message Passing 7 here

Let’s learn by an example….

Coherence

Difficulty Intelligence

SATGrades

HappyJobLetter

Let’s pick an ordering for the variable eliminationC, D, I, H, G, S, L

The rest is obvious

46

Page 47: Message Passing and Junction Tree Algorithms · Message Passing and Junction Tree Algorithms Kayhan Batmanghelich 1. Review 2. Review 3. Great Ideas in ML: Message Passing 7 here

OK, what we got so far?Coherence

Difficulty Intelligence

SATGrades

HappyJobLetter

Coherence

Difficulty Intelligence

SATGrades

HappyJob

Letter

Moralized and TriangulatedWe started with 47

Page 48: Message Passing and Junction Tree Algorithms · Message Passing and Junction Tree Algorithms Kayhan Batmanghelich 1. Review 2. Review 3. Great Ideas in ML: Message Passing 7 here

OK, what we got so far?Coherence

Difficulty Intelligence

SATGrades

Happy

JobLetter

Coherence

Difficulty Intelligence

SATGrades

Happy

JobLetter

Moralized and TriangulatedWe started with

Def: An undirected graph is triangulated if every loop of length 4 or more has a chord. An equivalent term is that the graph is decomposable or chordal. From this definition, one may show that an undirected graph is triangulated if and only if its clique graph has a junction tree.

48

Page 49: Message Passing and Junction Tree Algorithms · Message Passing and Junction Tree Algorithms Kayhan Batmanghelich 1. Review 2. Review 3. Great Ideas in ML: Message Passing 7 here

Let’s build the Junction Tree

Coherence

Difficulty Intelligence

SATGrades

HappyJobLetter

C,D

D,I,G

G,I,S

H,G,J

G,J,S,L J,S,L

L,J

D

G,I

G,S

G,J

J,S,LL,J

The orderingC, D, I, H, G, S, L

49

Page 50: Message Passing and Junction Tree Algorithms · Message Passing and Junction Tree Algorithms Kayhan Batmanghelich 1. Review 2. Review 3. Great Ideas in ML: Message Passing 7 here

Pass the messages on the JT

Coherence

Difficulty Intelligence

SATGrades

HappyJobLetter

C,D

D,I,G

G,I,S

H,G,J

G,J,S,L J,S,L

L,J

D

G,I

G,S

G,J

J,S,LL,J

The orderingC, D, I, H, G, S, L

can you figure out the directionality?

50

Page 51: Message Passing and Junction Tree Algorithms · Message Passing and Junction Tree Algorithms Kayhan Batmanghelich 1. Review 2. Review 3. Great Ideas in ML: Message Passing 7 here

root

The message passing protocol

51

Cluster B is allowed to send a message to a neighbor C only after it has received messages from all neighbors except C.

Message passing protocol

COLLECT

DISTRIBUTE

Page 52: Message Passing and Junction Tree Algorithms · Message Passing and Junction Tree Algorithms Kayhan Batmanghelich 1. Review 2. Review 3. Great Ideas in ML: Message Passing 7 here

Message from Clique to another(The Shafer-Shenoy Algorithm)

B C

µB!C(u) =X

v2B\C

B(u [ v)Y

(A,B)2EA 6=C

µA!B(uA [ vA)

B \ C

52

Page 53: Message Passing and Junction Tree Algorithms · Message Passing and Junction Tree Algorithms Kayhan Batmanghelich 1. Review 2. Review 3. Great Ideas in ML: Message Passing 7 here

Formal Algorithm• Moralisation: Marry the parents (only for directed distributions). • Triangulation: Ensure that every loop of length 4 or more has a chord.• Junction Tree: Form a junction tree from cliques of the triangulated graph, removing any

unnecessary links in a loop on the cluster graph. Algorithmically, this can be achieved by finding a tree with maximal spanning weight with weight given by the number of variables in the separator between cliques. Alternatively, given a clique elimination order (with the lowest cliques eliminated first), one may connect each clique to the single neighboring clique.• Potential Assignment: Assign potentials to junction tree cliques and set the separator

potentials to unity. • Message Propagation

53

Page 54: Message Passing and Junction Tree Algorithms · Message Passing and Junction Tree Algorithms Kayhan Batmanghelich 1. Review 2. Review 3. Great Ideas in ML: Message Passing 7 here

Some Facts about BP• BP is exact on trees.

• If BP converges it has reached a local minimum of an objective function • (the Bethe free energy Yedidia et.al ‘00 , Heskes ’02)àoften good approximation

• If it converges, convergence is fast near the fixed point.• Many exciting applications:

- error correcting decoding (MacKay, Yedidia, McEliece, Frey)- vision (Freeman, Weiss)- bioinformatics (Weiss)- constraint satisfaction problems (Dechter)- game theory (Kearns)- … 54

Page 55: Message Passing and Junction Tree Algorithms · Message Passing and Junction Tree Algorithms Kayhan Batmanghelich 1. Review 2. Review 3. Great Ideas in ML: Message Passing 7 here

Summary of the Network Zoo

55

x1x2

x3

x4 f(x2, x4)

f(x1, x3)

f(x1, x2)

UGM and DGM• Use to represent family of probability

distributions• Clear definition of arrows and circles

Factor Graph• A way to present factorization for

both UGM and DGM• It is bipartite graph• More like a data structure• Not to read the independencies

Clique graph or Junction Tree• A data structure used for exact

inference and message passing• Nodes are cluster of variables• Not to read the independencies