資源簡介
MCMC算法,metropolis hasting算法的實現代碼,可正常運行,加入了自己的注釋,對于正在學習MCMC采樣的同學會提供一定的幫助。
代碼片段和文件信息
function?[samples?naccept]?=?MH(target?proposal?xinit?Nsamples?targetArgs?proposalArgs?proposalProb)
%?Metropolis-Hastings?algorithm
%?Inputs
%?target?returns?the?unnormalized?log?posterior?called?as?’p?=?exp(target(x?targetArgs{:}))’
%?proposal?is?a?fn?as?’xprime?=?proposal(x?proposalArgs{:})’?where?x?is?a?1xd?vector
%?xinit?is?a?1xd?vector?specifying?the?initial?state
%?Nsamples? -?total?number?of?samples?to?draw
%?targetArgs? -?cell?array?passed?to?target
%?proposalArgs? -?cell?array?passed?to?proposal
%?proposalProb? -?optional?fn?called?as?’p?=?proposalProb(xxprime?proposalArgs{:})’
%?computes?q(xprime|x).?Not?needed?for?symmetric?proposals?(Metropolis?algorithm)
%
%?Outputs
%?samples(s:)?is?the?s’th?sample?(of?size?d)
%?naccept?=?number?of?accepted?move
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????2289??2014-10-26?13:50??MCMC_Metropolis_hasting_1D\MH.m
?????文件???????2037??2014-10-26?14:03??MCMC_Metropolis_hasting_1D\mhDemoMOG.m
?????文件????????560??2014-10-26?13:14??MCMC_Metropolis_hasting_1D\mogProb.m
?????文件?????????92??2014-10-26?13:19??MCMC_Metropolis_hasting_1D\proposal.m
?????文件????????159??2014-10-26?13:19??MCMC_Metropolis_hasting_1D\proposalProb.m
?????文件????????127??2014-10-26?13:14??MCMC_Metropolis_hasting_1D\target.m
?????目錄??????????0??2015-06-19?14:21??MCMC_Metropolis_hasting_1D
-----------?---------??----------?-----??----
?????????????????5264????????????????????7
評論
共有 條評論