BNN {BayesFluxR}R Documentation

Create a Bayesian Neural Network

Description

Create a Bayesian Neural Network

Usage

BNN(x, y, like, prior, init)

Arguments

x

For a Feedforward structure, this must be a matrix of dimensions variables x observations; For a recurrent structure, this must be a tensor of dimensions sequence_length x number_variables x number_sequences; In general, the last dimension is always the dimension over which will be batched.

y

A vector or matrix with observations.

like

Likelihood; See for example likelihood.feedforward_normal

prior

Prior; See for example prior.gaussian

init

Initialiser; See for example initialise.allsame

Value

List with the following content

Examples

## Not run: 
  ## 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)
  sampler <- sampler.SGLD()
  ch <- mcmc(bnn, 10, 1000, sampler)

## End(Not run)



[Package BayesFluxR version 0.1.3 Index]