SlideShare a Scribd company logo
1 of 30
Monte Carlo Method
이정현
17.1 Sampling and Monte Carlo Methods
17.1.1 why sampling?
출처 : http://www.secmem.org/blog/2019/01/11/mcmc/
<인터넷 자료>
1. 높은 차원의 최적화 문제
2. 높은 차원의 적분
<교재 내용>
1. 처리는 가능하지만 비용이 많이 드는 sum과 integrals에 이용
2. 아예 처리 불가능한 sum과 integrals에 대한 근사를 할 때
3. 표본추출 자체가 목적
출처 https://www.youtube.com/watch?v=AadKNJU1-lk
Approximate expectations
- estimated statics
- Posterior inference (확률의 계산에 쓰임)
Why expectation ?
- Any probability is an E :
- Many time hard to compute, approx. is needed for sum or integral which
can be represented expectations
𝑝 𝑋 ∈ 𝐴 = 𝐸𝐼 𝑥 ∈ 𝐴
17.1.1 why sampling?
시작하기에 앞서 Monte Carlo의 컨셉
무작위 추출된 난수를 이용하여 함수의 값을 계산하는
통계학의 방법
EX) 원의 넓이 구하기
1) 원의 면적 식을 이용하여 구하기
2) 몬테 카를로 방법 - 난수들을 찍은 다음 원안에 들어
간 개수들을 계산하면 원의 면적을 구할 수 있음
17.1.2 basic of monte carlo sampling
그림 출처:
http://blog.naver.com/PostView.nhn?blogId=dalsapcho&logNo=20147545698&categoryNo=11&parentCategory
No=0&viewDate=&currentPage=1&postListTopCurrentPage=1&from=postView
s =
𝑥
𝑝 𝑥 𝑞 𝑥 = 𝐸 𝑝 𝑓 𝑥
𝑠 = 𝑝 𝑥 𝑓 𝑥 ⅆ𝑥 = 𝐸 𝑃 𝑓 𝑥
기대값 형태로 표현할 경우
이산형인 경우
연속형인 경우 확률밀도 함수
확률변수
𝑠 𝑛 =
1
𝑛
𝑖=1
𝑛
𝑓 𝑥 𝑖
교재에서 추정량 𝒔 𝒏 을 구하는 과정
𝑥 1 , 𝑥 2 , … , 𝑥 𝑛
𝐸 𝑠 𝑛 = 𝐸
1
𝑛
𝑖=1
𝑛
𝑓 𝑥 𝑖
=
1
𝑛
𝐸
𝐼
𝑓 𝑥 𝑙
그냥 표본 평균 (추출된 표본들의 산술 평균)이라고 보면 된다
=
1
𝑛
𝐸 𝑥 1
, 𝑥 2
, … , 𝑥 𝑛
=
1
𝑛 𝑖=1
𝑛
𝑠 = s
그냥 한국말로 하면
Sample 들을 확률변수 기대값이
s이므로 추정량의 기대값은 s이다
모평균과 표본평균은 같다
교재에서 추정량 𝐕𝐚𝐫 𝑠 𝑛 을 구하는 과정
표본평균의 분산
17.2 Importance sampling
이전의 소개한 방법은 분포로부터 표본을 쉽게 추출할 수 있을 때이다. 하지만 그렇지 않은 경우가
많다
왜?why?
- pdf 혹은 cdf의 역연산을 해야 되는데 그것이 쉽지 않다
- 다변량 pdf의 경우 굉장히 고차원이다. 복잡한 joint distribution으로 이루어져 있어서 계산이 쉽지 않다
좀더 자세한 내용을 원하시는 분은 다음 slide 출처 참고
다음 글도 참고 : https://www.quora.com/What-are-high-dimensional-probability-density-functions-pdfs-Do-
both-high-dimensional-and-multivariate-pdfs-mean-the-same-Also-what-makes-it-difficult-to-sample-from-
such-high-dimensional-pdfs-in-reference-to-Monte
https://www.youtube.com/watch?v=S3LAOZxGcnk
그렇다면 어떻게 sample을 좀더 쉽게 뽑아 낼 수 있을까?
다른 distribution 을 통해서 추정할 수 잇을까? p(라는 진짜 distribution)을 안쓰고?? 이것이 importance
Sampling의 컨셉
새로운 대안적인 q라는 distriubution에서 뽑아 올수 있을까 ? 그렇다!!
오히려 더 잘 뽑아 올 수 있다.
1) p에서 sample을 뽑지 못할 때 (p하고 최대한 비슷하게 q를 만든다, q는 좀더
sample을 뽑기 쉬운 분포)
2) Estimator 를 개선하고 싶을 때
언제 importance weight을 쓰는가?
https://medium.com/@jonathan_hui/rl-importance-sampling-ebfb28b4a8c6
Importance sampling 예시
일명 MCMC20세기 영향력 있는 top 10 알고리즘에 들었다고 한다!!
특징
- (상대적으로) 빠른 수력속도
- 더 많은 확률 분포 샘플링 가능
MCMC는 무엇인가?
Markov Chain과 Monte Carlo라는 두가지 수학적 특성을 기반으로 샘플링을 하는 것.
MCMC의 샘플링 방법은 이전의 샘플이 다음 샘플의 추출에 영향을 줌.
정확히 표현하면 MCMC는 임의의 랜덤한 표본에서 시작하여, i번째 표본을 참고하여 i+1번째
표본을 뽑습니다.
http://www.secmem.org/blog/2019/01/11/mcmc/
17.3Monte Carlo Markov chain
여러 상태들 (x1,x2,⋯,xn,⋯) 이 있고 xi에서 xj로 이동할 조건
부 확률분포 transition distribution T(xj|xi) 이 주어져 있어
서 매턴마다 이 확률 값에 따라 상태들 사이를 이동하는 것
입니다.
그렇다면 확률이 정해져 있다면 동선에 특정한 패턴이 존
재하지는 않을까요? 예를 들어, “100번 이동했다면 평균적
으로 3번은 출발지점에 돌아올 것이다”와 같은 예측을 할
수도 있을 것 같습니다.
항상은 아니지만 확률이 정해져 있으므로 “특정조건”을 만
족할 때 일정한 패턴이 나타납니다. 어떤 지점에서 시작하
더라도, 상태 사이를 충분히 많은 횟수 이동하게 되면 각 상
태의 방문횟수의 비율이 일정한 값으로 수렴하게 됩니다.
다시 말하면, 상태들의 방문횟수의 비율이 특정 확률분포
로 수렴하게 되고 이 분포를 stationary distribution이라
부릅니다.
Markov Chain
https://www.youtube.com/watch?v=zL2lg_Nfi80
뭐하는 친구인지 우선 보자
MCMC 중에서도 대표적인 Metropolis-Hastings algorithm을 살펴보자
그전에 베이지안 정리에 대한 리마인드
동전던지기를 하는데 앞면이 나올 확률분포를 추정해보자고 하잡
사전에 주어진 information이 많은
경우 (piror 분포를 따라감)
Sample이 많아 질 수록
Proposal distirubution 주로 정규분포를 사용, 추정되는 세타 값을 샘플링 한다
Monte carlo
Makrov chain
정규분포의 평균값이 이전의 데이터를 사용한다
Metropolis - hastings
새로운 후보
이전의 distribution 친구
https://stats.stackexchange.com/questions/242616/why-
compare-with-uniform-distributed-values-in-metropolis-
hastings
근데 왜 uniform distributio과 비교할까??
(반 뇌피셜) unfiorm distribution cdf는 identity function이다 따라서
𝑃 U ≤ 𝑢 = u, 𝑃 U ≤ 𝛼 = 𝑎 는 확률의 비교와 같고 어느정도의 랜덤으로 주어진 확률보다
낮으면 쳐내겠다는 뜻이 아닐까
MCMC 관해서 추가적으로 읽어볼 자료(4분50초부터)
https://www.youtube.com/watch?v=U561HGMWjcw
17.4 Gibbs Sampling
https://ratsgo.github.io/statistics/2017/05/31/gibbs/
Gibbs sampling은 metropolis-hasting sampling의 조금 특이한 케이스이다
컨셉은 비슷한데
17.5 The challenge of mixing between separated modes (누가 energy based model 설명좀..)
http://www.secmem.org/blog/2019/02/11/fmmc/
MCMC가 만드는 샘플들은 target distribution에 점점 수렴하는 특징이 있습니다. 다르게 말하면
MCMC가 만들어내는 샘플을 사용하기 위해서는 샘플들이 target distribution에 수렴할 때 까지 기
다려야 합니다. 적절히 수렴한 상태를 mix 되었다고 하고 이때까지 걸리는 시간을 mixing time이
라고 합니다.
이상적으로는 표본들이 독립적이여야 한다. 하지만 고차원의 경우에는
MCMC방법이 잘 작동하지 않아서 이를 혼합이 느리다
(왼) 독립변수들로 이루어진 분포, mix가 잘된다
(중간) 상관관계가 높은 변수들로 이루어진 분포, mix가 잘되지 않는다
(오) 모드들이 아예 떨어져 있는 경우 따른 모드로 잘 바뀌지 않기 때문에 mix가 정말 느리다

