CS 6347 Lecture 5 - personal.utdallas.edunicholas.ruozzi/cs6347/2016sp/lects/... · Recap •...

48
CS 6347 Lecture 5 Exact Inference in MRFs

Transcript of CS 6347 Lecture 5 - personal.utdallas.edunicholas.ruozzi/cs6347/2016sp/lects/... · Recap •...

Page 1: CS 6347 Lecture 5 - personal.utdallas.edunicholas.ruozzi/cs6347/2016sp/lects/... · Recap • Announcements – First homework updated (to correct a typo) • Last Time – MRFs •

CS 6347

Lecture 5

Exact Inference in MRFs

Page 2: CS 6347 Lecture 5 - personal.utdallas.edunicholas.ruozzi/cs6347/2016sp/lects/... · Recap • Announcements – First homework updated (to correct a typo) • Last Time – MRFs •

Recap

• Announcements

– First homework updated (to correct a typo)

• Last Time

– MRFs

• Today

– Exact inference: variable elimination and belief propagation

2

Page 3: CS 6347 Lecture 5 - personal.utdallas.edunicholas.ruozzi/cs6347/2016sp/lects/... · Recap • Announcements – First homework updated (to correct a typo) • Last Time – MRFs •

Inference

𝑝𝑝 𝑥𝑥𝐴𝐴, 𝑥𝑥𝐵𝐵, 𝑥𝑥𝐶𝐶 =1𝑍𝑍𝜓𝜓𝐴𝐴𝐵𝐵 𝑥𝑥𝐴𝐴, 𝑥𝑥𝐵𝐵 𝜓𝜓𝐵𝐵𝐶𝐶 𝑥𝑥𝐵𝐵, 𝑥𝑥𝐶𝐶 𝜓𝜓𝐶𝐶𝐶𝐶(𝑥𝑥𝐶𝐶 , 𝑥𝑥𝐶𝐶)

𝑍𝑍 = �𝑥𝑥𝐴𝐴′ ,𝑥𝑥𝐵𝐵

′ ,𝑥𝑥𝐶𝐶′ ,𝑥𝑥𝐷𝐷

𝜓𝜓𝐴𝐴𝐵𝐵 𝑥𝑥𝐴𝐴′ , 𝑥𝑥𝐵𝐵′ 𝜓𝜓𝐵𝐵𝐶𝐶 𝑥𝑥𝐵𝐵′ , 𝑥𝑥𝐶𝐶′ 𝜓𝜓𝐶𝐶𝐶𝐶(𝑥𝑥𝐶𝐶′ , 𝑥𝑥𝐶𝐶′ )

𝐴𝐴 𝐵𝐵 𝐶𝐶 𝐷𝐷

3

Page 4: CS 6347 Lecture 5 - personal.utdallas.edunicholas.ruozzi/cs6347/2016sp/lects/... · Recap • Announcements – First homework updated (to correct a typo) • Last Time – MRFs •

Inference

𝑍𝑍 = �𝑥𝑥𝐴𝐴′ ,𝑥𝑥𝐵𝐵

′ ,𝑥𝑥𝐶𝐶′ ,𝑥𝑥𝐷𝐷

𝜓𝜓𝐴𝐴𝐵𝐵 𝑥𝑥𝐴𝐴′ , 𝑥𝑥𝐵𝐵′ 𝜓𝜓𝐵𝐵𝐶𝐶 𝑥𝑥𝐵𝐵′ , 𝑥𝑥𝐶𝐶′ 𝜓𝜓𝐶𝐶𝐶𝐶(𝑥𝑥𝐶𝐶′ , 𝑥𝑥𝐶𝐶′ )

= �𝑥𝑥𝐴𝐴′

�𝑥𝑥𝐵𝐵′

�𝑥𝑥𝐶𝐶′

�𝑥𝑥𝐷𝐷′

𝜓𝜓𝐴𝐴𝐵𝐵 𝑥𝑥𝐴𝐴′ , 𝑥𝑥𝐵𝐵′ 𝜓𝜓𝐵𝐵𝐶𝐶 𝑥𝑥𝐵𝐵′ , 𝑥𝑥𝐶𝐶′ 𝜓𝜓𝐶𝐶𝐶𝐶(𝑥𝑥𝐶𝐶′ , 𝑥𝑥𝐶𝐶′ )

