bayesian networks
play

Bayesian Networks Machine Learning 10-601B Seyoung Kim - PowerPoint PPT Presentation

Bayesian Networks Machine Learning 10-601B Seyoung Kim Many of these slides are derived from William Cohen. Thanks! Bayesian Networks B E


  1. Bayesian ¡Networks ¡ Machine ¡Learning ¡10-­‑601B ¡ Seyoung ¡Kim ¡ Many ¡of ¡these ¡slides ¡are ¡derived ¡from ¡William ¡ Cohen. ¡Thanks! ¡

  2. Bayesian ¡Networks ¡ B ¡ E ¡ ¡ ¡ ¡ B ¡– ¡Did ¡a ¡burglary ¡occur? ¡ ¡ ¡ ¡ ¡E ¡– ¡Did ¡an ¡earthquake ¡occur? ¡ ¡ ¡ ¡ ¡A ¡– ¡Did ¡the ¡alarm ¡sound ¡off? ¡ ¡ ¡ ¡ ¡M ¡– ¡Mary ¡calls ¡ A ¡ ¡ ¡ ¡ ¡J ¡– ¡John ¡calls ¡ J ¡ M

  3. Bayesian ¡network: ¡Inference ¡ • Once ¡the ¡network ¡is ¡constructed, ¡we ¡can ¡use ¡algorithms ¡for ¡ inferring ¡the ¡values ¡of ¡unobserved ¡variables. ¡ • For ¡example, ¡in ¡our ¡previous ¡network ¡the ¡only ¡observed ¡ variables ¡are ¡the ¡phone ¡calls. ¡However, ¡what ¡we ¡are ¡really ¡ interested ¡in ¡is ¡whether ¡there ¡was ¡a ¡burglary ¡or ¡not. ¡ • How ¡can ¡we ¡determine ¡that? ¡

  4. Inference ¡ • Let’s ¡start ¡with ¡a ¡simpler ¡quesTon ¡ ¡ ¡ ¡-­‑ ¡How ¡can ¡we ¡compute ¡a ¡joint ¡distribuTon ¡from ¡the ¡network? ¡ ¡ ¡ ¡-­‑ ¡For ¡example, ¡P(B, ¬ E,A,J, ¡ ¬ M)? ¡ • Answer: ¡ ¡ ¡ ¡-­‑ ¡That’s ¡easy, ¡let’s ¡use ¡the ¡network ¡

  5. Compu;ng: ¡P(B, ¬ E,A,J, ¡ ¬ M) ¡ P(B, ¬ E,A,J, ¡ ¬ M) ¡= ¡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we ¡compute ¡the ¡new ¡joint? ¡ J ¡ M

  8. Inference ¡in ¡Bayesian ¡networks ¡ We ¡will ¡discuss ¡three ¡methods: ¡ • 1. EnumeraTon ¡ ¡ 2. Variable ¡eliminaTon ¡ 3. StochasTc ¡inference ¡

  9. Compu;ng ¡par;al ¡joints ¡ Sum ¡all ¡instances ¡with ¡these ¡seengs ¡(the ¡sum ¡is ¡ over ¡the ¡possible ¡assignments ¡to ¡the ¡other ¡two ¡ variables, ¡E ¡and ¡A) ¡

  10. Compu;ng: ¡P(B,J, ¡ ¬ M) ¡ P(B,J, ¡ ¬ M) ¡= ¡ ¡ P(B)=.05 ¡ P(E)=.1 ¡ B ¡ E ¡ P(B,J, ¡ ¬ M,A,E) ¡+ ¡ ¡ P(B,J, ¡ ¬ M, ¡ ¬ ¡A,E) ¡+ ¡ ¡ P(B,J, ¡ ¬ M,A, ¡ ¬ ¡E) ¡+ ¡ ¡ P(A|B,E) ¡)=.95 ¡ P(A|B, ¬ E) ¡= ¡.85 ¡ P(B,J, ¡ ¬ M, ¡ ¬ ¡A, ¡ ¬ ¡E) ¡ ¡ A ¡ P(A| ¡ ¬ ¡B,E) ¡)=.5 ¡ = ¡0.0007+0.00001+0.005+0.0003 ¡ P(A| ¡ ¬ ¡B, ¡ ¬ ¡E) ¡= ¡.05 ¡ = ¡0.00601 ¡ P(J|A) ¡)=.7 ¡ J ¡ M P(J| ¬ A) ¡= ¡.05 ¡ P(M|A) ¡)=.8 ¡ P(M| ¬ A) ¡= ¡.15 ¡

  11. Compu;ng ¡par;al ¡joints ¡ Sum ¡all ¡instances ¡with ¡these ¡seengs ¡(the ¡sum ¡is ¡over ¡the ¡ possible ¡assignments ¡to ¡the ¡other ¡two ¡variables, ¡E ¡and ¡A) ¡ • ¡This ¡method ¡can ¡be ¡improved ¡by ¡re-­‑using ¡calculaTons ¡(similar ¡to ¡ dynamic ¡programming) ¡ • ¡STll, ¡the ¡number ¡of ¡possible ¡assignments ¡is ¡exponenTal ¡in ¡the ¡ number ¡of ¡unobserved ¡variables? ¡ • ¡That ¡is, ¡unfortunately, ¡the ¡best ¡we ¡can ¡do. ¡General ¡querying ¡of ¡ Bayesian ¡networks ¡is ¡NP-­‑complete ¡

  12. Inference ¡in ¡Bayesian ¡networks ¡is ¡NP ¡ complete ¡(sketch) ¡ • ReducTon ¡from ¡3SAT ¡ • Recall: ¡3SAT, ¡find ¡saTsfying ¡assignments ¡to ¡the ¡following ¡ problem: ¡(a ¡ ∨ ¡b ¡ ∨ ¡c) ¡ ∧ ¡(d ¡ ∨ ¡ ¬ ¡b ¡ ∨ ¡ ¬ ¡c) ¡… ¡ What ¡is ¡P(Y=1)? ¡ P(x i =1) ¡= ¡0.5 ¡ P(x i =1) ¡= ¡ P (( x 1 ¡ ∨ ¡ x 2 ¡ ∨ ¡ x 3 )=1) ¡ ¡ P(Y=1) ¡= ¡ P (( x 1 ¡ ∧ ¡ x 2 ¡ ∧ ¡ x 3 ¡ ∧ ¡ x 4 )=1) ¡ ¡ Y ¡

  13. Inference ¡in ¡Bayesian ¡networks ¡ We ¡will ¡discuss ¡three ¡methods: ¡ • 1. EnumeraTon ¡ ¡ 2. Variable ¡eliminaTon ¡ 3. StochasTc ¡inference ¡

  14. Variable ¡elimina;on ¡ P(B,J, ¡ ¬ M) ¡= ¡ ¡ P(B)=.05 ¡ P(E)=.1 ¡ B ¡ E ¡ P(B,J, ¡ ¬ M,A,E)+ ¡ ¡ P(B,J, ¡ ¬ M, ¡ ¬ ¡A,E) ¡+ ¡ ¡ P(B,J, ¬ M,A, ¡ ¬ ¡E) ¡+ ¡ ¡ P(A|B,E) ¡)=.95 ¡ P(A|B, ¬ E) ¡= ¡.85 ¡ P(B,J, ¡ ¬ M, ¡ ¬ ¡A, ¡ ¬ ¡E) ¡ ¡ A ¡ P(A| ¡ ¬ ¡B,E) ¡)=.5 ¡ = ¡0.0007+0.00001+0.005+0.0003 ¡ ¡ P(A| ¡ ¬ ¡B, ¡ ¬ ¡E) ¡= ¡.05 ¡ = ¡0.00601 ¡ P(J|A) ¡)=.7 ¡ J ¡ M P(J| ¬ A) ¡= ¡.05 ¡ P(M|A) ¡)=.8 ¡ Reuse ¡computaTons ¡ P(M| ¬ A) ¡= ¡.15 ¡ rather ¡than ¡recompute ¡ probabiliTes ¡

  15. Compu;ng: ¡P(B,J, ¡ ¬ M) ¡ B ¡ E ¡ P(B,J, ¡ ¬ M) ¡= ¡ ¡ P(B,J, ¡ ¬ M,A,E)+ ¡ ¡ P(B,J, ¡ ¬ M, ¡ ¬ ¡A,E) ¡+ ¡ ¡ A ¡ P(B,J, ¡ ¬ M,A, ¡ ¬ ¡E) ¡+ ¡ ¡P(B,J, ¡ ¬ M, ¡ ¬ ¡A, ¡ ¬ ¡E) ¡= ¡ J ¡ M Store ¡as ¡a ¡funcTon ¡of ¡a ¡and ¡use ¡whenever ¡ necessary ¡(no ¡need ¡to ¡recompute ¡each ¡ Tme) ¡

  16. Variable ¡elimina;on ¡ B ¡ E ¡ Set: ¡ A ¡ J ¡ M

  17. Variable ¡elimina;on ¡ B ¡ E ¡ Set: ¡ A ¡ J ¡ M

  18. Variable ¡elimina;on ¡ B ¡ E ¡ Lets ¡conTnue ¡with ¡these ¡funcTons: ¡ We ¡can ¡now ¡define ¡the ¡following ¡funcTon: ¡ A ¡ And ¡so ¡we ¡can ¡write: ¡ J ¡ M

  19. Variable ¡elimina;on ¡ Lets ¡conTnue ¡with ¡another ¡funcTon: ¡ B ¡ E ¡ And ¡finally ¡we ¡can ¡write: ¡ A ¡ J ¡ M

  20. Example ¡ P(B)=.05 ¡ P(E)=.1 ¡ B ¡ E ¡ P(A|B,E) ¡=.95 ¡ P(A|B,¬E) ¡= ¡.85 ¡ A ¡ P(A| ¡¬ ¡B,E) ¡=.5 ¡ P(A| ¡¬ ¡B, ¡¬ ¡E) ¡= ¡.05 ¡ M ¡ J ¡ Calling ¡the ¡same ¡ funcTon ¡mulTple ¡ P(J|A) ¡)=.7 ¡ P(M|A) ¡=.8 ¡ P(J| ¡¬ ¡A) ¡= ¡.05 ¡ P(M| ¡¬ ¡A) ¡= ¡.15 ¡ Tmes ¡

  21. Final ¡computa;on ¡(normaliza;on) ¡

  22. Algorithm ¡ • e ¡-­‑ ¡evidence ¡(the ¡variables ¡that ¡are ¡known) ¡ • vars ¡-­‑ ¡the ¡condiTonal ¡probabiliTes ¡derived ¡from ¡the ¡network ¡ in ¡reverse ¡order ¡(bocom ¡up) ¡ • For ¡each ¡ var ¡in ¡ vars ¡ ¡ ¡ ¡ ¡-­‑ ¡ factors ¡<-­‑ ¡make_factor ¡( var,e ) ¡ ¡ ¡ ¡ ¡-­‑ ¡if ¡ var ¡is ¡a ¡hidden ¡variable ¡then ¡create ¡a ¡new ¡factor ¡by ¡ summing ¡out ¡ var ¡ • Compute ¡the ¡product ¡of ¡all ¡factors ¡ • Normalize ¡

  23. Computa;onal ¡complexity ¡ • We ¡are ¡reusing ¡computaTons ¡so ¡we ¡are ¡reducing ¡the ¡running ¡ Tme. ¡ • However, ¡there ¡are ¡sTll ¡cases ¡in ¡which ¡this ¡algorithm ¡will ¡lead ¡ to ¡exponenTal ¡running ¡Tme. ¡ • Consider ¡the ¡case ¡of ¡ f x (y 1 ¡… ¡y n ). ¡ When ¡factoring ¡x ¡out ¡we ¡ would ¡need ¡to ¡account ¡for ¡all ¡possible ¡values ¡of ¡the ¡y’s. ¡ Variable ¡eliminaTon ¡can ¡lead ¡to ¡ significant ¡cost ¡saving ¡but ¡its ¡ efficiency ¡depends ¡on ¡the ¡ network ¡structure ¡

  24. Inference ¡in ¡Bayesian ¡networks ¡ We ¡will ¡discuss ¡three ¡methods: ¡ • 1. EnumeraTon ¡ ¡ 2. Variable ¡eliminaTon ¡ 3. StochasTc ¡inference ¡

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