Think bayes

Jinseob Kim
Jinseob KimSenior Engineer at Samsung Electronics
Frequentist VS Bayesian
Integration issue

ThinkBayes
Introduction of bayesian inference

김진섭
서울대학교 보건대학원

January 14, 2014

김진섭

ThinkBayes
Frequentist VS Bayesian
Integration issue

목차

1

Frequentist VS Bayesian
확률을 보는 관점
Bayes’ rule

2

Integration issue
Why?
Simulation

김진섭

ThinkBayes
Frequentist VS Bayesian
Integration issue

확률을 보는 관점
Bayes’ rule

객관적 VS 주관적 확률

주사위를 던져 1이 나올 확률
1

객관적: 확률은 정확한 숫자로 존재하고 그것을 추정한다.

2

주관적: 알수 없다, 믿음을 계속 업데이트할 수 밖에..

주사위를 던져 1이 나올 확률에 대한 접근법
1

객관적: 계속 던져봐서 추정해보니 확률은 1/6인 듯 하다.

2

주관적: 1/6일 것 같은데, 계속 던져보니 1/6이 맞는 것
같네..

김진섭

ThinkBayes
Frequentist VS Bayesian
Integration issue

확률을 보는 관점
Bayes’ rule

Homo bayesianis

Figure : Fun example of bayesian

김진섭

ThinkBayes
Frequentist VS Bayesian
Integration issue

확률을 보는 관점
Bayes’ rule

Frequentist의 논쟁법

상대방: 신약이랑 기존 약이랑 혈압강하효과가 차이가 없는 것
같은데..
나: 뭐? 신약이랑 기존 약이랑 차이가 0이라고?? 차이가 0
이라고 치자. 그러면 어쩌구저쩌구.. 이 데이터의 상황이 나올
가능성이 거의 없는데(5%미만인데)? 그니까 넌 틀렸어.
1

차이가 0이라고 말한 사람은 없다. 가상의적을 난타.

2

상대방의 주장을 최대한 좁게 해석하여 반박.

3

얍삽하다.

김진섭

ThinkBayes
Frequentist VS Bayesian
Integration issue

확률을 보는 관점
Bayes’ rule

Bayesian의 논쟁법

상대방: 신약이랑 기존 약이랑 혈압강하효과가 차이가 없는 것
같은데.. N(0, 1)분포를 따르지 않을까?
나: 차이가 N(0, 1)을 따른다고 가정하자. 가정에 따르면 이
데이터의 상황이 주어졌을 때, 차이의 조건부확률을
계산해보니 N(5, 1.2)를 따르는데?
1

사전믿음에 대한 분포를 가정: Prior

2

데이터가 주는 정보: Likelihood

3

믿음과 데이터의 정보를 종합 : Posterior- 이걸로 해석.

김진섭

ThinkBayes
Frequentist VS Bayesian
Integration issue

확률을 보는 관점
Bayes’ rule

Conditional probability

P(A ∩ B)
P(B)
P(A ∩ B)
P(B) × P(A|B)
P(B|A) =
=
P(A)
P(A)
P(B|A) ∝ P(B) × P(A|B)
P(A|B) =

김진섭

ThinkBayes

(1)
Frequentist VS Bayesian
Integration issue

확률을 보는 관점
Bayes’ rule

Bayesian inference

P(θ) × P(data|θ)
P(data)
P(θ|data) ∝ P(θ) × P(data|θ)

P(θ|data) =

Posterior ∝ Prior × Likelihood
P(data) 구해야 되는데...
P(data) = P(θ) × P(data|θ)dθ

김진섭

ThinkBayes

(2)
Frequentist VS Bayesian
Integration issue

확률을 보는 관점
Bayes’ rule

Prior, likelihood, posterior

Figure : Prior, likelihood, posterior
김진섭

ThinkBayes
Frequentist VS Bayesian
Integration issue

Why?
Simulation

1

Posterior 분포를 그려야 평균 or 95% C.I....

2

Prior와 Likelihood가 적당히 좋은 함수라면 Posterior가 잘
알고 있는 분포가 될 수도..

3

대부분은 Posterior는 알고 있는 분포가 아니다...
적분불가능.

김진섭

ThinkBayes
Frequentist VS Bayesian
Integration issue

Why?
Simulation

Monte Carlo integration

1

적분을 시뮬레이션으로 해결하겠다.

2

