Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Tutorial #9 by Ma’ayan Fishelson. 2 Bucket Elimination Algorithm An algorithm for performing inference in a Bayesian network. Similar algorithms can.

Similar presentations


Presentation on theme: "1 Tutorial #9 by Ma’ayan Fishelson. 2 Bucket Elimination Algorithm An algorithm for performing inference in a Bayesian network. Similar algorithms can."— Presentation transcript:

1 1 Tutorial #9 by Ma’ayan Fishelson

2 2 Bucket Elimination Algorithm An algorithm for performing inference in a Bayesian network. Similar algorithms can be used in other domains, such as constraint satisfaction.

3 3 Bayesian Network X = {X 1,…,X n } is a set of random variables. A BN is a pair (G,P): –G is a directed acyclic graph over nodes that represent the random variables X. –P = {P i |1 ≤i ≤n}. P i, defined on, is the conditional probability table associated with node X i. P i = P(X i | pa(X i )) The BN represents a probability distribution over X.

4 4 Bayesian Network - Example A BC E F D Bayesian Network P(A) P(C|A) P(B|A) P(E|B,C) P(F|E) P(D|A,B) P(A,B,C,D,E,F) = P(A)P(B|A)P(C|A)P(D|A,B)P(E|B,C)P(F|E) A BC E F D Moralized Graph

5 5 Some Probabilistic Inference Tasks… Belief Assessment: find P(X i = x i | e). Most Probable Explanation (MPE): find

6 6 Solution – Bucket Elimination Algorithms Given an ordering of the variables X 1,…X n : –Distribute P 1,…,P n into buckets B 1,…,B n. is the highest in order in A i. –Process the buckets in reverse order: B n  B 1. (When processing bucket B i, multiply all the probability tables in B i and eliminate the bucket’s variable X i by summing over all its possible values.) –Place the resulting function in the bucket of the highest variable (in the order) that is in its scope.

7 7 Example – Belief Assessment Compute: P(A=a) = Σ {A=a,B,C,D,E,F} P(A,B,C,D,E,F) = Σ {A=a,B,C,D,E,F} P(A)P(B|A)P(C|A)P(D|A,B)P(E|B,C)P(F|E) Suppose an order A,C,B,E,D,F. and evidence that F=1. The distribution into buckets is as follows: P(F|E)P(D|A,B)P(E|B,C)P(B|A)P(A)P(C|A) B 1 (A) B 2 (C)B 3 (B)B 4 (E)B 5 (D)B 6 (F)

8 8 Example – Computing P(A=a) P(D|A,B) P(E|B,C) λ F (E) P(B|A)P(A)P(C|A) B 1 (A) B 2 (C)B 3 (B)B 4 (E)B 5 (D)B 6 (F) P(F|E)P(D|A,B)P(E|B,C)P(B|A)P(A)P(C|A) B 1 (A) B 2 (C)B 3 (B)B 4 (E)B 5 (D)B 6 (F) To process B 6 : Assign F=1, get λ F (E) = P(F=1|E) Place λ F (E) in bucket B 4 (E).

9 9 Computing P(A=a) (cont. 1) P(E|B,C) λ F (E) P(B|A) λ D (A,B) P(A)P(C|A) B 1 (A) B 2 (C)B 3 (B)B 4 (E)B 5 (D)B 6 (F) P(D|A,B) P(E|B,C) λ F (E) P(B|A)P(A)P(C|A) B 1 (A) B 2 (C)B 3 (B)B 4 (E)B 5 (D)B 6 (F) To process B 5 : λ D (A,B) = Σ D P(D|A,B) Place λ D (A,B) in bucket B 3 (B).

10 10 Computing P(A=a) (cont. 2) B 3 (B) P(B|A) λ D (A,B) λ E (B,C) P(A)P(C|A) B 1 (A) B 2 (C)B 4 (E)B 5 (D)B 6 (F) P(E|B,C) λ F (E) P(B|A) λ D (A,B) P(A)P(C|A) B 1 (A) B 2 (C)B 3 (B)B 4 (E)B 5 (D)B 6 (F) To process B 4 : λ E (B,C) = Σ E P(E|B,C) λ F (E) Place λ E (B,C) in bucket B 3 (B).

11 11 Computing P(A=a) (cont. 3) P(A) P(C|A) λ B (A,C) B 1 (A) B 2 (C)B 3 (B)B 4 (E)B 5 (D)B 6 (F) To process B 3 : λ B (A,C) = Σ B P(B|A) λ D (A,B) λ E (B,C) Place λ B (A,C) in bucket B 2 (C). P(A)P(C|A) B 1 (A) B 2 (C) B 3 (B) B 4 (E)B 5 (D)B 6 (F) P(B|A) λ D (A,B) λ E (B,C)

