sampler_stan_adapt_diag_e_nuts_MCMC Class Reference
Inheritance diagram for sampler_stan_adapt_diag_e_nuts_MCMC:
Collaboration diagram for sampler_stan_adapt_diag_e_nuts_MCMC:
Public Member Functions | |
sampler_stan_adapt_diag_e_nuts_MCMC (int seed, likelihood &L, std::vector< std::string > var_names, size_t dimension) | |
void | set_initial_location (std::vector< double > initial_parameters) |
void | run_sampler (int nsteps, int thin, int refresh, int verbosity=1) |
void | set_adaptation_parameters (int num_adapt, bool save_adapt) |
sets the adaption stuff with the applicable window stuff for stan. More... | |
void | set_stepsize (double step_size) |
void | set_max_depth (int max_depth) |
void | set_delta (double delta) |
void | set_gamma (double gamma) |
Sets the adaptation regularization scale which must be greater than zero [default is 0.05]. | |
void | set_kappa (double kappa) |
void | set_t0 (double t0) |
void | set_window_parameters (unsigned int init_buffer, unsigned int term_buffer, unsigned int window) |
Sets the window parameters for STAN, these rarely need to be changed. | |
void | set_initial_inverse_metric (std::vector< double > inverse_metric) |
Sets the initial metric diagonal, default is vector will with ones, i.e. identity matrix. | |
void | get_chain_state (std::vector< double > ¶meters, std::vector< double > &sample_state) |
void | set_chain_state (std::vector< double > model_values, std::vector< double > state_values) |
void | write_checkpoint (std::ostream &) |
void | read_checkpoint (std::string ckpt_file) |
Restarts the sampler from the state specified in the ckpt_file. More... | |
void | read_checkpoint (std::istream &ckpt_in) |
virtual double | get_rand () |
virtual void | reset_rng_seed (int seed) |
Public Member Functions inherited from sampler_MCMC_base | |
sampler_MCMC_base (int seed, likelihood &L, std::vector< std::string > var_names, size_t dimension) | |
virtual void | set_output_stream (std::string chain_name, std::string state_name, std::string sampler_name, int output_precision=8) |
Sets the output names for the chains and sampler states. This must be implemented in any classes inheriting sampler_exploration_mcmc_base. More... | |
virtual std::vector< double > | find_best_fit (std::string chain_file, std::string state_file) const |
Finds the best fit within provided chain file and returns it. More... | |
virtual std::vector< double > | find_best_fit () const |
Finds the best fit from the chain and state file saved in set_output_stream. More... | |
void | set_checkpoint (int ckpt_stride, std::string ckpt_file) |
Sets the checkpoint/restart functionality. More... | |
virtual void | reset_sampler_step () |
void | reset_likelihood_sum () |
double | get_likelihood_sum () |
void | set_mpi_communicator (MPI_Comm comm) |
Sets the MPI_Comm to be used for the likelihood evaluation. More... | |
void | close_streams () |
Helper function that closes the streams from a sampler. | |
Private Attributes | |
themistan_model | _stan_model |
boost::ecuyer1988 | _stan_rng |
stan::mcmc::adapt_diag_e_nuts< themistan_model, boost::ecuyer1988 > | _stan_sampler |
unsigned int | _init_buffer |
unsigned int | _term_buffer |
unsigned int | _window |
std::vector< double > | _inverse_metric |
std::vector< double > | _initial |
stan::mcmc::sample | _current_sample |
stan::callbacks::stream_logger | _logger |
bool | _adaptation |
bool | _save_adaptation |
int | _nadapt |
int | _start_step |
restart flag. | |
bool | _restart |
Additional Inherited Members | |
Protected Attributes inherited from sampler_MCMC_base | |
int | _seed |
Ran2RNG | _rng |
std::vector< std::string > | _var_names |
size_t | _dimension |
size_t | _step_count |
likelihood * | _L |
std::string | _chain_file |
std::string | _state_file |
std::string | _sampler_file |
std::string | _ckpt_file |
std::ofstream | _chain_out |
std::ofstream | _state_out |
std::ofstream | _sampler_out |
int | _output_precision |
int | _ckpt_stride |
double | _sum_lklhd |
MPI_Comm | _comm |
int | _rank |
Member Function Documentation
|
inlinevirtual |
- Parameters
-
ckpt_file The file where the checkpoint information was saved.
Reimplemented from sampler_MCMC_base.
Here is the call graph for this function:
void set_adaptation_parameters | ( | int | num_adapt, |
bool | save_adapt | ||
) |
- Parameters
-
num_warmup The number of adaptation steps to take. Default is 1000. save_adapt Whether to save the adaptation steps.
- Note
- Be aggressive with adaptation. If HMC is poorly tuned the performance tanks.
void set_delta | ( | double | delta | ) |
Sets the target acceptance rate for nuts [default of 0.8 which is the theoretical optimal result in high dim]
void set_kappa | ( | double | kappa | ) |
Sets the adaptation relaxation scale which must be greater than zero because it should damp. [default is 0.75]
void set_max_depth | ( | int | max_depth | ) |
Sets the max tree depth (max number of leapfrog steps is 2^tree_depth) for the sampler [default 10]
void set_stepsize | ( | double | step_size | ) |
Set the initial step size for the hmc algorithm. [default is 0.1]
void set_t0 | ( | double | t0 | ) |
Sets the adaptation iteration offset, which must be greater than 0 [default is 10]
The documentation for this class was generated from the following files:
- sampling/sampler_stan_adapt_diag_e_nuts_MCMC.h
- sampling/sampler_stan_adapt_diag_e_nuts_MCMC.cpp