queso-0.57.1
|
Class representing the infinite dimensional Markov chain Monte Carlo sampler. More...
#include <InfiniteDimensionalMCMCSampler.h>
Public Member Functions | |
InfiniteDimensionalMCMCSampler (const BaseEnvironment &env, InfiniteDimensionalMeasureBase &prior, InfiniteDimensionalLikelihoodBase &llhd, InfiniteDimensionalMCMCSamplerOptions *ov) | |
Construct an infinite dimensional MCMC chain with given prior , likelihood llhd , and options ov . More... | |
~InfiniteDimensionalMCMCSampler () | |
Destructor. More... | |
void | step () |
Do one iteration of the Markov chain. More... | |
double | llhd_val () const |
Get the current value of the llhd. More... | |
double | acc_prob () |
Returns current acceptance probability. More... | |
double | avg_acc_prob () |
Returns current average acceptance probability. More... | |
unsigned int | iteration () const |
Returns the current iteration number. More... | |
SharedPtr < InfiniteDimensionalMCMCSampler > ::Type | clone_and_reset () const |
Returns a pointer to new sampler, with all the moments reset. More... | |
Private Member Functions | |
void | _propose () |
void | _metropolis_hastings () |
void | _update_moments () |
void | _write_state () |
hid_t | _create_scalar_dataset (const std::string &name) |
void | _append_scalar_dataset (hid_t dset, double data) |
Private Attributes | |
unsigned int | _iteration |
double | _llhd_val |
double | _acc_prob |
double | _avg_acc_prob |
InfiniteDimensionalMeasureBase & | prior |
InfiniteDimensionalLikelihoodBase & | llhd |
InfiniteDimensionalMCMCSamplerOptions * | m_ov |
const BaseEnvironment & | m_env |
SharedPtr< FunctionBase >::Type | current_physical_state |
SharedPtr< FunctionBase >::Type | proposed_physical_state |
SharedPtr< FunctionBase >::Type | current_physical_mean |
SharedPtr< FunctionBase >::Type | current_physical_var |
SharedPtr< FunctionBase >::Type | _delta |
SharedPtr< FunctionBase >::Type | _M2 |
hid_t | _outfile |
hid_t | _acc_dset |
hid_t | _avg_acc_dset |
hid_t | _neg_log_llhd_dset |
hid_t | _L2_norm_samples_dset |
hid_t | _L2_norm_mean_dset |
hid_t | _L2_norm_var_dset |
Class representing the infinite dimensional Markov chain Monte Carlo sampler.
Definition at line 51 of file InfiniteDimensionalMCMCSampler.h.
QUESO::InfiniteDimensionalMCMCSampler::InfiniteDimensionalMCMCSampler | ( | const BaseEnvironment & | env, |
InfiniteDimensionalMeasureBase & | prior, | ||
InfiniteDimensionalLikelihoodBase & | llhd, | ||
InfiniteDimensionalMCMCSamplerOptions * | ov | ||
) |
Construct an infinite dimensional MCMC chain with given prior
, likelihood llhd
, and options ov
.
Definition at line 42 of file InfiniteDimensionalMCMCSampler.C.
References _acc_dset, _acc_prob, _avg_acc_dset, _avg_acc_prob, _create_scalar_dataset(), _delta, _iteration, _L2_norm_mean_dset, _L2_norm_samples_dset, _L2_norm_var_dset, _llhd_val, _M2, _neg_log_llhd_dset, _outfile, QUESO::CheckFilePath(), current_physical_mean, current_physical_state, current_physical_var, QUESO::InfiniteDimensionalLikelihoodBase::evaluate(), QUESO::InfiniteDimensionalMCMCSamplerOptions::m_dataOutputDirName, QUESO::InfiniteDimensionalMCMCSamplerOptions::m_dataOutputFileName, m_env, m_ov, QUESO::InfiniteDimensionalMCMCSamplerOptions::m_prefix, QUESO::BaseEnvironment::optionsInputFileName(), and QUESO::BaseEnvironment::subDisplayFile().
Referenced by clone_and_reset().
QUESO::InfiniteDimensionalMCMCSampler::~InfiniteDimensionalMCMCSampler | ( | ) |
Destructor.
Definition at line 133 of file InfiniteDimensionalMCMCSampler.C.
References _acc_dset, _avg_acc_dset, _L2_norm_mean_dset, _L2_norm_samples_dset, _L2_norm_var_dset, _neg_log_llhd_dset, _outfile, and m_env.
|
private |
Definition at line 268 of file InfiniteDimensionalMCMCSampler.C.
References _iteration, m_env, m_ov, and QUESO::InfiniteDimensionalMCMCSamplerOptions::m_save_freq.
Referenced by _write_state().
|
private |
Definition at line 231 of file InfiniteDimensionalMCMCSampler.C.
References _outfile, and m_env.
Referenced by InfiniteDimensionalMCMCSampler().
|
private |
Definition at line 158 of file InfiniteDimensionalMCMCSampler.C.
References _acc_prob, _llhd_val, current_physical_state, QUESO::InfiniteDimensionalLikelihoodBase::evaluate(), llhd, m_env, proposed_physical_state, QUESO::BaseEnvironment::rngObject(), and QUESO::RngBase::uniformSample().
Referenced by step().
|
private |
Make a proposal from the prior using a standard random walk
Definition at line 146 of file InfiniteDimensionalMCMCSampler.C.
References current_physical_state, QUESO::InfiniteDimensionalMeasureBase::draw(), m_ov, QUESO::InfiniteDimensionalMCMCSamplerOptions::m_rwmh_step, prior, and proposed_physical_state.
Referenced by step().
|
private |
Definition at line 186 of file InfiniteDimensionalMCMCSampler.C.
References _avg_acc_prob, _delta, _iteration, _M2, acc_prob(), avg_acc_prob(), current_physical_mean, current_physical_state, current_physical_var, and iteration().
Referenced by step().
|
private |
Definition at line 304 of file InfiniteDimensionalMCMCSampler.C.
References _acc_dset, _append_scalar_dataset(), _avg_acc_dset, _L2_norm_mean_dset, _L2_norm_samples_dset, _L2_norm_var_dset, _llhd_val, _neg_log_llhd_dset, acc_prob(), avg_acc_prob(), current_physical_mean, current_physical_state, current_physical_var, iteration(), QUESO::InfiniteDimensionalMCMCSamplerOptions::m_dataOutputDirName, m_env, and m_ov.
Referenced by step().
double QUESO::InfiniteDimensionalMCMCSampler::acc_prob | ( | ) |
Returns current acceptance probability.
Definition at line 353 of file InfiniteDimensionalMCMCSampler.C.
References _acc_prob.
Referenced by _update_moments(), and _write_state().
double QUESO::InfiniteDimensionalMCMCSampler::avg_acc_prob | ( | ) |
Returns current average acceptance probability.
Definition at line 358 of file InfiniteDimensionalMCMCSampler.C.
References _avg_acc_prob.
Referenced by _update_moments(), and _write_state().
SharedPtr< InfiniteDimensionalMCMCSampler >::Type QUESO::InfiniteDimensionalMCMCSampler::clone_and_reset | ( | ) | const |
Returns a pointer to new sampler, with all the moments reset.
Definition at line 338 of file InfiniteDimensionalMCMCSampler.C.
References _acc_prob, _llhd_val, current_physical_state, InfiniteDimensionalMCMCSampler(), llhd, m_env, m_ov, prior, and proposed_physical_state.
unsigned int QUESO::InfiniteDimensionalMCMCSampler::iteration | ( | ) | const |
Returns the current iteration number.
Definition at line 368 of file InfiniteDimensionalMCMCSampler.C.
References _iteration.
Referenced by _update_moments(), and _write_state().
double QUESO::InfiniteDimensionalMCMCSampler::llhd_val | ( | ) | const |
Get the current value of the llhd.
Definition at line 363 of file InfiniteDimensionalMCMCSampler.C.
References _llhd_val.
void QUESO::InfiniteDimensionalMCMCSampler::step | ( | ) |
Do one iteration of the Markov chain.
Definition at line 219 of file InfiniteDimensionalMCMCSampler.C.
References _iteration, _metropolis_hastings(), _propose(), _update_moments(), _write_state(), m_ov, and QUESO::InfiniteDimensionalMCMCSamplerOptions::m_save_freq.
|
private |
Definition at line 130 of file InfiniteDimensionalMCMCSampler.h.
Referenced by _write_state(), InfiniteDimensionalMCMCSampler(), and ~InfiniteDimensionalMCMCSampler().
|
private |
Definition at line 90 of file InfiniteDimensionalMCMCSampler.h.
Referenced by _metropolis_hastings(), acc_prob(), clone_and_reset(), and InfiniteDimensionalMCMCSampler().
|
private |
Definition at line 131 of file InfiniteDimensionalMCMCSampler.h.
Referenced by _write_state(), InfiniteDimensionalMCMCSampler(), and ~InfiniteDimensionalMCMCSampler().
|
private |
Definition at line 93 of file InfiniteDimensionalMCMCSampler.h.
Referenced by _update_moments(), avg_acc_prob(), and InfiniteDimensionalMCMCSampler().
|
private |
Definition at line 121 of file InfiniteDimensionalMCMCSampler.h.
Referenced by _update_moments(), and InfiniteDimensionalMCMCSampler().
|
private |
Definition at line 84 of file InfiniteDimensionalMCMCSampler.h.
Referenced by _append_scalar_dataset(), _update_moments(), InfiniteDimensionalMCMCSampler(), iteration(), and step().
|
private |
Definition at line 134 of file InfiniteDimensionalMCMCSampler.h.
Referenced by _write_state(), InfiniteDimensionalMCMCSampler(), and ~InfiniteDimensionalMCMCSampler().
|
private |
Definition at line 133 of file InfiniteDimensionalMCMCSampler.h.
Referenced by _write_state(), InfiniteDimensionalMCMCSampler(), and ~InfiniteDimensionalMCMCSampler().
|
private |
Definition at line 135 of file InfiniteDimensionalMCMCSampler.h.
Referenced by _write_state(), InfiniteDimensionalMCMCSampler(), and ~InfiniteDimensionalMCMCSampler().
|
private |
Definition at line 87 of file InfiniteDimensionalMCMCSampler.h.
Referenced by _metropolis_hastings(), _write_state(), clone_and_reset(), InfiniteDimensionalMCMCSampler(), and llhd_val().
|
private |
Definition at line 124 of file InfiniteDimensionalMCMCSampler.h.
Referenced by _update_moments(), and InfiniteDimensionalMCMCSampler().
|
private |
Definition at line 132 of file InfiniteDimensionalMCMCSampler.h.
Referenced by _write_state(), InfiniteDimensionalMCMCSampler(), and ~InfiniteDimensionalMCMCSampler().
|
private |
Definition at line 127 of file InfiniteDimensionalMCMCSampler.h.
Referenced by _create_scalar_dataset(), InfiniteDimensionalMCMCSampler(), and ~InfiniteDimensionalMCMCSampler().
|
private |
Definition at line 115 of file InfiniteDimensionalMCMCSampler.h.
Referenced by _update_moments(), _write_state(), and InfiniteDimensionalMCMCSampler().
|
private |
Definition at line 109 of file InfiniteDimensionalMCMCSampler.h.
Referenced by _metropolis_hastings(), _propose(), _update_moments(), _write_state(), clone_and_reset(), and InfiniteDimensionalMCMCSampler().
|
private |
Definition at line 118 of file InfiniteDimensionalMCMCSampler.h.
Referenced by _update_moments(), _write_state(), and InfiniteDimensionalMCMCSampler().
|
private |
Definition at line 100 of file InfiniteDimensionalMCMCSampler.h.
Referenced by _metropolis_hastings(), and clone_and_reset().
|
private |
Definition at line 106 of file InfiniteDimensionalMCMCSampler.h.
Referenced by _append_scalar_dataset(), _create_scalar_dataset(), _metropolis_hastings(), _write_state(), clone_and_reset(), InfiniteDimensionalMCMCSampler(), and ~InfiniteDimensionalMCMCSampler().
|
private |
Definition at line 103 of file InfiniteDimensionalMCMCSampler.h.
Referenced by _append_scalar_dataset(), _propose(), _write_state(), clone_and_reset(), InfiniteDimensionalMCMCSampler(), and step().
|
private |
Definition at line 96 of file InfiniteDimensionalMCMCSampler.h.
Referenced by _propose(), and clone_and_reset().
|
private |
Definition at line 112 of file InfiniteDimensionalMCMCSampler.h.
Referenced by _metropolis_hastings(), _propose(), and clone_and_reset().