probabilistic programming using first class stores and
play

Probabilistic programming using first-class stores and first-class - PowerPoint PPT Presentation

Probabilistic programming using first-class stores and first-class continuations Oleg Kiselyov Chung-chieh Shan FNMOC Rutgers University oleg@pobox.com ccshan@rutgers.edu ML workshop September 26, 2010


  1. Probabilistic programming using first-class stores and first-class continuations Oleg Kiselyov Chung-chieh Shan FNMOC Rutgers University oleg@pobox.com ccshan@rutgers.edu ML workshop September 26, 2010

  2. ✷ ❂ ✸ ✶ ❂ ✷ ✶ ❂ ✸ ✶ ❂ ✹ Pr✭❘❡❛❧✐t②✮ ✾ ❂ ❘❡❛❧✐t② ✦ ❖❜s ❀ ❘❡s✉❧t ❀ Pr✭❘❡s✉❧t ❥ ❖❜s ❂ ♦❜s✮ ♦❜s Probabilistic inference I have exactly two kids. What is the probability that At least one is a girl. my older kid is a girl? 2/15

  3. ✷ ❂ ✸ ✶ ❂ ✷ ✶ ❂ ✸ ✶ ❂ ✹ Probabilistic inference Model (what) Inference (how) Pr✭❘❡❛❧✐t②✮ ✾ ❂ ❘❡❛❧✐t② ✦ ❖❜s ❀ ❘❡s✉❧t ❀ Pr✭❘❡s✉❧t ❥ ❖❜s ❂ ♦❜s✮ ♦❜s I have exactly two kids. What is the probability that At least one is a girl. my older kid is a girl? 2/15

  4. ✷ ❂ ✸ ✶ ❂ ✷ ✶ ❂ ✸ ✶ ❂ ✹ Declarative probabilistic inference Model (what) Inference (how) Pr✭❘❡❛❧✐t②✮ ✾ ❂ ❘❡❛❧✐t② ✦ ❖❜s ❀ ❘❡s✉❧t ❀ Pr✭❘❡s✉❧t ❥ ❖❜s ❂ ♦❜s✮ ♦❜s I have exactly two kids. What is the probability that At least one is a girl. my older kid is a girl? 2/15

  5. ✷ ❂ ✸ ✶ ❂ ✷ ✶ ❂ ✸ ✶ ❂ ✹ Declarative probabilistic inference (UAI 2009, DSL 2009) Model (what) Inference (how) Pr✭❘❡❛❧✐t②✮ ✾ ❂ ❘❡❛❧✐t② ✦ ❖❜s ❀ ❘❡s✉❧t ❀ Pr✭❘❡s✉❧t ❥ ❖❜s ❂ ♦❜s✮ ♦❜s I have exactly two kids. What is the probability that At least one is a girl. my older kid is a girl? Models and inference as interacting programs in the same general- purpose language 2/15

  6. ✷ ❂ ✸ ✶ ❂ ✷ ✶ ❂ ✸ ✶ ❂ ✹ Declarative probabilistic inference (UAI 2009, DSL 2009) Model (what) Inference (how) Pr✭❘❡❛❧✐t②✮ ✾ ❂ ❘❡❛❧✐t② ✦ ❖❜s ❀ ❘❡s✉❧t ❀ Pr✭❘❡s✉❧t ❥ ❖❜s ❂ ♦❜s✮ ♦❜s I have exactly two kids. What is the probability that At least one is a girl. my older kid is a girl? let flip = fun p -> dist [(p, true); (1.-.p, false)] Models and inference in let girl1 = flip 0.5 in as interacting programs let girl2 = flip 0.5 in in the same general- if girl1 || girl2 purpose language then girl1 else fail () 2/15

  7. ✷ ❂ ✸ ✶ ❂ ✸ Declarative probabilistic inference (UAI 2009, DSL 2009) Model (what) Inference (how) Pr✭❘❡❛❧✐t②✮ ✾ ❂ ❘❡❛❧✐t② ✦ ❖❜s ❀ ❘❡s✉❧t ❀ Pr✭❘❡s✉❧t ❥ ❖❜s ❂ ♦❜s✮ ♦❜s I have exactly two kids. What is the probability that At least one is a girl. my older kid is a girl? normalize (exact_reify (fun () -> let flip = fun p -> ✶ ❂ ✷ true dist [(p, true); false ✶ ❂ ✹ (1.-.p, false)] Models and inference in let girl1 = flip 0.5 in as interacting programs let girl2 = flip 0.5 in in the same general- if girl1 || girl2 purpose language then girl1 else fail ())) 2/15

  8. Declarative probabilistic inference (UAI 2009, DSL 2009) Model (what) Inference (how) Pr✭❘❡❛❧✐t②✮ ✾ ❂ ❘❡❛❧✐t② ✦ ❖❜s ❀ ❘❡s✉❧t ❀ Pr✭❘❡s✉❧t ❥ ❖❜s ❂ ♦❜s✮ ♦❜s I have exactly two kids. What is the probability that At least one is a girl. my older kid is a girl? normalize (exact_reify (fun () -> let flip = fun p -> ✷ ❂ ✸ ✶ ❂ ✷ true true dist [(p, true); false ✶ ❂ ✸ false ✶ ❂ ✹ (1.-.p, false)] Models and inference in let girl1 = flip 0.5 in as interacting programs let girl2 = flip 0.5 in in the same general- if girl1 || girl2 purpose language then girl1 else fail ())) 2/15

  9. ✷ ❂ ✸ ✶ ❂ ✷ ✶ ❂ ✸ ✶ ❂ ✹ Declarative probabilistic inference (UAI 2009, DSL 2009) Model (what) Inference (how) Pr✭❘❡❛❧✐t②✮ ✾ ❂ ❘❡❛❧✐t② ✦ ❖❜s ❀ ❘❡s✉❧t ❀ Pr✭❘❡s✉❧t ❥ ❖❜s ❂ ♦❜s✮ ♦❜s I have exactly two kids. What is the probability that At least one is a girl. my older kid is a girl? normalize (exact_reify (fun () -> let flip = fun p -> dist [(p, true); Expressive models (1.-.p, false)] and efficient inference in let girl1 = flip 0.5 in as interacting programs let girl2 = flip 0.5 in in the same general- if girl1 || girl2 purpose language then girl1 else fail ())) 2/15

  10. Outline ◮ Expressive models Reuse existing infrastructure Nested inference Efficient inference First-class continuations First-class stores 3/15

  11. Motivic development in Beethoven sonatas (Pfeffer 2007) � � � � � � � � � � � � Source motif 4/15

  12. Motivic development in Beethoven sonatas (Pfeffer 2007) � � � � � � � Source motif � �� � � 4/15

  13. Motivic development in Beethoven sonatas (Pfeffer 2007) � � � � � � � � � � � � Source motif � � � � � � � � 4/15

  14. Motivic development in Beethoven sonatas (Pfeffer 2007) � � � � � � � � � � � � Source motif � � � � � � � 4/15

  15. Motivic development in Beethoven sonatas (Pfeffer 2007) � � � � � � � � � � � � Source motif infer � � � � � � � Destination motif 4/15

  16. Motivic development in Beethoven sonatas (Pfeffer 2007) � � � � � � � � � � � � Source motif infer � � � � � � � Destination motif Motif pair 1 2 3 4 5 6 7 % correct Pfeffer 2007 (30 sec) 93 100 28 80 98 100 63 HANSEI (90 sec) 98 100 29 87 94 100 77 HANSEI (30 sec) 92 99 25 46 72 95 61 Importance sampling using lazy stochastic lists. 4/15

  17. Noisy radar blips for aircraft tracking (Milch et al. 2007) Probability infer 0 1 2 3 4 5 6 7 Blips present and absent Number of planes 5/15

  18. Noisy radar blips for aircraft tracking (Milch et al. 2007) Probability infer 1 2 3 4 5 6 Blips present and absent Number of planes t ❂ ✶ Particle filter using lazy stochastic coordinates. 5/15

  19. Noisy radar blips for aircraft tracking (Milch et al. 2007) Probability infer 1 2 3 4 Blips present and absent Number of planes t ❂ ✶ , t ❂ ✷ Particle filter using lazy stochastic coordinates. 5/15

  20. Noisy radar blips for aircraft tracking (Milch et al. 2007) Probability infer 3 4 Blips present and absent Number of planes t ❂ ✶ , t ❂ ✷ , t ❂ ✸ Particle filter using lazy stochastic coordinates. 5/15

  21. Models as programs in a general-purpose language Reuse existing infrastructure! ◮ Rich libraries: lists, arrays, database access, I/O, . . . ◮ Type system ◮ Functions as first-class values ◮ Compiler ◮ Debugger ◮ Memoization Implemented independently in Haskell, Scheme, Ruby, Scala . . . 6/15

  22. ♣ ♣ ♣ ✵ ✿ ✸ Models that invoke nested inference Choose a coin that is either fair or completely biased for true . let biased = flip 0.5 in let coin = fun () -> flip 0.5 || biased in 7/15

  23. ♣ Models that invoke nested inference Choose a coin that is either fair or completely biased for true . let biased = flip 0.5 in let coin = fun () -> flip 0.5 || biased in Let ♣ be the probability that flipping the coin yields true . What is the probability that ♣ is at least ✵ ✿ ✸ ? 7/15

  24. ♣ Models that invoke nested inference Choose a coin that is either fair or completely biased for true . let biased = flip 0.5 in let coin = fun () -> flip 0.5 || biased in Let ♣ be the probability that flipping the coin yields true . What is the probability that ♣ is at least ✵ ✿ ✸ ? Answer: 1. at_least 0.3 true (exact_reify coin) 7/15

  25. ♣ Models that invoke nested inference exact_reify (fun () -> Choose a coin that is either fair or completely biased for true . let biased = flip 0.5 in let coin = fun () -> flip 0.5 || biased in Let ♣ be the probability that flipping the coin yields true . What is the probability that ♣ is at least ✵ ✿ ✸ ? Answer: 1. at_least 0.3 true (exact_reify coin) ) 7/15

  26. Models that invoke nested inference exact_reify (fun () -> Choose a coin that is either fair or completely biased for true . let biased = flip 0.5 in let coin = fun () -> flip 0.5 || biased in Let ♣ be the probability that flipping the coin yields true . Estimate ♣ by flipping the coin twice. What is the probability that our estimate of ♣ is at least ✵ ✿ ✸ ? Answer: 7/8. at_least 0.3 true (sample 2 coin) ) 7/15

  27. Models that invoke nested inference exact_reify (fun () -> Choose a coin that is either fair or completely biased for true . let biased = flip 0.5 in let coin = fun () -> flip 0.5 || biased in Let ♣ be the probability that flipping the coin yields true . Estimate ♣ by flipping the coin twice. What is the probability that our estimate of ♣ is at least ✵ ✿ ✸ ? Answer: 7/8. at_least 0.3 true (sample 2 coin) ) Returns a distribution, using dist like models do. Works with observation, recursion, memoization. Metareasoning without interpretive overhead. 7/15

  28. Outline Expressive models Reuse existing infrastructure Nested inference ◮ Efficient inference First-class continuations First-class stores 8/15

Recommend


More recommend