= �𝑥𝑥𝐴𝐴′

�𝑥𝑥𝐵𝐵′

𝜓𝜓𝐴𝐴𝐵𝐵 𝑥𝑥𝐴𝐴′ , 𝑥𝑥𝐵𝐵′ �𝑥𝑥𝐶𝐶′

𝜓𝜓𝐵𝐵𝐶𝐶 𝑥𝑥𝐵𝐵′ , 𝑥𝑥𝐶𝐶′ �𝑥𝑥𝐷𝐷′

𝜓𝜓𝐶𝐶𝐶𝐶(𝑥𝑥𝐶𝐶′ , 𝑥𝑥𝐶𝐶′ )

4

Page 5: CS 6347 Lecture 5 - personal.utdallas.edunicholas.ruozzi/cs6347/2016sp/lects/... · Recap • Announcements – First homework updated (to correct a typo) • Last Time – MRFs •

Inference

𝑍𝑍 = �𝑥𝑥𝐴𝐴′ ,𝑥𝑥𝐵𝐵

′ ,𝑥𝑥𝐶𝐶′ ,𝑥𝑥𝐷𝐷

𝜓𝜓𝐴𝐴𝐵𝐵 𝑥𝑥𝐴𝐴′ , 𝑥𝑥𝐵𝐵′ 𝜓𝜓𝐵𝐵𝐶𝐶 𝑥𝑥𝐵𝐵′ , 𝑥𝑥𝐶𝐶′ 𝜓𝜓𝐶𝐶𝐶𝐶(𝑥𝑥𝐶𝐶′ , 𝑥𝑥𝐶𝐶′ )

= �𝑥𝑥𝐴𝐴′

�𝑥𝑥𝐵𝐵′

�𝑥𝑥𝐶𝐶′

�𝑥𝑥𝐷𝐷′

𝜓𝜓𝐴𝐴𝐵𝐵 𝑥𝑥𝐴𝐴′ , 𝑥𝑥𝐵𝐵′ 𝜓𝜓𝐵𝐵𝐶𝐶 𝑥𝑥𝐵𝐵′ , 𝑥𝑥𝐶𝐶′ 𝜓𝜓𝐶𝐶𝐶𝐶(𝑥𝑥𝐶𝐶′ , 𝑥𝑥𝐶𝐶′ )

= �𝑥𝑥𝐴𝐴′

�𝑥𝑥𝐵𝐵′

𝜓𝜓𝐴𝐴𝐵𝐵 𝑥𝑥𝐴𝐴′ , 𝑥𝑥𝐵𝐵′ �𝑥𝑥𝐶𝐶′

𝜓𝜓𝐵𝐵𝐶𝐶 𝑥𝑥𝐵𝐵′ , 𝑥𝑥𝐶𝐶′ �𝑥𝑥𝐷𝐷′

𝜓𝜓𝐶𝐶𝐶𝐶(𝑥𝑥𝐶𝐶′ , 𝑥𝑥𝐶𝐶′ )

𝜙𝜙𝐶𝐶(𝑥𝑥𝐶𝐶′ )

5

Page 6: CS 6347 Lecture 5 - personal.utdallas.edunicholas.ruozzi/cs6347/2016sp/lects/... · Recap • Announcements – First homework updated (to correct a typo) • Last Time – MRFs •

Inference

𝑍𝑍 = �𝑥𝑥𝐴𝐴′ ,𝑥𝑥𝐵𝐵

′ ,𝑥𝑥𝐶𝐶′ ,𝑥𝑥𝐷𝐷

𝜓𝜓𝐴𝐴𝐵𝐵 𝑥𝑥𝐴𝐴′ , 𝑥𝑥𝐵𝐵′ 𝜓𝜓𝐵𝐵𝐶𝐶 𝑥𝑥𝐵𝐵′ , 𝑥𝑥𝐶𝐶′ 𝜓𝜓𝐶𝐶𝐶𝐶(𝑥𝑥𝐶𝐶′ , 𝑥𝑥𝐶𝐶′ )

= �𝑥𝑥𝐴𝐴′

�𝑥𝑥𝐵𝐵′

