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.

「ベータ分布の謎に迫る」第6回 プログラマのための数学勉強会 LT資料

6,152 views

Published on

「ベータ分布の謎に迫る」第6回 プログラマのための数学勉強会 発表資料 (2016/3/19[sat])
確率・統計を学んだことがある方向けに、ベータ分布とは何かを解説してみた記事です。特にベイズ統計学を学んでいるとベータ分布が出現しますが、いまいちどんな事象が対応している分布かわかりにくいので、その辺りに迫ります。

Published in: Data & Analytics
  • DOWNLOAD FULL BOOKS, INTO AVAILABLE Format, ......................................................................................................................... ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD FULL BOOKS, INTO AVAILABLE Format, ......................................................................................................................... ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

「ベータ分布の謎に迫る」第6回 プログラマのための数学勉強会 LT資料

  1. 1. f(x) = x↵ 1 (1 x) 1 B(↵, ) B(x, y) = Z 1 0 tx 1 (1 t)y 1 dt B(↵, ) 0  x  1 ↵ ↵ + ↵ (↵ + )2(↵ + + 1) x, y > 0, ↵, > 0,
  2. 2. (́・ω・) ん? (́・ω・) で、どういう事象がこの分布するの?
  3. 3. 0  x  1 f(p) = p↵ 1 (1 p) 1 B(↵, ) , 0  p  1 0  t  1 B(↵, ) = Z 1 0 p↵ 1 (1 p) 1 dp
  4. 4. 0  x  1 f(p) = p↵ 1 (1 p) 1 B(↵, ) , 0  p  1 0  t  1 B(↵, ) = Z 1 0 p↵ 1 (1 p) 1 dp
  5. 5. Z 1 0 f(p) = Z 1 0 p↵ 1 (1 p) 1 B(↵, ) dp = Z 1 0 p↵ 1 (1 p) 1 dp 1 B(↵, ) = B(↵, ) B(↵, ) = 1
  6. 6. f(p) = p↵ 1 (1 p) 1 B(↵, ) / p↵ 1 (1 p) 1 B(↵, )
  7. 7. p) = p↵ 1 (1 p) 1 B(↵, ) , 0  p  1 ) = p↵ 1 (1 p) 1 B(↵, ) , 0  p  1
  8. 8. (́・ω・) ん? f(p) = p↵ 1 (1 p) 1 B(↵, ) ,
  9. 9. (́・ω・) ん? (́・ω・) よく見るとコイン投げ? f(p) = p↵ 1 (1 p) 1 B(↵, ) ,
  10. 10. x = 1 x = 0 f(x; p) = 8 < : p if x = 1, 1 p if x = 0. f(x; p) = px (1 p)1 x , x = {0, 1} x p p 1 p
  11. 11. f(x1, · · · , xn; p) = nY i=1 pxi (1 p)1 xi , xi = {0, 1} f(x1, · · · , xn; p) = pa (1 p)b a = nX i=1 xi, b = n a
  12. 12. f(x1, · · · , xn; p) = nY i=1 pxi (1 p)1 xi , xi = {0, 1} f(x1, · · · , xn; p) = pa (1 p)b a = nX i=1 xi, b = n a f(p) = p↵ 1 (1 p) 1 B(↵, ) / p↵ 1 (1 p) 1
  13. 13. f(p) = p↵ 1 (1 p) 1 f(x1, · · · , xn; p) = pa (1 p)b a = nX i=1 xi, b = n a x1, · · · , xn 🌾
  14. 14. f(x1, · · · , xn; p) = pa (1 p)b a = nX i=1 xi, b = n a x1, · · · , xn 🌾 f(p) = p↵ 1 (1 p) 1
  15. 15. f(x1, · · · , xn; p) = pa (1 p)b a = nX i=1 xi, b = n a x1, · · · , xn 🌾 f(p) = p↵ 1 (1 p) 1
  16. 16. でもこのpを確率変数とみなしちゃう、 そう、ベイズならね (๑•`ㅁ•́๑)✧
  17. 17. < < < < < < < < < < < < < < < <
  18. 18. … … n = i + j 1 f(p) = ( n! (i 1)!(n i)! pi 1 (1 p)j 1 if 0  p  1 0 otherwise << < < < < p ⇠ Unif(0, 1)
  19. 19. f(p) = ( n! (i 1)!(n i)! pi 1 (1 p)j 1 if 0  p  1 0 otherwise … …<< < < < < i-1個 p ⇠ Unif(0, 1)
  20. 20. f(p) = ( n! (i 1)!(n i)! pi 1 (1 p)j 1 if 0  p  1 0 otherwise … …<< < < < < i-1個 p ⇠ Unif(0, 1)
  21. 21. B(a, b) = (a) (b) (a + b) (n + 1) = n!、 = 1 B(i, j) n = i + j 1 ! n i = j 1 n! (i 1)!(n i)! = n! (j 1)!(i 1)! = (n + 1) (i) (j) = (i + j) (i) (j)
  22. 22. f(p) = ( n! (i 1)!(j 1)! pi 1 (1 p)j 1 if 0  p  1 0 otherwise = ( 1 B(i,j)! pi 1 (1 p)j 1 if 0  p  1 0 otherwise f(p) 🌾
  23. 23. f(p) = ( n! (i 1)!(j 1)! pi 1 (1 p)j 1 if 0  p  1 0 otherwise = ( 1 B(i,j)! pi 1 (1 p)j 1 if 0  p  1 0 otherwise f(p) 🌾
  24. 24. @interact(a=(1,15,1),  b=(1,15,1))   def  draw_norm_dist(a=2,  b=2):            set_size  =  a+b-­‐1          trial_size  =  30000          bin_width  =  51          def  gen_orderd_unif(size):                  unif  =  rd.rand(size)                        unif.sort()                                          return  unif                    result  =  [gen_orderd_unif(set_size)[a-­‐1]  for  _  in  np.arange(trial_size)]          plt.hist(result,  bins=np.linspace(0,1,bin_width))                    plt.plot(p,  st.beta.pdf(p,  a,  b)*trial_size/bin_width,  c="g",  lw=3)              plt.show()
  25. 25. おわり
  26. 26. どうしても順序統計量が 気になる人のためのAPPENDIX
  27. 27. FX (x) fX (x) X1, X2, · · · , Xn FX (x) fX (x) X(1), X(2), · · · , X(n) Xi X(j), j = 1, 2, · · · , n fX(j) = n! (j 1)!(n j)! fX(x)[FX(x)]j 1 [1 FX(x)]n j 1 FX(x)FX(x) x fX (x) i j
  28. 28. Y = #{Xj, j = 1, 2, · · · , n|Xj  x} x Y個 Zj = ( 1 if {Xj  x} 0 otherwise x Z4=1 Z3=1 Z9=1 Z8=1 Z6=1 Z2=1 Z1=0 Z5=0 Z7=0 Y = nX j=1 Zj
  29. 29. P(Zj = 1) = Pi = FX(x) 1 1O FX(x) Xi Zi Zi xP(Zj = 1) = Pi = FX (x) x Zi Pi
  30. 30. FX(j) (x) = P(Y j) = nX k=j ✓ n k ◆ [FX (x)]k [1 FX(x)]n k 1 FX (x) = P6 x Y j Xi x
  31. 31. FX(j) (x) fX(j) (x) fX(j) (x) = dFX(j) (x) dx (f · g)0 = f0 g + fg0 = d dx nX k=j ✓ n k ◆ [FX(x)]k [1 FX(x)]n k [f(g(x))]0 = f0 (g(x))g0 (x) = nX k=j ✓ n k ◆ kfX(x)[FX(x)]k 1 [1 FX(x)]n k (n k)fX(x)[FX(x)]k [1 FX(x)]n k 1 = ✓ n k ◆ jfX (x)[FX (x)]j 1 [1 FX (x)]n j + nX k=j+1 ✓ n k ◆ kfX (x)[FX (x)]k 1 [1 FX (x)]n k n 1X k=j (n k)fX (x)[FX (x)]k [1 FX (x)]n k 1
  32. 32. = n! (j 1)!(n j)! fX (x)[FX (x)]j 1 [1 FX (x)]n j + n 1X k=j ✓ n k + 1 ◆ (k + 1)fX (x)[FX (x)]k [1 FX (x)]n k 1 n 1X k=j ✓ n k ◆ (n k)fX (x)[FX (x)]k [1 FX (x)]n k 1 = ✓ n k ◆ jfX (x)[FX (x)]j 1 [1 FX (x)]n j + nX k=j+1 ✓ n k ◆ kfX (x)[FX(x)]k 1 [1 FX (x)]n k n 1X k=j ✓ n k ◆ (n k)fX(x)[FX (x)]k [1 FX (x)]n k 1
  33. 33. = n! (j 1)!(n j)! fX (x)[FX(x)]j 1 [1 FX (x)]n j + n 1X k=j ✓ n k + 1 ◆ (k + 1)fX(x)[FX (x)]k [1 FX (x)]n k 1 n 1X k=j ✓ n k ◆ (n k)fX (x)[FX (x)]k [1 FX(x)]n k 1 = n! (j 1)!(n j)! fX(x)[FX(x)]j 1 [1 FX(x)]n j + fX(x)[FX(x)]k [1 FX(x)]n k 1 0 @ n 1X k=j ✓ n k + 1 ◆ (k + 1) n 1X k=j ✓ n k ◆ (n k) 1 A = 0 ✓ n k + 1 ◆ (k + 1) = n! k!(n k 1)! = ✓ n k ◆ (n k) = n! (j 1)!(n j)! fX(x)[FX(x)]j 1 [1 FX(x)]n j
  34. 34. 【証明】(cont.) X1, X2, · · · , Xn fX(j) (x) = n! (j 1)!(n j)! fX (x)[FX (x)]j 1 [1 FX (x)]n j fX(x) = ( 1 0 < x < 1 0 otherwise FX (x) = 8 >< >: 0 x  0, x 0 < x < 1, 1 x 1 = 1, (0 < x < 1) = x, (0 < x < 1) fX(j) (x) = ( 0 otherwise n! (j 1)!(n j)! xj 1 (1 x)n j , 0 < x < 1 n = j + i 1 ! n j = i 1 ! n! (j 1)!(i 1)! xj 1 (1 x)i 1

×