initialise.allsame: Initialises all parameters of the network, all hyper...

View source: R/initialisers.R

initialise.allsameR Documentation

Initialises all parameters of the network, all hyper parameters of the prior and all additional parameters of the likelihood by drawing random values from 'dist'.

Description

Initialises all parameters of the network, all hyper parameters of the prior and all additional parameters of the likelihood by drawing random values from 'dist'.

Usage

initialise.allsame(dist, like, prior)

Arguments

dist

A distribution; See for example Normal

like

A likelihood; See for example likelihood.feedforward_normal

prior

A prior; See for example prior.gaussian

Value

A list containing the following

  • 'juliavar' - julia variable storing the initialiser

  • 'juliacode' - julia code used to create the initialiser

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)
  BNN.totparams(bnn)

## End(Not run)


enweg/BFluxR documentation built on Jan. 27, 2024, 6:43 p.m.