SlideShare a Scribd company logo
1 of 52
Download to read offline
kos59125


[2011-09-24] Tokyo.R#17
1
..


2
..


3
..




4
..
1
..


2
..


3
..




4
..
• Twitter ID: kos59125
• R           :7
1
..


2
..


3
..




4
..
.
..
 .
.
..
                          P(D|θ) π(θ)
             f (θ|D) =                ∝ P(D|θ) π(θ)
                            P(D)

         •       π(θ):                          D
                                    θ
         •   P(D|θ):                    D                       θ

         •        f (θ|D):              D
 .                              θ
     ∝                                      x   f (x) = cg(x)       c
                 f (x) ∝ g(x)
.
..
         N(µ, 52 )                 3

                       4.7,    11.9,   13.4

                     π(µ)              N(0, 102 )
                                        (          )
                              1              µ2
            π(µ) =          √        exp −
                             2π · 10       2 · 102

 .   µ
(                 )
              1              (4.7 − µ)2
P(D|µ) =    √        exp −
              2π · 5            2 · 52
                                  (               )
                       1              (11.9 − µ)2
                × √          exp −
                      2π · 5              2 · 52
                                  (               )
                       1              (13.4 − µ)2
                × √          exp −
                      2π · 5              2 · 52
               (                                          )
                   (4.7 − µ)2 + (11.9 − µ)2 + (13.4 − µ)2
      ∝    exp −
                                      2 · 52
               (                                       )
                   3µ2 − 60µ + (4.72 + 11.92 + 13.42 )
      =    exp −
                                    2 · 52
               (               )
                   3µ2 − 60µ
      ∝    exp −
                      2 · 52
f (µ|D) ∝ P(D|µ) π(µ)
              (              )      (         )
                 3µ2 − 60µ               µ2
        ∝ exp −                exp −
                   2 · 52             2 · 102
               (              )2              
               µ − 120/13 − (120/13)2 
                                              
        = exp −
              
              
                                               
                                               
                                               
                          2 · 100/13
                                   (            ) 
                 1                 µ − 120/13 2 
                                                  
        ∝ √      √          exp −
                                  
                                                   
                                                   
            2π · 100/13               2 · 100/13 
.
..
         N(µ, 52 )                  3

                       4.7,    11.9,      13.4

                     π(µ)              N(0, 102 )
                                        (          )
                              1              µ2
            π(µ) =          √        exp −
                             2π · 10       2 · 102

 .   µ

 .
..                                  (             )
                                        120 100
                                N          ,
 .                                      13 13
µ
•
•       (
    )
•
1
..


2
..


3
..




4
..
.
        (Approximate Bayesian Computation,
 ABC)
..
    •


. •
1
..


2
..


3
..




4
..
.
                (Rectangular Kernel)
..
 n   x1 , . . . , xn                              f (x)
                                                  f (x)
         h

                   1 ∑
                              n
          f (x) =         I(|x − x j | ≤ h)
                  2nh j=1

                       I(X)       X           1
.        0


                    F(x + h) − F(x − h)
       fh (x) ≡
                            2h
                     1
                  =    P(x − h < X ≤ x + h)
                    2h
.
                        (1)
..
                        θ       n
 D′ , . . . , D′
  1            n                P(D|θ)          ρ
    ϵ

                            1∑
                                     n
                   P(D|θ) ∝       I(ρ(D, D′j ) ≤ ϵ)
                          θ n j=1

                              I(X)       X            1
 .                  0

         ϵ→∞
.
                       (2)
..
                       θ            n
 D′ , . . . , D′
  1            n                    P(D|θ)        Sa        ρ
                       ϵ

                        1∑
                                   n
               P(D|θ) ∝       I(ρ(S(D), S(D′j )) ≤ ϵ)
                      θ n j=1

                                 I(X)   X               1
                   0

 .
     a
              S              D
1
..


2
..


3
..




4
..
.
                           (without ABC)
..
     1
     ..    θ           π(·)
     2
     ..    θ        P(D|θ)       a

     3
     ..    1
      a
          max P(D|θ) ≤ c                   c
           θ
 P(D|θ)/c
 .

                   1               f (θ|D)
                     P(D|θ) =      c         ≤ 1
                   c                    π(θ)
                                 P(D)
