likelihood.feedforward_normal: Use a Normal likelihood for a Feedforward network

View source: R/likelihoods.R

likelihood.feedforward_normalR Documentation

Use a Normal likelihood for a Feedforward network

Description

This creates a likelihood of the form

y_i \sim Normal(net(x_i), \sigma)\;\forall i=1,...,N

where the x_i is fed through the network in a standard feedforward way.

Usage

likelihood.feedforward_normal(chain, sig_prior)

Arguments

chain

Network structure obtained using link{Chain}

sig_prior

A prior distribution for sigma defined using Gamma, link{InverGamma}, Truncated, Normal

Value

A list containing the following

  • juliavar - julia variable containing the likelihood

  • juliacode - julia code used to create the likelihood

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.