bayesian networks
play

Bayesian networks Compact representa)on of distribu)ons over - PowerPoint PPT Presentation

Introduc)on to Ar)ficial Intelligence Lecture 13 Approximate Inference CS/CNS/EE 154 Andreas Krause TexPoint fonts used in EMF. Bayesian networks


  1. Introduc)on ¡to ¡ ¡ Ar)ficial ¡Intelligence ¡ Lecture ¡13 ¡– ¡Approximate ¡Inference ¡ CS/CNS/EE ¡154 ¡ Andreas ¡Krause ¡ TexPoint ¡fonts ¡used ¡in ¡EMF. ¡ ¡

  2. Bayesian ¡networks ¡ � Compact ¡representa)on ¡of ¡distribu)ons ¡over ¡large ¡ number ¡of ¡variables ¡ � (OQen) ¡allows ¡efficient ¡exact ¡inference ¡(compu)ng ¡ marginals, ¡etc.) ¡ HailFinder ¡ 56 ¡vars ¡ ~ ¡3 ¡states ¡each ¡  ~10 26 ¡terms ¡ > ¡ 10.000 ¡years ¡ on ¡Top ¡ ¡ supercomputers ¡ JavaBayes ¡applet ¡ 2 ¡

  3. Typical ¡queries: ¡Condi)onal ¡distribu)on ¡ � Compute ¡distribu)on ¡of ¡some ¡ E ¡ B ¡ variables ¡given ¡values ¡for ¡others ¡ A ¡ J ¡ M ¡ 3 ¡

  4. Typical ¡queries: ¡Maximiza)on ¡ � MPE ¡(Most ¡probable ¡explana)on): ¡ E ¡ B ¡ ¡Given ¡values ¡for ¡some ¡vars, ¡ compute ¡most ¡likely ¡assignment ¡to ¡ all ¡remaining ¡vars ¡ A ¡ J ¡ M ¡ � MAP ¡(Maximum ¡a ¡posteriori): ¡ ¡Compute ¡most ¡likely ¡assignment ¡to ¡ some ¡variables ¡ 4 ¡

  5. Hardness ¡of ¡inference ¡for ¡general ¡BNs ¡ � Compu)ng ¡condi)onal ¡distribu)ons: ¡ � Exact ¡solu)on: ¡#P-­‑complete ¡ � NP-­‑hard ¡to ¡obtain ¡any ¡nontrivial ¡approxima)on ¡ � Maximiza)on: ¡ � MPE: ¡NP-­‑complete ¡ � MAP: ¡NP PP -­‑complete ¡ � Inference ¡in ¡general ¡BNs ¡is ¡really ¡hard ¡  ¡ ¡ 5 ¡

  6. Inference ¡ � Can ¡exploit ¡structure ¡(condi)onal ¡independence) ¡to ¡ efficiently ¡perform ¡ exact ¡inference ¡ in ¡many ¡prac)cal ¡ situa)ons ¡ � For ¡BNs ¡where ¡exact ¡inference ¡is ¡not ¡possible, ¡can ¡use ¡ algorithms ¡for ¡ approximate ¡inference ¡ (later) ¡ 6 ¡

  7. Variable ¡elimina)on ¡algorithm ¡ � Given ¡BN ¡and ¡Query ¡P(X ¡| ¡ E = e ) ¡ � Choose ¡an ¡ordering ¡of ¡X 1 ,…,X n ¡ � Set ¡up ¡ini)al ¡factors: ¡f i ¡= ¡P(X i ¡| ¡ Pa i ) ¡ � For ¡i ¡=1:n, ¡X i ¡ ∉ ¡{X, E } ¡ � Collect ¡all ¡factors ¡f ¡that ¡include ¡X i ¡ � Generate ¡new ¡factor ¡by ¡marginalizing ¡out ¡X i ¡ � Add ¡g ¡to ¡set ¡of ¡factors ¡ � Renormalize ¡P(x, e ) ¡to ¡get ¡P(x ¡| ¡ e ) ¡ 7 ¡

  8. Reusing ¡computa)on ¡ � OQen, ¡want ¡to ¡compute ¡condi)onal ¡distribu)ons ¡of ¡ many ¡variables, ¡for ¡fixed ¡observa)ons ¡ � E.g., ¡probability ¡of ¡ Pits ¡ at ¡different ¡loca)ons ¡given ¡ observed ¡ Breezes ¡ ¡ � Repeatedly ¡performing ¡variable ¡elimina)on ¡is ¡ wasteful ¡(many ¡factors ¡are ¡recomputed) ¡ � Need ¡right ¡data-­‑structure ¡to ¡avoid ¡recomputa)on ¡  ¡Message ¡passing ¡on ¡factor ¡graphs ¡ 8 ¡

  9. Factor ¡graphs ¡ � P(C,D,G,I,S,L) ¡= ¡P(C) ¡P(I) ¡P(D|C) ¡P(G|D,I) ¡P(S|I,G) ¡P(L|S) ¡ C ¡ f 1 ¡ f 2 ¡ f 3 ¡ f 4 ¡ D ¡ I ¡ CD ¡ DIG ¡ IGS ¡ SL ¡ G ¡ S ¡ L ¡ G ¡ C ¡ D ¡ I ¡ S ¡ L ¡ 9 ¡

  10. Factor ¡graph ¡ � A ¡factor ¡graph ¡for ¡a ¡Bayesian ¡network ¡is ¡a ¡bipar)te ¡ graph ¡consis)ng ¡of ¡ � Variables ¡and ¡ � Factors ¡ � Each ¡factor ¡is ¡associated ¡with ¡a ¡subset ¡of ¡variables, ¡ and ¡all ¡CPDs ¡of ¡the ¡Bayesian ¡network ¡have ¡to ¡be ¡ assigned ¡to ¡one ¡of ¡the ¡factor ¡nodes ¡ C ¡ f 1 ¡ f 2 ¡ f 3 ¡ f 4 ¡ D ¡ I ¡ CD ¡ DIG ¡ IGS ¡ SL ¡ G ¡ S ¡ L ¡ G ¡ C ¡ D ¡ I ¡ S ¡ L ¡ 10 ¡

  11. Sum-­‑product ¡message ¡passing ¡on ¡factor ¡graphs ¡ � Messages ¡from ¡node ¡ v ¡to ¡factor ¡ u ¡ � Messages ¡from ¡factor ¡ u ¡to ¡node ¡ v ¡ f 1 ¡ f 2 ¡ f 3 ¡ f 4 ¡ CD ¡ DIG ¡ IGS ¡ SL ¡ G ¡ C ¡ D ¡ I ¡ S ¡ L ¡ 11 ¡

  12. Example ¡messages ¡ P(C|B) ¡ P(A)P(B|A) ¡ f 1 ¡ f 2 ¡ AB ¡ BC ¡ C ¡ A ¡ B ¡ 12 ¡

  13. Belief ¡propaga)on ¡on ¡polytrees ¡ � Belief ¡propaga)on ¡(aka ¡sum-­‑product) ¡is ¡ exact ¡ for ¡ polytree ¡Bayesian ¡networks ¡ � Factor ¡graph ¡of ¡polytree ¡is ¡a ¡tree ¡ � Choose ¡one ¡node ¡as ¡root ¡ � Send ¡messages ¡from ¡leaves ¡to ¡root, ¡ ¡ and ¡from ¡root ¡to ¡leaves ¡ � AQer ¡convergence: ¡ � Thus: ¡immediately ¡have ¡correct ¡values ¡for ¡ all ¡ marginals! ¡ 13 ¡

  14. What ¡if ¡we ¡have ¡loops? ¡ � Can ¡s)ll ¡apply ¡belief ¡propaga)on ¡even ¡if ¡we ¡have ¡loops ¡ � Just ¡run ¡it, ¡close ¡your ¡eyes ¡and ¡hope ¡for ¡the ¡best! ¡ � Use ¡approxima)on: ¡ � In ¡general, ¡will ¡not ¡converge… ¡ � Even ¡if ¡it ¡converges, ¡may ¡converge ¡to ¡incorrect ¡marginals… ¡ � However, ¡in ¡prac)ce ¡oQen ¡s)ll ¡useful! ¡ C ¡ � E.g., ¡turbo-­‑codes, ¡etc. ¡ D ¡ I ¡ � “Loopy ¡belief ¡propaga)on” ¡ G ¡ S ¡ L ¡ 14 ¡

  15. Behavior ¡of ¡Loopy ¡BP ¡ P(X 1 ¡= ¡1) ¡ 1 ¡ BP ¡es)mate ¡ True ¡ X 1 ¡ posterior ¡ .5 ¡ X 2 ¡ X 3 ¡ 0 ¡ X 4 ¡ Itera)on ¡# ¡ � Loopy ¡BP ¡mul)plies ¡same ¡factors ¡mul)ple ¡)mes ¡ ¡  ¡BP ¡oQen ¡overconfident ¡ 15 ¡

  16. Does ¡Loopy ¡BP ¡always ¡converge? ¡ � No! ¡Can ¡oscillate! ¡ � Typically, ¡oscilla)on ¡the ¡more ¡severe ¡the ¡more ¡ “determinis)c” ¡the ¡poten)als ¡ Graphs ¡from ¡K. ¡Murphy ¡UAI ¡‘99 ¡ 16 ¡

  17. What ¡about ¡MPE ¡queries? ¡ � E.g.,: ¡What’s ¡the ¡most ¡likely ¡assignment ¡to ¡the ¡ unobserved ¡variables, ¡given ¡the ¡observed ¡ones? ¡ E ¡ B ¡ A ¡ J ¡ M ¡ � Use ¡max-­‑product ¡ ¡ (same ¡as ¡sum-­‑product/BP, ¡but ¡with ¡max ¡instead ¡of ¡sums!) ¡ 17 ¡

  18. Max-­‑product ¡message ¡passing ¡on ¡factor ¡graphs ¡ � Messages ¡from ¡nodes ¡to ¡factors ¡ � Messages ¡from ¡factors ¡to ¡nodes ¡ f 1 ¡ f 2 ¡ f 3 ¡ f 4 ¡ CD ¡ DIG ¡ IGS ¡ SL ¡ G ¡ C ¡ D ¡ I ¡ S ¡ L ¡ 18 ¡

  19. Sampling ¡based ¡inference ¡ � So ¡far: ¡determinis)c ¡inference ¡techniques ¡ � Variable ¡elimina)on ¡ � (Loopy) ¡belief ¡propaga)on ¡ � Will ¡now ¡introduce ¡stochas)c ¡approxima)ons ¡ � Algorithms ¡that ¡“randomize” ¡to ¡compute ¡expecta)ons ¡ � In ¡contrast ¡to ¡the ¡determinis)c ¡methods, ¡guaranteed ¡to ¡ converge ¡to ¡right ¡answer ¡(if ¡wait ¡looong ¡enough..) ¡ � More ¡exact, ¡but ¡slower ¡than ¡determinis)c ¡variants ¡ 19 ¡

  20. Compu)ng ¡expecta)ons ¡ � OQen, ¡we’re ¡not ¡necessarily ¡interested ¡in ¡compu)ng ¡ marginal ¡distribu)ons, ¡but ¡certain ¡expecta)ons: ¡ � Moments ¡(mean, ¡variance, ¡…) ¡ � Event ¡probabili)es ¡ 20 ¡

  21. Sample ¡approxima)ons ¡of ¡expecta)ons ¡ � x 1 ,…,x N ¡samples ¡from ¡RV ¡X ¡ � Law ¡of ¡large ¡numbers: ¡ � Hereby, ¡the ¡convergence ¡is ¡with ¡probability ¡1 ¡ ¡ (almost ¡sure ¡convergence) ¡ � Finite ¡samples: ¡ 21 ¡

  22. How ¡many ¡samples ¡do ¡we ¡need? ¡ � Hoeffding ¡inequality ¡ Suppose ¡f ¡is ¡bounded ¡in ¡[0,C]. ¡Then ¡ � Thus, ¡probability ¡of ¡error ¡decreases ¡exponen)ally ¡in ¡N! ¡ � Need ¡to ¡be ¡able ¡to ¡draw ¡samples ¡from ¡P ¡ 22 ¡

  23. Sampling ¡from ¡a ¡Bernoulli ¡distribu)on ¡ � Most ¡random ¡number ¡generators ¡produce ¡ (approximately) ¡uniformly ¡distributed ¡random ¡ numbers ¡ � How ¡can ¡we ¡draw ¡samples ¡from ¡X ¡~ ¡Bernoulli(p)? ¡ 23 ¡

  24. Sampling ¡from ¡a ¡Mul)nomial ¡ � X ¡~ ¡Mult([ µ 1 ,…, µ k ]) ¡ ¡where ¡ µ i ¡= ¡P(X=i); ¡ ∑ i ¡ µ i ¡= ¡1 ¡ µ 3 ¡ … ¡ µ 1 ¡ µ 2 ¡ µ k ¡ 0 ¡ 1 ¡ � Func)on ¡g: ¡[0,1]  {1,…,k} ¡assigns ¡state ¡g(x) ¡to ¡each ¡x ¡ � Draw ¡sample ¡from ¡uniform ¡distribu)on ¡on ¡[0,1] ¡ � Return ¡g -­‑1 (x) ¡ 24 ¡

  25. Forward ¡sampling ¡from ¡a ¡BN ¡ 25 ¡

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