likelihood <- (function(data) {
   L <- function(m) prod(dnorm(data, m, 5))
   function(mu) sapply(mu, L)
})(observed)
ML <- likelihood(mean(observed))

posterior <- numeric()
while ((n <- N - length(posterior)) > 0) {
   theta <- rprior(n)
   posterior <- c(posterior, theta[runif(n) <= likelihood(theta)/ML])
}
µ
.
                          (with ABC)
..
     1
     ..   θ             π(·)
                   ′
     2
     ..   θ     D
     ..
     3    ρ(S(D), S(D′ )) ≤ ϵ     θ

 .   4
     ..   1
distance <- (function(data)
   function(mu) {
      S <- function(m) mean(rnorm(length(data), m, 5))
      abs((mean(data) - sapply(mu, S)) / mean(data))
   }
)(observed)

posterior <- numeric()
while ((n <- N - length(posterior)) > 0) {
   theta <- rprior(n)
   posterior <- c(posterior, theta[distance(theta) <= TOLERANCE])
}
µ
.
 MCMC (M-H algorithm without ABC)
..
         ′
    .. θ
    1             q(θ → θ′ )
              {                             }
                  P(D|θ′ ) π(θ′ ) q(θ′ → θ)
    2
    ..     min 1,                                      θ′
                  P(D|θ) π(θ) q(θ → θ′ )
 . .3. 1
                       P(D|θ′ ) π(θ′ )
         f (θ′ |D)        P(D)               P(D|θ′ ) π(θ′ )
                   =                     =
          f (θ|D)      P(D|θ) π(θ)           P(D|θ) π(θ)
                         P(D)
likelihood <- (function(data) {
    L <- function(m) prod(dnorm(data, m, 5))
    function(mu) sapply(mu, L)
 })(observed)
 ratio <- function(mu1, mu2)
    (likelihood(mu2) /likelihood(mu1)) * (dprior(mu2) / dprior(mu1)) *
       (dtransition(mu2, mu1) / dtransition(mu1, mu2))

 chain <- numeric(N)
 chain[1] <- rprior(1)
 t <- 1; while (t < length(chain)) {
    proposal <- rtransition(chain[t])
    probability <- min(1, ratio(chain[t], proposal))
    if (runif(1) <= probability) {
       chain[t + 1] <- proposal
       t <- t + 1
    }
 }




                   (             ratio)
log
µ
.
 MCMC (M-H algorithm with ABC)
..
       ′
   .. θ
   1                 q(θ → θ′ )
       ′
   .. θ
   2          D′
                 ′
   .. ρ(S(D), S(D )) > ϵ
   3                            1
                              {                    }
                   ′
                                  π(θ′ ) q(θ′ → θ)
   4
   ..     α(θ → θ ) = min 1,                                                     θ′
                                  π(θ) q(θ → θ′ )

.   5
    ..   1
                 π(θ′ ) q(θ′ →θ)
α(θ → θ′ ) =     π(θ) q(θ→θ′ )     (≤ 1)

                 f (θ|ρ ≤ ϵ) q(θ → θ′ ) P(ρ ≤ ϵ|θ′ ) α(θ → θ′ )
                 P(ρ ≤ ϵ|θ)π(θ)                         π(θ′ ) q(θ′ → θ)
             =                  q(θ → θ′ ) P(ρ ≤ ϵ|θ′ )
                    P(ρ ≤ ϵ)                            π(θ) q(θ → θ′ )
             =   f (θ′ |ρ ≤ ϵ) q(θ′ → θ) P(ρ ≤ ϵ|θ) α(θ′ → θ)     (∵ α(θ′ → θ) = 1)


α(θ → θ′ ) = 1
distance <- (function(data)
    function(mu) {
       S <- function(m) mean(rnorm(length(data), m, 5))
       abs((mean(data) - sapply(mu, S)) / mean(data))
    }
 )(observed)
 ratio <- function(mu1, mu2)
    (dprior(mu2) / dprior(mu1)) *
       (dtransition(mu2, mu1) / dtransition(mu1, mu2))

 chain <- numeric(N)
 while (distance(chain[1] <- rprior(1)) > TOLERANCE) {}
 t <- 1; while (t < length(chain)) {
    proposal <- rtransition(chain[t])
    if (distance(proposal) <= TOLERANCE) {
       probability <- min(1, ratio(chain[t], proposal))
       if (runif(1) <= probability) {
          chain[t + 1] <- proposal
          t <- t + 1
       }
    }
 }




                   (             ratio)