More Related Content

What's hot

3.unsupervised learing(epoch#2)
3.unsupervised learing(epoch#2)3.unsupervised learing(epoch#2)
3.unsupervised learing(epoch#2)Haesun Park
 
[홍대 머신러닝 스터디 - 핸즈온 머신러닝] 2장. 머신러닝 프로젝트 처음부터 끝까지
[홍대 머신러닝 스터디 - 핸즈온 머신러닝] 2장. 머신러닝 프로젝트 처음부터 끝까지[홍대 머신러닝 스터디 - 핸즈온 머신러닝] 2장. 머신러닝 프로젝트 처음부터 끝까지
[홍대 머신러닝 스터디 - 핸즈온 머신러닝] 2장. 머신러닝 프로젝트 처음부터 끝까지Haesun Park
 
5.model evaluation and improvement(epoch#2) 1
5.model evaluation and improvement(epoch#2) 15.model evaluation and improvement(epoch#2) 1
5.model evaluation and improvement(epoch#2) 1Haesun Park
 
(Handson ml)ch.7-ensemble learning and random forest
(Handson ml)ch.7-ensemble learning and random forest(Handson ml)ch.7-ensemble learning and random forest
(Handson ml)ch.7-ensemble learning and random forestHaesun Park
 
[홍대 머신러닝 스터디 - 핸즈온 머신러닝] 1장. 한눈에 보는 머신러닝
[홍대 머신러닝 스터디 - 핸즈온 머신러닝] 1장. 한눈에 보는 머신러닝[홍대 머신러닝 스터디 - 핸즈온 머신러닝] 1장. 한눈에 보는 머신러닝
[홍대 머신러닝 스터디 - 핸즈온 머신러닝] 1장. 한눈에 보는 머신러닝Haesun Park
 
6.algorithm chains and piplines(epoch#2)
6.algorithm chains and piplines(epoch#2)6.algorithm chains and piplines(epoch#2)
6.algorithm chains and piplines(epoch#2)Haesun Park
 
2.supervised learning(epoch#2)-2
2.supervised learning(epoch#2)-22.supervised learning(epoch#2)-2
2.supervised learning(epoch#2)-2Haesun Park
 
[홍대 머신러닝 스터디 - 핸즈온 머신러닝] 5장. 서포트 벡터 머신
[홍대 머신러닝 스터디 - 핸즈온 머신러닝] 5장. 서포트 벡터 머신[홍대 머신러닝 스터디 - 핸즈온 머신러닝] 5장. 서포트 벡터 머신
[홍대 머신러닝 스터디 - 핸즈온 머신러닝] 5장. 서포트 벡터 머신Haesun Park
 
4.convolutional neural networks
4.convolutional neural networks4.convolutional neural networks
4.convolutional neural networksHaesun Park
 
2.supervised learning(epoch#2)-3
2.supervised learning(epoch#2)-32.supervised learning(epoch#2)-3
2.supervised learning(epoch#2)-3Haesun Park
 
2.supervised learning
2.supervised learning2.supervised learning
2.supervised learningHaesun Park
 
5.model evaluation and improvement
5.model evaluation and improvement5.model evaluation and improvement
5.model evaluation and improvementHaesun Park
 
Chapter 19 Variational Inference
Chapter 19 Variational InferenceChapter 19 Variational Inference
Chapter 19 Variational InferenceKyeongUkJang
 
[홍대 머신러닝 스터디 - 핸즈온 머신러닝] 4장. 모델 훈련
[홍대 머신러닝 스터디 - 핸즈온 머신러닝] 4장. 모델 훈련[홍대 머신러닝 스터디 - 핸즈온 머신러닝] 4장. 모델 훈련
[홍대 머신러닝 스터디 - 핸즈온 머신러닝] 4장. 모델 훈련Haesun Park
 
4.representing data and engineering features(epoch#2)
4.representing data and engineering features(epoch#2)4.representing data and engineering features(epoch#2)
4.representing data and engineering features(epoch#2)Haesun Park
 
3.unsupervised learing
3.unsupervised learing3.unsupervised learing
3.unsupervised learingHaesun Park
 
7.woring with text data
7.woring with text data7.woring with text data
7.woring with text dataHaesun Park
 
Chapter 15 Representation learning - 2
Chapter 15 Representation learning - 2Chapter 15 Representation learning - 2
Chapter 15 Representation learning - 2KyeongUkJang
 

What's hot (19)

3.unsupervised learing(epoch#2)
3.unsupervised learing(epoch#2)3.unsupervised learing(epoch#2)
3.unsupervised learing(epoch#2)
 
[홍대 머신러닝 스터디 - 핸즈온 머신러닝] 2장. 머신러닝 프로젝트 처음부터 끝까지
[홍대 머신러닝 스터디 - 핸즈온 머신러닝] 2장. 머신러닝 프로젝트 처음부터 끝까지[홍대 머신러닝 스터디 - 핸즈온 머신러닝] 2장. 머신러닝 프로젝트 처음부터 끝까지
[홍대 머신러닝 스터디 - 핸즈온 머신러닝] 2장. 머신러닝 프로젝트 처음부터 끝까지
 
5.model evaluation and improvement(epoch#2) 1
5.model evaluation and improvement(epoch#2) 15.model evaluation and improvement(epoch#2) 1
5.model evaluation and improvement(epoch#2) 1
 
(Handson ml)ch.7-ensemble learning and random forest
(Handson ml)ch.7-ensemble learning and random forest(Handson ml)ch.7-ensemble learning and random forest
(Handson ml)ch.7-ensemble learning and random forest
 
[홍대 머신러닝 스터디 - 핸즈온 머신러닝] 1장. 한눈에 보는 머신러닝
[홍대 머신러닝 스터디 - 핸즈온 머신러닝] 1장. 한눈에 보는 머신러닝[홍대 머신러닝 스터디 - 핸즈온 머신러닝] 1장. 한눈에 보는 머신러닝
[홍대 머신러닝 스터디 - 핸즈온 머신러닝] 1장. 한눈에 보는 머신러닝
 
6.algorithm chains and piplines(epoch#2)
6.algorithm chains and piplines(epoch#2)6.algorithm chains and piplines(epoch#2)
6.algorithm chains and piplines(epoch#2)
 
2.supervised learning(epoch#2)-2
2.supervised learning(epoch#2)-22.supervised learning(epoch#2)-2
2.supervised learning(epoch#2)-2
 
[홍대 머신러닝 스터디 - 핸즈온 머신러닝] 5장. 서포트 벡터 머신
[홍대 머신러닝 스터디 - 핸즈온 머신러닝] 5장. 서포트 벡터 머신[홍대 머신러닝 스터디 - 핸즈온 머신러닝] 5장. 서포트 벡터 머신
[홍대 머신러닝 스터디 - 핸즈온 머신러닝] 5장. 서포트 벡터 머신
 
4.convolutional neural networks
4.convolutional neural networks4.convolutional neural networks
4.convolutional neural networks
 
2.supervised learning(epoch#2)-3
2.supervised learning(epoch#2)-32.supervised learning(epoch#2)-3
2.supervised learning(epoch#2)-3
 
2.supervised learning
2.supervised learning2.supervised learning
2.supervised learning
 
5.model evaluation and improvement
5.model evaluation and improvement5.model evaluation and improvement
5.model evaluation and improvement
 
Chapter 19 Variational Inference
Chapter 19 Variational InferenceChapter 19 Variational Inference
Chapter 19 Variational Inference
 
[홍대 머신러닝 스터디 - 핸즈온 머신러닝] 4장. 모델 훈련
[홍대 머신러닝 스터디 - 핸즈온 머신러닝] 4장. 모델 훈련[홍대 머신러닝 스터디 - 핸즈온 머신러닝] 4장. 모델 훈련
[홍대 머신러닝 스터디 - 핸즈온 머신러닝] 4장. 모델 훈련
 
4.representing data and engineering features(epoch#2)
4.representing data and engineering features(epoch#2)4.representing data and engineering features(epoch#2)
4.representing data and engineering features(epoch#2)
 
3.unsupervised learing
3.unsupervised learing3.unsupervised learing
3.unsupervised learing
 
7.woring with text data
7.woring with text data7.woring with text data
7.woring with text data
 
Chapter 15 Representation learning - 2
Chapter 15 Representation learning - 2Chapter 15 Representation learning - 2
Chapter 15 Representation learning - 2
 
Gan
GanGan
Gan
 

Similar to Chapter 17 monte carlo methods

Chapter 11 Practical Methodology
Chapter 11 Practical MethodologyChapter 11 Practical Methodology
Chapter 11 Practical MethodologyKyeongUkJang
 
Attention is all you need 설명
Attention is all you need 설명Attention is all you need 설명
Attention is all you need 설명Junho Lee
 
PYCON KR 2017 - 구름이 하늘의 일이라면 (윤상웅)
PYCON KR 2017 - 구름이 하늘의 일이라면 (윤상웅)PYCON KR 2017 - 구름이 하늘의 일이라면 (윤상웅)
PYCON KR 2017 - 구름이 하늘의 일이라면 (윤상웅)Haezoom Inc.
 
Guided policy search
Guided policy searchGuided policy search
Guided policy searchJaehyeon Park
 
Imagination-Augmented Agents for Deep Reinforcement Learning
Imagination-Augmented Agents for Deep Reinforcement LearningImagination-Augmented Agents for Deep Reinforcement Learning
Imagination-Augmented Agents for Deep Reinforcement Learning성재 최
 
파이썬으로 익히는 딥러닝 기본 (18년)
파이썬으로 익히는 딥러닝 기본 (18년)파이썬으로 익히는 딥러닝 기본 (18년)
파이썬으로 익히는 딥러닝 기본 (18년)SK(주) C&C - 강병호
 
"From image level to pixel-level labeling with convolutional networks" Paper ...
"From image level to pixel-level labeling with convolutional networks" Paper ..."From image level to pixel-level labeling with convolutional networks" Paper ...
"From image level to pixel-level labeling with convolutional networks" Paper ...LEE HOSEONG
 
InfoGAN Paper Review
InfoGAN Paper ReviewInfoGAN Paper Review
InfoGAN Paper Review태엽 김
 
Bidirectional attention flow for machine comprehension
Bidirectional attention flow for machine comprehensionBidirectional attention flow for machine comprehension
Bidirectional attention flow for machine comprehensionWoodam Lim
 
[Paper Review] What have we achieved on text summarization?
[Paper Review] What have we achieved on text summarization? [Paper Review] What have we achieved on text summarization?
[Paper Review] What have we achieved on text summarization? Hangil Kim
 
Exploring Deep Learning Acceleration Technology Embedded in LLMs
Exploring Deep Learning Acceleration Technology Embedded in LLMsExploring Deep Learning Acceleration Technology Embedded in LLMs
Exploring Deep Learning Acceleration Technology Embedded in LLMsTae Young Lee
 
[kor ver.]패턴인식을 위한 인공신경망 Caps-net 구현
[kor ver.]패턴인식을 위한 인공신경망 Caps-net 구현 [kor ver.]패턴인식을 위한 인공신경망 Caps-net 구현
[kor ver.]패턴인식을 위한 인공신경망 Caps-net 구현 Adonis Han
 
스마트폰 위의 딥러닝
스마트폰 위의 딥러닝스마트폰 위의 딥러닝
스마트폰 위의 딥러닝NAVER Engineering
 
Howto_Tensorflow+Linear Regression
Howto_Tensorflow+Linear RegressionHowto_Tensorflow+Linear Regression
Howto_Tensorflow+Linear RegressionHyo jeong Lee
 
180624 mobile visionnet_baeksucon_jwkang_pub
180624 mobile visionnet_baeksucon_jwkang_pub180624 mobile visionnet_baeksucon_jwkang_pub
180624 mobile visionnet_baeksucon_jwkang_pubJaewook. Kang
 
[한국어] Neural Architecture Search with Reinforcement Learning
[한국어] Neural Architecture Search with Reinforcement Learning[한국어] Neural Architecture Search with Reinforcement Learning
[한국어] Neural Architecture Search with Reinforcement LearningKiho Suh
 
Transfer learning usage
Transfer learning usageTransfer learning usage
Transfer learning usageTae Young Lee
 

Similar to Chapter 17 monte carlo methods (20)

Chapter 11 Practical Methodology
Chapter 11 Practical MethodologyChapter 11 Practical Methodology
Chapter 11 Practical Methodology
 
Deep learning overview
Deep learning overviewDeep learning overview
Deep learning overview
 
Attention is all you need 설명
Attention is all you need 설명Attention is all you need 설명
Attention is all you need 설명
 
PYCON KR 2017 - 구름이 하늘의 일이라면 (윤상웅)
PYCON KR 2017 - 구름이 하늘의 일이라면 (윤상웅)PYCON KR 2017 - 구름이 하늘의 일이라면 (윤상웅)
PYCON KR 2017 - 구름이 하늘의 일이라면 (윤상웅)
 
Guided policy search
Guided policy searchGuided policy search
Guided policy search
 
Imagination-Augmented Agents for Deep Reinforcement Learning
Imagination-Augmented Agents for Deep Reinforcement LearningImagination-Augmented Agents for Deep Reinforcement Learning
Imagination-Augmented Agents for Deep Reinforcement Learning
 
파이썬으로 익히는 딥러닝 기본 (18년)
파이썬으로 익히는 딥러닝 기본 (18년)파이썬으로 익히는 딥러닝 기본 (18년)
파이썬으로 익히는 딥러닝 기본 (18년)
 
"From image level to pixel-level labeling with convolutional networks" Paper ...
"From image level to pixel-level labeling with convolutional networks" Paper ..."From image level to pixel-level labeling with convolutional networks" Paper ...
"From image level to pixel-level labeling with convolutional networks" Paper ...
 
InfoGAN Paper Review
InfoGAN Paper ReviewInfoGAN Paper Review
InfoGAN Paper Review
 
Bidirectional attention flow for machine comprehension
Bidirectional attention flow for machine comprehensionBidirectional attention flow for machine comprehension
Bidirectional attention flow for machine comprehension
 
[Paper Review] What have we achieved on text summarization?
[Paper Review] What have we achieved on text summarization? [Paper Review] What have we achieved on text summarization?
[Paper Review] What have we achieved on text summarization?
 
Exploring Deep Learning Acceleration Technology Embedded in LLMs
Exploring Deep Learning Acceleration Technology Embedded in LLMsExploring Deep Learning Acceleration Technology Embedded in LLMs
Exploring Deep Learning Acceleration Technology Embedded in LLMs
 
[kor ver.]패턴인식을 위한 인공신경망 Caps-net 구현
[kor ver.]패턴인식을 위한 인공신경망 Caps-net 구현 [kor ver.]패턴인식을 위한 인공신경망 Caps-net 구현
[kor ver.]패턴인식을 위한 인공신경망 Caps-net 구현
 
스마트폰 위의 딥러닝
스마트폰 위의 딥러닝스마트폰 위의 딥러닝
스마트폰 위의 딥러닝
 
CS294-112 18
CS294-112 18CS294-112 18
CS294-112 18
 
Rl
RlRl
Rl
 
Howto_Tensorflow+Linear Regression
Howto_Tensorflow+Linear RegressionHowto_Tensorflow+Linear Regression
Howto_Tensorflow+Linear Regression
 
180624 mobile visionnet_baeksucon_jwkang_pub
180624 mobile visionnet_baeksucon_jwkang_pub180624 mobile visionnet_baeksucon_jwkang_pub
180624 mobile visionnet_baeksucon_jwkang_pub
 
[한국어] Neural Architecture Search with Reinforcement Learning
[한국어] Neural Architecture Search with Reinforcement Learning[한국어] Neural Architecture Search with Reinforcement Learning
[한국어] Neural Architecture Search with Reinforcement Learning
 
Transfer learning usage
Transfer learning usageTransfer learning usage
Transfer learning usage
 

More from KyeongUkJang

Photo wake up - 3d character animation from a single photo
Photo wake up - 3d character animation from a single photoPhoto wake up - 3d character animation from a single photo
Photo wake up - 3d character animation from a single photoKyeongUkJang
 
GAN - Generative Adversarial Nets
GAN - Generative Adversarial NetsGAN - Generative Adversarial Nets
GAN - Generative Adversarial NetsKyeongUkJang
 
Distilling the knowledge in a neural network
Distilling the knowledge in a neural networkDistilling the knowledge in a neural network
Distilling the knowledge in a neural networkKyeongUkJang
 
Latent Dirichlet Allocation
Latent Dirichlet AllocationLatent Dirichlet Allocation
Latent Dirichlet AllocationKyeongUkJang
 
Gaussian Mixture Model
Gaussian Mixture ModelGaussian Mixture Model
Gaussian Mixture ModelKyeongUkJang
 
Visualizing data using t-SNE
Visualizing data using t-SNEVisualizing data using t-SNE
Visualizing data using t-SNEKyeongUkJang
 
Playing atari with deep reinforcement learning
Playing atari with deep reinforcement learningPlaying atari with deep reinforcement learning
Playing atari with deep reinforcement learningKyeongUkJang
 
Chapter 20 Deep generative models
Chapter 20 Deep generative modelsChapter 20 Deep generative models
Chapter 20 Deep generative modelsKyeongUkJang
 
Natural Language Processing(NLP) - basic 2
Natural Language Processing(NLP) - basic 2Natural Language Processing(NLP) - basic 2
Natural Language Processing(NLP) - basic 2KyeongUkJang
 
Natural Language Processing(NLP) - Basic
Natural Language Processing(NLP) - BasicNatural Language Processing(NLP) - Basic
Natural Language Processing(NLP) - BasicKyeongUkJang
 
Chapter 15 Representation learning - 1
Chapter 15 Representation learning - 1Chapter 15 Representation learning - 1
Chapter 15 Representation learning - 1KyeongUkJang
 
Chapter 6 Deep feedforward networks - 2
Chapter 6 Deep feedforward networks - 2Chapter 6 Deep feedforward networks - 2
Chapter 6 Deep feedforward networks - 2KyeongUkJang
 
Chapter 6 Deep feedforward networks - 1
Chapter 6 Deep feedforward networks - 1Chapter 6 Deep feedforward networks - 1
Chapter 6 Deep feedforward networks - 1KyeongUkJang
 
Chapter 7 Regularization for deep learning - 3
Chapter 7 Regularization for deep learning - 3Chapter 7 Regularization for deep learning - 3
Chapter 7 Regularization for deep learning - 3KyeongUkJang
 
Chapter 7 Regularization for deep learning - 2
Chapter 7 Regularization for deep learning - 2Chapter 7 Regularization for deep learning - 2
Chapter 7 Regularization for deep learning - 2KyeongUkJang
 

More from KyeongUkJang (20)

Photo wake up - 3d character animation from a single photo
Photo wake up - 3d character animation from a single photoPhoto wake up - 3d character animation from a single photo
Photo wake up - 3d character animation from a single photo
 
YOLO
YOLOYOLO
YOLO
 
AlphagoZero
AlphagoZeroAlphagoZero
AlphagoZero
 
GoogLenet
GoogLenetGoogLenet
GoogLenet
 
GAN - Generative Adversarial Nets
GAN - Generative Adversarial NetsGAN - Generative Adversarial Nets
GAN - Generative Adversarial Nets
 
Distilling the knowledge in a neural network
Distilling the knowledge in a neural networkDistilling the knowledge in a neural network
Distilling the knowledge in a neural network
 
Latent Dirichlet Allocation
Latent Dirichlet AllocationLatent Dirichlet Allocation
Latent Dirichlet Allocation
 
Gaussian Mixture Model
Gaussian Mixture ModelGaussian Mixture Model
Gaussian Mixture Model
 
Visualizing data using t-SNE
Visualizing data using t-SNEVisualizing data using t-SNE
Visualizing data using t-SNE
 
Playing atari with deep reinforcement learning
Playing atari with deep reinforcement learningPlaying atari with deep reinforcement learning
Playing atari with deep reinforcement learning
 
Chapter 20 - GAN
Chapter 20 - GANChapter 20 - GAN
Chapter 20 - GAN
 
Chapter 20 - VAE
Chapter 20 - VAEChapter 20 - VAE
Chapter 20 - VAE
 
Chapter 20 Deep generative models
Chapter 20 Deep generative modelsChapter 20 Deep generative models
Chapter 20 Deep generative models
 
Natural Language Processing(NLP) - basic 2
Natural Language Processing(NLP) - basic 2Natural Language Processing(NLP) - basic 2
Natural Language Processing(NLP) - basic 2
 
Natural Language Processing(NLP) - Basic
Natural Language Processing(NLP) - BasicNatural Language Processing(NLP) - Basic
Natural Language Processing(NLP) - Basic
 
Chapter 15 Representation learning - 1
Chapter 15 Representation learning - 1Chapter 15 Representation learning - 1
Chapter 15 Representation learning - 1
 
Chapter 6 Deep feedforward networks - 2
Chapter 6 Deep feedforward networks - 2Chapter 6 Deep feedforward networks - 2
Chapter 6 Deep feedforward networks - 2
 
Chapter 6 Deep feedforward networks - 1
Chapter 6 Deep feedforward networks - 1Chapter 6 Deep feedforward networks - 1
Chapter 6 Deep feedforward networks - 1
 
Chapter 7 Regularization for deep learning - 3
Chapter 7 Regularization for deep learning - 3Chapter 7 Regularization for deep learning - 3
Chapter 7 Regularization for deep learning - 3
 
Chapter 7 Regularization for deep learning - 2
Chapter 7 Regularization for deep learning - 2Chapter 7 Regularization for deep learning - 2
Chapter 7 Regularization for deep learning - 2
 

Chapter 17 monte carlo methods

  • 2. 17.1 Sampling and Monte Carlo Methods 17.1.1 why sampling? 출처 : http://www.secmem.org/blog/2019/01/11/mcmc/ <인터넷 자료> 1. 높은 차원의 최적화 문제 2. 높은 차원의 적분 <교재 내용> 1. 처리는 가능하지만 비용이 많이 드는 sum과 integrals에 이용 2. 아예 처리 불가능한 sum과 integrals에 대한 근사를 할 때 3. 표본추출 자체가 목적
  • 3. 출처 https://www.youtube.com/watch?v=AadKNJU1-lk Approximate expectations - estimated statics - Posterior inference (확률의 계산에 쓰임) Why expectation ? - Any probability is an E : - Many time hard to compute, approx. is needed for sum or integral which can be represented expectations 𝑝 𝑋 ∈ 𝐴 = 𝐸𝐼 𝑥 ∈ 𝐴 17.1.1 why sampling?
  • 4. 시작하기에 앞서 Monte Carlo의 컨셉 무작위 추출된 난수를 이용하여 함수의 값을 계산하는 통계학의 방법 EX) 원의 넓이 구하기 1) 원의 면적 식을 이용하여 구하기 2) 몬테 카를로 방법 - 난수들을 찍은 다음 원안에 들어 간 개수들을 계산하면 원의 면적을 구할 수 있음
  • 5. 17.1.2 basic of monte carlo sampling 그림 출처: http://blog.naver.com/PostView.nhn?blogId=dalsapcho&logNo=20147545698&categoryNo=11&parentCategory No=0&viewDate=&currentPage=1&postListTopCurrentPage=1&from=postView
  • 6. s = 𝑥 𝑝 𝑥 𝑞 𝑥 = 𝐸 𝑝 𝑓 𝑥 𝑠 = 𝑝 𝑥 𝑓 𝑥 ⅆ𝑥 = 𝐸 𝑃 𝑓 𝑥 기대값 형태로 표현할 경우 이산형인 경우 연속형인 경우 확률밀도 함수 확률변수
  • 7. 𝑠 𝑛 = 1 𝑛 𝑖=1 𝑛 𝑓 𝑥 𝑖 교재에서 추정량 𝒔 𝒏 을 구하는 과정 𝑥 1 , 𝑥 2 , … , 𝑥 𝑛 𝐸 𝑠 𝑛 = 𝐸 1 𝑛 𝑖=1 𝑛 𝑓 𝑥 𝑖 = 1 𝑛 𝐸 𝐼 𝑓 𝑥 𝑙 그냥 표본 평균 (추출된 표본들의 산술 평균)이라고 보면 된다 = 1 𝑛 𝐸 𝑥 1 , 𝑥 2 , … , 𝑥 𝑛 = 1 𝑛 𝑖=1 𝑛 𝑠 = s 그냥 한국말로 하면 Sample 들을 확률변수 기대값이 s이므로 추정량의 기대값은 s이다 모평균과 표본평균은 같다
  • 8. 교재에서 추정량 𝐕𝐚𝐫 𝑠 𝑛 을 구하는 과정 표본평균의 분산
  • 9. 17.2 Importance sampling 이전의 소개한 방법은 분포로부터 표본을 쉽게 추출할 수 있을 때이다. 하지만 그렇지 않은 경우가 많다 왜?why? - pdf 혹은 cdf의 역연산을 해야 되는데 그것이 쉽지 않다 - 다변량 pdf의 경우 굉장히 고차원이다. 복잡한 joint distribution으로 이루어져 있어서 계산이 쉽지 않다 좀더 자세한 내용을 원하시는 분은 다음 slide 출처 참고
  • 10. 다음 글도 참고 : https://www.quora.com/What-are-high-dimensional-probability-density-functions-pdfs-Do- both-high-dimensional-and-multivariate-pdfs-mean-the-same-Also-what-makes-it-difficult-to-sample-from- such-high-dimensional-pdfs-in-reference-to-Monte
  • 11. https://www.youtube.com/watch?v=S3LAOZxGcnk 그렇다면 어떻게 sample을 좀더 쉽게 뽑아 낼 수 있을까? 다른 distribution 을 통해서 추정할 수 잇을까? p(라는 진짜 distribution)을 안쓰고?? 이것이 importance Sampling의 컨셉 새로운 대안적인 q라는 distriubution에서 뽑아 올수 있을까 ? 그렇다!! 오히려 더 잘 뽑아 올 수 있다.
  • 12. 1) p에서 sample을 뽑지 못할 때 (p하고 최대한 비슷하게 q를 만든다, q는 좀더 sample을 뽑기 쉬운 분포) 2) Estimator 를 개선하고 싶을 때 언제 importance weight을 쓰는가?
  • 14. 일명 MCMC20세기 영향력 있는 top 10 알고리즘에 들었다고 한다!! 특징 - (상대적으로) 빠른 수력속도 - 더 많은 확률 분포 샘플링 가능 MCMC는 무엇인가? Markov Chain과 Monte Carlo라는 두가지 수학적 특성을 기반으로 샘플링을 하는 것. MCMC의 샘플링 방법은 이전의 샘플이 다음 샘플의 추출에 영향을 줌. 정확히 표현하면 MCMC는 임의의 랜덤한 표본에서 시작하여, i번째 표본을 참고하여 i+1번째 표본을 뽑습니다. http://www.secmem.org/blog/2019/01/11/mcmc/ 17.3Monte Carlo Markov chain
  • 15. 여러 상태들 (x1,x2,⋯,xn,⋯) 이 있고 xi에서 xj로 이동할 조건 부 확률분포 transition distribution T(xj|xi) 이 주어져 있어 서 매턴마다 이 확률 값에 따라 상태들 사이를 이동하는 것 입니다. 그렇다면 확률이 정해져 있다면 동선에 특정한 패턴이 존 재하지는 않을까요? 예를 들어, “100번 이동했다면 평균적 으로 3번은 출발지점에 돌아올 것이다”와 같은 예측을 할 수도 있을 것 같습니다. 항상은 아니지만 확률이 정해져 있으므로 “특정조건”을 만 족할 때 일정한 패턴이 나타납니다. 어떤 지점에서 시작하 더라도, 상태 사이를 충분히 많은 횟수 이동하게 되면 각 상 태의 방문횟수의 비율이 일정한 값으로 수렴하게 됩니다. 다시 말하면, 상태들의 방문횟수의 비율이 특정 확률분포 로 수렴하게 되고 이 분포를 stationary distribution이라 부릅니다. Markov Chain
  • 16. https://www.youtube.com/watch?v=zL2lg_Nfi80 뭐하는 친구인지 우선 보자 MCMC 중에서도 대표적인 Metropolis-Hastings algorithm을 살펴보자
  • 17. 그전에 베이지안 정리에 대한 리마인드 동전던지기를 하는데 앞면이 나올 확률분포를 추정해보자고 하잡
  • 18.
  • 19. 사전에 주어진 information이 많은 경우 (piror 분포를 따라감) Sample이 많아 질 수록
  • 20. Proposal distirubution 주로 정규분포를 사용, 추정되는 세타 값을 샘플링 한다 Monte carlo
  • 21. Makrov chain 정규분포의 평균값이 이전의 데이터를 사용한다
  • 22. Metropolis - hastings 새로운 후보 이전의 distribution 친구
  • 23.
  • 24. https://stats.stackexchange.com/questions/242616/why- compare-with-uniform-distributed-values-in-metropolis- hastings 근데 왜 uniform distributio과 비교할까?? (반 뇌피셜) unfiorm distribution cdf는 identity function이다 따라서 𝑃 U ≤ 𝑢 = u, 𝑃 U ≤ 𝛼 = 𝑎 는 확률의 비교와 같고 어느정도의 랜덤으로 주어진 확률보다 낮으면 쳐내겠다는 뜻이 아닐까
  • 25.
  • 26. MCMC 관해서 추가적으로 읽어볼 자료(4분50초부터) https://www.youtube.com/watch?v=U561HGMWjcw
  • 27. 17.4 Gibbs Sampling https://ratsgo.github.io/statistics/2017/05/31/gibbs/ Gibbs sampling은 metropolis-hasting sampling의 조금 특이한 케이스이다 컨셉은 비슷한데
  • 28.
  • 29. 17.5 The challenge of mixing between separated modes (누가 energy based model 설명좀..) http://www.secmem.org/blog/2019/02/11/fmmc/ MCMC가 만드는 샘플들은 target distribution에 점점 수렴하는 특징이 있습니다. 다르게 말하면 MCMC가 만들어내는 샘플을 사용하기 위해서는 샘플들이 target distribution에 수렴할 때 까지 기 다려야 합니다. 적절히 수렴한 상태를 mix 되었다고 하고 이때까지 걸리는 시간을 mixing time이 라고 합니다. 이상적으로는 표본들이 독립적이여야 한다. 하지만 고차원의 경우에는 MCMC방법이 잘 작동하지 않아서 이를 혼합이 느리다
  • 30. (왼) 독립변수들로 이루어진 분포, mix가 잘된다 (중간) 상관관계가 높은 변수들로 이루어진 분포, mix가 잘되지 않는다 (오) 모드들이 아예 떨어져 있는 경우 따른 모드로 잘 바뀌지 않기 때문에 mix가 정말 느리다

Editor's Notes

  1. https://wikidocs.net/4060