Inference in Graphical Models Henrik I. Christensen Robotics & - - PowerPoint PPT Presentation

inference in graphical models
SMART_READER_LITE
LIVE PREVIEW

Inference in Graphical Models Henrik I. Christensen Robotics & - - PowerPoint PPT Presentation

Introduction Inference Factor Graphs Sum-Product Max-Sum P Inference in Graphical Models Henrik I. Christensen Robotics & Intelligent Machines @ GT Georgia Institute of Technology, Atlanta, GA 30332-0280 hic@cc.gatech.edu Henrik I.


slide-1
SLIDE 1

Introduction Inference Factor Graphs Sum-Product Max-Sum P

Inference in Graphical Models

Henrik I. Christensen

Robotics & Intelligent Machines @ GT Georgia Institute of Technology, Atlanta, GA 30332-0280 hic@cc.gatech.edu

Henrik I. Christensen (RIM@GT) Graphical Inference 1 / 38

slide-2
SLIDE 2

Introduction Inference Factor Graphs Sum-Product Max-Sum P

Outline

1

Introduction

2

Inference

3

Factor Graphs

4

Sum-Product Algorithm

5

The Max-Sum Algorithm

6

Summary

Henrik I. Christensen (RIM@GT) Graphical Inference 2 / 38

slide-3
SLIDE 3

Introduction Inference Factor Graphs Sum-Product Max-Sum P

Introduction

Last time we discussed the structure and basics of graphical models Structure of graphs and decomposition of probabilities We have them both in directed and undirected versions Excellent tool for modelling of many robotics related problems such as: SLAM, Gesture Recognition, ... How do we perform inference in these networks? How do perform these operations efficiently?

Henrik I. Christensen (RIM@GT) Graphical Inference 3 / 38

slide-4
SLIDE 4

Introduction Inference Factor Graphs Sum-Product Max-Sum P

Outline

1

Introduction

2

Inference

3

Factor Graphs

4

Sum-Product Algorithm

5

The Max-Sum Algorithm

6

Summary

Henrik I. Christensen (RIM@GT) Graphical Inference 4 / 38

slide-5
SLIDE 5

Introduction Inference Factor Graphs Sum-Product Max-Sum P

Inference in graphical models

Consider inference of p(x, y) we can formulate this as p(x, y) = p(x|y)p(y) = p(y|x)p(x) We can further marginalize p(y) =

  • x′

p(y|x′)p(x′) Using Bayes Rule we can reverse the inference p(x|y) = p(y|x)p(x) p(y) Helpful as mechanisms for inference

Henrik I. Christensen (RIM@GT) Graphical Inference 5 / 38

slide-6
SLIDE 6

Introduction Inference Factor Graphs Sum-Product Max-Sum P

Inference in graphical models

x y x y x y (a) (b) (c)

Henrik I. Christensen (RIM@GT) Graphical Inference 6 / 38

slide-7
SLIDE 7

Introduction Inference Factor Graphs Sum-Product Max-Sum P

Inference on a chain

x1 x2 xN−1 xN p(x) = 1 Z ψ1,2(x1, x2)ψ2,3(x2, x3) · · · ψN−1,N(xN−1, xN) p(xn) =

  • x1

· · ·

  • xn−1
  • xn+1
  • xN

p(x)

Henrik I. Christensen (RIM@GT) Graphical Inference 7 / 38

slide-8
SLIDE 8

Introduction Inference Factor Graphs Sum-Product Max-Sum P

Inference on a chain

x1 xn−1 xn xn+1 xN µα(xn−1) µα(xn) µβ(xn) µβ(xn+1) p(xn) = 1 Z  

xn−1

ψn−1,n(xn−1, xn) · · ·

  • x1

ψ1,2(x1, x2)  

  • µa(xn)
  • xn+1

ψn,n+1(xn, xn+1) · · ·

  • xN

ψN−1,N(xN−1, xN)

  • µb(xn)

Henrik I. Christensen (RIM@GT) Graphical Inference 8 / 38

slide-9
SLIDE 9

Introduction Inference Factor Graphs Sum-Product Max-Sum P

Inference on a chain

x1 xn−1 xn xn+1 xN µα(xn−1) µα(xn) µβ(xn) µβ(xn+1) µa(xn) =

  • xn−1

ψn−1,n(xn−1, xn) · · ·

  • x1

ψ1,2(x1, x2)

  • =
  • xn−1

