SlideShare une entreprise Scribd logo
1  sur  23
Télécharger pour lire hors ligne
Replica exchange MCMC
with Stan and R
Kentaro Matsuura
June 4, 2016
Tokyo.Stan
Example data
• N = 50 # number of data points
2
Model (Assumptions)
• 𝑌 𝑛 ~ Normal sin 𝛽 𝑋 𝑛 , 𝜎 𝑌
• angular rate: 𝛽 ~ Normal+ 0, 50
• noise scale: 𝜎 𝑌 ~ Student_t+ 4, 0, 5
3
𝑛 = 1, … , 𝑁
Stan Code 4
R Code 5
Result | trace plot 6
This chain seems good.
Should I set initial values
around (b, s_y)=(24, 0.3) ?
By the way
A contour map of log-posterior can be visualized.
Because the number of parameters is just two in this model.
7
For later explanation, I visualized
𝐸
𝑇
(≈ − log-posterior )
𝐸: Energy, 𝑇: Temperature
higher log-posterior  lower
𝐸
𝑇
previous model is correspond to 𝑇 = 1
Contour map of 𝐸/𝑇 (at 𝑇 = 1) 8
Contour map of 𝐸/𝑇 (at 𝑇 = 1) 9
around (24, 0.3)
𝐸 ≈ 33
around (0.5, 0.3)
𝐸 ≈ 28
10
Replica exchange MCMC
(also known as parallel tempering)
Setting initial values is generally difficult.
References
• Y. Iba, "Extended Ensemble Monte Carlo," Int. J. Mod.
Phys. C, 12, pp.623-652, 2001.
• Movie by Y. Iba (in Japanese):
レプリカ交換MCMC講義 (伊庭幸人) 難易度★★
https://www.youtube.com/watch?v=1c7mQIhEqmQ
• Books (in Japanese)
– 福島孝治 (2006) サイコロふって積分する方法 確率的情報処理と統
計力学(SGCライブラリ 50) p.60-66.
– 伊庭ほか (2005) 計算統計II (統計科学のフロンティア 12) p.74-78
11
Overview 12
Monte Carlo Step
𝑇5
𝑇4
𝑇3
𝑇2
𝑇1 = 1
>>>>
𝑁𝑟𝑒𝑝𝑙𝑖𝑐𝑎 = 5
Annealing and Heating 13
𝑇ℎ𝑖𝑔ℎ
𝑇 𝑚𝑖𝑑𝑑𝑙𝑒
𝑇1 = 1
Sampling from joint distribution
• Theoretically, Replica exchange MCMC
does sampling from the following joint
distribution:
𝑝 𝜽1, … , 𝜽 𝑇 𝑁_𝑟𝑒𝑝𝑙𝑖𝑐𝑎
=
𝑟=1
𝑁_𝑟𝑒𝑝𝑙𝑖𝑐𝑎
𝑝 𝜽 𝑟|𝑇 = 𝑇𝑟
where 𝑝 𝜽 𝑟|𝑇 = 𝑇𝑟 ∝ exp −
𝐸 𝜽 𝑟
𝑇𝑟
14
Exchange probability of replicas
𝑝 = min 1,
exp −
𝐸 𝑟′
𝑇𝑟
−
𝐸𝑟
𝑇 𝑟′
exp −
𝐸𝑟
𝑇𝑟
−
𝐸 𝑟′
𝑇 𝑟′
= min 1, exp 𝐸𝑟 − 𝐸 𝑟′ ×
1
𝑇𝑟
−
1
𝑇 𝑟′
15
Pseudo Code 16
set T of replicas: T = (1, T2, T3, ..., TN_replica)
set initial values: x = (x0, x0, ..., x0)
for e in 1, ..., N_exchange
for r in 1, ..., N_replica
short sampling started from x[r] at each T[r]
end
save MCMC samples at T = 1
exchange replicas if p < unif(0,1)
for r in 1, ..., N_replica
update x[r]
end
end
Stan Code 17
R Code and Settings
• R Code:
• 𝑁𝑟𝑒𝑝𝑙𝑖𝑐𝑎 = 10
• 𝑁𝑒𝑥𝑐ℎ𝑎𝑛𝑔𝑒 = 100
• 𝑇 = 1, 1.54, … , 32.37, 50
• 𝑥0 = 𝑏, 𝜎 𝑦 0
= 24. 2, 0.4
• iter=70 and warmup=50 each short sampling
(i.e. 20 MCMC samples)
18
𝑁𝑟𝑒𝑝𝑙𝑖𝑐𝑎 needs ≈ 𝑁
geometric progression
deep local minimum ☠
https://gist.github.com/MatsuuraKentaro/bccf13af3ba5
2c9d6c379c0032725b91
Result | Exchanges of replicas 19
Result | 𝐸 (Energy) 20
Result | 𝐸 (Energy) 21
Result | trace plot (at 𝑇 = 1) 22
Discussion
• Can I re-use warmup result in Stan?
i.e. step size &
diagonal elements of inverse mass matrix
• How to set iter and warmup of each short
sampling?
warmup=50 is usually too short as total sampling.
But, total warmup is 50*100 in this case.
Does it make sense?
23