�𝑥𝑥𝐶𝐶′

�𝑥𝑥𝐷𝐷′

𝜓𝜓𝐴𝐴𝐵𝐵 𝑥𝑥𝐴𝐴′ , 𝑥𝑥𝐵𝐵′ 𝜓𝜓𝐵𝐵𝐶𝐶 𝑥𝑥𝐵𝐵′ , 𝑥𝑥𝐶𝐶′ 𝜓𝜓𝐶𝐶𝐶𝐶(𝑥𝑥𝐶𝐶′ , 𝑥𝑥𝐶𝐶′ )

= �𝑥𝑥𝐴𝐴′

�𝑥𝑥𝐵𝐵′

𝜓𝜓𝐴𝐴𝐵𝐵 𝑥𝑥𝐴𝐴′ , 𝑥𝑥𝐵𝐵′ �𝑥𝑥𝐶𝐶′

𝜓𝜓𝐵𝐵𝐶𝐶 𝑥𝑥𝐵𝐵′ , 𝑥𝑥𝐶𝐶′ 𝜙𝜙𝐶𝐶(𝑥𝑥𝐶𝐶′ )

6

Page 7: CS 6347 Lecture 5 - personal.utdallas.edunicholas.ruozzi/cs6347/2016sp/lects/... · Recap • Announcements – First homework updated (to correct a typo) • Last Time – MRFs •

Inference

𝑍𝑍 = �𝑥𝑥𝐴𝐴′ ,𝑥𝑥𝐵𝐵

′ ,𝑥𝑥𝐶𝐶′ ,𝑥𝑥𝐷𝐷

𝜓𝜓𝐴𝐴𝐵𝐵 𝑥𝑥𝐴𝐴′ , 𝑥𝑥𝐵𝐵′ 𝜓𝜓𝐵𝐵𝐶𝐶 𝑥𝑥𝐵𝐵′ , 𝑥𝑥𝐶𝐶′ 𝜓𝜓𝐶𝐶𝐶𝐶(𝑥𝑥𝐶𝐶′ , 𝑥𝑥𝐶𝐶′ )

= �𝑥𝑥𝐴𝐴′

�𝑥𝑥𝐵𝐵′

�𝑥𝑥𝐶𝐶′

�𝑥𝑥𝐷𝐷′

𝜓𝜓𝐴𝐴𝐵𝐵 𝑥𝑥𝐴𝐴′ , 𝑥𝑥𝐵𝐵′ 𝜓𝜓𝐵𝐵𝐶𝐶 𝑥𝑥𝐵𝐵′ , 𝑥𝑥𝐶𝐶′ 𝜓𝜓𝐶𝐶𝐶𝐶(𝑥𝑥𝐶𝐶′ , 𝑥𝑥𝐶𝐶′ )

= �𝑥𝑥𝐴𝐴′

�𝑥𝑥𝐵𝐵′

𝜓𝜓𝐴𝐴𝐵𝐵 𝑥𝑥𝐴𝐴′ , 𝑥𝑥𝐵𝐵′ �𝑥𝑥𝐶𝐶′

𝜓𝜓𝐵𝐵𝐶𝐶 𝑥𝑥𝐵𝐵′ , 𝑥𝑥𝐶𝐶′ 𝜙𝜙𝐶𝐶(𝑥𝑥𝐶𝐶′ )

𝜙𝜙𝐵𝐵(𝑥𝑥𝐵𝐵′ )

7

Page 8: CS 6347 Lecture 5 - personal.utdallas.edunicholas.ruozzi/cs6347/2016sp/lects/... · Recap • Announcements – First homework updated (to correct a typo) • Last Time – MRFs •

Inference

𝑍𝑍 = �𝑥𝑥𝐴𝐴′ ,𝑥𝑥𝐵𝐵

′ ,𝑥𝑥𝐶𝐶′ ,𝑥𝑥𝐷𝐷

𝜓𝜓𝐴𝐴𝐵𝐵 𝑥𝑥𝐴𝐴′ , 𝑥𝑥𝐵𝐵′ 𝜓𝜓𝐵𝐵𝐶𝐶 𝑥𝑥𝐵𝐵′ , 𝑥𝑥𝐶𝐶′ 𝜓𝜓𝐶𝐶𝐶𝐶(𝑥𝑥𝐶𝐶′ , 𝑥𝑥𝐶𝐶′ )