log
µ
ϵ
•
•
.
                                (with ABC            )
..
     1
     ..   θ1 , . . . , θkN (k > 1)                           π(·)
     2
     ..   θi           D′i
     3
     ..   ρ(S(D), S(D′ ))    i
     4
     ..                              (1), . . . , (kN)         {θ(1) , . . . , θ(N) }
 .

                                                         ϵ = ρ(S(D), S(D′ ))
                                                                        (N)
distance <- (function(data)
   function(mu) {
      S <- function(m) mean(rnorm(length(data), m, 5))
      abs((mean(data) - sapply(mu, S)) / mean(data))
   }
)(observed)

prior <- rprior(k * N)
sortedDistance <- sort(distance(prior), index.return=TRUE)
posterior <- prior[sortedDistance$ix[1:N]]
µ
•
•
•
•
CRAN   abc
→
1
..


2
..


3
..




4
..
.
..
 .



 .
..
     (   )
 .
.
..
 .


          : 突然変異




     現在      過去
.
..
         a
             N            k

                     (          )
                     k(k − 1)
                 EXP
                       2N


     a
 .                   (              )
.
..

         POIS(Lµ)

     L       (      )   µ
 .
現在   分化   過去


•
    ⇒
    ⇒
•
.
..
 2               Hana mogeraa        2
                                                 b
                                                     (
         2                                   )

     •       1            N    400,000
     •       2            rN        1  2
     •                      aN               1   5

     •           (T; 4N          )       2
     a
     b
.
集団 1   2N
                                         2aN
集団 2   2rN


             0                T


                 N    ∼   U(0, 400000)
                  r   ∼   U(0, 2)
                 a    ∼   U(0, 5)
                 T    ∼   U(0, 2)
•                                                     30
                           1

         •                                       10−5
         •                                  20
   •                                                              S
                                        k


                   (S1 , k1 , S2 , k2 ) = (15.4, 2.9, 8.9, 0.3)




   1

(N, r, a, T) = (80000, 0.1, 3.0, 0.1)
•
•
•
´
[1] Marjoram P, Molitor J, Plagnol V, and Tavare S (2003)
    Markov chain Monte Carlo without likelihoods. PNAS,
    100: 15324–15328.
[2]           (2001)
         .                 , 31: 305–344.
[3]           (2005)
                       .                        , 12:
                                                        II
                                            (           )
      pp.153–211.
[4] Robert CP (2010) MCMC and Likelihood-free
    Methods. SlideShare.
https://bitbucket.org/kos59125/tokyo.r-17/

More Related Content

What's hot

パターン認識と機械学習(PRML)第2章 確率分布 2.3 ガウス分布
パターン認識と機械学習(PRML)第2章 確率分布 2.3 ガウス分布パターン認識と機械学習(PRML)第2章 確率分布 2.3 ガウス分布
パターン認識と機械学習(PRML)第2章 確率分布 2.3 ガウス分布
Nagayoshi Yamashita
 
Disentanglement Survey:Can You Explain How Much Are Generative models Disenta...
Disentanglement Survey:Can You Explain How Much Are Generative models Disenta...Disentanglement Survey:Can You Explain How Much Are Generative models Disenta...
Disentanglement Survey:Can You Explain How Much Are Generative models Disenta...
Hideki Tsunashima
 

What's hot (20)

Tensor コアを使った PyTorch の高速化
Tensor コアを使った PyTorch の高速化Tensor コアを使った PyTorch の高速化
Tensor コアを使った PyTorch の高速化
 
Sparse estimation tutorial 2014
Sparse estimation tutorial 2014Sparse estimation tutorial 2014
Sparse estimation tutorial 2014
 
数学で解き明かす深層学習の原理
数学で解き明かす深層学習の原理数学で解き明かす深層学習の原理
数学で解き明かす深層学習の原理
 