Contenu connexe

Tendances

MLaPP 24章 「マルコフ連鎖モンテカルロ法 (MCMC) による推論」
MLaPP 24章 「マルコフ連鎖モンテカルロ法 (MCMC) による推論」MLaPP 24章 「マルコフ連鎖モンテカルロ法 (MCMC) による推論」
MLaPP 24章 「マルコフ連鎖モンテカルロ法 (MCMC) による推論」moterech
 
ベイズモデリングと仲良くするために
ベイズモデリングと仲良くするためにベイズモデリングと仲良くするために
ベイズモデリングと仲良くするためにShushi Namba
 
Cmdstanr入門とreduce_sum()解説
Cmdstanr入門とreduce_sum()解説Cmdstanr入門とreduce_sum()解説
Cmdstanr入門とreduce_sum()解説Hiroshi Shimizu
 
社会心理学者のための時系列分析入門_小森
社会心理学者のための時系列分析入門_小森社会心理学者のための時系列分析入門_小森
社会心理学者のための時系列分析入門_小森Masashi Komori
 
15分でわかる(範囲の)ベイズ統計学
15分でわかる(範囲の)ベイズ統計学15分でわかる(範囲の)ベイズ統計学
15分でわかる(範囲の)ベイズ統計学Ken'ichi Matsui
 
Stanコードの書き方 中級編
Stanコードの書き方 中級編Stanコードの書き方 中級編
Stanコードの書き方 中級編Hiroshi Shimizu
 
指数分布とポアソン分布のいけない関係
指数分布とポアソン分布のいけない関係指数分布とポアソン分布のいけない関係
指数分布とポアソン分布のいけない関係Nagi Teramo
 
Juliaで学ぶ Hamiltonian Monte Carlo (NUTS 入り)
Juliaで学ぶ Hamiltonian Monte Carlo (NUTS 入り)Juliaで学ぶ Hamiltonian Monte Carlo (NUTS 入り)
Juliaで学ぶ Hamiltonian Monte Carlo (NUTS 入り)Kenta Sato
 
変分ベイズ法の説明
変分ベイズ法の説明変分ベイズ法の説明
変分ベイズ法の説明Haruka Ozaki
 
統計モデリングで癌の5年生存率データから良い病院を探す
統計モデリングで癌の5年生存率データから良い病院を探す統計モデリングで癌の5年生存率データから良い病院を探す
統計モデリングで癌の5年生存率データから良い病院を探す. .
 
変分推論法(変分ベイズ法)(PRML第10章)
変分推論法(変分ベイズ法)(PRML第10章)変分推論法(変分ベイズ法)(PRML第10章)
変分推論法(変分ベイズ法)(PRML第10章)Takao Yamanaka
 
強化学習その3
強化学習その3強化学習その3
強化学習その3nishio
 
Prml 最尤推定からベイズ曲線フィッティング
Prml 最尤推定からベイズ曲線フィッティングPrml 最尤推定からベイズ曲線フィッティング
Prml 最尤推定からベイズ曲線フィッティングtakutori
 
幾何を使った統計のはなし
幾何を使った統計のはなし幾何を使った統計のはなし
幾何を使った統計のはなしToru Imai
 
とぽろじー入門(画像なし版)
とぽろじー入門(画像なし版)とぽろじー入門(画像なし版)
とぽろじー入門(画像なし版)Katsuya Ito
 
ベイズファクターとモデル選択
ベイズファクターとモデル選択ベイズファクターとモデル選択
ベイズファクターとモデル選択kazutantan
 