= �𝑥𝑥𝐴𝐴′

�𝑥𝑥𝐵𝐵′

�𝑥𝑥𝐶𝐶′

�𝑥𝑥𝐷𝐷′

𝜓𝜓𝐴𝐴𝐵𝐵 𝑥𝑥𝐴𝐴′ , 𝑥𝑥𝐵𝐵′ 𝜓𝜓𝐵𝐵𝐶𝐶 𝑥𝑥𝐵𝐵′ , 𝑥𝑥𝐶𝐶′ 𝜓𝜓𝐶𝐶𝐶𝐶(𝑥𝑥𝐶𝐶′ , 𝑥𝑥𝐶𝐶′ )

= �𝑥𝑥𝐴𝐴′

�𝑥𝑥𝐵𝐵′

𝜓𝜓𝐴𝐴𝐵𝐵 𝑥𝑥𝐴𝐴′ , 𝑥𝑥𝐵𝐵′ 𝜙𝜙𝐵𝐵(𝑥𝑥𝐵𝐵′ )

8

Page 9: CS 6347 Lecture 5 - personal.utdallas.edunicholas.ruozzi/cs6347/2016sp/lects/... · Recap • Announcements – First homework updated (to correct a typo) • Last Time – MRFs •

Inference

𝑍𝑍 = �𝑥𝑥𝐴𝐴′ ,𝑥𝑥𝐵𝐵

′ ,𝑥𝑥𝐶𝐶′ ,𝑥𝑥𝐷𝐷

𝜓𝜓𝐴𝐴𝐵𝐵 𝑥𝑥𝐴𝐴′ , 𝑥𝑥𝐵𝐵′ 𝜓𝜓𝐵𝐵𝐶𝐶 𝑥𝑥𝐵𝐵′ , 𝑥𝑥𝐶𝐶′ 𝜓𝜓𝐶𝐶𝐶𝐶(𝑥𝑥𝐶𝐶′ , 𝑥𝑥𝐶𝐶′ )

= �𝑥𝑥𝐴𝐴′

�𝑥𝑥𝐵𝐵′

�𝑥𝑥𝐶𝐶′

�𝑥𝑥𝐷𝐷′

𝜓𝜓𝐴𝐴𝐵𝐵 𝑥𝑥𝐴𝐴′ , 𝑥𝑥𝐵𝐵′ 𝜓𝜓𝐵𝐵𝐶𝐶 𝑥𝑥𝐵𝐵′ , 𝑥𝑥𝐶𝐶′ 𝜓𝜓𝐶𝐶𝐶𝐶(𝑥𝑥𝐶𝐶′ , 𝑥𝑥𝐶𝐶′ )

= �𝑥𝑥𝐴𝐴′

�𝑥𝑥𝐵𝐵′

𝜓𝜓𝐴𝐴𝐵𝐵 𝑥𝑥𝐴𝐴′ , 𝑥𝑥𝐵𝐵′ 𝜙𝜙𝐵𝐵(𝑥𝑥𝐵𝐵′ )

𝜙𝜙𝐴𝐴(𝑥𝑥𝐴𝐴′ )

9

Page 10: CS 6347 Lecture 5 - personal.utdallas.edunicholas.ruozzi/cs6347/2016sp/lects/... · Recap • Announcements – First homework updated (to correct a typo) • Last Time – MRFs •

Inference

𝑍𝑍 = �𝑥𝑥𝐴𝐴′ ,𝑥𝑥𝐵𝐵

′ ,𝑥𝑥𝐶𝐶′ ,𝑥𝑥𝐷𝐷

𝜓𝜓𝐴𝐴𝐵𝐵 𝑥𝑥𝐴𝐴′ , 𝑥𝑥𝐵𝐵′ 𝜓𝜓𝐵𝐵𝐶𝐶 𝑥𝑥𝐵𝐵′ , 𝑥𝑥𝐶𝐶′ 𝜓𝜓𝐶𝐶𝐶𝐶(𝑥𝑥𝐶𝐶′ , 𝑥𝑥𝐶𝐶′ )

