Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

PyMCがあれば,ベイズ推定でもう泣いたりなんかしない

32,568 views

Published on

ベイズ推定の基本とPyMCによる簡単な実装例です.

関連資料: https://github.com/scipy-japan/tokyo-scipy/tree/master/006/shima__shima

Published in: Data & Analytics
  • -- DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT -- ......................................................................................................................... ......................................................................................................................... Download FULL PDF EBOOK here { http://bit.ly/2m77EgH } ......................................................................................................................... (Unlimited)
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • -- DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT -- ......................................................................................................................... ......................................................................................................................... Download FULL PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... (Unlimited)
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • If you want to download or read this book, copy link or url below in the New tab ......................................................................................................................... DOWNLOAD FULL PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download EPUB Ebook here { http://bit.ly/2m6jJ5M } .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • -- DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT -- ......................................................................................................................... ......................................................................................................................... Download FULL PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... (Unlimited)
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THAT BOOKS/FILE INTO AVAILABLE FORMAT - (Unlimited) ......................................................................................................................... ......................................................................................................................... Download FULL PDF EBOOK here { http://bit.ly/2m77EgH } ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... accessibility Books Library allowing access to top content, including thousands of title from favorite author, plus the ability to read or download a huge selection of books for your pc or smartphone within minutes Christian, Classics, Comics, Contemporary, Cookbooks, Art, Biography, Business, Chick Lit, Children's, Manga, Memoir, Music, Science, Science Fiction, Self Help, History, Horror, Humor And Comedy, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance,
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

PyMCがあれば,ベイズ推定でもう泣いたりなんかしない

  1. 1. 1
  2. 2. • • • • • • • 2
  3. 3. 3
  4. 4. 4 Pr[✓|x] = Pr[x|✓] Pr[✓] P ✓ Pr[x|✓] Pr[✓]
  5. 5. 5
  6. 6. 6
  7. 7. 7 • • •
  8. 8. 8 Pr[ θ, Z, D ] Pr[ θ | D ] Z D
  9. 9. 9 X y2Dom(Y ) Pr[X, y] = Pr[X] X y2Dom(Y ) Pr[y|X] = Pr[X] ⇥ 1 + =
  10. 10. 10 Pr[✓, D] = Pr[✓|D] Pr[D] Pr[✓|D] = Pr[✓, D] Pr[D] D Z D D Pr[✓|D] = Pr[✓, D] Pr[D] = Pr[✓, D] P ✓ Pr[✓, D] = Pr[D|✓] Pr[✓] P ✓ Pr[D|✓] Pr[✓]
  11. 11. 11 • • • • • •
  12. 12. 12 1. N Poisson(ξ) 2. θ Dirichlet(θ ; α) 3. For n in 1, …, N (a) zn Categorical(zn | θ) (b) wn Categorical(wn | zn; β)
  13. 13. 13 z, z=1, . . . , K M N ✓ t ↵ w
  14. 14. 14 1. N Poisson(ξ) 2. θ Dirichlet(θ ; α) 3. For n in 1 … N (a) zn Categorical(zn | θ) (b) wn Categorical(wn | zn; β) ✤ Pr[w, z, ✓; ↵, ] = Pr[✓|↵] NY n=1 Pr[zn|✓] Pr[wn|zn, zn ]
  15. 15. 15
  16. 16. 16 • • • • • • • • • •
  17. 17. 17 1. μ Normal(0.0, 0.12) 2. For i in 1 … N (a) xi Normal(μ, 1.02) μ x N • x • μ Pr[µ|x1, . . . , xN ] = Pr[µ|{x}]
  18. 18. 18 • • • • •
  19. 19. 19 mu = Normal('mu', 0, 1 / (0.1 ** 2)) ✤
  20. 20. x 20 x = Normal('x', mu=mu, tau=1/(1.0**2), value=x_sample, observed=True) x
  21. 21. 21 M = MCMC(input=[mu, x]) M.sample(iter=10000) ✤
  22. 22. 22 Matplot.plot(mu)
  23. 23. 23 1. p Beta(1.0, 1.0) 2. μ0 Normal(-1, 1.0) 3. μ1 Normal(1, 1.0) 4. For i in 1 … N (a) yi Bernoulli(p) (b) μ = μ0 if yi = 0; μ1 if yi = 1 (c) xi Normal(μ, 1.02) y x N ✤ xi p μ0 μ1
  24. 24. 24 @deterministic(plot=False) def mu(y=y, mu0=mu0, mu1=mu1): out = np.empty_like(y, dtype=np.float) out[y == 0] = mu0 out[y == 1] = mu1 return out
  25. 25. 25
  26. 26. • • • • • • • • • 26

×