Skip to main content

Bayesian supervised deep learning with TensorFlow

Project description

circleCI Documentation Status

A bare-bones TensorFlow framework for Bayesian deep learning and Gaussian process approximation [1] with stochastic gradient variational Bayes inference [2].

Features

Some of the features of Aboleth:

  • Bayesian fully-connected, embedding and convolutional layers using SGVB [2] for inference.

  • Random Fourier and arc-cosine features for approximate Gaussian processes. Optional variational optimisation of these feature weights as per [1].

  • 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.

Why?

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 Bayesian neural net 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) >>
)

X_ = tf.placeholder(tf.float, shape=(None, D))
Y_ = tf.placeholder(tf.float, shape=(None, 1))

# Build the network, nn, and the parameter regularization, kl
nn, kl = net(X=X_)

# Define the likelihood model
likelihood = tf.distributions.Bernoulli(logits=nn)

# Build the final loss function to use with TensorFlow train
loss = ab.elbo(likelihood, Y_, N, kl)

# 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.

Installation

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 git@github.com:data61/aboleth.git

Then in the directory that you cloned into, issue the following:

$ pip install -e .[dev]

Getting Started

See the quick start guide to get started. Also see the demos folder for more examples of creating and training algorithms with Aboleth.

The full project documentation can be found on readthedocs.

References

License

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

http://www.apache.org/licenses/LICENSE-2.0

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aboleth-0.6.0.tar.gz (29.1 kB view details)

Uploaded Source

Built Distribution

aboleth-0.6.0-py2.py3-none-any.whl (37.4 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file aboleth-0.6.0.tar.gz.

File metadata

  • Download URL: aboleth-0.6.0.tar.gz
  • Upload date:
  • Size: 29.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for aboleth-0.6.0.tar.gz
Algorithm Hash digest
SHA256 4fc44dada23c0190b821f0ef096ac2d8c80ad21dcc0c7c0caa76547aaebe9d4c
MD5 b0695648d8f5081c6e6f9b10f0263927
BLAKE2b-256 a6c51e171e5ede46ed04af8c2d0a321594f6d5eb0764fcd3ae2d5add427e627c

See more details on using hashes here.

File details

Details for the file aboleth-0.6.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for aboleth-0.6.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 b15da7d6ce926cff6caf61cb63debe1c7daa3dba6b81600c7b420b1cc010f38a
MD5 d94cb88678d853ffe0796826786133b0
BLAKE2b-256 43613c1d57b191c634339051655638e12a67e14544f2741ef50a51cf09523699

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page