find_mode {BayesFluxR} | R Documentation |
Find the MAP of a BNN using SGD
Description
Find the MAP of a BNN using SGD
Usage
find_mode(bnn, optimiser, batchsize, epochs)
Arguments
bnn |
a BNN obtained using |
optimiser |
an optimiser. These start with 'opt.'.
See for example |
batchsize |
batch size |
epochs |
number of epochs to run for |
Value
Returns a vector. Use posterior_predictive
to obtain a prediction using this MAP estimate.
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)
find_mode(bnn, opt.RMSProp(), 10, 100)
## End(Not run)
[Package BayesFluxR version 0.1.3 Index]