Exact Inference Algorithms Bucket-elimination
Transcript of Exact Inference Algorithms Bucket-elimination
![Page 1: Exact Inference Algorithms Bucket-elimination](https://reader031.fdocuments.net/reader031/viewer/2022020702/61fb231f2e268c58cd5a95c1/html5/thumbnails/1.jpg)
1
Exact Inference Algorithms Bucket-elimination
COMPSCI 276, Spring 2011
Class 5: Rina Dechter
(Reading: class notes chapter 4 , Darwiche chapter 6)
![Page 2: Exact Inference Algorithms Bucket-elimination](https://reader031.fdocuments.net/reader031/viewer/2022020702/61fb231f2e268c58cd5a95c1/html5/thumbnails/2.jpg)
2
Belief Updating
lung Cancer
Smoking
X-ray
Bronchitis
Dyspnoea
P (lung cancer=yes | smoking=no, dyspnoea=yes ) = ?
![Page 3: Exact Inference Algorithms Bucket-elimination](https://reader031.fdocuments.net/reader031/viewer/2022020702/61fb231f2e268c58cd5a95c1/html5/thumbnails/3.jpg)
![Page 4: Exact Inference Algorithms Bucket-elimination](https://reader031.fdocuments.net/reader031/viewer/2022020702/61fb231f2e268c58cd5a95c1/html5/thumbnails/4.jpg)
4
Probabilistic Inference Tasks
X/A
a
*
k
*
1 e),xP(maxarg)a,...,(a
evidence)|xP(X)BEL(X iii
Belief updating: E is a subset {X1,…,Xn}, Y subset X-E, P(Y=y|E=e)
P(e)?
Finding most probable explanation (MPE)
Finding maximum a-posteriory hypothesis
Finding maximum-expected-utility (MEU) decision
e),xP(maxarg*xx
)xU(e),xP(maxarg)d,...,(d X/D
d
*
k
*
1
variableshypothesis
: XA
function utilityx
variablesdecision
: )(
:
U
XD
![Page 5: Exact Inference Algorithms Bucket-elimination](https://reader031.fdocuments.net/reader031/viewer/2022020702/61fb231f2e268c58cd5a95c1/html5/thumbnails/5.jpg)
5
Belief updating is NP-hard
Each sat formula can be mapped to a Bayesian network query.
Example: (u,~v,w) and (~u,~w,y) sat?
![Page 6: Exact Inference Algorithms Bucket-elimination](https://reader031.fdocuments.net/reader031/viewer/2022020702/61fb231f2e268c58cd5a95c1/html5/thumbnails/6.jpg)
6
Motivation
How can we compute P(D)?, P(D|A=0)? P(A|D=0)?
Brute force O(k^4)
Maybe O(4k^2)
A DB CGiven:
![Page 7: Exact Inference Algorithms Bucket-elimination](https://reader031.fdocuments.net/reader031/viewer/2022020702/61fb231f2e268c58cd5a95c1/html5/thumbnails/7.jpg)
![Page 8: Exact Inference Algorithms Bucket-elimination](https://reader031.fdocuments.net/reader031/viewer/2022020702/61fb231f2e268c58cd5a95c1/html5/thumbnails/8.jpg)
![Page 9: Exact Inference Algorithms Bucket-elimination](https://reader031.fdocuments.net/reader031/viewer/2022020702/61fb231f2e268c58cd5a95c1/html5/thumbnails/9.jpg)
![Page 10: Exact Inference Algorithms Bucket-elimination](https://reader031.fdocuments.net/reader031/viewer/2022020702/61fb231f2e268c58cd5a95c1/html5/thumbnails/10.jpg)
10
Belief updating: P(X|evidence)=?
“Moral” graph
A
D E
CB
P(a|e=0) P(a,e=0)=
bcde ,,,0
P(a)P(b|a)P(c|a)P(d|b,a)P(e|b,c)=
0e
P(a) d
),,,( ecdah B
b
P(b|a)P(d|b,a)P(e|b,c)
B C
ED
Variable Elimination
P(c|a)c
![Page 11: Exact Inference Algorithms Bucket-elimination](https://reader031.fdocuments.net/reader031/viewer/2022020702/61fb231f2e268c58cd5a95c1/html5/thumbnails/11.jpg)
11
![Page 12: Exact Inference Algorithms Bucket-elimination](https://reader031.fdocuments.net/reader031/viewer/2022020702/61fb231f2e268c58cd5a95c1/html5/thumbnails/12.jpg)
12
“Moral” graph
A
D E
CB
![Page 13: Exact Inference Algorithms Bucket-elimination](https://reader031.fdocuments.net/reader031/viewer/2022020702/61fb231f2e268c58cd5a95c1/html5/thumbnails/13.jpg)
13
![Page 14: Exact Inference Algorithms Bucket-elimination](https://reader031.fdocuments.net/reader031/viewer/2022020702/61fb231f2e268c58cd5a95c1/html5/thumbnails/14.jpg)
![Page 15: Exact Inference Algorithms Bucket-elimination](https://reader031.fdocuments.net/reader031/viewer/2022020702/61fb231f2e268c58cd5a95c1/html5/thumbnails/15.jpg)
![Page 16: Exact Inference Algorithms Bucket-elimination](https://reader031.fdocuments.net/reader031/viewer/2022020702/61fb231f2e268c58cd5a95c1/html5/thumbnails/16.jpg)
![Page 17: Exact Inference Algorithms Bucket-elimination](https://reader031.fdocuments.net/reader031/viewer/2022020702/61fb231f2e268c58cd5a95c1/html5/thumbnails/17.jpg)
![Page 18: Exact Inference Algorithms Bucket-elimination](https://reader031.fdocuments.net/reader031/viewer/2022020702/61fb231f2e268c58cd5a95c1/html5/thumbnails/18.jpg)
18
Bucket elimination Algorithm BE-bel (Dechter 1996)
b
Elimination operator
P(a|e=0)
W*=4”induced width” (max clique size)
bucket B:
P(a)
P(c|a)
P(b|a) P(d|b,a) P(e|b,c)
bucket C:
bucket D:
bucket E:
bucket A:
e=0
B
C
D
E
A
e)(a,hD
(a)hE
e)c,d,(a,hB
e)d,(a,hC
![Page 19: Exact Inference Algorithms Bucket-elimination](https://reader031.fdocuments.net/reader031/viewer/2022020702/61fb231f2e268c58cd5a95c1/html5/thumbnails/19.jpg)
19
BE-BEL
![Page 20: Exact Inference Algorithms Bucket-elimination](https://reader031.fdocuments.net/reader031/viewer/2022020702/61fb231f2e268c58cd5a95c1/html5/thumbnails/20.jpg)
IntelligenceDifficulty
Grade
Letter
SAT
Job
Apply
Student Network example
P(J)?
![Page 21: Exact Inference Algorithms Bucket-elimination](https://reader031.fdocuments.net/reader031/viewer/2022020702/61fb231f2e268c58cd5a95c1/html5/thumbnails/21.jpg)
21
E
D
C
B
A
B
C
D
E
A
![Page 22: Exact Inference Algorithms Bucket-elimination](https://reader031.fdocuments.net/reader031/viewer/2022020702/61fb231f2e268c58cd5a95c1/html5/thumbnails/22.jpg)
22
Complexity of elimination
))((exp ( * dwnO
ddw ordering along graph moral of widthinduced the)(*
The effect of the ordering:
4)( 1
* dw 2)( 2
* dw“Moral” graph
A
D E
CB
B
C
D
E
A
E
D
C
B
A
![Page 23: Exact Inference Algorithms Bucket-elimination](https://reader031.fdocuments.net/reader031/viewer/2022020702/61fb231f2e268c58cd5a95c1/html5/thumbnails/23.jpg)
23
More accurately: O(r exp(w*(d)) where r is the number of cpts.For Bayesian networks r=n. For Markov networks?
BE-BEL
![Page 24: Exact Inference Algorithms Bucket-elimination](https://reader031.fdocuments.net/reader031/viewer/2022020702/61fb231f2e268c58cd5a95c1/html5/thumbnails/24.jpg)
24
![Page 25: Exact Inference Algorithms Bucket-elimination](https://reader031.fdocuments.net/reader031/viewer/2022020702/61fb231f2e268c58cd5a95c1/html5/thumbnails/25.jpg)
25
The impact of observations
Induced graphOrdered graph Ordered conditioned graph
![Page 26: Exact Inference Algorithms Bucket-elimination](https://reader031.fdocuments.net/reader031/viewer/2022020702/61fb231f2e268c58cd5a95c1/html5/thumbnails/26.jpg)
26Use the ancestral graph only
BE-BEL
“Moral” graph
A
D E
CB
![Page 27: Exact Inference Algorithms Bucket-elimination](https://reader031.fdocuments.net/reader031/viewer/2022020702/61fb231f2e268c58cd5a95c1/html5/thumbnails/27.jpg)
![Page 28: Exact Inference Algorithms Bucket-elimination](https://reader031.fdocuments.net/reader031/viewer/2022020702/61fb231f2e268c58cd5a95c1/html5/thumbnails/28.jpg)
![Page 29: Exact Inference Algorithms Bucket-elimination](https://reader031.fdocuments.net/reader031/viewer/2022020702/61fb231f2e268c58cd5a95c1/html5/thumbnails/29.jpg)
![Page 30: Exact Inference Algorithms Bucket-elimination](https://reader031.fdocuments.net/reader031/viewer/2022020702/61fb231f2e268c58cd5a95c1/html5/thumbnails/30.jpg)
![Page 31: Exact Inference Algorithms Bucket-elimination](https://reader031.fdocuments.net/reader031/viewer/2022020702/61fb231f2e268c58cd5a95c1/html5/thumbnails/31.jpg)
![Page 32: Exact Inference Algorithms Bucket-elimination](https://reader031.fdocuments.net/reader031/viewer/2022020702/61fb231f2e268c58cd5a95c1/html5/thumbnails/32.jpg)
32
Probabilistic Inference Tasks
X/A
a
*
k
*
1 e),xP(maxarg)a,...,(a
evidence)|xP(X)BEL(X iii
Belief updating:
Finding most probable explanation (MPE)
Finding maximum a-posteriory hypothesis
Finding maximum-expected-utility (MEU) decision
e),xP(maxarg*xx
)xU(e),xP(maxarg)d,...,(d X/D
d
*
k
*
1
variableshypothesis
: XA
function utilityx
variablesdecision
: )(
:
U
XD
![Page 33: Exact Inference Algorithms Bucket-elimination](https://reader031.fdocuments.net/reader031/viewer/2022020702/61fb231f2e268c58cd5a95c1/html5/thumbnails/33.jpg)
33
b
maxElimination operator
MPE
W*=4”induced width” (max clique size)
bucket B:
P(a)
P(c|a)
P(b|a) P(d|b,a) P(e|b,c)
bucket C:
bucket D:
bucket E:
bucket A:
e=0
B
C
D
E
A
e)(a,hD
(a)hE
e)c,d,(a,hB
e)d,(a,hC
FindingAlgorithm elim-mpe (Dechter 1996)
)xP(maxMPEx
),|(),|()|()|()(max
by replaced is
,,,,cbePbadPabPacPaPMPE
:
bcdea max
![Page 34: Exact Inference Algorithms Bucket-elimination](https://reader031.fdocuments.net/reader031/viewer/2022020702/61fb231f2e268c58cd5a95c1/html5/thumbnails/34.jpg)
34
Generating the MPE-tuple
C:
E:
P(b|a) P(d|b,a) P(e|b,c)B:
D:
A: P(a)
P(c|a)
e=0 e)(a,hD
(a)hE
e)c,d,(a,hB
e)d,(a,hC
(a)hP(a)max arga' 1. E
a
0e' 2.
)e'd,,(a'hmax argd' 3. C
d
)e'c,,d',(a'h
)a'|P(cmax argc' 4.B
c
)c'b,|P(e')a'b,|P(d'
)a'|P(bmax argb' 5.b
)e',d',c',b',(a' Return
![Page 35: Exact Inference Algorithms Bucket-elimination](https://reader031.fdocuments.net/reader031/viewer/2022020702/61fb231f2e268c58cd5a95c1/html5/thumbnails/35.jpg)
35
![Page 36: Exact Inference Algorithms Bucket-elimination](https://reader031.fdocuments.net/reader031/viewer/2022020702/61fb231f2e268c58cd5a95c1/html5/thumbnails/36.jpg)
Algorithm BE-MPE
36
![Page 37: Exact Inference Algorithms Bucket-elimination](https://reader031.fdocuments.net/reader031/viewer/2022020702/61fb231f2e268c58cd5a95c1/html5/thumbnails/37.jpg)
37
![Page 38: Exact Inference Algorithms Bucket-elimination](https://reader031.fdocuments.net/reader031/viewer/2022020702/61fb231f2e268c58cd5a95c1/html5/thumbnails/38.jpg)
Algorithm BE-MAP
38
Variable ordering:Restricted: Max buckets shouldBe processed after sum buckets
![Page 39: Exact Inference Algorithms Bucket-elimination](https://reader031.fdocuments.net/reader031/viewer/2022020702/61fb231f2e268c58cd5a95c1/html5/thumbnails/39.jpg)
39
More accurately: O(r exp(w*(d)) where r is the number of cpts.For Bayesian networks r=n. For Markov networks?
![Page 40: Exact Inference Algorithms Bucket-elimination](https://reader031.fdocuments.net/reader031/viewer/2022020702/61fb231f2e268c58cd5a95c1/html5/thumbnails/40.jpg)
40
Finding small induced-width
NP-complete
A tree has induced-width of ?
Greedy algorithms:
Min width
Min induced-width
Max-cardinality
Fill-in (thought as the best)
See anytime min-width (Gogate and Dechter)
![Page 41: Exact Inference Algorithms Bucket-elimination](https://reader031.fdocuments.net/reader031/viewer/2022020702/61fb231f2e268c58cd5a95c1/html5/thumbnails/41.jpg)
41
Min-width ordering
Proposition: algorithm min-width finds a min-width ordering of a graph
![Page 42: Exact Inference Algorithms Bucket-elimination](https://reader031.fdocuments.net/reader031/viewer/2022020702/61fb231f2e268c58cd5a95c1/html5/thumbnails/42.jpg)
Greedy orderings heuristics
42
min-induced-width (miw)input: a graph G = (V;E), V = {1; :::; vn}output: An ordering of the nodes d = (v1; :::; vn).1. for j = n to 1 by -1 do2. r a node in V with smallest degree.3. put r in position j.4. connect r's neighbors: E E union {(vi; vj)| (vi; r) in E; (vj ; r) 2 in E},5. remove r from the resulting graph: V V - {r}.
min-fill (min-fill)input: a graph G = (V;E), V = {v1; :::; vn}output: An ordering of the nodes d = (v1; :::; vn).1. for j = n to 1 by -1 do2. r a node in V with smallest fill edges for his parents.3. put r in position j.4. connect r's neighbors: E E union {(vi; vj)| (vi; r) 2 E; (vj ; r) in E},5. remove r from the resulting graph: V V –{r}.
Theorem: A graph is a tree iff it has both width and induced-width of 1.
![Page 43: Exact Inference Algorithms Bucket-elimination](https://reader031.fdocuments.net/reader031/viewer/2022020702/61fb231f2e268c58cd5a95c1/html5/thumbnails/43.jpg)
43
Different Induced-graphs
![Page 44: Exact Inference Algorithms Bucket-elimination](https://reader031.fdocuments.net/reader031/viewer/2022020702/61fb231f2e268c58cd5a95c1/html5/thumbnails/44.jpg)
Fall 2003 ICS 275A - Constraint Networks 44
Min-induced-width
![Page 45: Exact Inference Algorithms Bucket-elimination](https://reader031.fdocuments.net/reader031/viewer/2022020702/61fb231f2e268c58cd5a95c1/html5/thumbnails/45.jpg)
Fall 2003 ICS 275A - Constraint Networks 45
Min-fill algorithm
Prefers a node who add the least number of fill-in arcs.
Empirically, fill-in is the best among the greedy algorithms (MW,MIW,MF,MC)
![Page 46: Exact Inference Algorithms Bucket-elimination](https://reader031.fdocuments.net/reader031/viewer/2022020702/61fb231f2e268c58cd5a95c1/html5/thumbnails/46.jpg)
Fall 2003 ICS 275A - Constraint Networks 46
Chordal graphs and Max-cardinality ordering
A graph is chordal if every cycle of length at least 4 has a chord
Finding w* over chordal graph is easy using the max-cardinality ordering
If G* is an induced graph it is chordal chord
K-trees are special chordal graphs (A graph is a k-tree if all its max-clique are of size k+1, created recursively by connection a new node to k earlier nodes in a cliques
Finding the max-clique in chordal graphs is easy (just enumerate all cliques in a max-cardinality ordering
![Page 47: Exact Inference Algorithms Bucket-elimination](https://reader031.fdocuments.net/reader031/viewer/2022020702/61fb231f2e268c58cd5a95c1/html5/thumbnails/47.jpg)
47
Max-cardinality ordering
Figure 4.5 The max-cardinality (MC) ordering procedure.