Chapter9 一歩進んだ文法(前半)
Chapter9 一歩進んだ文法(前半)Chapter9 一歩進んだ文法(前半)
Chapter9 一歩進んだ文法(前半)itoyan110
 

Tendances (20)

MLaPP 24章 「マルコフ連鎖モンテカルロ法 (MCMC) による推論」
MLaPP 24章 「マルコフ連鎖モンテカルロ法 (MCMC) による推論」MLaPP 24章 「マルコフ連鎖モンテカルロ法 (MCMC) による推論」
MLaPP 24章 「マルコフ連鎖モンテカルロ法 (MCMC) による推論」
 
ベイズモデリングと仲良くするために
ベイズモデリングと仲良くするためにベイズモデリングと仲良くするために
ベイズモデリングと仲良くするために
 
Cmdstanr入門とreduce_sum()解説
Cmdstanr入門とreduce_sum()解説Cmdstanr入門とreduce_sum()解説
Cmdstanr入門とreduce_sum()解説
 
社会心理学者のための時系列分析入門_小森
社会心理学者のための時系列分析入門_小森社会心理学者のための時系列分析入門_小森
社会心理学者のための時系列分析入門_小森
 
15分でわかる(範囲の)ベイズ統計学
15分でわかる(範囲の)ベイズ統計学15分でわかる(範囲の)ベイズ統計学
15分でわかる(範囲の)ベイズ統計学
 
Stanコードの書き方 中級編
Stanコードの書き方 中級編Stanコードの書き方 中級編
Stanコードの書き方 中級編
 
指数分布とポアソン分布のいけない関係
指数分布とポアソン分布のいけない関係指数分布とポアソン分布のいけない関係
指数分布とポアソン分布のいけない関係
 
Juliaで学ぶ Hamiltonian Monte Carlo (NUTS 入り)
Juliaで学ぶ Hamiltonian Monte Carlo (NUTS 入り)Juliaで学ぶ Hamiltonian Monte Carlo (NUTS 入り)
Juliaで学ぶ Hamiltonian Monte Carlo (NUTS 入り)
 
変分ベイズ法の説明
変分ベイズ法の説明変分ベイズ法の説明
変分ベイズ法の説明
 
マーク付き点過程
マーク付き点過程マーク付き点過程
マーク付き点過程
 
統計モデリングで癌の5年生存率データから良い病院を探す
統計モデリングで癌の5年生存率データから良い病院を探す統計モデリングで癌の5年生存率データから良い病院を探す
統計モデリングで癌の5年生存率データから良い病院を探す
 
変分推論法(変分ベイズ法)(PRML第10章)
変分推論法(変分ベイズ法)(PRML第10章)変分推論法(変分ベイズ法)(PRML第10章)
変分推論法(変分ベイズ法)(PRML第10章)
 
強化学習その3
強化学習その3強化学習その3
強化学習その3
 
Prml 最尤推定からベイズ曲線フィッティング
Prml 最尤推定からベイズ曲線フィッティングPrml 最尤推定からベイズ曲線フィッティング
Prml 最尤推定からベイズ曲線フィッティング
 
幾何を使った統計のはなし
幾何を使った統計のはなし幾何を使った統計のはなし
幾何を使った統計のはなし
 
階層ベイズとWAIC
階層ベイズとWAIC階層ベイズとWAIC
階層ベイズとWAIC
 
とぽろじー入門(画像なし版)
とぽろじー入門(画像なし版)とぽろじー入門(画像なし版)
とぽろじー入門(画像なし版)
 
ベイズファクターとモデル選択
ベイズファクターとモデル選択ベイズファクターとモデル選択
ベイズファクターとモデル選択
 
EMアルゴリズム
EMアルゴリズムEMアルゴリズム
EMアルゴリズム
 
Chapter9 一歩進んだ文法(前半)
Chapter9 一歩進んだ文法(前半)Chapter9 一歩進んだ文法(前半)
Chapter9 一歩進んだ文法(前半)
 

Similaire à Replica exchange MCMC

DSP_FOEHU - MATLAB 02 - The Discrete-time Fourier Analysis
DSP_FOEHU - MATLAB 02 - The Discrete-time Fourier AnalysisDSP_FOEHU - MATLAB 02 - The Discrete-time Fourier Analysis
DSP_FOEHU - MATLAB 02 - The Discrete-time Fourier AnalysisAmr E. Mohamed
 