12 12 Computing P(A=a) (cont. 4) P(A) λ C (A) B 1 (A) B 2 (C)B 3 (B)B 4 (E)B 5 (D)B 6 (F) To process B 2 : λ C (A) = Σ C P(C|A) λ B (A,C) Place λ C (A) in bucket B 1 (A). P(A) P(C|A) λ B (A,C) B 1 (A) B 2 (C) B 3 (B) B 4 (E)B 5 (D)B 6 (F)

13 13 Computing P(A=a) (cont. 5) P(A) λ C (A) B 1 (A) B 2 (C)B 3 (B)B 4 (E)B 5 (D)B 6 (F) To compute the belief P(A=a), we multiply P(A) λ C (A). We obtain a function of A.

14 14 Bucket Elimination Complexity The time and space complexity is bounded by the size of the probability tables that are created by the algorithm. w*(d) is the induced width (max clique size) of the moral graph along ordering d. A BC E Moral graph D B C D E A Order B,C,D,E,A. w*(d 1 ) =4 E D C B A Order E,D,C,B,A. w*(d 2 ) =2

15 15 Constraint Satisfaction Problem (CSP) Input : –A set of variables: X = {X 1,…,X n }. –A set of constraints: R = {R 1,…,R m }. –For each constraint R i : Scope of R i : R i is a relation over the variables in A i. Output : –An assignment to X that is consistent with R.

16 16 Constraint Graph Nodes: {X 1,…X n }. Edges: For simplicity, assume that constraints are defined on maximal cliques of the graph.

17 17 Example of CSP: Find Possible Genotypes Possible haplotypes : h 1 =A,A 1 ; h 2 = A,A 2 ; h 3 =O,A 1 ; h 4 = O,A 2 ; Possible genotypes (ordered): g ij = h i /h j (father/mother) Ind #1: g 11, g 13, g 31 Ind #2: g 44 Ind #3: g 12, g 21, g 14, g 41, g 23, g 32 Ind #4: g 22, g 24, g 42 Ind #5: g 34, g 43 12 34 5 A A 1 /A 1 O A 2 /A 2 A A 1 /A 2 A A 2 /A 2 O A 1 /A 2 A pedigree typed at the ABO and AK1 loci : Constraints: R 13 = {, }, similarly for R 23, R 35, and R 45.

18 18 Bucket Elimination for CSP Given an order X 1,…, X n : –Distribute constraints into buckets, according to the highest variable in the constraint’s scope. –Process the buckets one by one starting from X n : Join the constraints (with equal value for the eliminated variable), in the eliminated bucket and remember the value of the eliminated variable. Put the new constraint in the bucket of the highest variable in its scope.

19 19 Example of CSP: Find Possible Genotypes (cont. 1) Constraints : R AC = {, }; R BC = { }; R CE = {<g {14,41,23,32} g {34,43} }; R DE = { } AB C E D Constraint graph

20 20 Find Possible Genotypes (cont. 2) Suppose an order: A, B, C, D, E. The distribution into buckets is as follows: BABAB BCBC BDBD BEBE Initial R AC = {, } R BC = { } R CE = { } R DE = { }

21 21 Find Possible Genotypes (cont. 3) BABAB BCBC BDBD BEBE Initial R AC = {, } R BC = { } R CE = { } R DE = { } When processing B E : compute R CD = { }. put R CD into bucket B D. remember the value g 34 for E.

22 22 Find Possible Genotypes (cont. 4) BABAB BCBC BDBD BEBE After Processing B E. R AC = {, } R BC = { } R CD = { } When processing B D : compute R C = {<g {23,32,14,41 } }. put R C into bucket B C. remember the values g 24,g 42 for D.

23 23 Find Possible Genotypes (cont. 5) BABAB BCBC BDBD BEBE After Processing B D. R AC = {, } R BC = { } R C = {<g {23,32,14,41} }. When processing B C : compute R AB = { }. put R C into bucket B B. remember the value g 14 for C.

24 24 Find Possible Genotypes (cont. 6) BABAB BCBC BDBD BEBE After Processing B D. R AB = { }. When processing B B : compute R A = { }. remember the value g 44 for B.

25 25 Find Possible Genotypes (cont. 7) By backtracking we get the possible values: Ind #1 (A): g 11, g 13, g 31 Ind #2 (B): g 44 Ind #3 (C): g 14 Ind #4 (D): g 24, g 42 Ind #5 (E): g 34 12 34 5 A A 1 /A 1 O A 2 /A 2 A A 1 /A 2 A A 2 /A 2 O A 1 /A 2 12 34 5 A|A or A|O or O|A A 1 |A 1 O|O A 2 |A 2 A|O A 1 |A 2 A|O or O|A A 2 /A 2 O|O A 1 |A 2


Download ppt "1 Tutorial #9 by Ma’ayan Fishelson. 2 Bucket Elimination Algorithm An algorithm for performing inference in a Bayesian network. Similar algorithms can."

Similar presentations


Ads by Google