Learn R Programming

BayesFluxR (version 0.1.3)

sadapter.DualAverage: Use Dual Averaging like in STAN to tune stepsize

Description

Use Dual Averaging like in STAN to tune stepsize

Usage

sadapter.DualAverage(
  adapt_steps,
  initial_stepsize = 1,
  target_accept = 0.65,
  gamma = 0.05,
  t0 = 10,
  kappa = 0.75
)

Value

list with `juliavar`, `juliacode`, and all given arguments

Arguments

adapt_steps

number of adaptation steps

initial_stepsize

initial stepsize

target_accept

target acceptance ratio

gamma

See STAN manual NUTS paper

t0

See STAN manual or NUTS paper

kappa

See STAN manual or NUTS paper

Examples

Run this code
if (FALSE) {
  ## Needs previous call to `BayesFluxR_setup` which is time
  ## consuming and requires Julia and BayesFlux.jl
  BayesFluxR_setup(installJulia=TRUE, seed=123)
  net <- Chain(Dense(5, 1))
  like <- likelihood.feedforward_normal(net, Gamma(2.0, 0.5))
  prior <- prior.gaussian(net, 0.5)
  init <- initialise.allsame(Normal(0, 0.5), like, prior)
  x <- matrix(rnorm(5*100), nrow = 5)
  y <- rnorm(100)
  bnn <- BNN(x, y, like, prior, init)
  sadapter <- sadapter.DualAverage(100)
  sampler <- sampler.GGMC(sadapter = sadapter)
  ch <- mcmc(bnn, 10, 1000, sampler)
}

Run the code above in your browser using DataLab