Applied Algorithms and Structures week999
Applied Algorithms and Structures week999Applied Algorithms and Structures week999
Applied Algorithms and Structures week999fashiontrendzz20
 
Markov chain Monte Carlo methods and some attempts at parallelizing them
Markov chain Monte Carlo methods and some attempts at parallelizing themMarkov chain Monte Carlo methods and some attempts at parallelizing them
Markov chain Monte Carlo methods and some attempts at parallelizing themPierre Jacob
 
Low rank tensor approximation of probability density and characteristic funct...
Low rank tensor approximation of probability density and characteristic funct...Low rank tensor approximation of probability density and characteristic funct...
Low rank tensor approximation of probability density and characteristic funct...Alexander Litvinenko
 
Lecture: Monte Carlo Methods
Lecture: Monte Carlo MethodsLecture: Monte Carlo Methods
Lecture: Monte Carlo MethodsFrank Kienle
 
Molecular Solutions For The Set-Partition Problem On Dna-Based Computing
Molecular Solutions For The Set-Partition Problem On Dna-Based ComputingMolecular Solutions For The Set-Partition Problem On Dna-Based Computing
Molecular Solutions For The Set-Partition Problem On Dna-Based Computingijcsit
 
Response Surface in Tensor Train format for Uncertainty Quantification
Response Surface in Tensor Train format for Uncertainty QuantificationResponse Surface in Tensor Train format for Uncertainty Quantification
Response Surface in Tensor Train format for Uncertainty QuantificationAlexander Litvinenko
 
Numerical Methods
Numerical MethodsNumerical Methods
Numerical MethodsTeja Ande
 
K-adaptive partitioning for survival data
K-adaptive partitioning for survival dataK-adaptive partitioning for survival data
K-adaptive partitioning for survival data수행 어
 
Phase-Type Distributions for Finite Interacting Particle Systems
Phase-Type Distributions for Finite Interacting Particle SystemsPhase-Type Distributions for Finite Interacting Particle Systems
Phase-Type Distributions for Finite Interacting Particle SystemsStefan Eng
 
Approximating Value of pi(Π) using Monte Carlo Iterative Method
Approximating Value of pi(Π) using Monte Carlo Iterative MethodApproximating Value of pi(Π) using Monte Carlo Iterative Method
Approximating Value of pi(Π) using Monte Carlo Iterative MethodNischal Lal Shrestha
 
Digital Signal Processing[ECEG-3171]-Ch1_L05
Digital Signal Processing[ECEG-3171]-Ch1_L05Digital Signal Processing[ECEG-3171]-Ch1_L05
Digital Signal Processing[ECEG-3171]-Ch1_L05Rediet Moges
 
Common Fixed Theorems Using Random Implicit Iterative Schemes
Common Fixed Theorems Using Random Implicit Iterative SchemesCommon Fixed Theorems Using Random Implicit Iterative Schemes
Common Fixed Theorems Using Random Implicit Iterative Schemesinventy
 
PART VII.3 - Quantum Electrodynamics
PART VII.3 - Quantum ElectrodynamicsPART VII.3 - Quantum Electrodynamics
PART VII.3 - Quantum ElectrodynamicsMaurice R. TREMBLAY
 
Quantum Annealing for Dirichlet Process Mixture Models with Applications to N...
Quantum Annealing for Dirichlet Process Mixture Models with Applications to N...Quantum Annealing for Dirichlet Process Mixture Models with Applications to N...
Quantum Annealing for Dirichlet Process Mixture Models with Applications to N...Shu Tanaka
 

Similaire à Replica exchange MCMC (20)

DSP_FOEHU - MATLAB 02 - The Discrete-time Fourier Analysis
DSP_FOEHU - MATLAB 02 - The Discrete-time Fourier AnalysisDSP_FOEHU - MATLAB 02 - The Discrete-time Fourier Analysis
DSP_FOEHU - MATLAB 02 - The Discrete-time Fourier Analysis
 
Applied Algorithms and Structures week999
Applied Algorithms and Structures week999Applied Algorithms and Structures week999
Applied Algorithms and Structures week999
 
Markov chain Monte Carlo methods and some attempts at parallelizing them
Markov chain Monte Carlo methods and some attempts at parallelizing themMarkov chain Monte Carlo methods and some attempts at parallelizing them
Markov chain Monte Carlo methods and some attempts at parallelizing them
 
