SlideShare ist ein Scribd-Unternehmen logo
1 von 14
Downloaden Sie, um offline zu lesen
Doing Bayesian Data Analysis

Chapter 4: Bayes’ Rule
東京大学 松尾研究室 修士2年"
飯塚修平@tushuhei
2013/08/04 1
導入
•  あの子がオレのことを見て微笑んだ"
•  もしかしてオレに気がある!?"
•  残念ながら p(♡|J) ≠ p(☺|♡)."
–  p(♡|☺): あの子が微笑んだ時に、あなたに好意がある確率"
–  p(☺|♡): あの子があなたに好意があるときに、微笑む確率"
•  ベイズの定理によると p(♡|☺) = p(☺|♡)p(♡)/p(☺)"
–  p(☺) = Σp(J|θ)p(θ): あなたのことが好きで微笑んだ、あなたが純粋に
面白い顔をしていた、たまたま昨日のお笑い番組を思い出した etc. す
べての和であることに注意"
–  とりあえず、p(♡)(あの子があなたに好意がある確率)はどれくらい
だと思う?(事前確率)"
2013/08/04 2
ベイズの定理
2013/08/04 3
p(y, x) = p(y|x)p(x) = p(x|y)p(y)
p(y|x) =
p(x|y)p(y)
p(x)
p(x) =
y
p(x, y) =
y
p(x|y)p(y)
p(y|x) =
p(x|y)p(y)
y p(x|y)p(y)
p(y|x) =
p(x|y)p(y)
dy p(x|y)p(y)
条件付き確率の定義
p(y, x) = p(y|x)p(x) = p(x|y)p(y)
p(y|x) =
p(x|y)p(y)
p(x)
p(x) =
y
p(x, y) =
y
p(x|y)p(y)
p(y|x) =
p(x|y)p(y)
y p(x|y)p(y)
p(y|x) =
p(x|y)p(y)
dy p(x|y)p(y)
ベイズの定理
ベイズの定理(連続値)
p(y, x) = p(y|x)p(x) = p(x
p(y|x) =
p(x|y)p(y)
p(x)
p(x) =
y
p(x, y) =
y
p(x|
p(y|x) =
p(x|y)p(y)
y p(x|y)p(y)
p(y|x) =
p(x|y)p(y)
dy p(x|y)p(y)
p(y, x) = p(y|x)p(x) = p(x|y)p(y)
p(y|x) =
p(x|y)p(y)
p(x)
p(x) =
y
p(x, y) =
y
p(x|y)p(y)
p(y|x) =
p(x|y)p(y)
y p(x|y)p(y)
p(y|x) =
p(x|y)p(y)
dy p(x|y)p(y)
ベイズの定理(離散値)
p(y, x) = p(y|x)p(x) = p(x|y)p(y)
p(y|x) =
p(x|y)p(y)
p(x)
p(x) =
y
p(x, y) =
y
p(x|y)p(y)
p(y|x) =
p(x|y)p(y)
y p(x|y)p(y)
p(y|x) =
p(x|y)p(y)
dy p(x|y)p(y)
ベイズの定理
2013/08/04 4
p(y|x) =
y p(x|y)p(y)
p(y|x) =
p(x|y)p(y)
dy p(x|y)p(y)
p( |D) = p(D| ) p( ) /p(D)
Posterior	
  
事後確率
Likelihood	
  
尤度	
  
Prior	
  
事前確率	
  
Evidence	
  
証拠	
  
p(y|x) =
p(x|y)p(y)
p(x)
p(x) =
y
p(x, y) =
y
p(x|y)p(y)
p(y|x) =
p(x|y)p(y)
y p(x|y)p(y)
p(y|x) =
p(x|y)p(y)
dy p(x|y)p(y)
p( |D) = p(D| ) p( ) /p(D)
p(D) = d p(D| )p( )Where:
ベイズの定理
2013/08/04 5
モデル自体も	
  M	
  としてパラメタに組み込むと、ベイズの定理は、
p( |D, M) = p(D| , M) p( |M)/p(D|M)
p(M1|D) = p(D|M1)p(M1)/p(D)
p(M2|D) = p(D|M2)p(M2)/p(D)
p(M1|D)
p(M2|D)
=
p(D|M1)
p(D|M2)
M1
M2
p( |D, M) = p(D| , M) p( |M)/p(D|M)
p(M1|D) = p(D|M1)p(M1)/p(D)
p(M2|D) = p(D|M2)p(M2)/p(D)
p(M1|D)
p(M2|D)
=
p(D|M1)
p(D|M2)
M1
M2
なので、
すなわち、事後確率の比は、証拠の比と事前確率の比の積で表される。	
  
この事前確率の比を Bayers	
  Factor	
  と呼ぶ。
p( |D, M) = p(D| , M) p( |M)/p(D|M)
p(M1|D) = p(D|M1)p(M1)/p(D)
p(M2|D) = p(D|M2)p(M2)/p(D)
p(M1|D)
p(M2|D)
=
p(D|M1)
p(D|M2)
p(M1)
p(M2)
Bayes	
  Factor
と表せる。ここで、
ベイズの定理
2013/08/04 6
出現する証拠はモデルのパラメタθにしかよらないので、	
  
p(D | , D) = p(D | )
p( |D , D) =
p(D | , D)p( |D)
d p(D | , D)p( |D)
=
p(D | )p( |D)
d p(D | )p( |D)
したがって、
再度テストを行うなど、複数回にわたってデータをサンプリングするときに使える
【複数の証拠	
  D,	
  D’	
  がある場合】	
  
コイントスの例
•  あなたのコインは公平?それともインチキ?"
2013/08/04 7
H : head, T : tail
= p(H)
H : head, T : tail
= p(H)
p( ) =
0.25 ( = 0.25, 0.75)
0.5 ( = 0.5)
0 (otherwise)
→下記のように	
  Prior	
  (事前確率)	
  を設定
おそらくちゃんと作
られてるから θ=0.5 "
だけど"
もしかしたら偽物で
偏ってるかも?
↑	
  
A君の頭のなかの	
  
モデル
コイントスの例
2013/08/04 8
p( ) =
0.25 ( = 0.25, 0.75)
0.5 ( = 0.5)
0 (otherwise)
Prior (事前確率)
D = 3H, 9T のときLikelihood (尤度)
p(D| ) = 3
(1 )9
=
1.2 10 3
( = 0.25)
2.4 10 4
( = 0.50)
1.6 10 6
( = 0.75)
0 (otherwise)
データの当てはまり具合
コイントスの例
2013/08/04 9
Posterior (事後確率) ベイズの定理より、
p( |D) =
p(D| )p( )
p(D| )p( )
0.71 ( = 0.25)
0.29 ( = 0.50)
9.0 10 4
( = 0.75)
0 (otherwise)
合計=1となることに注目。
•  事前確率がもう少し複雑な例を考える"
•  ベイズならモデルの比較も簡単!"
コイントスの例2
2013/08/04 10
VS
simple complex
コイントスの例2
p(D|M) simple complex
D = 3H, 9T 0.000416 0.000392
D = 1H, 11T 0.00276 0.00366
2013/08/04 11
モデルMからデータDが	
  
生じる確率
日常に潜むベイズの考え方
•  「ワトソン君、何度言ったら分かるんだ。起こり得ないことをすべ
て取り除いてそれが残ったんだったら、どんなに可能性が低くても、
それが真実なんだよ。」
2013/08/04 12
•  屋根からなんか落ちてきた→「猫かな?」

今隣の家に子供が遊びにきたらしい→「あ、そっちだね」"
屋根からなんか落ちてきた→ cat かな?
p(D| child) が大きいらしい→ p(D| i) = Const.( i = j) であっても、
p( child|D) が小さくなる
「ワトソン君、何度言ったら分かるんだ。p(D| i) = 0( i = j) なら
どんなに p( j) > 0 が小さくても p( j|D) = 1 なんだよ。」
Exercise 4.2
•  ある病気と検査の話(条件付き確率あるある)"
•  病気の確率変数 θ = J, L(事象「かからない」or「かかる」)"
•  p(θ=L) = 0.001: 罹患率は 0.1%"
•  検査の結果の確率変数 D=+(陽性), ー(陰性)"
•  p(D=+| θ=L) = 0.99: 的中率 99%"
•  p(D=+| θ=J) = 0.05: エラー率 5%"
•  運悪く、あなたは最初の検査で陽性反応が出てしまいました。"
•  不安になってもう一度検査を受けたところ、陰性反応が出ました。"
•  さて、このときあなたが病気にかかっている確率は?"
•  すなわち、p(θ=L | D1=+, D2=ー) は?"
2013/08/04 13
Exercise 4.2
2013/08/04 14
p( =):|D1 = +, D2 = )
=
p(D2 = +| =
):
, D1 = +)p( =
p(D2 = +| =
):
, D1 = +)p( =
):
|D1 = +) + p(D2 =
=
p(D2 = +| =
):
)p( =
):
|D1 = +)
p(D2 = +| =):)p( =
):
|D1 = +) + p(D2 = +| =
p( =
):
|D1 = +, D2 = )
=
p(D2 = +| =
):
, D1 = +)p( =
):
|D1 = +)
p(D2 = +| =
):
, D1 = +)p( =
):
|D1 = +) + p(D2 = +| =
(:
, D1 = +)p( =
(:
|D1 = +)
=
p(D2 = +| =):)p( =
):
|D1 = +)
p(D2 = +| =
):
)p( =
):
|D1 = +) + p(D2 = +| =
(:
)p( =
(:
|D1 = +)
θ=L	
  と D2	
  についてベイズの定理を適用して
p( =
):
|D1 = +, D2 = )
=
p(D2 = +| =
):
, D1 = +)p( =
):
|D1 = +)
p(D2 = +| =
):
, D1 = +)p( =):|D1 = +) + p(D2 = +| =
(:
, D1 = +)p
=
p(D2 = +| =
):
)p( =
):
|D1 = +)
p(D2 = +| =
):
)p( =
):
|D1 = +) + p(D2 = +| =
(:
)p( =
(:
|D1 = +)
D2	
  の結果は	
  D1	
  とは無関係なので(スライド	
  p6	
  参照)
あとは各項の値を求める。 = 2.1*10^{-4} = 0.021%

Weitere ähnliche Inhalte

Andere mochten auch

Doing Bayesian Data Analysis, Chapter 5
Doing Bayesian Data Analysis, Chapter 5Doing Bayesian Data Analysis, Chapter 5
Doing Bayesian Data Analysis, Chapter 5春 根上
 
【DBDA勉強会2013】Doing Bayesian Data Analysis Chapter 16: Metric Predicted Variab...
【DBDA勉強会2013】Doing Bayesian Data Analysis Chapter 16: Metric Predicted Variab...【DBDA勉強会2013】Doing Bayesian Data Analysis Chapter 16: Metric Predicted Variab...
【DBDA勉強会2013】Doing Bayesian Data Analysis Chapter 16: Metric Predicted Variab...Junki Marui
 
Doing Bayesian Data Analysis; Chapter 14
Doing Bayesian Data Analysis; Chapter 14Doing Bayesian Data Analysis; Chapter 14
Doing Bayesian Data Analysis; Chapter 14春 根上
 
【DBDA勉強会2013】Doing Bayesian Data Analysis Chapter 8: Inferring Two Binomial P...
【DBDA勉強会2013】Doing Bayesian Data Analysis Chapter 8: Inferring Two Binomial P...【DBDA勉強会2013】Doing Bayesian Data Analysis Chapter 8: Inferring Two Binomial P...
【DBDA勉強会2013】Doing Bayesian Data Analysis Chapter 8: Inferring Two Binomial P...Junki Marui
 
【DBDA 勉強会 2013 夏】Chapter 12: Bayesian Approaches to Testing a Point (‘‘Null’’...
【DBDA 勉強会 2013 夏】Chapter 12: Bayesian Approaches to Testing a Point (‘‘Null’’...【DBDA 勉強会 2013 夏】Chapter 12: Bayesian Approaches to Testing a Point (‘‘Null’’...
【DBDA 勉強会 2013 夏】Chapter 12: Bayesian Approaches to Testing a Point (‘‘Null’’...Shuhei Iitsuka
 
Doing Bayesian Data Analysis Chapter 11. Null Hypothesis Significance Testing
Doing Bayesian Data Analysis Chapter 11. Null Hypothesis Significance TestingDoing Bayesian Data Analysis Chapter 11. Null Hypothesis Significance Testing
Doing Bayesian Data Analysis Chapter 11. Null Hypothesis Significance TestingHiroki Takanashi
 
Chapter.13: Goals, Power and Sample Size "Doing Bayesian Data Analysis: A Tu...
Chapter.13: Goals, Power and Sample Size "Doing Bayesian Data Analysis:  A Tu...Chapter.13: Goals, Power and Sample Size "Doing Bayesian Data Analysis:  A Tu...
Chapter.13: Goals, Power and Sample Size "Doing Bayesian Data Analysis: A Tu...Hajime Sasaki
 
全脳アーキテクチャ勉強会 第1回(松尾)
全脳アーキテクチャ勉強会 第1回(松尾)全脳アーキテクチャ勉強会 第1回(松尾)
全脳アーキテクチャ勉強会 第1回(松尾)Yutaka Matsuo
 

Andere mochten auch (10)

Doing Bayesian Data Analysis, Chapter 5
Doing Bayesian Data Analysis, Chapter 5Doing Bayesian Data Analysis, Chapter 5
Doing Bayesian Data Analysis, Chapter 5
 
【DBDA勉強会2013】Doing Bayesian Data Analysis Chapter 16: Metric Predicted Variab...
【DBDA勉強会2013】Doing Bayesian Data Analysis Chapter 16: Metric Predicted Variab...【DBDA勉強会2013】Doing Bayesian Data Analysis Chapter 16: Metric Predicted Variab...
【DBDA勉強会2013】Doing Bayesian Data Analysis Chapter 16: Metric Predicted Variab...
 
Doing Bayesian Data Analysis; Chapter 14
Doing Bayesian Data Analysis; Chapter 14Doing Bayesian Data Analysis; Chapter 14
Doing Bayesian Data Analysis; Chapter 14
 
【DBDA勉強会2013】Doing Bayesian Data Analysis Chapter 8: Inferring Two Binomial P...
【DBDA勉強会2013】Doing Bayesian Data Analysis Chapter 8: Inferring Two Binomial P...【DBDA勉強会2013】Doing Bayesian Data Analysis Chapter 8: Inferring Two Binomial P...
【DBDA勉強会2013】Doing Bayesian Data Analysis Chapter 8: Inferring Two Binomial P...
 
【DBDA 勉強会 2013 夏】Chapter 12: Bayesian Approaches to Testing a Point (‘‘Null’’...
【DBDA 勉強会 2013 夏】Chapter 12: Bayesian Approaches to Testing a Point (‘‘Null’’...【DBDA 勉強会 2013 夏】Chapter 12: Bayesian Approaches to Testing a Point (‘‘Null’’...
【DBDA 勉強会 2013 夏】Chapter 12: Bayesian Approaches to Testing a Point (‘‘Null’’...
 
Doing Bayesian Data Analysis Chapter 11. Null Hypothesis Significance Testing
Doing Bayesian Data Analysis Chapter 11. Null Hypothesis Significance TestingDoing Bayesian Data Analysis Chapter 11. Null Hypothesis Significance Testing
Doing Bayesian Data Analysis Chapter 11. Null Hypothesis Significance Testing
 
Dbda chapter15
Dbda chapter15Dbda chapter15
Dbda chapter15
 
Chapter.13: Goals, Power and Sample Size "Doing Bayesian Data Analysis: A Tu...
Chapter.13: Goals, Power and Sample Size "Doing Bayesian Data Analysis:  A Tu...Chapter.13: Goals, Power and Sample Size "Doing Bayesian Data Analysis:  A Tu...
Chapter.13: Goals, Power and Sample Size "Doing Bayesian Data Analysis: A Tu...
 
Dbda chapter17
Dbda chapter17Dbda chapter17
Dbda chapter17
 
全脳アーキテクチャ勉強会 第1回(松尾)
全脳アーキテクチャ勉強会 第1回(松尾)全脳アーキテクチャ勉強会 第1回(松尾)
全脳アーキテクチャ勉強会 第1回(松尾)
 

Mehr von Shuhei Iitsuka

Online and offline handwritten chinese character recognition a comprehensive...
Online and offline handwritten chinese character recognition  a comprehensive...Online and offline handwritten chinese character recognition  a comprehensive...
Online and offline handwritten chinese character recognition a comprehensive...Shuhei Iitsuka
 
Inferring win–lose product network from user behavior
Inferring win–lose product network from user behaviorInferring win–lose product network from user behavior
Inferring win–lose product network from user behaviorShuhei Iitsuka
 
バリエーションの提示がもたらす長期的効果に着目したウェブサイト最適化手法 @第31回人工知能学会全国大会
バリエーションの提示がもたらす長期的効果に着目したウェブサイト最適化手法 @第31回人工知能学会全国大会バリエーションの提示がもたらす長期的効果に着目したウェブサイト最適化手法 @第31回人工知能学会全国大会
バリエーションの提示がもたらす長期的効果に着目したウェブサイト最適化手法 @第31回人工知能学会全国大会Shuhei Iitsuka
 
Procedural modeling using autoencoder networks
Procedural modeling using autoencoder networksProcedural modeling using autoencoder networks
Procedural modeling using autoencoder networksShuhei Iitsuka
 
Generating sentences from a continuous space
Generating sentences from a continuous spaceGenerating sentences from a continuous space
Generating sentences from a continuous spaceShuhei Iitsuka
 
ウェブサイト最適化のためのバリエーション自動生成システム
ウェブサイト最適化のためのバリエーション自動生成システムウェブサイト最適化のためのバリエーション自動生成システム
ウェブサイト最適化のためのバリエーション自動生成システムShuhei Iitsuka
 
Improving the Sensitivity of Online Controlled Experiments by Utilizing Pre-E...
Improving the Sensitivity of Online Controlled Experiments by Utilizing Pre-E...Improving the Sensitivity of Online Controlled Experiments by Utilizing Pre-E...
Improving the Sensitivity of Online Controlled Experiments by Utilizing Pre-E...Shuhei Iitsuka
 
Machine learning meets web development
Machine learning meets web developmentMachine learning meets web development
Machine learning meets web developmentShuhei Iitsuka
 
Python と Xpath で ウェブからデータをあつめる
Python と Xpath で ウェブからデータをあつめるPython と Xpath で ウェブからデータをあつめる
Python と Xpath で ウェブからデータをあつめるShuhei Iitsuka
 
リミックスからはじめる DTM 入門
リミックスからはじめる DTM 入門リミックスからはじめる DTM 入門
リミックスからはじめる DTM 入門Shuhei Iitsuka
 
Asia Trend Map: Forecasting “Cool Japan” Content Popularity on Web Data
Asia Trend Map: Forecasting “Cool Japan” Content Popularity on Web DataAsia Trend Map: Forecasting “Cool Japan” Content Popularity on Web Data
Asia Trend Map: Forecasting “Cool Japan” Content Popularity on Web DataShuhei Iitsuka
 
UT Startup Gym で人生が変わった話
UT Startup Gym で人生が変わった話UT Startup Gym で人生が変わった話
UT Startup Gym で人生が変わった話Shuhei Iitsuka
 
ウェブサイトで収益を得る
ウェブサイトで収益を得るウェブサイトで収益を得る
ウェブサイトで収益を得るShuhei Iitsuka
 
HTML で自己紹介ページをつくる
HTML で自己紹介ページをつくるHTML で自己紹介ページをつくる
HTML で自己紹介ページをつくるShuhei Iitsuka
 
データベースを使おう
データベースを使おうデータベースを使おう
データベースを使おうShuhei Iitsuka
 
ウェブサービスの企画とデザイン
ウェブサービスの企画とデザインウェブサービスの企画とデザイン
ウェブサービスの企画とデザインShuhei Iitsuka
 
データベースを使おう
データベースを使おうデータベースを使おう
データベースを使おうShuhei Iitsuka
 
第3期キックオフ説明会+勉強会
第3期キックオフ説明会+勉強会 第3期キックオフ説明会+勉強会
第3期キックオフ説明会+勉強会 Shuhei Iitsuka
 
かんたん Twitter アプリをつくろう
かんたん Twitter アプリをつくろう かんたん Twitter アプリをつくろう
かんたん Twitter アプリをつくろう Shuhei Iitsuka
 
ペルソナシナリオとプロトタイプ
ペルソナシナリオとプロトタイプペルソナシナリオとプロトタイプ
ペルソナシナリオとプロトタイプShuhei Iitsuka
 

Mehr von Shuhei Iitsuka (20)

Online and offline handwritten chinese character recognition a comprehensive...
Online and offline handwritten chinese character recognition  a comprehensive...Online and offline handwritten chinese character recognition  a comprehensive...
Online and offline handwritten chinese character recognition a comprehensive...
 
Inferring win–lose product network from user behavior
Inferring win–lose product network from user behaviorInferring win–lose product network from user behavior
Inferring win–lose product network from user behavior
 
バリエーションの提示がもたらす長期的効果に着目したウェブサイト最適化手法 @第31回人工知能学会全国大会
バリエーションの提示がもたらす長期的効果に着目したウェブサイト最適化手法 @第31回人工知能学会全国大会バリエーションの提示がもたらす長期的効果に着目したウェブサイト最適化手法 @第31回人工知能学会全国大会
バリエーションの提示がもたらす長期的効果に着目したウェブサイト最適化手法 @第31回人工知能学会全国大会
 
Procedural modeling using autoencoder networks
Procedural modeling using autoencoder networksProcedural modeling using autoencoder networks
Procedural modeling using autoencoder networks
 
Generating sentences from a continuous space
Generating sentences from a continuous spaceGenerating sentences from a continuous space
Generating sentences from a continuous space
 
ウェブサイト最適化のためのバリエーション自動生成システム
ウェブサイト最適化のためのバリエーション自動生成システムウェブサイト最適化のためのバリエーション自動生成システム
ウェブサイト最適化のためのバリエーション自動生成システム
 
Improving the Sensitivity of Online Controlled Experiments by Utilizing Pre-E...
Improving the Sensitivity of Online Controlled Experiments by Utilizing Pre-E...Improving the Sensitivity of Online Controlled Experiments by Utilizing Pre-E...
Improving the Sensitivity of Online Controlled Experiments by Utilizing Pre-E...
 
Machine learning meets web development
Machine learning meets web developmentMachine learning meets web development
Machine learning meets web development
 
Python と Xpath で ウェブからデータをあつめる
Python と Xpath で ウェブからデータをあつめるPython と Xpath で ウェブからデータをあつめる
Python と Xpath で ウェブからデータをあつめる
 
リミックスからはじめる DTM 入門
リミックスからはじめる DTM 入門リミックスからはじめる DTM 入門
リミックスからはじめる DTM 入門
 
Asia Trend Map: Forecasting “Cool Japan” Content Popularity on Web Data
Asia Trend Map: Forecasting “Cool Japan” Content Popularity on Web DataAsia Trend Map: Forecasting “Cool Japan” Content Popularity on Web Data
Asia Trend Map: Forecasting “Cool Japan” Content Popularity on Web Data
 
UT Startup Gym で人生が変わった話
UT Startup Gym で人生が変わった話UT Startup Gym で人生が変わった話
UT Startup Gym で人生が変わった話
 
ウェブサイトで収益を得る
ウェブサイトで収益を得るウェブサイトで収益を得る
ウェブサイトで収益を得る
 
HTML で自己紹介ページをつくる
HTML で自己紹介ページをつくるHTML で自己紹介ページをつくる
HTML で自己紹介ページをつくる
 
データベースを使おう
データベースを使おうデータベースを使おう
データベースを使おう
 
ウェブサービスの企画とデザイン
ウェブサービスの企画とデザインウェブサービスの企画とデザイン
ウェブサービスの企画とデザイン
 
データベースを使おう
データベースを使おうデータベースを使おう
データベースを使おう
 
第3期キックオフ説明会+勉強会
第3期キックオフ説明会+勉強会 第3期キックオフ説明会+勉強会
第3期キックオフ説明会+勉強会
 
かんたん Twitter アプリをつくろう
かんたん Twitter アプリをつくろう かんたん Twitter アプリをつくろう
かんたん Twitter アプリをつくろう
 
ペルソナシナリオとプロトタイプ
ペルソナシナリオとプロトタイプペルソナシナリオとプロトタイプ
ペルソナシナリオとプロトタイプ
 

Kürzlich hochgeladen

What I did before opening my business..pdf
What I did before opening my business..pdfWhat I did before opening my business..pdf
What I did before opening my business..pdfoganekyokoi
 
KARAPATANG PANTAO.pptxhrhrhrhrhrhrhrhrhr
KARAPATANG PANTAO.pptxhrhrhrhrhrhrhrhrhrKARAPATANG PANTAO.pptxhrhrhrhrhrhrhrhrhr
KARAPATANG PANTAO.pptxhrhrhrhrhrhrhrhrhrRodolfFernandez1
 
Establishment and operation of medical corporations.pdf
Establishment and operation of medical corporations.pdfEstablishment and operation of medical corporations.pdf
Establishment and operation of medical corporations.pdfoganekyokoi
 
3年前期 交通基盤工学 第一回 ガイダンス 交通基盤工学の概要  パワーポイント
3年前期 交通基盤工学 第一回 ガイダンス 交通基盤工学の概要  パワーポイント3年前期 交通基盤工学 第一回 ガイダンス 交通基盤工学の概要  パワーポイント
3年前期 交通基盤工学 第一回 ガイダンス 交通基盤工学の概要  パワーポイントshu1108hina1020
 
International Politics I - Lecture 1
International Politics I - Lecture 1International Politics I - Lecture 1
International Politics I - Lecture 1Toru Oga
 
Divorce agreements in administrative work.pdf
Divorce agreements in administrative work.pdfDivorce agreements in administrative work.pdf
Divorce agreements in administrative work.pdfoganekyokoi
 
レポートの書き方講座 [大学生初年次向けに対する講義資料] Lecture on how to write a report [lecture mater...
レポートの書き方講座 [大学生初年次向けに対する講義資料] Lecture on how to write a report [lecture mater...レポートの書き方講座 [大学生初年次向けに対する講義資料] Lecture on how to write a report [lecture mater...
レポートの書き方講座 [大学生初年次向けに対する講義資料] Lecture on how to write a report [lecture mater...yutakashikano1984
 
Registration of travel agents - 'Explanation of the registration system under...
Registration of travel agents - 'Explanation of the registration system under...Registration of travel agents - 'Explanation of the registration system under...
Registration of travel agents - 'Explanation of the registration system under...oganekyokoi
 

Kürzlich hochgeladen (8)

What I did before opening my business..pdf
What I did before opening my business..pdfWhat I did before opening my business..pdf
What I did before opening my business..pdf
 
KARAPATANG PANTAO.pptxhrhrhrhrhrhrhrhrhr
KARAPATANG PANTAO.pptxhrhrhrhrhrhrhrhrhrKARAPATANG PANTAO.pptxhrhrhrhrhrhrhrhrhr
KARAPATANG PANTAO.pptxhrhrhrhrhrhrhrhrhr
 
Establishment and operation of medical corporations.pdf
Establishment and operation of medical corporations.pdfEstablishment and operation of medical corporations.pdf
Establishment and operation of medical corporations.pdf
 
3年前期 交通基盤工学 第一回 ガイダンス 交通基盤工学の概要  パワーポイント
3年前期 交通基盤工学 第一回 ガイダンス 交通基盤工学の概要  パワーポイント3年前期 交通基盤工学 第一回 ガイダンス 交通基盤工学の概要  パワーポイント
3年前期 交通基盤工学 第一回 ガイダンス 交通基盤工学の概要  パワーポイント
 
International Politics I - Lecture 1
International Politics I - Lecture 1International Politics I - Lecture 1
International Politics I - Lecture 1
 
Divorce agreements in administrative work.pdf
Divorce agreements in administrative work.pdfDivorce agreements in administrative work.pdf
Divorce agreements in administrative work.pdf
 
レポートの書き方講座 [大学生初年次向けに対する講義資料] Lecture on how to write a report [lecture mater...
レポートの書き方講座 [大学生初年次向けに対する講義資料] Lecture on how to write a report [lecture mater...レポートの書き方講座 [大学生初年次向けに対する講義資料] Lecture on how to write a report [lecture mater...
レポートの書き方講座 [大学生初年次向けに対する講義資料] Lecture on how to write a report [lecture mater...
 
Registration of travel agents - 'Explanation of the registration system under...
Registration of travel agents - 'Explanation of the registration system under...Registration of travel agents - 'Explanation of the registration system under...
Registration of travel agents - 'Explanation of the registration system under...
 

【DBDA 勉強会 2013 夏】Doing Bayesian Data Analysis Chapter 4: Bayes’ Rule

  • 1. Doing Bayesian Data Analysis
 Chapter 4: Bayes’ Rule 東京大学 松尾研究室 修士2年" 飯塚修平@tushuhei 2013/08/04 1
  • 2. 導入 •  あの子がオレのことを見て微笑んだ" •  もしかしてオレに気がある!?" •  残念ながら p(♡|J) ≠ p(☺|♡)." –  p(♡|☺): あの子が微笑んだ時に、あなたに好意がある確率" –  p(☺|♡): あの子があなたに好意があるときに、微笑む確率" •  ベイズの定理によると p(♡|☺) = p(☺|♡)p(♡)/p(☺)" –  p(☺) = Σp(J|θ)p(θ): あなたのことが好きで微笑んだ、あなたが純粋に 面白い顔をしていた、たまたま昨日のお笑い番組を思い出した etc. す べての和であることに注意" –  とりあえず、p(♡)(あの子があなたに好意がある確率)はどれくらい だと思う?(事前確率)" 2013/08/04 2
  • 3. ベイズの定理 2013/08/04 3 p(y, x) = p(y|x)p(x) = p(x|y)p(y) p(y|x) = p(x|y)p(y) p(x) p(x) = y p(x, y) = y p(x|y)p(y) p(y|x) = p(x|y)p(y) y p(x|y)p(y) p(y|x) = p(x|y)p(y) dy p(x|y)p(y) 条件付き確率の定義 p(y, x) = p(y|x)p(x) = p(x|y)p(y) p(y|x) = p(x|y)p(y) p(x) p(x) = y p(x, y) = y p(x|y)p(y) p(y|x) = p(x|y)p(y) y p(x|y)p(y) p(y|x) = p(x|y)p(y) dy p(x|y)p(y) ベイズの定理 ベイズの定理(連続値) p(y, x) = p(y|x)p(x) = p(x p(y|x) = p(x|y)p(y) p(x) p(x) = y p(x, y) = y p(x| p(y|x) = p(x|y)p(y) y p(x|y)p(y) p(y|x) = p(x|y)p(y) dy p(x|y)p(y) p(y, x) = p(y|x)p(x) = p(x|y)p(y) p(y|x) = p(x|y)p(y) p(x) p(x) = y p(x, y) = y p(x|y)p(y) p(y|x) = p(x|y)p(y) y p(x|y)p(y) p(y|x) = p(x|y)p(y) dy p(x|y)p(y) ベイズの定理(離散値) p(y, x) = p(y|x)p(x) = p(x|y)p(y) p(y|x) = p(x|y)p(y) p(x) p(x) = y p(x, y) = y p(x|y)p(y) p(y|x) = p(x|y)p(y) y p(x|y)p(y) p(y|x) = p(x|y)p(y) dy p(x|y)p(y)
  • 4. ベイズの定理 2013/08/04 4 p(y|x) = y p(x|y)p(y) p(y|x) = p(x|y)p(y) dy p(x|y)p(y) p( |D) = p(D| ) p( ) /p(D) Posterior   事後確率 Likelihood   尤度   Prior   事前確率   Evidence   証拠   p(y|x) = p(x|y)p(y) p(x) p(x) = y p(x, y) = y p(x|y)p(y) p(y|x) = p(x|y)p(y) y p(x|y)p(y) p(y|x) = p(x|y)p(y) dy p(x|y)p(y) p( |D) = p(D| ) p( ) /p(D) p(D) = d p(D| )p( )Where:
  • 5. ベイズの定理 2013/08/04 5 モデル自体も  M  としてパラメタに組み込むと、ベイズの定理は、 p( |D, M) = p(D| , M) p( |M)/p(D|M) p(M1|D) = p(D|M1)p(M1)/p(D) p(M2|D) = p(D|M2)p(M2)/p(D) p(M1|D) p(M2|D) = p(D|M1) p(D|M2) M1 M2 p( |D, M) = p(D| , M) p( |M)/p(D|M) p(M1|D) = p(D|M1)p(M1)/p(D) p(M2|D) = p(D|M2)p(M2)/p(D) p(M1|D) p(M2|D) = p(D|M1) p(D|M2) M1 M2 なので、 すなわち、事後確率の比は、証拠の比と事前確率の比の積で表される。   この事前確率の比を Bayers  Factor  と呼ぶ。 p( |D, M) = p(D| , M) p( |M)/p(D|M) p(M1|D) = p(D|M1)p(M1)/p(D) p(M2|D) = p(D|M2)p(M2)/p(D) p(M1|D) p(M2|D) = p(D|M1) p(D|M2) p(M1) p(M2) Bayes  Factor と表せる。ここで、
  • 6. ベイズの定理 2013/08/04 6 出現する証拠はモデルのパラメタθにしかよらないので、   p(D | , D) = p(D | ) p( |D , D) = p(D | , D)p( |D) d p(D | , D)p( |D) = p(D | )p( |D) d p(D | )p( |D) したがって、 再度テストを行うなど、複数回にわたってデータをサンプリングするときに使える 【複数の証拠  D,  D’  がある場合】  
  • 7. コイントスの例 •  あなたのコインは公平?それともインチキ?" 2013/08/04 7 H : head, T : tail = p(H) H : head, T : tail = p(H) p( ) = 0.25 ( = 0.25, 0.75) 0.5 ( = 0.5) 0 (otherwise) →下記のように  Prior  (事前確率)  を設定 おそらくちゃんと作 られてるから θ=0.5 " だけど" もしかしたら偽物で 偏ってるかも? ↑   A君の頭のなかの   モデル
  • 8. コイントスの例 2013/08/04 8 p( ) = 0.25 ( = 0.25, 0.75) 0.5 ( = 0.5) 0 (otherwise) Prior (事前確率) D = 3H, 9T のときLikelihood (尤度) p(D| ) = 3 (1 )9 = 1.2 10 3 ( = 0.25) 2.4 10 4 ( = 0.50) 1.6 10 6 ( = 0.75) 0 (otherwise) データの当てはまり具合
  • 9. コイントスの例 2013/08/04 9 Posterior (事後確率) ベイズの定理より、 p( |D) = p(D| )p( ) p(D| )p( ) 0.71 ( = 0.25) 0.29 ( = 0.50) 9.0 10 4 ( = 0.75) 0 (otherwise) 合計=1となることに注目。
  • 11. コイントスの例2 p(D|M) simple complex D = 3H, 9T 0.000416 0.000392 D = 1H, 11T 0.00276 0.00366 2013/08/04 11 モデルMからデータDが   生じる確率
  • 12. 日常に潜むベイズの考え方 •  「ワトソン君、何度言ったら分かるんだ。起こり得ないことをすべ て取り除いてそれが残ったんだったら、どんなに可能性が低くても、 それが真実なんだよ。」 2013/08/04 12 •  屋根からなんか落ちてきた→「猫かな?」
 今隣の家に子供が遊びにきたらしい→「あ、そっちだね」" 屋根からなんか落ちてきた→ cat かな? p(D| child) が大きいらしい→ p(D| i) = Const.( i = j) であっても、 p( child|D) が小さくなる 「ワトソン君、何度言ったら分かるんだ。p(D| i) = 0( i = j) なら どんなに p( j) > 0 が小さくても p( j|D) = 1 なんだよ。」
  • 13. Exercise 4.2 •  ある病気と検査の話(条件付き確率あるある)" •  病気の確率変数 θ = J, L(事象「かからない」or「かかる」)" •  p(θ=L) = 0.001: 罹患率は 0.1%" •  検査の結果の確率変数 D=+(陽性), ー(陰性)" •  p(D=+| θ=L) = 0.99: 的中率 99%" •  p(D=+| θ=J) = 0.05: エラー率 5%" •  運悪く、あなたは最初の検査で陽性反応が出てしまいました。" •  不安になってもう一度検査を受けたところ、陰性反応が出ました。" •  さて、このときあなたが病気にかかっている確率は?" •  すなわち、p(θ=L | D1=+, D2=ー) は?" 2013/08/04 13
  • 14. Exercise 4.2 2013/08/04 14 p( =):|D1 = +, D2 = ) = p(D2 = +| = ): , D1 = +)p( = p(D2 = +| = ): , D1 = +)p( = ): |D1 = +) + p(D2 = = p(D2 = +| = ): )p( = ): |D1 = +) p(D2 = +| =):)p( = ): |D1 = +) + p(D2 = +| = p( = ): |D1 = +, D2 = ) = p(D2 = +| = ): , D1 = +)p( = ): |D1 = +) p(D2 = +| = ): , D1 = +)p( = ): |D1 = +) + p(D2 = +| = (: , D1 = +)p( = (: |D1 = +) = p(D2 = +| =):)p( = ): |D1 = +) p(D2 = +| = ): )p( = ): |D1 = +) + p(D2 = +| = (: )p( = (: |D1 = +) θ=L  と D2  についてベイズの定理を適用して p( = ): |D1 = +, D2 = ) = p(D2 = +| = ): , D1 = +)p( = ): |D1 = +) p(D2 = +| = ): , D1 = +)p( =):|D1 = +) + p(D2 = +| = (: , D1 = +)p = p(D2 = +| = ): )p( = ): |D1 = +) p(D2 = +| = ): )p( = ): |D1 = +) + p(D2 = +| = (: )p( = (: |D1 = +) D2  の結果は  D1  とは無関係なので(スライド  p6  参照) あとは各項の値を求める。 = 2.1*10^{-4} = 0.021%