예) N(0,1) 적분 : N(0,1)에서 sample N개 뽑아서 그것의
평균, N이 커지면 원래 적분값에 가까워짐.

즉, f (x) 적분할 때 f (x)에서 샘플링 많이 해서 그것의
평균으로..
f (x) 샘플링 어려울 땐 비슷하게 생긴 g (x)이용 : Importance
sampling

김진섭

ThinkBayes
Frequentist VS Bayesian
Integration issue

Why?
Simulation

Monte carlo example

Figure : 원의 넓이 구하기

김진섭

ThinkBayes
Frequentist VS Bayesian
Integration issue

Why?
Simulation

Monte carlo example(2)

Figure : Integration of f (x)

김진섭

ThinkBayes
Frequentist VS Bayesian
Integration issue

Why?
Simulation

MCMC(Markov chain Monte Carlo)

1

Monte carlo: Random sampling- 효율이 떨어짐.

2

다변량 분석, 특히 multilevel 샘플링 어렵다.

MCMC
1

Markov chain MC : 바로 전의 샘플링한것을 이용하여
sampling - 효율, hierarchial model에 적합.

2

Metropolis-Hastings 알고리즘, Gibbs sampler(거의 표준)

김진섭

ThinkBayes
Frequentist VS Bayesian
Integration issue

Why?
Simulation

Gibbs sampler

Figure : Example of gibbs sampling: 2 variables

김진섭

ThinkBayes
Frequentist VS Bayesian
Integration issue

Why?
Simulation

Multivariable gibbs sampler

Figure : Gibbs sampling: > 2 variables

김진섭

ThinkBayes
1 of 16

Recommended

베이지안 네트워크를 이용한, 가구 실태에 따른 지출 형태 비교 분석: 2011년 가계동향조사를 활용하여 by
베이지안 네트워크를 이용한, 가구 실태에 따른 지출 형태 비교 분석: 2011년 가계동향조사를 활용하여베이지안 네트워크를 이용한, 가구 실태에 따른 지출 형태 비교 분석: 2011년 가계동향조사를 활용하여
베이지안 네트워크를 이용한, 가구 실태에 따른 지출 형태 비교 분석: 2011년 가계동향조사를 활용하여Jae-seong Yoo
3.3K views87 slides
A Study on Comparison of Bayesian Network Structure Learning Algorithms for S... by
A Study on Comparison of Bayesian Network Structure Learning Algorithms for S...A Study on Comparison of Bayesian Network Structure Learning Algorithms for S...
A Study on Comparison of Bayesian Network Structure Learning Algorithms for S...Jae-seong Yoo
2K views74 slides
Bayesian Network 을 활용한 예측 분석 by
Bayesian Network 을 활용한 예측 분석Bayesian Network 을 활용한 예측 분석
Bayesian Network 을 활용한 예측 분석datasciencekorea
8.7K views54 slides
Unsupervised Deep Learning Applied to Breast Density Segmentation and Mammogr... by
Unsupervised Deep Learning Applied to Breast Density Segmentation and Mammogr...Unsupervised Deep Learning Applied to Breast Density Segmentation and Mammogr...
Unsupervised Deep Learning Applied to Breast Density Segmentation and Mammogr...Jinseob Kim
462 views43 slides
Fst, selection index by
Fst, selection indexFst, selection index
Fst, selection indexJinseob Kim
1.1K views65 slides
Why Does Deep and Cheap Learning Work So Well by
Why Does Deep and Cheap Learning Work So WellWhy Does Deep and Cheap Learning Work So Well
Why Does Deep and Cheap Learning Work So WellJinseob Kim
169 views38 slides

More Related Content

More from Jinseob Kim

가설검정의 심리학 by
가설검정의 심리학 가설검정의 심리학
가설검정의 심리학 Jinseob Kim
1.3K views8 slides
Win Above Replacement in Sabermetrics by
Win Above Replacement in SabermetricsWin Above Replacement in Sabermetrics
Win Above Replacement in SabermetricsJinseob Kim
546 views23 slides
Regression Basic : MLE by
Regression  Basic : MLERegression  Basic : MLE
Regression Basic : MLEJinseob Kim
1.7K views26 slides
iHS calculation in R by
iHS calculation in RiHS calculation in R
iHS calculation in RJinseob Kim
679 views6 slides
Fst in R by
Fst in R Fst in R
Fst in R Jinseob Kim
1K views5 slides
Selection index population_genetics by
Selection index population_geneticsSelection index population_genetics
Selection index population_geneticsJinseob Kim
1.2K views65 slides

