Class mcmc_stepper_base (o2scl)¶
-
template<class func_t, class data_t, class vec_t>
class mcmc_stepper_base¶ Stepper for o2scl::mcmc_para_base [pure virtual].
The user-specified function, should have a signature similar to
whereint f(size_t nv, const vec_t &x, double log_wgt, data_t &dat)
nv
is the number of parameters,x
is the vector of parameters,log_wgt
is the log likelihood, anddat
is the output data object. A return value of zero indicates success, while any return value other than zero indicates failure.Subclassed by o2scl::mcmc_stepper_rw< func_t, data_t, ubvector >, o2scl::mcmc_stepper_hmc< func_t, data_t, vec_t, grad_t, vec_bool_t >, o2scl::mcmc_stepper_mh< func_t, data_t, vec_t, mat_t, prop_t >, o2scl::mcmc_stepper_rw< func_t, data_t, vec_t >
Public Functions
-
inline mcmc_stepper_base()¶
-
inline virtual void write_params(o2scl_hdf::hdf_file &hf)¶
Write stepper parameters to the HDF5 file.
-
virtual const char *step_type() = 0¶
Stepper type.
-
inline void check_bounds(size_t i_thread, size_t n_params, vec_t &v, vec_t &low, vec_t &high, int &func_ret, int verbose)¶
Check that
v
is betweenlow
andhigh
.This function checks that the parameters are within limits. If they are not, then
func_ret
is set to mcmc_skip. Otherwise,func_ret
is unchanged. Ifverbose
is greater than or equal to 3, then a out-of-bounds warning is printed to the screen. Generally, if a point is out of bounds, this just means that the MCMC algorithm will reject this point as if it had a very small likelihood.
-
virtual void step(size_t i_thread, size_t n_params, func_t &f, vec_t ¤t, vec_t &next, double w_current, double &w_next, vec_t &low, vec_t &high, int &func_ret, bool &accept, data_t &dat, rng<> &r, int verbose) = 0¶
Construct a step.
This function constructs
next
andw_next
, the next point and log weight in parameter space. The objective functionf
is then evaluated at the new point, the return value is placed infunc_ret
, and the step acceptance or rejection is stored inaccept
.
-
inline virtual ~mcmc_stepper_base()¶
-
inline mcmc_stepper_base()¶