SlideShare a Scribd company logo
1 of 25
ベイズ推定
立命館大学理工学部数理科学科三回生 谷口泰地
ベイズの定理(Bayes’ theorem)
ベイズの定理とは、条件付き確率に関する定理
P(A|B)がわかった時、P(B|A)もわかる!!!
𝑷 𝑩 𝑨 =
𝐏 𝐀 𝐁 𝐏(𝐁)
𝐏(𝐀)
導出は簡単
ベイズの定理(Bayes’ theorem)
𝑃 𝐵 𝐴 =
𝑃(𝐴, 𝐵)
𝑃(𝐴)
=
𝑃(𝐴, 𝐵)
𝑃(𝐵)
𝑃(𝐵)
𝑃(𝐴)
=
𝑃 𝐴 𝐵 𝑃(𝐵)
𝑃(𝐴)
ベイズの定理の導出
無理やりP(A|B)の形を作る
ベイズの定理(Bayes’ theorem)
ベイズの定理はどのように使うのか??
例を用いて解説します。(^▽^)
ベイズの定理(Bayes’ theorem)
状況設定:
ある感染病が流行っている。世界で
この感染病にかかっている人は全人
口の99.9%である。(やばい汗)
この感染病にかかっているかを検査
する方法が一つあり、これをH検査と
いう。H検査では、病気の人に対して、
90%の確率で反応する。しかし、20%
の確率で健康な人にも反応してしま
う。
ベイズの定理(Bayes’ theorem)
整理すると、感染しているのは0.99%
そして、H検査は以下のような表になる。
H検査
反応する 反応しない
健康(0.1%) 20% 80%
感染(99.9%) 90% 10%
ベイズの定理(Bayes’ theorem)
Q検査を受けて反応がなかった時、その人が実際は感染していた時の
確率を求める
H検査
反応する 反応しない
健康(0.1%) 20% 80%
感染(99.9%) 90% 10%
ベイズの定理(Bayes’ theorem)
A:感染している
B:検査で反応がない
P(B|A)= 0.1
P(A) = 0.999
P(B) = 0.999*0.1+0.001*0.8 = 0.1007
感染しておらず検
査に反応しない
感染者であり、検
査に反応しない
H検査
反応する 反応しない
健康(0.1%) 20% 80%
感染(99.9%) 90% 10%
ベイズの定理(Bayes’ theorem)
A:感染している
B:検査で反応がない
P(A|B) =
0.1∗0.999
0.1007
= 0.99205561
この数字の意味は?(超重要)
H検査
反応する 反応しない
健康(0.1%) 20% 80%
感染(99.9%) 90% 10%
ベイズの定理(Bayes’ theorem)
A:感染している
B:検査で反応がない
P(A|B) =
0.1∗0.999
0.1007
= 0.99205561
この数字の意味は?(超重要)
検査で反応がなかった人の中で、実は感染していた人がいる確率が0.99
ベイズの定理(Bayes’ theorem)
検査で反応がなかった人の中で、実は感染していた人がいる確率が0.99
検査で反応しなかった人でも99%の人は実は感染している
やばい汗汗汗
ベイズ推定
ベイズ推定を見るためにまずは、事前分布と事後分布を理解する。
ベイズ推定でやりたいことはデータDを見たとき、どのような母集団(Hとす
る)から得られたDなのか?を考えたい。つまり、
P(H|D)を求めたい→ベイズの定理!!
𝑷 H D =
𝐏 D 𝑯 𝐏(𝐇)
𝐏(𝐃)
ベイズ推定
ベイズ推定を見るためにまずは、事前分布と事後分布を理解する。
𝑃 𝐻 𝐷 =
P 𝐷 𝐻 P(H)
P(D)
P(H|D):事後確率
P(H):事前分布
P(D|H):尤度
ベイズ推定
ベイズ推定を見るためにまずは、事前分布と事後分布を理解する。
𝑃 𝐻 𝐷 =
P 𝐷 𝐻 P(H)
P(D)
P(H)は分布Hの確率分布
# 事前分布
P(H|D):事後確率
P(H):事前分布
P(D|H):尤度
ベイズ推定
ベイズ推定を見るためにまずは、事前分布と事後分布を理解する。
𝑃 𝐻 𝐷 =
P 𝐷 𝐻 P(H)
P(D)
P(H|D)はデータDを得たとき、それが分布Hから発生して
いる確率
# 事後確率
P(H|D):事後確率
P(H):事前分布
P(D|H):尤度
ベイズ推定
ベイズ推定を見るためにまずは、事前分布と事後分布を理解する。
𝑃 𝐻 𝐷 =
P 𝐷 𝐻 P(H)
P(D)
P(D|H)は分布HからDが発生する確率
# 尤度
P(H|D):事後確率
P(H):事前分布
P(D|H):尤度
ベイズ推定
ベイズ推定を見るためにまずは、事前分布と事後分布を理解する。
𝑃 𝐻 𝐷 =
P 𝐷 𝐻 P(H)
P(D)
P(D)はシンプルにDが起こる確率
P(H|D):事後確率
P(H):事前分布
P(D|H):尤度
ベイズ推定
MAP推定とベイズ推定の違い。
MAP推定:P(H|D)を最大化させるようにHのパラメータを
決める->新たな情報Dが得られても分布は変わらない。
ベイズ推定:P(H|D)の確率分布はデータDによって変わっ
ていく。(パラメータは変数)
->新たな情報Dが得られるたびに分布は変わる
ベイズ推定
ベイズ推定の例
問題設定:
好きな人が自分と同じクラスになる確率を求めたい。
条件:
過去のデータによると、同じクラスになる確率は30%、別々のクラスになる確率は70%
今年の自分のクラスは、女子が他のクラスより多いとわかったとする。
一般的に好きな人と同じクラスだった時、自分のクラスが他のクラスより女子が多い確
率が80%、
別々のクラスであったとき、自分のクラスが他のクラスより女子が多い確率は30%であ
るという統計調査があるとします。
ベイズ推定
ベイズ推定の例
𝑫 𝟏:今年の自分のクラスが他のクラスより女子が多い
𝑫 𝟐:今年の自分のクラスが他のクラスより女子が少ない
Y:同じクラスになる
N:同じクラスにならない
問題設定:
好きな人が自分と同じクラスになる確率を求め
たい。
条件:
過去のデータによると、同じクラスになる確率
は30%、別々のクラスになる確率は70%
今年の自分のクラスは、女子が他のクラスより
多いとわかったとする。
一般的に好きな人と同じクラスだった時、自分
のクラスが他のクラスより女子が多い確率が
80%、
別々のクラスであったとき、自分のクラスが他
のクラスより女子が多い隔離tは30%であると
いう統計調査があるとします。
ベイズ推定
ベイズ推定の例
D:今年の自分のクラスが他のクラスより女子が多い
Y:同じクラスになる
N:同じクラスでない
P(Y) = 0.3
P(D1|Y) = 0.8
P(D 𝟐|Y) = 0.2
P(D1|N) = 0.3
P(D 𝟐|N) = 0.7
P(N) = 0.7
問題設定:
好きな人が自分と同じクラスになる確率を求め
たい。
条件:
過去のデータによると、同じクラスになる確率
は30%、別々のクラスになる確率は70%
今年の自分のクラスは、女子が他のクラスより
多いとわかったとする。
一般的に好きな人と同じクラスだった時、自分
のクラスが他のクラスより女子が多い確率が
80%、
別々のクラスであったとき、自分のクラスが他
のクラスより女子が多い確率は30%であるとい
う統計調査があるとします。
ベイズ推定
ベイズ推定の例
P(D1|Y) 𝑷(𝒀)
𝑷(𝑫 𝟏)
:
P(D 𝟏|N) 𝑷(𝑵)
𝑷(𝑫 𝟏)
=
𝟎.𝟖∗𝟎.𝟑
𝑷(𝑫 𝟏)
:
𝟎.𝟑∗𝟎.𝟕
𝑷(𝑫 𝟏)
= 𝟖: 𝟕
P(𝒀|D1) =
𝟖
𝟏𝟓
= 𝟎. 𝟓𝟑𝟑 …
P(Y) = 0.3
P(D1|Y) = 0.8
P(D 𝟐|Y) = 0.2
P(D1|N) = 0.3
P(D 𝟐|N) = 0.7
P(N) = 0.7
ベイズ推定
ベイズ推定の例
P(𝒀|D1) =
𝟖
𝟏𝟓
= 𝟎. 𝟓𝟑𝟑 …
今年、好きなこと同じクラスになれる確率は53%。
今まで30%だったことを考えると今年は期待大
ベイズ推定
まとめ。
ベイズ推定は「母集団の確率分布はデータに依存するパラメータ
で決まる」とする
新しいデータが得られるたびにP(H|D)の分布は変わっていく。
ちなみに頻度主義者とベイジアンの違いは最近では手法が違うだ
けで中身は同じと考えられているらしい
Reference
https://mathtrain.jp/bayesinfer
https://bellcurve.jp/statistics/course/6448.html
https://www.slideshare.net/iranainanimosuteteshimaou/ss
-55173144

More Related Content

Featured

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Bayes