= �𝑥𝑥𝐴𝐴′

�𝑥𝑥𝐵𝐵′

�𝑥𝑥𝐶𝐶′

�𝑥𝑥𝐷𝐷′

𝜓𝜓𝐴𝐴𝐵𝐵 𝑥𝑥𝐴𝐴′ , 𝑥𝑥𝐵𝐵′ 𝜓𝜓𝐵𝐵𝐶𝐶 𝑥𝑥𝐵𝐵′ , 𝑥𝑥𝐶𝐶′ 𝜓𝜓𝐶𝐶𝐶𝐶(𝑥𝑥𝐶𝐶′ , 𝑥𝑥𝐶𝐶′ )

= �𝑥𝑥𝐴𝐴′

𝜙𝜙𝐴𝐴 𝑥𝑥𝐴𝐴′

10

Page 11: CS 6347 Lecture 5 - personal.utdallas.edunicholas.ruozzi/cs6347/2016sp/lects/... · Recap • Announcements – First homework updated (to correct a typo) • Last Time – MRFs •

Variable Elimination

• Choose an ordering of the random variables

• Sum the joint distribution over the variables one at a time in the specified order exploiting the factorization where possible

– Each time a variable is eliminated, it creates a new potential that is multiplied back in after removing the sum that generated this potential

11

Page 12: CS 6347 Lecture 5 - personal.utdallas.edunicholas.ruozzi/cs6347/2016sp/lects/... · Recap • Announcements – First homework updated (to correct a typo) • Last Time – MRFs •

Variable Elimination

• What is the cost of the optimal variable elimination on the chain?

12

Page 13: CS 6347 Lecture 5 - personal.utdallas.edunicholas.ruozzi/cs6347/2016sp/lects/... · Recap • Announcements – First homework updated (to correct a typo) • Last Time – MRFs •

Variable Elimination

• What is the cost of the optimal variable elimination on the chain?

length of the chain × (size of state space)2

13

Page 14: CS 6347 Lecture 5 - personal.utdallas.edunicholas.ruozzi/cs6347/2016sp/lects/... · Recap • Announcements – First homework updated (to correct a typo) • Last Time – MRFs •

Another Example

Elimination order: C, B, D, F, E, A

(worked out on the board)

𝐴𝐴 𝐵𝐵 𝐶𝐶 𝐷𝐷

𝐸𝐸 𝐹𝐹

14

Page 15: CS 6347 Lecture 5 - personal.utdallas.edunicholas.ruozzi/cs6347/2016sp/lects/... · Recap • Announcements – First homework updated (to correct a typo) • Last Time – MRFs •

Another Example

Elimination order: C, B, D, F, E, A

𝐴𝐴 𝐵𝐵 𝐶𝐶 𝐷𝐷

𝐸𝐸 𝐹𝐹

15

Page 16: CS 6347 Lecture 5 - personal.utdallas.edunicholas.ruozzi/cs6347/2016sp/lects/... · Recap • Announcements – First homework updated (to correct a typo) • Last Time – MRFs •

Another Example

Elimination order: C, B, D, F, E, A

𝐴𝐴 𝐵𝐵 𝐷𝐷

𝐸𝐸 𝐹𝐹

16

Page 17: CS 6347 Lecture 5 - personal.utdallas.edunicholas.ruozzi/cs6347/2016sp/lects/... · Recap • Announcements – First homework updated (to correct a typo) • Last Time – MRFs •

Another Example

Elimination order: C, B, D, F, E, A

𝐴𝐴 𝐵𝐵 𝐷𝐷

𝐸𝐸 𝐹𝐹

17

Page 18: CS 6347 Lecture 5 - personal.utdallas.edunicholas.ruozzi/cs6347/2016sp/lects/... · Recap • Announcements – First homework updated (to correct a typo) • Last Time – MRFs •

Another Example

Elimination order: C, B, D, F, E, A

𝐴𝐴 𝐷𝐷

𝐸𝐸 𝐹𝐹

18

Page 19: CS 6347 Lecture 5 - personal.utdallas.edunicholas.ruozzi/cs6347/2016sp/lects/... · Recap • Announcements – First homework updated (to correct a typo) • Last Time – MRFs •