Low rank tensor approximation of probability density and characteristic funct...
Low rank tensor approximation of probability density and characteristic funct...Low rank tensor approximation of probability density and characteristic funct...
Low rank tensor approximation of probability density and characteristic funct...
 
numerical.ppt
numerical.pptnumerical.ppt
numerical.ppt
 
Unit 3
Unit 3Unit 3
Unit 3
 
Unit 3
Unit 3Unit 3
Unit 3
 
Lecture: Monte Carlo Methods
Lecture: Monte Carlo MethodsLecture: Monte Carlo Methods
Lecture: Monte Carlo Methods
 
Molecular Solutions For The Set-Partition Problem On Dna-Based Computing
Molecular Solutions For The Set-Partition Problem On Dna-Based ComputingMolecular Solutions For The Set-Partition Problem On Dna-Based Computing
Molecular Solutions For The Set-Partition Problem On Dna-Based Computing
 
Response Surface in Tensor Train format for Uncertainty Quantification
Response Surface in Tensor Train format for Uncertainty QuantificationResponse Surface in Tensor Train format for Uncertainty Quantification
Response Surface in Tensor Train format for Uncertainty Quantification
 
Numerical Methods
Numerical MethodsNumerical Methods
Numerical Methods
 
K-adaptive partitioning for survival data
K-adaptive partitioning for survival dataK-adaptive partitioning for survival data
K-adaptive partitioning for survival data
 
Phase-Type Distributions for Finite Interacting Particle Systems
Phase-Type Distributions for Finite Interacting Particle SystemsPhase-Type Distributions for Finite Interacting Particle Systems
Phase-Type Distributions for Finite Interacting Particle Systems
 
Approximating Value of pi(Π) using Monte Carlo Iterative Method
Approximating Value of pi(Π) using Monte Carlo Iterative MethodApproximating Value of pi(Π) using Monte Carlo Iterative Method
Approximating Value of pi(Π) using Monte Carlo Iterative Method
 
Digital Signal Processing[ECEG-3171]-Ch1_L05
Digital Signal Processing[ECEG-3171]-Ch1_L05Digital Signal Processing[ECEG-3171]-Ch1_L05
Digital Signal Processing[ECEG-3171]-Ch1_L05
 
legendre.pptx
legendre.pptxlegendre.pptx
legendre.pptx
 
Conference ppt
Conference pptConference ppt
Conference ppt
 
Common Fixed Theorems Using Random Implicit Iterative Schemes
Common Fixed Theorems Using Random Implicit Iterative SchemesCommon Fixed Theorems Using Random Implicit Iterative Schemes
Common Fixed Theorems Using Random Implicit Iterative Schemes
 
PART VII.3 - Quantum Electrodynamics
PART VII.3 - Quantum ElectrodynamicsPART VII.3 - Quantum Electrodynamics
PART VII.3 - Quantum Electrodynamics
 
Quantum Annealing for Dirichlet Process Mixture Models with Applications to N...
Quantum Annealing for Dirichlet Process Mixture Models with Applications to N...Quantum Annealing for Dirichlet Process Mixture Models with Applications to N...
Quantum Annealing for Dirichlet Process Mixture Models with Applications to N...
 

Plus de . .

TensorFlowで統計モデリング
TensorFlowで統計モデリングTensorFlowで統計モデリング
TensorFlowで統計モデリング. .
 
Stanの紹介と応用事例(age heapingの統計モデル)
Stanの紹介と応用事例(age heapingの統計モデル)Stanの紹介と応用事例(age heapingの統計モデル)
Stanの紹介と応用事例(age heapingの統計モデル). .
 
MCMCサンプルの使い方 ~見る・決める・探す・発生させる~
MCMCサンプルの使い方 ~見る・決める・探す・発生させる~MCMCサンプルの使い方 ~見る・決める・探す・発生させる~
MCMCサンプルの使い方 ~見る・決める・探す・発生させる~. .
 
階層ベイズモデルで割安mobile PCを探す
階層ベイズモデルで割安mobile PCを探す階層ベイズモデルで割安mobile PCを探す
階層ベイズモデルで割安mobile PCを探す. .
 
順序データでもベイズモデリング
順序データでもベイズモデリング順序データでもベイズモデリング
順序データでもベイズモデリング. .
 
データ解析で割安賃貸物件を探せ!(山手線沿線編) LT
データ解析で割安賃貸物件を探せ!(山手線沿線編) LTデータ解析で割安賃貸物件を探せ!(山手線沿線編) LT
データ解析で割安賃貸物件を探せ!(山手線沿線編) LT. .
 
