Variational Inference

bbb(args...; kwargs...)

Use Bayes By Backprop to find Variational Approximation to BNN.

This was proposed in Blundell, C., Cornebise, J., Kavukcuoglu, K., & Wierstra, D. (2015, June). Weight uncertainty in neural network. In International conference on machine learning (pp. 1613-1622). PMLR.


  • bnn::BNN: The Bayesian NN
  • batchsize::Int: Batchsize
  • epochs::Int: Epochs

Keyword Arguments

  • mc_samples::Int=1: Over how many gradients should be averaged?
  • shuffle::Bool=true: Should observations be shuffled after each epoch?
  • partial::Bool=true: Can the last batch be smaller than batchsize?
  • showprogress::Bool=true: Show progress bar?
  • opt=Flux.ADAM(): Must be an optimiser of type Flux.Optimiser
  • n_samples_convergence::Int=10: After each epoch the loss is calculated and kept track of using an average of n_samples_convergence samples.