Another Example

Elimination order: C, B, D, F, E, A

𝐴𝐴 𝐷𝐷

𝐸𝐸 𝐹𝐹

19

Page 20: CS 6347 Lecture 5 - personal.utdallas.edunicholas.ruozzi/cs6347/2016sp/lects/... · Recap • Announcements – First homework updated (to correct a typo) • Last Time – MRFs •

Another Example

Elimination order: C, B, D, F, E, A

𝐴𝐴

𝐸𝐸 𝐹𝐹

20

Page 21: CS 6347 Lecture 5 - personal.utdallas.edunicholas.ruozzi/cs6347/2016sp/lects/... · Recap • Announcements – First homework updated (to correct a typo) • Last Time – MRFs •

Another Example

Elimination order: C, B, D, F, E, A

𝐴𝐴

𝐸𝐸 𝐹𝐹

21

Page 22: CS 6347 Lecture 5 - personal.utdallas.edunicholas.ruozzi/cs6347/2016sp/lects/... · Recap • Announcements – First homework updated (to correct a typo) • Last Time – MRFs •

Another Example

Elimination order: C, B, D, F, E, A

𝐴𝐴

𝐸𝐸

22

Page 23: CS 6347 Lecture 5 - personal.utdallas.edunicholas.ruozzi/cs6347/2016sp/lects/... · Recap • Announcements – First homework updated (to correct a typo) • Last Time – MRFs •

Another Example

Elimination order: C, B, D, F, E, A

𝐴𝐴

𝐸𝐸

23

Page 24: CS 6347 Lecture 5 - personal.utdallas.edunicholas.ruozzi/cs6347/2016sp/lects/... · Recap • Announcements – First homework updated (to correct a typo) • Last Time – MRFs •

Another Example

Elimination order: C, B, D, F, E, A

𝐴𝐴

24

Page 25: CS 6347 Lecture 5 - personal.utdallas.edunicholas.ruozzi/cs6347/2016sp/lects/... · Recap • Announcements – First homework updated (to correct a typo) • Last Time – MRFs •

Another Example

Elimination order: C, B, D, F, E, A

𝐴𝐴

25

Page 26: CS 6347 Lecture 5 - personal.utdallas.edunicholas.ruozzi/cs6347/2016sp/lects/... · Recap • Announcements – First homework updated (to correct a typo) • Last Time – MRFs •

Another Example

Elimination order: C, B, D, F, E, A

26

Page 27: CS 6347 Lecture 5 - personal.utdallas.edunicholas.ruozzi/cs6347/2016sp/lects/... · Recap • Announcements – First homework updated (to correct a typo) • Last Time – MRFs •

Treewidth

• The treewidth of a graph is equal to the size of the largest clique created in any optimal elimination ordering

– Tree width of a tree: ?

27

Page 28: CS 6347 Lecture 5 - personal.utdallas.edunicholas.ruozzi/cs6347/2016sp/lects/... · Recap • Announcements – First homework updated (to correct a typo) • Last Time – MRFs •

Treewidth

• The treewidth of a graph is equal to the size of the largest clique created in any optimal elimination ordering

– Tree width of a tree: 1 (as long as it has at least one edge)

• The complexity of variable elimination is upper bounded by

n ⋅ (size of the state space)treewidth+1

28

Page 29: CS 6347 Lecture 5 - personal.utdallas.edunicholas.ruozzi/cs6347/2016sp/lects/... · Recap • Announcements – First homework updated (to correct a typo) • Last Time – MRFs •

What is the Treewidth of this Graph?

𝐴𝐴 𝐵𝐵 𝐶𝐶 𝐷𝐷

𝐸𝐸 𝐹𝐹

29

Page 30: CS 6347 Lecture 5 - personal.utdallas.edunicholas.ruozzi/cs6347/2016sp/lects/... · Recap • Announcements – First homework updated (to correct a typo) • Last Time – MRFs •

What is the Treewidth of this Graph?

Elimination order: D, C, F, E, B, A

𝐴𝐴 𝐵𝐵 𝐶𝐶 𝐷𝐷

𝐸𝐸 𝐹𝐹

30