分布から見た線形モデル・GLM・GLMM
分布から見た線形モデル・GLM・GLMM分布から見た線形モデル・GLM・GLMM
分布から見た線形モデル・GLM・GLMM. .
 
100人のための統計解析 和食レストラン編
100人のための統計解析   和食レストラン編100人のための統計解析   和食レストラン編
100人のための統計解析 和食レストラン編. .
 
とある病んだ院生の体内時計(サーカディアンリズム)
とある病んだ院生の体内時計(サーカディアンリズム)とある病んだ院生の体内時計(サーカディアンリズム)
とある病んだ院生の体内時計(サーカディアンリズム). .
 
『予測にいかす統計モデリングの基本』の売上データの分析をトレースしてみた
『予測にいかす統計モデリングの基本』の売上データの分析をトレースしてみた『予測にいかす統計モデリングの基本』の売上データの分析をトレースしてみた
『予測にいかす統計モデリングの基本』の売上データの分析をトレースしてみた. .
 
BUGSを使うメリット
BUGSを使うメリットBUGSを使うメリット
BUGSを使うメリット. .
 

Plus de . . (11)

TensorFlowで統計モデリング
TensorFlowで統計モデリングTensorFlowで統計モデリング
TensorFlowで統計モデリング
 
Stanの紹介と応用事例(age heapingの統計モデル)
Stanの紹介と応用事例(age heapingの統計モデル)Stanの紹介と応用事例(age heapingの統計モデル)
Stanの紹介と応用事例(age heapingの統計モデル)
 
MCMCサンプルの使い方 ~見る・決める・探す・発生させる~
MCMCサンプルの使い方 ~見る・決める・探す・発生させる~MCMCサンプルの使い方 ~見る・決める・探す・発生させる~
MCMCサンプルの使い方 ~見る・決める・探す・発生させる~
 
階層ベイズモデルで割安mobile PCを探す
階層ベイズモデルで割安mobile PCを探す階層ベイズモデルで割安mobile PCを探す
階層ベイズモデルで割安mobile PCを探す
 
順序データでもベイズモデリング
順序データでもベイズモデリング順序データでもベイズモデリング
順序データでもベイズモデリング
 
データ解析で割安賃貸物件を探せ!(山手線沿線編) LT
データ解析で割安賃貸物件を探せ!(山手線沿線編) LTデータ解析で割安賃貸物件を探せ!(山手線沿線編) LT
データ解析で割安賃貸物件を探せ!(山手線沿線編) LT
 
分布から見た線形モデル・GLM・GLMM
分布から見た線形モデル・GLM・GLMM分布から見た線形モデル・GLM・GLMM
分布から見た線形モデル・GLM・GLMM
 
100人のための統計解析 和食レストラン編
100人のための統計解析   和食レストラン編100人のための統計解析   和食レストラン編
100人のための統計解析 和食レストラン編
 
とある病んだ院生の体内時計(サーカディアンリズム)
とある病んだ院生の体内時計(サーカディアンリズム)とある病んだ院生の体内時計(サーカディアンリズム)
とある病んだ院生の体内時計(サーカディアンリズム)
 
『予測にいかす統計モデリングの基本』の売上データの分析をトレースしてみた
『予測にいかす統計モデリングの基本』の売上データの分析をトレースしてみた『予測にいかす統計モデリングの基本』の売上データの分析をトレースしてみた
『予測にいかす統計モデリングの基本』の売上データの分析をトレースしてみた
 
BUGSを使うメリット
BUGSを使うメリットBUGSを使うメリット
BUGSを使うメリット
 

Dernier

Call Girls In Doddaballapur Road ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Doddaballapur Road ☎ 7737669865 🥵 Book Your One night StandCall Girls In Doddaballapur Road ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Doddaballapur Road ☎ 7737669865 🥵 Book Your One night Standamitlee9823
 
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...amitlee9823
 
➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men 🔝malwa🔝 Escorts Ser...
➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men  🔝malwa🔝   Escorts Ser...➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men  🔝malwa🔝   Escorts Ser...
➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men 🔝malwa🔝 Escorts Ser...amitlee9823
 
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...amitlee9823
 
CebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptxCebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptxolyaivanovalion
 