ψn−1,n(xn−1, xn)µa(xn−1) µb(xn) =

  • xn+1

ψn,n+1(xn, xn+1) · · ·

  • xN

ψN−1,N(xN−1, xN)

  • =
  • xn+1

ψn,n+1(xn, xn+1)µb(xn+1

Henrik I. Christensen (RIM@GT) Graphical Inference 9 / 38

slide-10
SLIDE 10

Introduction Inference Factor Graphs Sum-Product Max-Sum P

Inference on a chain

x1 xn−1 xn xn+1 xN µα(xn−1) µα(xn) µβ(xn) µβ(xn+1) µa(x2) =

x1 ψ1,2(x1, x2)

µb(xN−1) =

xN ψN−1,N(xN−1, xn)

Z =

  • xn

µa(xn)µb(xn)

Henrik I. Christensen (RIM@GT) Graphical Inference 10 / 38

slide-11
SLIDE 11

Introduction Inference Factor Graphs Sum-Product Max-Sum P

Inference on a chain

To compute local marginals

Compute and store forward messages µa(xn) Compute and store backward messages µb(xn) Compute Z at all nodes Compute p(xn) = 1 Z µa(xn)µb(xn) for all variables

Henrik I. Christensen (RIM@GT) Graphical Inference 11 / 38

slide-12
SLIDE 12

Introduction Inference Factor Graphs Sum-Product Max-Sum P

Inference in trees

Undirected Tree Directed Tree Directed Polytree

Henrik I. Christensen (RIM@GT) Graphical Inference 12 / 38

slide-13
SLIDE 13

Introduction Inference Factor Graphs Sum-Product Max-Sum P

Outline

1

Introduction

2

Inference

3

Factor Graphs

4

Sum-Product Algorithm

5

The Max-Sum Algorithm

6

Summary

Henrik I. Christensen (RIM@GT) Graphical Inference 13 / 38

slide-14
SLIDE 14

Introduction Inference Factor Graphs Sum-Product Max-Sum P

Factor Graphs

x1 x2 x3 fa fb fc fd p(x) = fa(x1, x2)fb(x1, x2)fc(x2, x3)fd(x3) p(x) =

  • s

fs(xs)

Henrik I. Christensen (RIM@GT) Graphical Inference 14 / 38

slide-15
SLIDE 15

Introduction Inference Factor Graphs Sum-Product Max-Sum P

Factor Graphs from Directed Graphs

x1 x2 x3 x1 x2 x3 f x1 x2 x3 fc fa fb

p(x) = p(x1)p(x2) f (x1, x2, x3) = fa(x1) = p(x1) p(x3|x1, x2) p(x1)p(x2)p(x3|x1, x2) fb(x2) = p(x2) fc(x1, x2, x3) = p(x3|x2, x1)

Henrik I. Christensen (RIM@GT) Graphical Inference 15 / 38

slide-16
SLIDE 16

Introduction Inference Factor Graphs Sum-Product Max-Sum P

Factor Graphs from Undirected Graphs

x1 x2 x3 x1 x2 x3 f x1 x2 x3 fa fb

ψ(x1, x2, x3) f (x1, x2, x3) fa(x1, x2, x3)fb(x2, x3) = ψ(x1, x2, x3) = ψ(x1, x2, x3)

Henrik I. Christensen (RIM@GT) Graphical Inference 16 / 38

slide-17
SLIDE 17

Introduction Inference Factor Graphs Sum-Product Max-Sum P

Outline

1

Introduction

2

Inference

3

Factor Graphs

4

Sum-Product Algorithm

5

The Max-Sum Algorithm

6

Summary

Henrik I. Christensen (RIM@GT) Graphical Inference 17 / 38

slide-18
SLIDE 18

Introduction Inference Factor Graphs Sum-Product Max-Sum P

The Sum-Product Algorithm

Objective exact, efficient algorithm for computing marginals make allow multiple marginals to be computed efficiently Key Idea The distributive Law ab + ac = a(b + c)

Henrik I. Christensen (RIM@GT) Graphical Inference 18 / 38

slide-19
SLIDE 19

Introduction Inference Factor Graphs Sum-Product Max-Sum P

The Sum-Product Algorithm

x fs µfs→x(x) Fs(x, Xs)

p(x) =

  • x\x

p(x) p(x) =

  • s∈Ne(x)

Fs(x, Xs)

Henrik I. Christensen (RIM@GT) Graphical Inference 19 / 38

slide-20
SLIDE 20

Introduction Inference Factor Graphs Sum-Product Max-Sum P

The Sum-Product Algorithm

x fs µfs→x(x) Fs(x, Xs)

p(x) =

  • s∈Ne(x)

 

Xs

Fs(x, Xs)   =

  • s∈Ne(x)

µfs→x(x) µfs→x(x) =

  • Xs

Fs(x, Xs)

Henrik I. Christensen (RIM@GT) Graphical Inference 20 / 38

slide-21
SLIDE 21

Introduction Inference Factor Graphs Sum-Product Max-Sum P

The Sum-Product Algorithm

xm xM x fs µxM→fs(xM) µfs→x(x) Gm(xm, Xsm)

Fs(x, Xs) = fs(x, x1, ..., xM)G1(x1, Xs1) . . . GM(xM, XsM)

Henrik I. Christensen (RIM@GT) Graphical Inference 21 / 38

slide-22
SLIDE 22

Introduction Inference Factor Graphs Sum-Product Max-Sum P

The Sum-Product Algorithm

xm xM x fs µxM→fs(xM) µfs→x(x) Gm(xm, Xsm)

µfs→x(x) =

  • x1

· · ·

  • xM

fs(x, x1, ..., xM)

  • m∈Ne(fs)\x

 

Xsm

Gm(xm, Xsm)   =

  • x1

· · ·

  • xM

fs(x, x1, ..., xM)

  • m∈Ne(fs)\x

µxm→fs(xm)

Henrik I. Christensen (RIM@GT) Graphical Inference 22 / 38

slide-23
SLIDE 23

Introduction Inference Factor Graphs Sum-Product Max-Sum P

The Sum-Product Algorithm

xm xM x fs µxM→fs(xM) µfs→x(x) Gm(xm, Xsm)

µxm→fs(xm)

  • Xsm

Gm(xm, Xsm) =

  • Xsm
  • l∈Ne(xm)\fs

Fl(xm, Xlm) =

  • l∈Ne(xm)\fs

µfl→xm(xm)

Henrik I. Christensen (RIM@GT) Graphical Inference 23 / 38

slide-24
SLIDE 24

Introduction Inference Factor Graphs Sum-Product Max-Sum P

The Sum-Product Algorithm

Initialization For variable nodes

x f µx→f(x) = 1

For factor nodes

x f µf→x(x) = f(x)

Henrik I. Christensen (RIM@GT) Graphical Inference 24 / 38

slide-25
SLIDE 25

Introduction Inference Factor Graphs Sum-Product Max-Sum P

The Sum-Product Algorithm

To compute local marginals

Pick an arbitrary node as root Compute and propagate msgs from leafs to root (store msgs) Compute and propagate msgs from root to leaf nodes (store msgs) Compute products of received msgs and normalize as required

Propagate up the tree and down again to compute all marginals (as needed)

Henrik I. Christensen (RIM@GT) Graphical Inference 25 / 38

slide-26
SLIDE 26

Introduction Inference Factor Graphs Sum-Product Max-Sum P

Outline

1

Introduction

2

Inference

3

Factor Graphs

4

Sum-Product Algorithm

5

The Max-Sum Algorithm

6

Summary

Henrik I. Christensen (RIM@GT) Graphical Inference 26 / 38

slide-27
SLIDE 27

Introduction Inference Factor Graphs Sum-Product Max-Sum P

The Max-Sum Algorithm

Objective find value xmax that maximizes p(x) compute the value of p(xmax) the method should be efficient Observation In general max marginals = joint extremum

Henrik I. Christensen (RIM@GT) Graphical Inference 27 / 38

slide-28
SLIDE 28

Introduction Inference Factor Graphs Sum-Product Max-Sum P

The Max-Sum Algorithm

Maximizing over a chain (max product)

x1 x2 xN−1 xN

p(xmax) = max

x

p(x) = max

x1 . . . max xm p(x)

= 1 Z max

x1 · · · max xN [ψ1,2(x1, x2) · · · ψN−1,N(xN−1, xN)]

= 1 Z max

x1

  • max

x2

  • ψ1,2(x1, x2)
  • · · · max

xN ψN−1,N(xN−1, xN)

  • Henrik I. Christensen (RIM@GT)

Graphical Inference 28 / 38

slide-29
SLIDE 29

Introduction Inference Factor Graphs Sum-Product Max-Sum P

The Max-Sum Algorithm

Generalizes to tree-structured factor graphs max

x

p(x) = max

xn

  • fs∈Ne(xn)

max

Xs fs(xn, Xs)

I.e. maximizing as close to leaf nodes as possible

Henrik I. Christensen (RIM@GT) Graphical Inference 29 / 38

slide-30
SLIDE 30

Introduction Inference Factor Graphs Sum-Product Max-Sum P

The Max-Sum Algorithm

Max-Product → Max-Sum For numerical reasons, use ln

  • max

x

p(x)

  • = max

x

ln p(x) Note the use of distributive law max(a + b, a + c) = a + max(b, c)

Henrik I. Christensen (RIM@GT) Graphical Inference 30 / 38

slide-31
SLIDE 31

Introduction Inference Factor Graphs Sum-Product Max-Sum P

The Max-Sum Algorithm

Initialization (leaf nodes) µx→f (x) = 0 µf →x(x) = ln f (x) Recursion

µf →x(x) = max

x1,...,xM

 ln f (x, x1, ...., xM) +

  • m∈Ne(fs)\x

µxm→f (xm)   φ(x) = arg maxx1,...,xM  ln f (x, x1, ...., xM) +

  • m∈Ne(fs)\x

µxm→f (xm)   µx→f (x) =

  • l∈Ne(x)\f

µfl→x(x)

Henrik I. Christensen (RIM@GT) Graphical Inference 31 / 38

slide-32
SLIDE 32

Introduction Inference Factor Graphs Sum-Product Max-Sum P

The Max-Sum Algorithm

Termination (the root node) pmax = max

x

 

s∈Ne(x)

µfs→x(x)   xmax = arg max

x

 

s∈Ne(x)

µfs→x(x)   Backtrack to all nodes (i) with factor nodes (l) connected to root xmax

l

= φ(xmax

i,l

)

Henrik I. Christensen (RIM@GT) Graphical Inference 32 / 38

slide-33
SLIDE 33

Introduction Inference Factor Graphs Sum-Product Max-Sum P

The Junction Tree Algorithm

Exact inference in general graphs Turn a graph into a tree structure (locate max cliques) Run a Sum-Product Algorithm on the Junction tree For large cliques the method is intractable

Henrik I. Christensen (RIM@GT) Graphical Inference 33 / 38

slide-34
SLIDE 34

Introduction Inference Factor Graphs Sum-Product Max-Sum P

Loopy Belief Propagation

An approximate approach Perform Sum-Product on the general graph Initial unit message passed across all links

Schedule of message passing important Flooding vs Serial scheduling

Continue until convergence (not guaranteed) Approximate but could be tractable Convergence is not gauranteed

Henrik I. Christensen (RIM@GT) Graphical Inference 34 / 38

slide-35
SLIDE 35

Introduction Inference Factor Graphs Sum-Product Max-Sum P

Outline

1

Introduction

2

Inference

3

Factor Graphs

4

Sum-Product Algorithm

5

The Max-Sum Algorithm

6

Summary

Henrik I. Christensen (RIM@GT) Graphical Inference 35 / 38

slide-36
SLIDE 36

Introduction Inference Factor Graphs Sum-Product Max-Sum P

Summary

Discussion of inference methods for Graphical Models Organization of structure to make computations tractable Approaches such as factor graphs are effective Direct message passage analogy allow for efficient implementation The computations are “regular” in structure For general graphs there might not always be an effective strategy Good tools are available such as Hugin, Genie, ...

Henrik I. Christensen (RIM@GT) Graphical Inference 36 / 38

slide-37
SLIDE 37

Introduction Inference Factor Graphs Sum-Product Max-Sum P

References

  • J. Pearl, Probabilistic Reasoning in Intelligent Systems, San Mateo:

Morgan Kaufmann, 1988.

  • F. V. Jensen, Bayesian Networks and Decision Graphs

Springer-Verlag, New york, 2001

  • U. B. Kjaerulff & A. L. Madsen, Bayesian Networks and Influence

Diagrams, Springer Verlag, New York, 2008 http://www.hugin.com

Henrik I. Christensen (RIM@GT) Graphical Inference 37 / 38

slide-38
SLIDE 38

Introduction Inference Factor Graphs Sum-Product Max-Sum P

Munin

Henrik I. Christensen (RIM@GT) Graphical Inference 38 / 38