逐次モンテカルロ法の基礎
逐次モンテカルロ法の基礎逐次モンテカルロ法の基礎
逐次モンテカルロ法の基礎
 
PCAの最終形態GPLVMの解説
PCAの最終形態GPLVMの解説PCAの最終形態GPLVMの解説
PCAの最終形態GPLVMの解説
 
負の二項分布について
負の二項分布について負の二項分布について
負の二項分布について
 
Deeplearning輪読会
Deeplearning輪読会Deeplearning輪読会
Deeplearning輪読会
 
[DL輪読会]When Does Label Smoothing Help?
[DL輪読会]When Does Label Smoothing Help?[DL輪読会]When Does Label Smoothing Help?
[DL輪読会]When Does Label Smoothing Help?
 
PyMCがあれば,ベイズ推定でもう泣いたりなんかしない
PyMCがあれば,ベイズ推定でもう泣いたりなんかしないPyMCがあれば,ベイズ推定でもう泣いたりなんかしない
PyMCがあれば,ベイズ推定でもう泣いたりなんかしない
 
パターン認識と機械学習(PRML)第2章 確率分布 2.3 ガウス分布
パターン認識と機械学習(PRML)第2章 確率分布 2.3 ガウス分布パターン認識と機械学習(PRML)第2章 確率分布 2.3 ガウス分布
パターン認識と機械学習(PRML)第2章 確率分布 2.3 ガウス分布
 
Disentanglement Survey:Can You Explain How Much Are Generative models Disenta...
Disentanglement Survey:Can You Explain How Much Are Generative models Disenta...Disentanglement Survey:Can You Explain How Much Are Generative models Disenta...
Disentanglement Survey:Can You Explain How Much Are Generative models Disenta...
 
Prml 2.3
Prml 2.3Prml 2.3
Prml 2.3
 
PRML輪読#13
PRML輪読#13PRML輪読#13
PRML輪読#13
 
凸最適化 〜 双対定理とソルバーCVXPYの紹介 〜
凸最適化 〜 双対定理とソルバーCVXPYの紹介 〜凸最適化 〜 双対定理とソルバーCVXPYの紹介 〜
凸最適化 〜 双対定理とソルバーCVXPYの紹介 〜
 
実装レベルで学ぶVQVAE
実装レベルで学ぶVQVAE実装レベルで学ぶVQVAE
実装レベルで学ぶVQVAE
 
ベイズファクターとモデル選択
ベイズファクターとモデル選択ベイズファクターとモデル選択
ベイズファクターとモデル選択
 
SSII2021 [OS2-02] 深層学習におけるデータ拡張の原理と最新動向
SSII2021 [OS2-02] 深層学習におけるデータ拡張の原理と最新動向SSII2021 [OS2-02] 深層学習におけるデータ拡張の原理と最新動向
SSII2021 [OS2-02] 深層学習におけるデータ拡張の原理と最新動向
 
モデルアーキテクチャ観点からのDeep Neural Network高速化
モデルアーキテクチャ観点からのDeep Neural Network高速化モデルアーキテクチャ観点からのDeep Neural Network高速化
モデルアーキテクチャ観点からのDeep Neural Network高速化
 
pymcとpystanでベイズ推定してみた話
pymcとpystanでベイズ推定してみた話pymcとpystanでベイズ推定してみた話
pymcとpystanでベイズ推定してみた話
 
PRML 上 2.3.6 ~ 2.5.2
PRML 上 2.3.6 ~ 2.5.2PRML 上 2.3.6 ~ 2.5.2
PRML 上 2.3.6 ~ 2.5.2
 

Viewers also liked

サーバ異常検知入門
サーバ異常検知入門サーバ異常検知入門
サーバ異常検知入門
mangantempy
 
Rで解く最適化問題 線型計画問題編
Rで解く最適化問題   線型計画問題編 Rで解く最適化問題   線型計画問題編
Rで解く最適化問題 線型計画問題編
Hidekazu Tanaka
 
TokyoWebmining統計学部 第1回
TokyoWebmining統計学部 第1回TokyoWebmining統計学部 第1回
TokyoWebmining統計学部 第1回
Issei Kurahashi
 