Mature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxMature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxolyaivanovalion
 
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% SecureCall me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% SecurePooja Nehwal
 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz1
 
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...amitlee9823
 
Week-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionWeek-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionfulawalesam
 
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...amitlee9823
 
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...amitlee9823
 
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
Probability Grade 10 Third Quarter Lessons
Probability Grade 10 Third Quarter LessonsProbability Grade 10 Third Quarter Lessons
Probability Grade 10 Third Quarter LessonsJoseMangaJr1
 
Accredited-Transport-Cooperatives-Jan-2021-Web.pdf
Accredited-Transport-Cooperatives-Jan-2021-Web.pdfAccredited-Transport-Cooperatives-Jan-2021-Web.pdf
Accredited-Transport-Cooperatives-Jan-2021-Web.pdfadriantubila
 
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAl Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAroojKhan71
 
➥🔝 7737669865 🔝▻ Bangalore Call-girls in Women Seeking Men 🔝Bangalore🔝 Esc...
➥🔝 7737669865 🔝▻ Bangalore Call-girls in Women Seeking Men  🔝Bangalore🔝   Esc...➥🔝 7737669865 🔝▻ Bangalore Call-girls in Women Seeking Men  🔝Bangalore🔝   Esc...
➥🔝 7737669865 🔝▻ Bangalore Call-girls in Women Seeking Men 🔝Bangalore🔝 Esc...amitlee9823
 

Dernier (20)

Predicting Loan Approval: A Data Science Project
Predicting Loan Approval: A Data Science ProjectPredicting Loan Approval: A Data Science Project
Predicting Loan Approval: A Data Science Project
 
Call Girls In Doddaballapur Road ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Doddaballapur Road ☎ 7737669865 🥵 Book Your One night StandCall Girls In Doddaballapur Road ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Doddaballapur Road ☎ 7737669865 🥵 Book Your One night Stand
 
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
 
➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men 🔝malwa🔝 Escorts Ser...
➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men  🔝malwa🔝   Escorts Ser...➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men  🔝malwa🔝   Escorts Ser...
➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men 🔝malwa🔝 Escorts Ser...
 
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
 
CebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptxCebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptx
 
Mature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxMature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptx
 
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% SecureCall me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signals
 
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
 
Week-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionWeek-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interaction
 
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...
 
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
 
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Probability Grade 10 Third Quarter Lessons
Probability Grade 10 Third Quarter LessonsProbability Grade 10 Third Quarter Lessons
Probability Grade 10 Third Quarter Lessons
 
Accredited-Transport-Cooperatives-Jan-2021-Web.pdf
Accredited-Transport-Cooperatives-Jan-2021-Web.pdfAccredited-Transport-Cooperatives-Jan-2021-Web.pdf
Accredited-Transport-Cooperatives-Jan-2021-Web.pdf
 
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAl Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
 
➥🔝 7737669865 🔝▻ Bangalore Call-girls in Women Seeking Men 🔝Bangalore🔝 Esc...
➥🔝 7737669865 🔝▻ Bangalore Call-girls in Women Seeking Men  🔝Bangalore🔝   Esc...➥🔝 7737669865 🔝▻ Bangalore Call-girls in Women Seeking Men  🔝Bangalore🔝   Esc...
➥🔝 7737669865 🔝▻ Bangalore Call-girls in Women Seeking Men 🔝Bangalore🔝 Esc...
 
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get CytotecAbortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
 
Anomaly detection and data imputation within time series
Anomaly detection and data imputation within time seriesAnomaly detection and data imputation within time series
Anomaly detection and data imputation within time series
 