Page 31: CS 6347 Lecture 5 - personal.utdallas.edunicholas.ruozzi/cs6347/2016sp/lects/... · Recap • Announcements – First homework updated (to correct a typo) • Last Time – MRFs •

What is the Treewidth of this Graph?

Elimination order: D, C, F, E, B, A

𝐴𝐴 𝐵𝐵 𝐶𝐶 𝐷𝐷

𝐸𝐸 𝐹𝐹

31

Page 32: CS 6347 Lecture 5 - personal.utdallas.edunicholas.ruozzi/cs6347/2016sp/lects/... · Recap • Announcements – First homework updated (to correct a typo) • Last Time – MRFs •

What is the Treewidth of this Graph?

Elimination order: D, C, F, E, B, A

𝐴𝐴 𝐵𝐵 𝐶𝐶

𝐸𝐸 𝐹𝐹

32

Page 33: CS 6347 Lecture 5 - personal.utdallas.edunicholas.ruozzi/cs6347/2016sp/lects/... · Recap • Announcements – First homework updated (to correct a typo) • Last Time – MRFs •

What is the Treewidth of this Graph?

Elimination order: D, C, F, E, B, A

𝐴𝐴 𝐵𝐵 𝐶𝐶

𝐸𝐸 𝐹𝐹

33

Page 34: CS 6347 Lecture 5 - personal.utdallas.edunicholas.ruozzi/cs6347/2016sp/lects/... · Recap • Announcements – First homework updated (to correct a typo) • Last Time – MRFs •

What is the Treewidth of this Graph?

Elimination order: D, C, F, E, B, A

𝐴𝐴 𝐵𝐵

𝐸𝐸 𝐹𝐹

34

Page 35: CS 6347 Lecture 5 - personal.utdallas.edunicholas.ruozzi/cs6347/2016sp/lects/... · Recap • Announcements – First homework updated (to correct a typo) • Last Time – MRFs •

What is the Treewidth of this Graph?

Elimination order: D, C, F, E, B, A

𝐴𝐴 𝐵𝐵

𝐸𝐸 𝐹𝐹

35

Page 36: CS 6347 Lecture 5 - personal.utdallas.edunicholas.ruozzi/cs6347/2016sp/lects/... · Recap • Announcements – First homework updated (to correct a typo) • Last Time – MRFs •

What is the Treewidth of this Graph?

Elimination order: D, C, F, E, B, A

𝐴𝐴 𝐵𝐵

𝐸𝐸

36

Page 37: CS 6347 Lecture 5 - personal.utdallas.edunicholas.ruozzi/cs6347/2016sp/lects/... · Recap • Announcements – First homework updated (to correct a typo) • Last Time – MRFs •

What is the Treewidth of this Graph?

Elimination order: D, C, F, E, B, A

𝐴𝐴 𝐵𝐵

𝐸𝐸

37

Page 38: CS 6347 Lecture 5 - personal.utdallas.edunicholas.ruozzi/cs6347/2016sp/lects/... · Recap • Announcements – First homework updated (to correct a typo) • Last Time – MRFs •

What is the Treewidth of this Graph?

Elimination order: D, C, F, E, B, A

𝐴𝐴 𝐵𝐵

38

Page 39: CS 6347 Lecture 5 - personal.utdallas.edunicholas.ruozzi/cs6347/2016sp/lects/... · Recap • Announcements – First homework updated (to correct a typo) • Last Time – MRFs •

What is the Treewidth of this Graph?

Elimination order: D, C, F, E, B, A

𝐴𝐴 𝐵𝐵

39

Page 40: CS 6347 Lecture 5 - personal.utdallas.edunicholas.ruozzi/cs6347/2016sp/lects/... · Recap • Announcements – First homework updated (to correct a typo) • Last Time – MRFs •

What is the Treewidth of this Graph?

Elimination order: D, C, F, E, B, A

𝐴𝐴

40

Page 41: CS 6347 Lecture 5 - personal.utdallas.edunicholas.ruozzi/cs6347/2016sp/lects/... · Recap • Announcements – First homework updated (to correct a typo) • Last Time – MRFs •

What is the Treewidth of this Graph?

Elimination order: D, C, F, E, B, A

𝐴𝐴

41