R を起動するその前に
R を起動するその前にR を起動するその前に
R を起動するその前に
Kosei ABE
 
第5章glmの尤度比検定と検定の非対称性 前編
第5章glmの尤度比検定と検定の非対称性 前編第5章glmの尤度比検定と検定の非対称性 前編
第5章glmの尤度比検定と検定の非対称性 前編
T T
 

Viewers also liked (20)

Tokyor17
Tokyor17Tokyor17
Tokyor17
 
サーバ異常検知入門
サーバ異常検知入門サーバ異常検知入門
サーバ異常検知入門
 
Rで解く最適化問題 線型計画問題編
Rで解く最適化問題   線型計画問題編 Rで解く最適化問題   線型計画問題編
Rで解く最適化問題 線型計画問題編
 
3次元のデータをグラフにする(Tokyo.R#17)
3次元のデータをグラフにする(Tokyo.R#17)3次元のデータをグラフにする(Tokyo.R#17)
3次元のデータをグラフにする(Tokyo.R#17)
 
Rで学ぶ 傾向スコア解析入門 - 無作為割り当てが出来ない時の因果効果推定 -
Rで学ぶ 傾向スコア解析入門 - 無作為割り当てが出来ない時の因果効果推定 -Rで学ぶ 傾向スコア解析入門 - 無作為割り当てが出来ない時の因果効果推定 -
Rで学ぶ 傾向スコア解析入門 - 無作為割り当てが出来ない時の因果効果推定 -
 
Rて計量経済学入門#tokyo.r.17
Rて計量経済学入門#tokyo.r.17Rて計量経済学入門#tokyo.r.17
Rて計量経済学入門#tokyo.r.17
 
Rによるデータサイエンス:12章「時系列」
Rによるデータサイエンス:12章「時系列」Rによるデータサイエンス:12章「時系列」
Rによるデータサイエンス:12章「時系列」
 
学部生向けベイズ統計イントロ(公開版)
学部生向けベイズ統計イントロ(公開版)学部生向けベイズ統計イントロ(公開版)
学部生向けベイズ統計イントロ(公開版)
 
エクセルで統計分析 統計プログラムHADについて
エクセルで統計分析 統計プログラムHADについてエクセルで統計分析 統計プログラムHADについて
エクセルで統計分析 統計プログラムHADについて
 
ベイズ学習勉強会 EMアルゴリズム (作成途中)
ベイズ学習勉強会 EMアルゴリズム (作成途中)ベイズ学習勉強会 EMアルゴリズム (作成途中)
ベイズ学習勉強会 EMアルゴリズム (作成途中)
 
ノンパラメトリックベイズ4章クラスタリング
ノンパラメトリックベイズ4章クラスタリングノンパラメトリックベイズ4章クラスタリング
ノンパラメトリックベイズ4章クラスタリング
 
ベイズ推定の概要@広島ベイズ塾
ベイズ推定の概要@広島ベイズ塾ベイズ推定の概要@広島ベイズ塾
ベイズ推定の概要@広島ベイズ塾
 
Tokyor18
Tokyor18Tokyor18
Tokyor18
 
2ch
2ch2ch
2ch
 
TokyoWebmining統計学部 第1回
TokyoWebmining統計学部 第1回TokyoWebmining統計学部 第1回
TokyoWebmining統計学部 第1回
 
Tokyo r 10_12
Tokyo r 10_12Tokyo r 10_12
Tokyo r 10_12
 
Tokyor16
Tokyor16Tokyor16
Tokyor16
 
R を起動するその前に
R を起動するその前にR を起動するその前に
R を起動するその前に
 
第5章glmの尤度比検定と検定の非対称性 前編
第5章glmの尤度比検定と検定の非対称性 前編第5章glmの尤度比検定と検定の非対称性 前編
第5章glmの尤度比検定と検定の非対称性 前編
 
Rデバッグあれこれ
RデバッグあれこれRデバッグあれこれ
Rデバッグあれこれ
 

Similar to 近似ベイズ計算によるベイズ推定

Jyokyo-kai-20120605
Jyokyo-kai-20120605Jyokyo-kai-20120605
Jyokyo-kai-20120605
ketanaka
 
Integration techniques
Integration techniquesIntegration techniques
Integration techniques
Krishna Gali
 

Similar to 近似ベイズ計算によるベイズ推定 (20)

Dual Gravitons in AdS4/CFT3 and the Holographic Cotton Tensor
Dual Gravitons in AdS4/CFT3 and the Holographic Cotton TensorDual Gravitons in AdS4/CFT3 and the Holographic Cotton Tensor
Dual Gravitons in AdS4/CFT3 and the Holographic Cotton Tensor
 
Cosmin Crucean: Perturbative QED on de Sitter Universe.
Cosmin Crucean: Perturbative QED on de Sitter Universe.Cosmin Crucean: Perturbative QED on de Sitter Universe.
Cosmin Crucean: Perturbative QED on de Sitter Universe.
 
Holographic Cotton Tensor
Holographic Cotton TensorHolographic Cotton Tensor
Holographic Cotton Tensor
 
Instantons and Chern-Simons Terms in AdS4/CFT3
Instantons and Chern-Simons Terms in AdS4/CFT3Instantons and Chern-Simons Terms in AdS4/CFT3
Instantons and Chern-Simons Terms in AdS4/CFT3
 
Tensor Train data format for uncertainty quantification
Tensor Train data format for uncertainty quantificationTensor Train data format for uncertainty quantification
Tensor Train data format for uncertainty quantification
 
Additional notes EC220
Additional notes EC220Additional notes EC220
Additional notes EC220
 
Jyokyo-kai-20120605
Jyokyo-kai-20120605Jyokyo-kai-20120605
Jyokyo-kai-20120605
 
Andreas Eberle
Andreas EberleAndreas Eberle
Andreas Eberle
 
A Szemeredi-type theorem for subsets of the unit cube
A Szemeredi-type theorem for subsets of the unit cubeA Szemeredi-type theorem for subsets of the unit cube
A Szemeredi-type theorem for subsets of the unit cube
 
Integration techniques
Integration techniquesIntegration techniques
Integration techniques
 
Linear Differential Equations1
Linear Differential Equations1Linear Differential Equations1
Linear Differential Equations1
 
Sect1 5
Sect1 5Sect1 5
Sect1 5
 
Tam 2nd
Tam 2ndTam 2nd
Tam 2nd
 
Calculo Diferencial
Calculo DiferencialCalculo Diferencial
Calculo Diferencial
 
125 5.2
125 5.2125 5.2
125 5.2
 
My PhD talk "Application of H-matrices for computing partial inverse"
My PhD talk "Application of H-matrices for computing partial inverse"My PhD talk "Application of H-matrices for computing partial inverse"
My PhD talk "Application of H-matrices for computing partial inverse"
 
Ex algebra (5)
Ex algebra  (5)Ex algebra  (5)
Ex algebra (5)
 
Quantitative norm convergence of some ergodic averages
Quantitative norm convergence of some ergodic averagesQuantitative norm convergence of some ergodic averages
Quantitative norm convergence of some ergodic averages
 
02 2d systems matrix
02 2d systems matrix02 2d systems matrix
02 2d systems matrix
 
Rousseau
RousseauRousseau
Rousseau
 

Recently uploaded

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 

Recently uploaded (20)

80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 

近似ベイズ計算によるベイズ推定

  • 4. • Twitter ID: kos59125 • R :7
  • 7. . .. P(D|θ) π(θ) f (θ|D) = ∝ P(D|θ) π(θ) P(D) • π(θ): D θ • P(D|θ): D θ • f (θ|D): D . θ ∝ x f (x) = cg(x) c f (x) ∝ g(x)
  • 8. . .. N(µ, 52 ) 3 4.7, 11.9, 13.4 π(µ) N(0, 102 ) ( ) 1 µ2 π(µ) = √ exp − 2π · 10 2 · 102 . µ
  • 9. ( ) 1 (4.7 − µ)2 P(D|µ) = √ exp − 2π · 5 2 · 52 ( ) 1 (11.9 − µ)2 × √ exp − 2π · 5 2 · 52 ( ) 1 (13.4 − µ)2 × √ exp − 2π · 5 2 · 52 ( ) (4.7 − µ)2 + (11.9 − µ)2 + (13.4 − µ)2 ∝ exp − 2 · 52 ( ) 3µ2 − 60µ + (4.72 + 11.92 + 13.42 ) = exp − 2 · 52 ( ) 3µ2 − 60µ ∝ exp − 2 · 52
  • 10. f (µ|D) ∝ P(D|µ) π(µ) ( ) ( ) 3µ2 − 60µ µ2 ∝ exp − exp − 2 · 52 2 · 102  ( )2   µ − 120/13 − (120/13)2    = exp −      2 · 100/13  ( )  1  µ − 120/13 2    ∝ √ √ exp −    2π · 100/13 2 · 100/13 
  • 11. . .. N(µ, 52 ) 3 4.7, 11.9, 13.4 π(µ) N(0, 102 ) ( ) 1 µ2 π(µ) = √ exp − 2π · 10 2 · 102 . µ . .. ( ) 120 100 N , . 13 13
  • 12. µ
  • 13. • • ( ) •
  • 15. . (Approximate Bayesian Computation, ABC) .. • . •
  • 17. . (Rectangular Kernel) .. n x1 , . . . , xn f (x) f (x) h 1 ∑ n f (x) = I(|x − x j | ≤ h) 2nh j=1 I(X) X 1 . 0 F(x + h) − F(x − h) fh (x) ≡ 2h 1 = P(x − h < X ≤ x + h) 2h
  • 18. . (1) .. θ n D′ , . . . , D′ 1 n P(D|θ) ρ ϵ 1∑ n P(D|θ) ∝ I(ρ(D, D′j ) ≤ ϵ) θ n j=1 I(X) X 1 . 0 ϵ→∞
  • 19. . (2) .. θ n D′ , . . . , D′ 1 n P(D|θ) Sa ρ ϵ 1∑ n P(D|θ) ∝ I(ρ(S(D), S(D′j )) ≤ ϵ) θ n j=1 I(X) X 1 0 . a S D
  • 21. . (without ABC) .. 1 .. θ π(·) 2 .. θ P(D|θ) a 3 .. 1 a max P(D|θ) ≤ c c θ P(D|θ)/c . 1 f (θ|D) P(D|θ) = c ≤ 1 c π(θ) P(D)
  • 22. likelihood <- (function(data) { L <- function(m) prod(dnorm(data, m, 5)) function(mu) sapply(mu, L) })(observed) ML <- likelihood(mean(observed)) posterior <- numeric() while ((n <- N - length(posterior)) > 0) { theta <- rprior(n) posterior <- c(posterior, theta[runif(n) <= likelihood(theta)/ML]) }
  • 23. µ
  • 24. . (with ABC) .. 1 .. θ π(·) ′ 2 .. θ D .. 3 ρ(S(D), S(D′ )) ≤ ϵ θ . 4 .. 1
  • 25. distance <- (function(data) function(mu) { S <- function(m) mean(rnorm(length(data), m, 5)) abs((mean(data) - sapply(mu, S)) / mean(data)) } )(observed) posterior <- numeric() while ((n <- N - length(posterior)) > 0) { theta <- rprior(n) posterior <- c(posterior, theta[distance(theta) <= TOLERANCE]) }
  • 26. µ
  • 27. . MCMC (M-H algorithm without ABC) .. ′ .. θ 1 q(θ → θ′ ) { } P(D|θ′ ) π(θ′ ) q(θ′ → θ) 2 .. min 1, θ′ P(D|θ) π(θ) q(θ → θ′ ) . .3. 1 P(D|θ′ ) π(θ′ ) f (θ′ |D) P(D) P(D|θ′ ) π(θ′ ) = = f (θ|D) P(D|θ) π(θ) P(D|θ) π(θ) P(D)
  • 28. likelihood <- (function(data) { L <- function(m) prod(dnorm(data, m, 5)) function(mu) sapply(mu, L) })(observed) ratio <- function(mu1, mu2) (likelihood(mu2) /likelihood(mu1)) * (dprior(mu2) / dprior(mu1)) * (dtransition(mu2, mu1) / dtransition(mu1, mu2)) chain <- numeric(N) chain[1] <- rprior(1) t <- 1; while (t < length(chain)) { proposal <- rtransition(chain[t]) probability <- min(1, ratio(chain[t], proposal)) if (runif(1) <= probability) { chain[t + 1] <- proposal t <- t + 1 } } ( ratio) log
  • 29. µ
  • 30. . MCMC (M-H algorithm with ABC) .. ′ .. θ 1 q(θ → θ′ ) ′ .. θ 2 D′ ′ .. ρ(S(D), S(D )) > ϵ 3 1 { } ′ π(θ′ ) q(θ′ → θ) 4 .. α(θ → θ ) = min 1, θ′ π(θ) q(θ → θ′ ) . 5 .. 1 π(θ′ ) q(θ′ →θ) α(θ → θ′ ) = π(θ) q(θ→θ′ ) (≤ 1) f (θ|ρ ≤ ϵ) q(θ → θ′ ) P(ρ ≤ ϵ|θ′ ) α(θ → θ′ ) P(ρ ≤ ϵ|θ)π(θ) π(θ′ ) q(θ′ → θ) = q(θ → θ′ ) P(ρ ≤ ϵ|θ′ ) P(ρ ≤ ϵ) π(θ) q(θ → θ′ ) = f (θ′ |ρ ≤ ϵ) q(θ′ → θ) P(ρ ≤ ϵ|θ) α(θ′ → θ) (∵ α(θ′ → θ) = 1) α(θ → θ′ ) = 1
  • 31. distance <- (function(data) function(mu) { S <- function(m) mean(rnorm(length(data), m, 5)) abs((mean(data) - sapply(mu, S)) / mean(data)) } )(observed) ratio <- function(mu1, mu2) (dprior(mu2) / dprior(mu1)) * (dtransition(mu2, mu1) / dtransition(mu1, mu2)) chain <- numeric(N) while (distance(chain[1] <- rprior(1)) > TOLERANCE) {} t <- 1; while (t < length(chain)) { proposal <- rtransition(chain[t]) if (distance(proposal) <= TOLERANCE) { probability <- min(1, ratio(chain[t], proposal)) if (runif(1) <= probability) { chain[t + 1] <- proposal t <- t + 1 } } } ( ratio) log
  • 32. µ
  • 34. . (with ABC ) .. 1 .. θ1 , . . . , θkN (k > 1) π(·) 2 .. θi D′i 3 .. ρ(S(D), S(D′ )) i 4 .. (1), . . . , (kN) {θ(1) , . . . , θ(N) } . ϵ = ρ(S(D), S(D′ )) (N)
  • 35. distance <- (function(data) function(mu) { S <- function(m) mean(rnorm(length(data), m, 5)) abs((mean(data) - sapply(mu, S)) / mean(data)) } )(observed) prior <- rprior(k * N) sortedDistance <- sort(distance(prior), index.return=TRUE) posterior <- prior[sortedDistance$ix[1:N]]
  • 36. µ
  • 38. CRAN abc →
  • 40. . .. . . .. ( ) .
  • 41. . .. . : 突然変異 現在 過去
  • 42. . .. a N k ( ) k(k − 1) EXP 2N a . ( )
  • 43. . .. POIS(Lµ) L ( ) µ .
  • 44. 現在 分化 過去 • ⇒ ⇒ •
  • 45. . .. 2 Hana mogeraa 2 b ( 2 ) • 1 N 400,000 • 2 rN 1 2 • aN 1 5 • (T; 4N ) 2 a b .
  • 46. 集団 1 2N 2aN 集団 2 2rN 0 T N ∼ U(0, 400000) r ∼ U(0, 2) a ∼ U(0, 5) T ∼ U(0, 2)
  • 47. 30 1 • 10−5 • 20 • S k (S1 , k1 , S2 , k2 ) = (15.4, 2.9, 8.9, 0.3) 1 (N, r, a, T) = (80000, 0.1, 3.0, 0.1)
  • 48.
  • 49.
  • 51. ´ [1] Marjoram P, Molitor J, Plagnol V, and Tavare S (2003) Markov chain Monte Carlo without likelihoods. PNAS, 100: 15324–15328. [2] (2001) . , 31: 305–344. [3] (2005) . , 12: II ( ) pp.153–211. [4] Robert CP (2010) MCMC and Likelihood-free Methods. SlideShare.