Replica exchange MCMC

  • 1. Replica exchange MCMC with Stan and R Kentaro Matsuura June 4, 2016 Tokyo.Stan
  • 2. Example data • N = 50 # number of data points 2
  • 3. Model (Assumptions) • 𝑌 𝑛 ~ Normal sin 𝛽 𝑋 𝑛 , 𝜎 𝑌 • angular rate: 𝛽 ~ Normal+ 0, 50 • noise scale: 𝜎 𝑌 ~ Student_t+ 4, 0, 5 3 𝑛 = 1, … , 𝑁
  • 6. Result | trace plot 6 This chain seems good. Should I set initial values around (b, s_y)=(24, 0.3) ?
  • 7. By the way A contour map of log-posterior can be visualized. Because the number of parameters is just two in this model. 7 For later explanation, I visualized 𝐸 𝑇 (≈ − log-posterior ) 𝐸: Energy, 𝑇: Temperature higher log-posterior  lower 𝐸 𝑇 previous model is correspond to 𝑇 = 1
  • 8. Contour map of 𝐸/𝑇 (at 𝑇 = 1) 8
  • 9. Contour map of 𝐸/𝑇 (at 𝑇 = 1) 9 around (24, 0.3) 𝐸 ≈ 33 around (0.5, 0.3) 𝐸 ≈ 28
  • 10. 10 Replica exchange MCMC (also known as parallel tempering) Setting initial values is generally difficult.
  • 11. References • Y. Iba, "Extended Ensemble Monte Carlo," Int. J. Mod. Phys. C, 12, pp.623-652, 2001. • Movie by Y. Iba (in Japanese): レプリカ交換MCMC講義 (伊庭幸人) 難易度★★ https://www.youtube.com/watch?v=1c7mQIhEqmQ • Books (in Japanese) – 福島孝治 (2006) サイコロふって積分する方法 確率的情報処理と統 計力学(SGCライブラリ 50) p.60-66. – 伊庭ほか (2005) 計算統計II (統計科学のフロンティア 12) p.74-78 11
  • 12. Overview 12 Monte Carlo Step 𝑇5 𝑇4 𝑇3 𝑇2 𝑇1 = 1 >>>> 𝑁𝑟𝑒𝑝𝑙𝑖𝑐𝑎 = 5
  • 13. Annealing and Heating 13 𝑇ℎ𝑖𝑔ℎ 𝑇 𝑚𝑖𝑑𝑑𝑙𝑒 𝑇1 = 1
  • 14. Sampling from joint distribution • Theoretically, Replica exchange MCMC does sampling from the following joint distribution: 𝑝 𝜽1, … , 𝜽 𝑇 𝑁_𝑟𝑒𝑝𝑙𝑖𝑐𝑎 = 𝑟=1 𝑁_𝑟𝑒𝑝𝑙𝑖𝑐𝑎 𝑝 𝜽 𝑟|𝑇 = 𝑇𝑟 where 𝑝 𝜽 𝑟|𝑇 = 𝑇𝑟 ∝ exp − 𝐸 𝜽 𝑟 𝑇𝑟 14
  • 15. Exchange probability of replicas 𝑝 = min 1, exp − 𝐸 𝑟′ 𝑇𝑟 − 𝐸𝑟 𝑇 𝑟′ exp − 𝐸𝑟 𝑇𝑟 − 𝐸 𝑟′ 𝑇 𝑟′ = min 1, exp 𝐸𝑟 − 𝐸 𝑟′ × 1 𝑇𝑟 − 1 𝑇 𝑟′ 15
  • 16. Pseudo Code 16 set T of replicas: T = (1, T2, T3, ..., TN_replica) set initial values: x = (x0, x0, ..., x0) for e in 1, ..., N_exchange for r in 1, ..., N_replica short sampling started from x[r] at each T[r] end save MCMC samples at T = 1 exchange replicas if p < unif(0,1) for r in 1, ..., N_replica update x[r] end end
  • 18. R Code and Settings • R Code: • 𝑁𝑟𝑒𝑝𝑙𝑖𝑐𝑎 = 10 • 𝑁𝑒𝑥𝑐ℎ𝑎𝑛𝑔𝑒 = 100 • 𝑇 = 1, 1.54, … , 32.37, 50 • 𝑥0 = 𝑏, 𝜎 𝑦 0 = 24. 2, 0.4 • iter=70 and warmup=50 each short sampling (i.e. 20 MCMC samples) 18 𝑁𝑟𝑒𝑝𝑙𝑖𝑐𝑎 needs ≈ 𝑁 geometric progression deep local minimum ☠ https://gist.github.com/MatsuuraKentaro/bccf13af3ba5 2c9d6c379c0032725b91
  • 19. Result | Exchanges of replicas 19
  • 20. Result | 𝐸 (Energy) 20
  • 21. Result | 𝐸 (Energy) 21
  • 22. Result | trace plot (at 𝑇 = 1) 22
  • 23. Discussion • Can I re-use warmup result in Stan? i.e. step size & diagonal elements of inverse mass matrix • How to set iter and warmup of each short sampling? warmup=50 is usually too short as total sampling. But, total warmup is 50*100 in this case. Does it make sense? 23