Bayesian supervised deep learning with TensorFlow
Some of the features of Aboleth:
- Bayesian fully-connected, embedding and convolutional layers using SGVB  for inference.
- Random Fourier and arc-cosine features for approximate Gaussian processes. Optional variational optimisation of these feature weights as per .
- Imputation layers with parameters that are learned as part of a model.
- Very flexible construction of networks, e.g. multiple inputs, ResNets etc.
- Optional maximum-likelihood type II inference for model parameters such as weight priors/regularizers and regression observation noise.
The purpose of Aboleth is to provide a set of high performance and light weight components for building Bayesian neural nets and approximate (deep) Gaussian process computational graphs. We aim for minimal abstraction over pure TensorFlow, so you can still assign parts of the computational graph to different hardware, use your own data feeds/queues, and manage your own sessions etc.
Here is an example of building a simple BNN classifier with one hidden layer and Normal prior/posterior distributions on the network weights:
import tensorflow as tf import aboleth as ab # Define the network, ">>" implements function composition, # the InputLayer gives a kwarg for this network, and # allows us to specify the number of samples for stochastic # gradient variational Bayes. layers = ( ab.InputLayer(name="X", n_samples=5) >> ab.DenseVariational(output_dim=100) >> ab.Activation(tf.nn.relu) >> ab.DenseVariational(output_dim=1) >> ab.Activation(tf.nn.sigmoid) ) X_ = tf.placeholder(tf.float, shape=(None, D)) Y_ = tf.placeholder(tf.float, shape=(None, 1)) # Define the likelihood model likelihood = ab.likelihoods.Bernoulli() # Build the network, net, and the parameter regularization, kl net, kl = net(X=X_) # Build the final loss function to use with TensorFlow train loss = ab.elbo(net, Y_, N, kl, likelihood) # Now your TensorFlow training code here! ...
At the moment the focus of Aboleth is on supervised tasks, however this is subject to change in subsequent releases if there is interest in this capability.
To get up and running quickly you can use pip and get the Aboleth package from PyPI:
$ pip install aboleth
For the best performance on your architecture, we recommend installing TensorFlow from sources.
Or, to install additional dependencies required by the demos:
$ pip install aboleth[demos]
To install in develop mode with packages required for development we recommend you clone the repository from GitHub:
$ git clone firstname.lastname@example.org:data61/aboleth.git
Then in the directory that you cloned into, issue the following:
$ pip install -e .[dev]
The full project documentation can be found on readthedocs.
|||(1, 2) Cutajar, K. Bonilla, E. Michiardi, P. Filippone, M. Random Feature Expansions for Deep Gaussian Processes. In ICML, 2017.|
|||(1, 2) Kingma, D. P. and Welling, M. Auto-encoding variational Bayes. In ICLR, 2014.|
Copyright 2017 CSIRO (Data61)
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.