KJB
|
#include <sample_step.h>
Public Types | |
typedef Abstract_mh_step < Model, Proposer_type > | Parent |
typedef Parent::Target_distribution | Target_distribution |
typedef Proposer_type | Proposer |
Public Types inherited from Abstract_mh_step< Model, Proposer_type > | |
typedef Model_evaluator< Model > ::Type | Target_distribution |
Public Member Functions | |
Basic_mh_step (const Target_distribution &log_target, const Proposer_type &proposer) | |
Initializes target and proposer functors (or functions) to the given arguments. More... | |
virtual | ~Basic_mh_step () |
Initializes target and proposer functors (or functions) to the given arguments. More... | |
virtual Mh_proposal_result | propose (const Model &m, Model &m_p) const |
Assignment. More... | |
virtual double | l_target (const Model &m) const |
Evaluate the log-target distribution for the given model. More... | |
void | set_target (const Target_distribution &target) |
void | record_extra (bool enable) |
void | set_temperature (double T) |
virtual double | get_temperature () const |
Public Member Functions inherited from Abstract_mh_step< Model, Proposer_type > | |
BOOST_CONCEPT_ASSERT ((BaseModel< Model >)) | |
Step_log< Model > | run_step (Model &m, double lt_m, double &accept_prob, boost::optional< Model & > proposed_state_out=boost::none) const |
Runs a step of Metropolis-Hastings on a model m. More... | |
virtual Step_log< Model > | operator() (Model &m, double lt_m) const |
Runs a step of Metropolis-Hastings on a model m. More... | |
virtual | ~Abstract_mh_step () |
virtual void | on_accept () const |
virtual void | on_reject () const |
Protected Member Functions | |
virtual bool | record_extra () const |
Proposer_type & | get_proposer_ () |
Protected Attributes | |
Target_distribution | m_log_target |
Proposer_type | m_proposer |
double | m_temperature |
bool | m_record_extra |
Protected Attributes inherited from Abstract_mh_step< Model, Proposer_type > | |
boost::optional< Model > | tmp_model_ |
Model | The model type. Must comply with BaseModel concept. |
Basic_mh_step is a functor that runs a single step of metropolis hastings on a model.
This class is a subclass of the abstract class Abstract_mh_step. It implements the get_log_target and get_proposer member functions in the obvious way: it returns references to private members of the correct types. These members are initialized from references received in the constructor.
typedef Abstract_mh_step<Model, Proposer_type> Basic_mh_step< Model, Proposer_type >::Parent |
typedef Proposer_type Basic_mh_step< Model, Proposer_type >::Proposer |
typedef Parent::Target_distribution Basic_mh_step< Model, Proposer_type >::Target_distribution |
|
inline |
Initializes target and proposer functors (or functions) to the given arguments.
log_target | Target_distribution object used to initialize internal target distribution used in operator(). |
proposer | Proposer_type object used to initialize internal proposer used in operator(). |
|
inlinevirtual |
Initializes target and proposer functors (or functions) to the given arguments.
log_target | Target_distribution object used to initialize internal target distribution used in operator(). |
proposer | Proposer_type object used to initialize internal proposer used in operator(). |
default_model | If Model is not default-constructible, you need to provide a model to initialize new models. Copy-constructor |
|
inlineprotected |
|
inlinevirtual |
Reimplemented from Abstract_mh_step< Model, Proposer_type >.
|
inlinevirtual |
Evaluate the log-target distribution for the given model.
Implements Abstract_mh_step< Model, Proposer_type >.
|
inlinevirtual |
|
inline |
Set to true if the step should store intermediate values and return them in the Step_log. Useful for debugging, but incurs a small performance penalty.
|
inlineprotectedvirtual |
returns true if the step should store intermediate values and return them in the Step_log. Useful for debugging, but incurs a small performance penalty.
Reimplemented from Abstract_mh_step< Model, Proposer_type >.
|
inline |
Set the log-target distribution. Generally it's preferred to set this in the constructor, but this is occasionally useful when implementing copy constructor that needs to copy everything except the target, which you'll set yourself. This comes up when you're doing fancy stuff with the target distribution, like introducing coupling with other objects, and you need to maintain correct references, which the default copy constructor won't let you do.
|
inline |
Set annealing temperature. Increases acceptance rate; proposal distribution is unaffected
|
protected |
|
protected |
|
protected |
|
protected |