More from Jinseob Kim(20)

가설검정의 심리학 by Jinseob Kim
가설검정의 심리학 가설검정의 심리학
가설검정의 심리학
Jinseob Kim1.3K views
Win Above Replacement in Sabermetrics by Jinseob Kim
Win Above Replacement in SabermetricsWin Above Replacement in Sabermetrics
Win Above Replacement in Sabermetrics
Jinseob Kim546 views
Regression Basic : MLE by Jinseob Kim
Regression  Basic : MLERegression  Basic : MLE
Regression Basic : MLE
Jinseob Kim1.7K views
iHS calculation in R by Jinseob Kim
iHS calculation in RiHS calculation in R
iHS calculation in R
Jinseob Kim679 views
Selection index population_genetics by Jinseob Kim
Selection index population_geneticsSelection index population_genetics
Selection index population_genetics
Jinseob Kim1.2K views
질병부담계산: Dismod mr gbd2010 by Jinseob Kim
질병부담계산: Dismod mr gbd2010질병부담계산: Dismod mr gbd2010
질병부담계산: Dismod mr gbd2010
Jinseob Kim2K views
Case-crossover study by Jinseob Kim
Case-crossover studyCase-crossover study
Case-crossover study
Jinseob Kim3K views
Generalized Additive Model by Jinseob Kim
Generalized Additive Model Generalized Additive Model
Generalized Additive Model
Jinseob Kim2.5K views
Deep Learning by JSKIM (Korean) by Jinseob Kim
Deep Learning by JSKIM (Korean)Deep Learning by JSKIM (Korean)
Deep Learning by JSKIM (Korean)
Jinseob Kim1.7K views
Machine Learning Introduction by Jinseob Kim
Machine Learning IntroductionMachine Learning Introduction
Machine Learning Introduction
Jinseob Kim932 views
Deep learning by JSKIM by Jinseob Kim
Deep learning by JSKIMDeep learning by JSKIM
Deep learning by JSKIM
Jinseob Kim8.4K views
Multilevel study by Jinseob Kim
Multilevel study Multilevel study
Multilevel study
Jinseob Kim1.2K views
GEE & GLMM in GWAS by Jinseob Kim
GEE & GLMM in GWASGEE & GLMM in GWAS
GEE & GLMM in GWAS
Jinseob Kim1.2K views
Whole Genome Regression using Bayesian Lasso by Jinseob Kim
Whole Genome Regression using Bayesian LassoWhole Genome Regression using Bayesian Lasso
Whole Genome Regression using Bayesian Lasso
Jinseob Kim980 views
R Introduction & auto make table1 by Jinseob Kim
R Introduction & auto make table1R Introduction & auto make table1
R Introduction & auto make table1
Jinseob Kim2.1K views

Think bayes

  • 1. Frequentist VS Bayesian Integration issue ThinkBayes Introduction of bayesian inference 김진섭 서울대학교 보건대학원 January 14, 2014 김진섭 ThinkBayes
  • 2. Frequentist VS Bayesian Integration issue 목차 1 Frequentist VS Bayesian 확률을 보는 관점 Bayes’ rule 2 Integration issue Why? Simulation 김진섭 ThinkBayes
  • 3. Frequentist VS Bayesian Integration issue 확률을 보는 관점 Bayes’ rule 객관적 VS 주관적 확률 주사위를 던져 1이 나올 확률 1 객관적: 확률은 정확한 숫자로 존재하고 그것을 추정한다. 2 주관적: 알수 없다, 믿음을 계속 업데이트할 수 밖에.. 주사위를 던져 1이 나올 확률에 대한 접근법 1 객관적: 계속 던져봐서 추정해보니 확률은 1/6인 듯 하다. 2 주관적: 1/6일 것 같은데, 계속 던져보니 1/6이 맞는 것 같네.. 김진섭 ThinkBayes
  • 4. Frequentist VS Bayesian Integration issue 확률을 보는 관점 Bayes’ rule Homo bayesianis Figure : Fun example of bayesian 김진섭 ThinkBayes
  • 5. Frequentist VS Bayesian Integration issue 확률을 보는 관점 Bayes’ rule Frequentist의 논쟁법 상대방: 신약이랑 기존 약이랑 혈압강하효과가 차이가 없는 것 같은데.. 나: 뭐? 신약이랑 기존 약이랑 차이가 0이라고?? 차이가 0 이라고 치자. 그러면 어쩌구저쩌구.. 이 데이터의 상황이 나올 가능성이 거의 없는데(5%미만인데)? 그니까 넌 틀렸어. 1 차이가 0이라고 말한 사람은 없다. 가상의적을 난타. 2 상대방의 주장을 최대한 좁게 해석하여 반박. 3 얍삽하다. 김진섭 ThinkBayes
  • 6. Frequentist VS Bayesian Integration issue 확률을 보는 관점 Bayes’ rule Bayesian의 논쟁법 상대방: 신약이랑 기존 약이랑 혈압강하효과가 차이가 없는 것 같은데.. N(0, 1)분포를 따르지 않을까? 나: 차이가 N(0, 1)을 따른다고 가정하자. 가정에 따르면 이 데이터의 상황이 주어졌을 때, 차이의 조건부확률을 계산해보니 N(5, 1.2)를 따르는데? 1 사전믿음에 대한 분포를 가정: Prior 2 데이터가 주는 정보: Likelihood 3 믿음과 데이터의 정보를 종합 : Posterior- 이걸로 해석. 김진섭 ThinkBayes
  • 7. Frequentist VS Bayesian Integration issue 확률을 보는 관점 Bayes’ rule Conditional probability P(A ∩ B) P(B) P(A ∩ B) P(B) × P(A|B) P(B|A) = = P(A) P(A) P(B|A) ∝ P(B) × P(A|B) P(A|B) = 김진섭 ThinkBayes (1)
  • 8. Frequentist VS Bayesian Integration issue 확률을 보는 관점 Bayes’ rule Bayesian inference P(θ) × P(data|θ) P(data) P(θ|data) ∝ P(θ) × P(data|θ) P(θ|data) = Posterior ∝ Prior × Likelihood P(data) 구해야 되는데... P(data) = P(θ) × P(data|θ)dθ 김진섭 ThinkBayes (2)
  • 9. Frequentist VS Bayesian Integration issue 확률을 보는 관점 Bayes’ rule Prior, likelihood, posterior Figure : Prior, likelihood, posterior 김진섭 ThinkBayes
  • 10. Frequentist VS Bayesian Integration issue Why? Simulation 1 Posterior 분포를 그려야 평균 or 95% C.I.... 2 Prior와 Likelihood가 적당히 좋은 함수라면 Posterior가 잘 알고 있는 분포가 될 수도.. 3 대부분은 Posterior는 알고 있는 분포가 아니다... 적분불가능. 김진섭 ThinkBayes
  • 11. Frequentist VS Bayesian Integration issue Why? Simulation Monte Carlo integration 1 적분을 시뮬레이션으로 해결하겠다. 2 예) N(0,1) 적분 : N(0,1)에서 sample N개 뽑아서 그것의 평균, N이 커지면 원래 적분값에 가까워짐. 즉, f (x) 적분할 때 f (x)에서 샘플링 많이 해서 그것의 평균으로.. f (x) 샘플링 어려울 땐 비슷하게 생긴 g (x)이용 : Importance sampling 김진섭 ThinkBayes
  • 12. Frequentist VS Bayesian Integration issue Why? Simulation Monte carlo example Figure : 원의 넓이 구하기 김진섭 ThinkBayes
  • 13. Frequentist VS Bayesian Integration issue Why? Simulation Monte carlo example(2) Figure : Integration of f (x) 김진섭 ThinkBayes
  • 14. Frequentist VS Bayesian Integration issue Why? Simulation MCMC(Markov chain Monte Carlo) 1 Monte carlo: Random sampling- 효율이 떨어짐. 2 다변량 분석, 특히 multilevel 샘플링 어렵다. MCMC 1 Markov chain MC : 바로 전의 샘플링한것을 이용하여 sampling - 효율, hierarchial model에 적합. 2 Metropolis-Hastings 알고리즘, Gibbs sampler(거의 표준) 김진섭 ThinkBayes
  • 15. Frequentist VS Bayesian Integration issue Why? Simulation Gibbs sampler Figure : Example of gibbs sampling: 2 variables 김진섭 ThinkBayes
  • 16. Frequentist VS Bayesian Integration issue Why? Simulation Multivariable gibbs sampler Figure : Gibbs sampling: > 2 variables 김진섭 ThinkBayes