MUQ  0.4.3
muq::SamplingAlgorithms::MHKernel Class Reference

An implementation of the standard Metropolis-Hastings transition kernel. More...

#include <MHKernel.h>

Inheritance diagram for muq::SamplingAlgorithms::MHKernel:

Detailed Description

An implementation of the standard Metropolis-Hastings transition kernel.

Configuration Parameters:

Parameter Key Type Default Value Description
"Proposal" String - A string pointing to a block of proposal options.

Definition at line 22 of file MHKernel.h.

Public Member Functions

 MHKernel (boost::property_tree::ptree const &pt, std::shared_ptr< AbstractSamplingProblem > problem)
 
 MHKernel (boost::property_tree::ptree const &pt, std::shared_ptr< AbstractSamplingProblem > problem, std::shared_ptr< MCMCProposal > proposalIn)
 
virtual ~MHKernel ()=default
 
virtual std::shared_ptr< MCMCProposalProposal ()
 
virtual void PostStep (unsigned int const t, std::vector< std::shared_ptr< SamplingState >> const &state) override
 Allow the kernel to adapt given a new state. More...
 
virtual std::vector< std::shared_ptr< SamplingState > > Step (unsigned int const t, std::shared_ptr< SamplingState > prevState) override
 
virtual void PrintStatus (std::string prefix) const override
 
virtual double AcceptanceRate () const
 
virtual void SetBlockInd (int newBlockInd) override
 
- Public Member Functions inherited from muq::SamplingAlgorithms::TransitionKernel
 TransitionKernel (boost::property_tree::ptree const &pt, std::shared_ptr< AbstractSamplingProblem > problem)
 
virtual ~TransitionKernel ()=default
 
virtual void SetCommunicator (std::shared_ptr< parcer::Communicator > newcomm)
 
virtual void PreStep (unsigned int const t, std::shared_ptr< SamplingState > state)
 Allow the kernel to preprocess the current step. More...
 
virtual void PrintStatus () const
 
virtual int GetBlockInd () const
 
virtual std::shared_ptr< AbstractSamplingProblem > const & Problem () const
 

Additional Inherited Members

- Public Types inherited from muq::SamplingAlgorithms::TransitionKernel
typedef boost::function< std::shared_ptr< TransitionKernel >boost::property_tree::ptree, std::shared_ptr< AbstractSamplingProblem >)> TransitionKernelConstructor
 
typedef std::map< std::string, TransitionKernelConstructorTransitionKernelMap
 
- Static Public Member Functions inherited from muq::SamplingAlgorithms::TransitionKernel
static std::shared_ptr< TransitionKernelConstruct (boost::property_tree::ptree const &pt, std::shared_ptr< AbstractSamplingProblem > problem)
 Static constructor for the transition kernel. More...
 
static std::shared_ptr< TransitionKernelMapGetTransitionKernelMap ()
 

Constructor & Destructor Documentation

◆ MHKernel() [1/2]

muq::SamplingAlgorithms::MHKernel::MHKernel ( boost::property_tree::ptree const &  pt,
std::shared_ptr< AbstractSamplingProblem problem 
)

◆ MHKernel() [2/2]

muq::SamplingAlgorithms::MHKernel::MHKernel ( boost::property_tree::ptree const &  pt,
std::shared_ptr< AbstractSamplingProblem problem,
std::shared_ptr< MCMCProposal proposalIn 
)

◆ ~MHKernel()

virtual muq::SamplingAlgorithms::MHKernel::~MHKernel ( )
virtualdefault

Member Function Documentation

◆ AcceptanceRate()

virtual double muq::SamplingAlgorithms::MHKernel::AcceptanceRate ( ) const
inlinevirtual

Definition at line 43 of file MHKernel.h.

References numAccepts, and numCalls.

◆ PostStep()

void MHKernel::PostStep ( unsigned int const  t,
std::vector< std::shared_ptr< SamplingState >> const &  state 
)
overridevirtual

Allow the kernel to adapt given a new state.

By default this function does nothing but children can override it to adapt the kernel

Parameters
[in]tThe current step
[in]stateThe current state

Reimplemented from muq::SamplingAlgorithms::TransitionKernel.

Definition at line 36 of file MHKernel.cpp.

References proposal.

◆ PrintStatus()

void MHKernel::PrintStatus ( std::string  prefix) const
overridevirtual

Reimplemented from muq::SamplingAlgorithms::TransitionKernel.

Definition at line 97 of file MHKernel.cpp.

References numAccepts, and numCalls.

◆ Proposal()

virtual std::shared_ptr<MCMCProposal> muq::SamplingAlgorithms::MHKernel::Proposal ( )
inlinevirtual

Definition at line 34 of file MHKernel.h.

References proposal.

◆ SetBlockInd()

virtual void muq::SamplingAlgorithms::MHKernel::SetBlockInd ( int  newBlockInd)
inlineoverridevirtual

◆ Step()

std::vector< std::shared_ptr< SamplingState > > MHKernel::Step ( unsigned int const  t,
std::shared_ptr< SamplingState prevState 
)
overridevirtual

Member Data Documentation

◆ numAccepts

unsigned int muq::SamplingAlgorithms::MHKernel::numAccepts = 0
protected

Definition at line 51 of file MHKernel.h.

Referenced by AcceptanceRate(), PrintStatus(), and Step().

◆ numCalls

unsigned int muq::SamplingAlgorithms::MHKernel::numCalls = 0
protected

Definition at line 50 of file MHKernel.h.

Referenced by AcceptanceRate(), PrintStatus(), and Step().

◆ proposal

std::shared_ptr<MCMCProposal> muq::SamplingAlgorithms::MHKernel::proposal
protected

The documentation for this class was generated from the following files: