25 #ifndef _MCMC_SAMPLER_HPP_ 26 #define _MCMC_SAMPLER_HPP_ 28 #include <boost/scoped_ptr.hpp> 81 void run(vectord &Xnext);
83 vectord getParticle(
size_t i);
85 void printParticles();
88 void randomJump(vectord &x);
89 void burnOut(vectord &x);
90 void sliceSample(vectord &x);
92 boost::scoped_ptr<RBOptimizableWrapper> obj;
102 randEngine& mtRandom;
113 { nSamples = nParticles; };
116 { nBurnOut = nParticles; };
118 inline vectord MCMCSampler::getParticle(
size_t i)
119 {
return mParticles[i]; };
121 inline void MCMCSampler::printParticles()
123 for(
size_t i=0; i<mParticles.size(); ++i)
125 FILE_LOG(logDEBUG) << i <<
"->" << mParticles[i]
126 <<
" | Log-lik " << -obj->evaluate(mParticles[i]);
Namespace of the library interface.
Abstract class for optimizable objects.
Boost types for random number generation.
Markov Chain Monte Carlo sampler.
void run(vectord &Xnext)
Compute the set of particles according to the target PDF.
void setNParticles(size_t nParticles)
Sets the number of particles that are stored.
void setNBurnOut(size_t nParticles)
Usually, the initial samples of any MCMC method are biased and they are discarded.
void setAlgorithm(McmcAlgorithms newAlg)
Sets the sampling algorithm (slice, MH, etc.)