You are on page 1of 23

# CMSC 471 Fall 2002

Class #19 – Monday, November 4

1

Today’s class
• (Probability theory) • Bayesian inference
– From the joint distribution – Using independence/factoring – From sources of evidence

• Bayesian networks
– – – – Network structure Conditional probability tables Conditional independence Inference in Bayesian networks

2

Bayesian Reasoning / Bayesian Networks Chapters 14.1-15. 15.2 3 .

and unsatisfiable propositions have probability 0: • P(true) = 1 . P(false) = 0 3. All probabilities are between 0 and 1: • 0 <= P(a) <= 1 2. Valid propositions (tautologies) have probability 1. Cox. and Carnap have also provided compelling arguments for these axioms 1. The probability of a disjunction is given by: • P(a  b) = P(a) + P(b) – P(a  b) a ab b 4 .Why probabilities anyway? • Kolmogorov showed that three simple axioms lead to the rules of probability theory – De Finetti.

09 earthquake .1 * 9. ¬earthquake) = α [ (. alarm. alarm) = α [P(Burglary.173 = .e.001.008.01) + (.173 = .9173 5 .Inference from the joint: Example alarm ¬alarm earthquake burglary ¬burglary . α = 1/(.0001 .001 ¬earthquake . alarm. earthquake) + P(Burglary.1) = 9.009.79 P(Burglary | alarm) = α P(Burglary.1) ] Since P(burglary | alarm) + P(¬burglary | alarm) = 1.008 .0009 . .009 * 9.109 – quizlet: how can you verify this?) P(burglary | alarm) = .08255 P(¬burglary | alarm) = . .001 ..173 (i. . P(alarm) = 1/α = .01 ¬earthquake .009+.09) ] = α [ (.

Independence • When two sets of propositions do not affect each others’ probabilities. {moon-phase. light level doesn’t affect whether the alarm goes off • We need a more complex notion of independence. the moon phase doesn’t affect whether we are burglarized – Once we’re burglarized. alarm. B) → P(A  B) = P(A) P(B). it might not: Burglars might be more likely to burglarize houses when there’s a new moon (and hence little light) – But if we know the light level. earthquake} – Then again. and methods for reasoning about these kinds of relationships 6 . light-level} might be independent of {burglary. we call them independent. and can easily compute their joint and conditional probability: – Independent (A. P(A | B) = P(A) • For example.

equivalently. P(A) = P(A | B) and P(B) = P(B | A) • A and B are conditionally independent given C if – P(A  B | C) = P(A | C) P(B | C) • This lets us decompose the joint distribution: – P(A  B  C) = P(A | C) P(B | C) P(C) • Moon-Phase and Burglary are conditionally independent given Light-Level • Conditional independence is weaker than absolute independence.Conditional independence • Absolute independence: – A and B are independent if P(A  B) = P(A) P(B). but still useful in decomposing the full joint probability distribution 7 .

Bayes’ rule • Bayes rule is derived from the product rule: – P(Y | X) = P(X | Y) P(Y) / P(X) • Often useful for diagnosis: – If X are (observed) effects and Y are (hidden) causes. 8 . – We may have a model for how causes lead to effects (P(X | Y)) – We may also have prior beliefs (based on experience) about the frequency of occurrence of effects (P(Y)) – Which allows us to reason abductively from effects to causes (P(Y | X)).

Bayesian inference • In the setting of diagnostic/evidential reasoning H i P(H i ) P(E j | Hi ) hypotheses Em evidence/manifestations P(H i ) P(E j | Hi ) P(Hi | E j ) E1 Ej – Know prior probability of hypothesis conditional probability – Want to compute the posterior probability • Bayes’ theorem (formula 1): P(Hi | E j )  P(Hi )P(E j | Hi ) / P(E j ) 9 .

El • Goal: Find the hypothesis Hi with the highest posterior – Maxi P(Hi | E1. El) 10 . … H n • Ej and Hi are binary. …. … n. i = 1. j = 1. hypotheses are mutually exclusive (nonoverlapping) and exhaustive (cover all possible cases) – Conditional probabilities: P(Ej | Hi).Simple Bayesian diagnostic reasoning • Knowledge base: – Evidence / manifestations: – Hypotheses / disorders: E1. …. … m • Cases (evidence for a particular instance): E1. … Em H1.

…. …. El) • Assume each piece of evidence Ei is conditionally independent of the others. then: – P(E1. …. El) = P(E1. then we have: – P(Hi | E1. given a hypothesis Hi. ….Bayesian diagnostic reasoning II • Bayes’ rule says that – P(Hi | E1. El) = α P(Hi) lj=1 P(Ej | Hi) 11 . El | Hi) P(Hi) / P(E1. …. El | Hi) = lj=1 P(Ej | Hi) • If we only care about relative probabilities for the Hi.

El | H1  H2) P(H1) P(H2) = α lj=1 P(Ej | H1  H2) P(H1) P(H2) • How do we compute P(Ej | H1  H2) ?? 12 . …. which causes correlated manifestations M1 and M2 • Consider a composite hypothesis H1  H2. …. ….Limitations of simple Bayesian inference • Cannot easily handle multi-fault situation. What is the relative posterior? – P(H1  H2 | E1. where H1 and H2 are independent. nor cases where intermediate (hidden) causes exist: – Disease D causes syndrome S. El | H1  H2) P(H1  H2) = α P(E1. El) = α P(E1.

earthquake) << P(burglar | alarm) • Another limitation is that simple application of Bayes’ rule doesn’t allow us to handle causal chaining: – A: year’s weather. El) = P(H1 | E1. A) = P(C | B) • Need a richer representation to model interacting hypotheses. El? – P(H1  H2 | E1. …. El) P(H2 | E1. but not given Alarm: • P(burglar | alarm. ….Limitations of simple Bayesian inference II • Assume H1 and H2 are independent. given E1. B: cotton production. conditional independence. …. and causal chaining • Next time: conditional independence and Bayesian networks! 13 . El) • This is a very unreasonable assumption – Earthquake and Burglar are independent. C: next year’s cotton price – A influences C indirectly: A→ B → C – P(C | B. ….

so P ( xi |  i )  P ( xi ) 14 . but methods also exist to handle continuous variables) • Arcs: indicate probabilistic dependencies between nodes (lack of link signifies conditional independence) – CPD: conditional probability distribution (BN’s parameters) • Conditional probabilities at each node. so just use priors in CPD:  i  .Bayesian Belief Networks (BNs) • Definition: BN = (DAG. or CPT) P ( xi |  i ) where  i is the set of all parent nodes of xi – Root nodes are a special case – no parents. CPD) – DAG: directed acyclic graph (BN’s structure) • Nodes: random variables (typically binary or discrete. usually stored as a table (conditional probability table.

not P(¬A).01 P(D|~B.01 P(D|~B. since they have to add to one 15 .2 P(C|~A) = 0.001 a P(B|A) = 0.4 P(E|~C) = 0.Example BN P(A) = 0.C) = 0.~C) = 0.00001 P(E|C) = 0.1 P(D|B.002 Note that we only specify P(A) etc.001 b d c e P(C|A) = 0..3 P(B|~A) = 0.~C) = 0.005 P(D|B.C) = 0.

Topological semantics • A node is conditionally independent of its nondescendants given its parents • A node is conditionally independent of all other nodes in the network given its parents. and children’s parents (also known as its Markov blanket) • The method called d-separation can be applied to decide whether a set of nodes X is independent of another set Y. children. given a third set Z 16 .

x n )   n1 P ( x i |  i ) i 17 .Independence and chaining • Independence assumption – P ( xi |  i .. the complete joint probability distribution of all variables in the network can be represented by (recovered from) local CPD by chaining these CPD P ( x1 .... q)  P ( xi |  i ) i where q is any set of variables q (nodes) other than x i and its successors xi –  i blocks influence of other nodes on x i and its successors (q influences x i only through variables in  i ) – With this assumption.

c. d) P(a. c) P(c | a) P(b | a) P(a) 18 . assumption = P(e | c) P(d | a. b. d) by indep. b. c. d) by Bayes’ theorem = P(e | c) P(a. c) P(c | a. c. d. e) = P(e | a. b) P(a. b) = P(e | c) P(d | b.Chaining: Example a b d c e Computing the joint probability for all variables is easy: P(a. b. b. c) P(a. b. b. c. c) = P(e | c) P(d | b.

Direct inference with BNs • Now suppose we just want the probability for one variable • Belief update method • Original belief (no variables are instantiated): Use prior probability p(xi) • If xi is a root. P(xi | πi) is given in the CPT. but computing P(πi) is complicated 19 . – P(xi) = Σ πi P(xi | πi) P(πi) • In this equation. then P(xi) is given directly in the BN (CPT at Xi) • Otherwise.

c) P(b. c) p(¬a. c) (marginalizing) = P(b | a.Computing πi: Example a b • • c • • d e P (d) = P(d | b. c) = P(a. b. b. c) p (a. c) (product rule) = P(b | a) P(c | a) P(a) + P(b | ¬a) P(c | ¬a) P(¬a) If some variables are instantiated. c) + P(¬a. c) P(b. c) + p(b | ¬a. can “plug that in” and reduce amount of marginalization Still have to marginalize over all values of uninstantiated parents – not computationally feasible with large networks 20 .

Representational extensions • Compactly representing CPTs – Noisy-OR – Noisy-MAX • Adding continuous variables – Discretization – Use density functions (usually mixtures of Gaussians) to build hybrid Bayesian networks (with discrete and continuous variables) 21 .

P(NoGas | Gauge=empty.g. Xj | E=e) = P(Xi | e=e) P(Xj | Xi. Starts=false) • Conjunctive queries: – P(Xi. Lights=on.Inference tasks • Simple queries: Computer posterior marginal P(Xi | E=e) – E. probabilistic inference is required to find P(outcome | action. E=e) • Optimal decisions: Decision networks include utility information. evidence) • Value of information: Which evidence should we seek next? • Sensitivity analysis: Which probability values are most critical? • Explanation: Why do I need a new starter motor? 22 ..

Approaches to inference • Exact inference – Enumeration – Variable elimination – Clustering / join tree algorithms • Approximate inference – – – – – – Stochastic simulation / sampling methods Markov chain Monte Carlo methods Genetic algorithms Neural networks Simulated annealing Mean field theory 23 .

08.3489./03.0.80 .70.3/.\$250.8433 W 340/0-.

9438 5490808.31089.2.

808 43/943.0 .3.0.808 0.5488-0.0    W 4. !      .3/0.:.4.0 343 4./847/078   2   3 W  .0147.:89.07.702:9:.:8.-908 !     3  2 W .3/90549088 99008954890747 .3/ .79..07.574-.7389.70-3.553 .75490808./03.5.

9 !     !     !  ..8433 W .08.3/.08 7:08.89.3489.70.

-90814790 903 0..9.70..43/943.0410..0574-.03 . 3/0503/039419049078 .549088 903 !     a !   W 1043.50./03.-4:970.!    W 88:200.0 !     .0 8.

!  a !    .

9.80.90 //03 .943 347.3 310703....3/02:9 1..:808.9438 .4254890549088  070 .3/ .29.08.:808089 80.0 W .:80883/7420\$ .31089..:989:.054890747 !      .9438418250..3/ W 438/07.989070.808070 390720/.4770.33490.90/ 2.8.703/0503/039 .

!      !   .

!      !  !  .

425:90!      . a !    !  !  W 4/40.

:8.935490808  .7.98250.3 310703.0.72 W ! -:7..88:25943 ..3/.843...3/:7.7.0 W 88:20.07:370.7.703/0503/039 -:9349 .94389.703/0503/039 .49943574/:..55.:8.3/0.7 80.07705708039.4:894.43/943.796:.907.03  !      !     !      W %88.9433090..72 W 3490729.9438418250..796:.43/943.0 31:03.-0.3/0503/03..3309478  ..33 W 09920.3/0503/03.03.0.3/.94341.08.72 0.3/.9439424/03907..7 8.29.7.9   !   !  W 00/.0 ! -:7.4994357.33 0.08 7:0/4083 9 .0 ..083/70.08.

-99..3/42.8408994.90/.-89..574-.850.-08 95.3/0.7.89470/.703934/0841    #44934/08.7..90574-.-3. 41383108.70..7.-908.4393:4:8.574-..34/0 :8:./0503/03...43/943.90.08-0900334/08 .0 !.9:70 W 4/087.-0 .8.9.43/943.08.5..-08 W 7.70398 84:89:8057478 3! 6   X 84 !    6   !   .-0 47!% !    6  0706  89080941 .747/8..43/943.209078 W 43/943.7090 -:9 2094/8.3/0503/03..-9/897-:943  85.5  8897:.80 345..7..300109478 8 W 013943  ! /70.83/.574-..

/0 !    ! =   ! ! ! !      =   =    = =   !    ! =   4909.090. !    ! =   -.250 !    ..094..//94430  .1!  09. 349!  83.9043850.

34907809  .8094134/0883/0503/03941.309 W %02094/.03985.3-0.490734/083 9030947.03/.74.03985.943 .-...%4544.70398 .03.70398 ..550/94/0.70398 W 34/08.39.898.8 W 34/08.43/943./703 8 5.43/943./0 0907.7.3/.0// 805.3/0503/039 4198343 /08.398 .3/0503/039 41.84343.802./703 .97/809  .

0.339080! !   3  " 3 !    6    .831:03.0 41490734/0843     ..-0839030947.88:25943 !    6  6  !   6  6  0706 8..4..-9/897-:94341.0.-08 6   34/08 49079. !-.3/.7...425090439574-.3.33 W 3/0503/03.-083 998.7.0843 6  974:..070/1742 4.088478 631:03.7.3/988:.088478   6  -4.3/988:.3/0503/03...3-07057080390/- 70. ..380941.88:25943 90.

33. ! .! ..  . .. /0 425:9390439574-. /  -3/05 .   ! 0. . ! . ..08 904702  ! 0... ! /.88:25943  ! 0. . ! /.7...8 ! . /   ! 0. ! . ! /. . ! -... -. / ! . ! . ! ..-9147..-0880.  ! 0.. / 0  -.250 . .. .

943 !  8.70389.9390 !%..90/ &805747 574-..098 W 48:554800:89.03/70..9310703.70.-0 W 001:5/.90/  .90 2094/ W 73.7.-001 34.425.7.-9147430.7449 903!  8.9  W 90780 !  Ð  !   !  W 39806:.-08.-95  W 1 8.03390!% -:9 .425:93!  8.39.3990574-.

.  ! - ..93 ..90/ ..0.3/ 70/:..425:93.73..250 . .. /0 W ! / ! /.. ! . ! . 5 . ! .73. ! . ! . .07.97:0 ! -..90/ 5.-08..  5 - .  ! .70389.7.70398 349.10.70309478  .. .  574/:.425:9. 5 .  2.39.0942. .39.73.8-09. -.3 ! -.04.24:39412. W 18420.:0841:3389.. .943. ! . . W ! . .3 5:9.943 W \$9.

#05708039.9438 :8:.29:70841.7090.08.4393:4:8..709.:88.38 94-:/ -7/.09038438 W 425.7.3/ .3309478 9/8.943 &80/03891:3.7.4393:4:8..-08  ..943.-08 8.97057080393!%8 48 # 48  W //3.

:00259 9843 \$9.06:0708 !   0 !  00 !   0 W 592.310703./03..9.09.084:/0800309 W \$0389.943 .843309478 3.3.420.3089.-9.88 W \$2506:0708 425:907548907472.943574-.8438 0.:/0:99 31472.!  0   ! 4.3.80 W 43:3./03.7981.702489 .574-.9.73.943 /4300/.88 .:08.0 W '.790724947  ...8.-89.0.:04131472.79.943 0.08706:70/9413/ ! 4:9. W 5.310703./0.

9310703.5574.0 3:207.943 '..0894310703..0 W .7.943 :89073.-0023.

943.82:.89.90310703.47928 W 55742..0 \$94.439700.

330..3 0.74.34390.2532094/8 .90/..309478 \$2:..742094/8 0309.310/9047  .47928 0:7.8.