Page 42: CS 6347 Lecture 5 - personal.utdallas.edunicholas.ruozzi/cs6347/2016sp/lects/... · Recap • Announcements – First homework updated (to correct a typo) • Last Time – MRFs •

What is the Treewidth of this Graph?

Elimination order: D, C, F, E, B, A

Largest clique created had size two(this is the best that we can do)

42

Page 43: CS 6347 Lecture 5 - personal.utdallas.edunicholas.ruozzi/cs6347/2016sp/lects/... · Recap • Announcements – First homework updated (to correct a typo) • Last Time – MRFs •

Elimination Orderings

• Finding the optimal elimination ordering is NP-hard!

• Heuristic methods are often used in practice

– Min-degree: the cost of a vertex is the number of neighbors it has in the current graph

– Min-fill: the cost of a vertex is the number of new edges that need to be added to the graph due to its elimination

43

Page 44: CS 6347 Lecture 5 - personal.utdallas.edunicholas.ruozzi/cs6347/2016sp/lects/... · Recap • Announcements – First homework updated (to correct a typo) • Last Time – MRFs •

Belief Propagation

• Efficient method for inference on a tree

• Represent the variable elimination process as a collection of messages passed between nodes in the tree

– The messages keep track of the potential functions produced throughout the elimination process

• Optimal elimination order on a tree always eliminate leaves of the current tree (i.e., always eliminate degree 1 vertices)

44

Page 45: CS 6347 Lecture 5 - personal.utdallas.edunicholas.ruozzi/cs6347/2016sp/lects/... · Recap • Announcements – First homework updated (to correct a typo) • Last Time – MRFs •

Belief Propagation

• 𝑝𝑝 𝑥𝑥1, … , 𝑥𝑥𝑛𝑛 = ∏𝑖𝑖∈𝑉𝑉 𝜙𝜙𝑖𝑖(𝑥𝑥𝑖𝑖)∏ 𝑖𝑖,𝑗𝑗 ∈𝐸𝐸 𝜓𝜓𝑖𝑖𝑗𝑗(𝑥𝑥𝑖𝑖 , 𝑥𝑥𝑗𝑗)

𝑚𝑚𝑖𝑖→𝑗𝑗 𝑥𝑥𝑗𝑗 = �𝑥𝑥𝑖𝑖

𝜙𝜙𝑖𝑖 𝑥𝑥𝑖𝑖 𝜓𝜓𝑖𝑖𝑗𝑗 𝑥𝑥𝑖𝑖 , 𝑥𝑥𝑗𝑗 �𝑘𝑘∈𝑁𝑁 𝑖𝑖 ∖𝑗𝑗

𝑚𝑚𝑘𝑘→i(𝑥𝑥𝑖𝑖)

where 𝑁𝑁(𝑖𝑖) is the set of neighbors of node 𝑖𝑖 in the graph

• Messages are passed in two phases: from the leaves up to the root and then from the root down to the leaves

45

Page 46: CS 6347 Lecture 5 - personal.utdallas.edunicholas.ruozzi/cs6347/2016sp/lects/... · Recap • Announcements – First homework updated (to correct a typo) • Last Time – MRFs •

Belief Propagation

• As an added bonus, BP allows you to efficiently compute the marginal probability over each single variable as well as the partition function

– Multiply the singleton potentials with all of the incoming messages

– Computing the normalization constant for this function gives the partition function of the model

• A similar strategy can be used whenever the factor graph is a tree

– Two types of messages: factor-to-variable and variable-to-factor

46

Page 47: CS 6347 Lecture 5 - personal.utdallas.edunicholas.ruozzi/cs6347/2016sp/lects/... · Recap • Announcements – First homework updated (to correct a typo) • Last Time – MRFs •

Belief Propagation

• What is the complexity of belief propagation on a tree with state space 𝐷𝐷?

47

Page 48: CS 6347 Lecture 5 - personal.utdallas.edunicholas.ruozzi/cs6347/2016sp/lects/... · Recap • Announcements – First homework updated (to correct a typo) • Last Time – MRFs •

Belief Propagation

• What is the complexity of belief propagation on a tree with state space 𝐷𝐷?

𝑂𝑂 𝑛𝑛 𝐷𝐷 2

• What if we want to compute the MAP assignment instead of the partition function?

48