Stan  2.5.0
probability, sampling & optimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
adapt_dense_e_static_hmc.hpp
Go to the documentation of this file.
1 #ifndef STAN__MCMC__ADAPT__DENSE__E__STATIC__HMC__BETA
2 #define STAN__MCMC__ADAPT__DENSE__E__STATIC__HMC__BETA
3 
6 
7 namespace stan {
8 
9  namespace mcmc {
10 
11  // Hamiltonian Monte Carlo on a
12  // Euclidean manifold with dense metric,
13  // static integration time,
14  // and adaptive stepsize
15 
16  template <typename M, class BaseRNG>
17  class adapt_dense_e_static_hmc: public dense_e_static_hmc<M, BaseRNG>,
18  public stepsize_covar_adapter {
19 
20  public:
21 
22  adapt_dense_e_static_hmc(M &m, BaseRNG& rng,
23  std::ostream* o = &std::cout, std::ostream* e = 0):
24  dense_e_static_hmc<M, BaseRNG>(m, rng, o, e),
25  stepsize_covar_adapter(m.num_params_r())
26  {};
27 
29 
30  sample transition(sample& init_sample) {
31 
33 
34  if (this->adapt_flag_) {
35 
37  this->update_L_();
38 
39  bool update = this->covar_adaptation_.learn_covariance(this->z_.mInv, this->z_.q);
40 
41  if(update) {
42  this->init_stepsize();
43  this->update_L_();
44 
45  this->stepsize_adaptation_.set_mu(log(10 * this->nom_epsilon_));
47  }
48 
49  }
50 
51  return s;
52 
53  }
54 
58  }
59 
60  };
61 
62  } // mcmc
63 
64 } // stan
65 
66 
67 #endif
void complete_adaptation(double &epsilon)
double accept_stat() const
Definition: sample.hpp:46
void learn_stepsize(double &epsilon, double adapt_stat)
bool learn_covariance(Eigen::MatrixXd &covar, const Eigen::VectorXd &q)
adapt_dense_e_static_hmc(M &m, BaseRNG &rng, std::ostream *o=&std::cout, std::ostream *e=0)
virtual void disengage_adaptation()
double e()
Return the base of the natural logarithm.
Definition: constants.hpp:86
fvar< T > log(const fvar< T > &x)
Definition: log.hpp:15

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