Stan  2.10.0
probability, sampling & optimization
init_nuts.hpp
Go to the documentation of this file.
1 #ifndef STAN_SERVICES_SAMPLE_INIT_NUTS_HPP
2 #define STAN_SERVICES_SAMPLE_INIT_NUTS_HPP
3 
8 
9 namespace stan {
10  namespace services {
11  namespace sample {
12 
13  template<class Sampler>
15  stan::services::argument* algorithm) {
18  (algorithm->arg("hmc"));
19 
22  (algorithm->arg("hmc")->arg("engine")->arg("nuts"));
23 
24  double epsilon
25  = dynamic_cast<stan::services::real_argument*>(hmc->arg("stepsize"))
26  ->value();
27  double epsilon_jitter
28  = dynamic_cast<stan::services::real_argument*>(
29  hmc->arg("stepsize_jitter"))
30  ->value();
31  int max_depth
32  = dynamic_cast<stan::services::int_argument*>(base->arg("max_depth"))
33  ->value();
34 
35  dynamic_cast<Sampler*>(sampler)->set_nominal_stepsize(epsilon);
36  dynamic_cast<Sampler*>(sampler)->set_stepsize_jitter(epsilon_jitter);
37  dynamic_cast<Sampler*>(sampler)->set_max_depth(max_depth);
38 
39  return true;
40  }
41 
42  }
43  }
44 }
45 
46 #endif
bool init_nuts(stan::mcmc::base_mcmc *sampler, stan::services::argument *algorithm)
Definition: init_nuts.hpp:14
void sample(stan::mcmc::base_mcmc *sampler, int num_warmup, int num_samples, int num_thin, int refresh, bool save, stan::services::sample::mcmc_writer< Model, SampleRecorder, DiagnosticRecorder, MessageRecorder > &mcmc_writer, stan::mcmc::sample &init_s, Model &model, RNG &base_rng, const std::string &prefix, const std::string &suffix, std::ostream &o, StartTransitionCallback &callback, interface_callbacks::writer::base_writer &info_writer, interface_callbacks::writer::base_writer &error_writer)
Definition: sample.hpp:17
Probability, optimization and sampling library.
virtual argument * arg(const std::string &name)
Definition: argument.hpp:74
argument * arg(const std::string &name)

     [ Stan Home Page ] © 2011–2016, Stan Development Team.