Model Basics
BFlux.BNN
— TypeBNN(x, y, like::BNNLikelihood, prior::NetworkPrior, init::BNNInitialiser)
Create a Bayesian Neural Network.
Arguments
x
: Explanatory datay
: Dependent variableslike
: A likelihoodprior
: A prior on network parametersinit
: An initilialiser
BFlux.loglikeprior
— FunctionObtain the log of the unnormalised posterior.
BFlux.∇loglikeprior
— FunctionObtain the derivative of the unnormalised log posterior.
BFlux.NetConstructor
— TypeNetConstructor{T, F}
Used to construct a network from a vector.
The NetConstructor
constains all important information to construct a network like the original network from a given vector.
Fields
num_params_net
: Number of network parametersθ
: Vector of network parameters of the original networkstarts
: Vector containing the starting points of each layer in θends
: Vector containing the end points of each layer in θreconstructors
: Vector containing the reconstruction functions for each layer
BFlux.destruct
— Functiondestruct(net::Flux.Chain{T}) where {T}
Destruct a network
Given a Flux.Chain
network, destruct it and create a NetConstructor. Each layer type must implement a destruct method taking the layer and returning a vector containing the original layer parameters, and a function that given a vector of the right length constructs a layer like the original using the parameters given in the vector