variable elimination
play

Variable elimination Graphical Models 10708 Carlos Guestrin - PowerPoint PPT Presentation

Reading: Chapters 5&6 of Koller&Friedman Variable elimination Graphical Models 10708 Carlos Guestrin Carnegie Mellon University September 26 th , 2005 Announcements Waiting List Anyone still wants to be registered?


  1. Reading: Chapters 5&6 of Koller&Friedman Variable elimination Graphical Models – 10708 Carlos Guestrin Carnegie Mellon University September 26 th , 2005

  2. Announcements � Waiting List � Anyone still wants to be registered?

  3. Inference in BNs hopeless? � In general, yes! � Even approximate! � In practice � Exploit structure � Many effective approximation algorithms (some with guarantees) � For now, we’ll talk about exact inference � Approximate inference later this semester

  4. General probabilistic inference Flu Allergy � Query: Sinus Nose Headache � Using def. of cond. prob.: � Normalization:

  5. Marginalization Allergy=t Sinus Flu

  6. Probabilistic inference example Flu Allergy Sinus Nose=t Headache Inference seems exponential in number of variables!

  7. Fast probabilistic inference example – Variable elimination Flu Allergy Sinus Nose=t Headache (Potential for) Exponential reduction in computation!

  8. Understanding variable elimination – Exploiting distributivity Flu Sinus Nose=t

  9. Understanding variable elimination – Order can make a HUGE difference Flu Allergy Sinus Nose=t Headache

  10. Understanding variable elimination – Intermediate results Flu Allergy Sinus Nose=t Headache Intermediate results are probability distributions

  11. Understanding variable elimination – Another example Sinus Nose=t Headache Pharmacy

  12. Pruning irrelevant variables Flu Allergy Sinus Nose=t Headache Prune all non-ancestors of query variables More generally: Prune all nodes not on active trail between evidence and query vars

  13. Variable elimination algorithm � Given a BN and a query P(X|e) ∝ P(X,e) � Instantiate evidence e IMPORTANT!!! � Prune non-active vars for {X, e } � Choose an ordering on variables, e.g., X 1 , …, X n � Initial factors {f 1 ,…,f n }: f i = P(X i | Pa Xi ) (CPT for X i ) � For i = 1 to n, If X i ∉ {X, E } � Collect factors f 1 ,…,f k that include X i � Generate a new factor by eliminating X i from these factors � Variable X i has been eliminated! � Normalize P(X, e ) to obtain P(X| e )

  14. Nose=t Allergy Sinus Headache Flu Operations on factors Multiplication:

  15. Nose=t Allergy Sinus Headache Flu Operations on factors Marginalization:

  16. Complexity of VE – First analysis � Number of multiplications: � Number of additions:

  17. Complexity of variable elimination – (Poly)-tree graphs Variable elimination order: Start from “leaves” inwards: • Start from skeleton! • Choose a “root”, any node • Find topological order for root • Eliminate variables in reverse order Linear in CPT sizes!!! (versus exponential)

  18. Complexity of variable elimination – Graphs with loops Coherence Moralize graph: Connect parents into a clique and remove edge directions Difficulty Intelligence Grade SAT Letter Job Happy Connect nodes that appear together in an initial factor

  19. Eliminating a node – Fill edges Coherence Eliminate variable add Fill Edges : Connect neighbors Difficulty Intelligence Grade SAT Letter Job Happy

  20. The induced graph I F ≺ for elimination order ≺ Induced graph has an edge X i – X j if X i and X j appear together in a factor generated by VE for elimination order ≺ on factors F Coherence Elimination order: {C,D,S,I,L,H,J,G} Difficulty Intelligence Grade SAT Letter Job Happy

  21. Induced graph and complexity of VE Read complexity from cliques in induced graph � Structure of induced graph Coherence encodes complexity of VE!!! � Theorem : Difficulty Intelligence � Every factor generated by VE subset of a maximal clique in I F ≺ Grade SAT � For every maximal clique in I F ≺ corresponds to a factor generated by VE Letter � Induced width (or treewidth) � Size of largest clique in I F ≺ Job Happy minus 1 Elimination order: � Minimal induced width – {C,D,I,S,L,H,J,G} induced width of best order ≺

  22. Example: Large induced-width with small number of parents Compact representation ⇒ Easy inference �

  23. Finding optimal elimination order � Theorem : Finding best elimination order is NP-complete: Coherence � Decision problem: Given a graph, determine if there exists an Difficulty Intelligence elimination order that achieves induced width · K Grade SAT � Interpretation : � Hardness of elimination order Letter “orthogonal” to hardness of inference Job Happy � Actually, can find elimination order Elimination order: in time exponential in size of largest {C,D,I,S,L,H,J,G} clique – same complexity as inference (next week)

  24. Induced graphs and chordal graphs � Chordal graph : Coherence � Every cycle X 1 – X 2 – … – X k – X 1 with k ≥ 3 has a chord Difficulty Intelligence � Edge X i – X j for non-consecutive i & j Grade SAT � Theorem : � Every induced graph is chordal Letter � “Optimal” elimination order Job Happy easily obtained for chordal graph

  25. Chordal graphs and triangulation � Triangulation : turning graph into chordal graph A � Max Cardinality Search : � Simple heuristic B C � Initialize unobserved nodes X as unmarked � For k = | X | to 1 D E � X ← unmarked var with most marked neighbors F � ≺ (X) ← k � Mark X G � Theorem : Obtains optimal order H for chordal graphs � Often, not so good in other graphs!

  26. Minimum fill/size/weight heuristics � Many more effective heuristics � page 262 of K&F A � Min (weighted) fill heuristic � Often very effective � Initialize unobserved nodes X as B C unmarked � For k = 1 to | X | D E � X ← unmarked var whose elimination adds fewest edges � ≺ (X) ← k F � Mark X � Add fill edges introduced by eliminating X G � Weighted version: H � Consider size of factor rather than number of edges

  27. Choosing an elimination order � Choosing best order is NP-complete � Reduction from MAX-Clique � Many good heuristics (some with guarantees) � Ultimately, can’t beat NP-hardness of inference � Even optimal order can lead to exponential variable elimination computation � In practice � Variable elimination often very effective � Many (many many) approximate inference approaches available when variable elimination too expensive � Most approximate inference approaches build on ideas from variable elimination

  28. Most likely explanation (MLE) Flu Allergy � Query: Sinus Nose Headache � Using Bayes rule: � Normalization irrelevant:

  29. Max-marginalization Allergy=t Sinus Flu

  30. Example of variable elimination for MLE – Forward pass Flu Allergy Sinus Nose=t Headache

  31. Example of variable elimination for MLE – Backward pass Flu Allergy Sinus Nose=t Headache

  32. MLE Variable elimination algorithm – Forward pass � Given a BN and a MLE query max x1,…,xn P(x 1 ,…,x n , e ) � Instantiate evidence E = e � Choose an ordering on variables, e.g., X 1 , …, X n � For i = 1 to n, If X i ∉ E � Collect factors f 1 ,…,f k that include X i � Generate a new factor by eliminating X i from these factors � Variable X i has been eliminated!

  33. MLE Variable elimination algorithm – Backward pass � {x 1* ,…, x n* } will store maximizing assignment � For i = n to 1, If X i ∉ E � Take factors f 1 ,…,f k used when X i was eliminated * ,…, x n * } � Instantiate f 1 ,…,f k , with {x i+1 � Now each f j depends only on X i � Generate maximizing assignment for X i :

  34. What you need to know � Variable elimination algorithm � Eliminate a variable: � Combine factors that include this var into single factor � Marginalize var from new factor � Cliques in induced graph correspond to factors generated by algorithm � Efficient algorithm (“only” exponential in induced-width, not number of variables) � If you hear: “Exact inference only efficient in tree graphical models” � You say: “No!!! Any graph with low induced width” � And then you say: “And even some with very large induced-width” (next week) � Elimination order is important! � NP-complete problem � Many good heuristics � Variable elimination for MLE � Only difference between probabilistic inference and MLE is “sum” versus “max”

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend