Stochastic Gradient Markov Chain Monte Carlo and Optimisation
Switch branches/tags
Nothing to show
Clone or download
Latest commit 8499b4e Mar 21, 2017
Failed to load latest commit information.
examples add MF Mar 21, 2017
src add MF Mar 21, 2017
tests add MF Mar 21, 2017
.gitignore Initial commit Dec 3, 2016
LICENSE Initial commit Dec 3, 2016 Update Mar 21, 2017
install.jl first version Feb 28, 2017


Stochastic Gradient Markov Chain Monte Carlo and Optimisation

SGMCMC.jl is a Julia test bed for stochastic gradient Markov chain Monte Carlo algorithms. There is a large range of SGMCMC algorithms but it can be difficult for practitioners to get a feel for different algorithms. We provide a simple package to try out different samplers on commonly used models. SGMCMC.jl is can also speed up experiments for researchers working on SGMCMC. It is simple to define new samplers and test them against existing ones on a number of commonly used models.


Currently SGMCMC.jl includes:

  • Stochastic gradient Langevin dynamics
  • Stochastic gradient Hamiltonian Monte Carlo
  • Stochastic gradient Nosé-Hoover thermostat
  • stochastic gradient relativistic HMC
  • stochastic gradient relativistic thermostat
  • preconditioned SGLD
  • SGD methods to compare
  • HMC as a baseline


Current Models are

  • Some toy models
  • Bayesian logistic regression
  • Bayesian neural networks for classification and regression
  • Matrix factorization for collaborative filtering

Getting started

To install the required packages please run julia install.jl.

To run a SGMCMC sampler in SGMCMC.jl you need three components:

- the model: a DataModel object `dm`, encompassing the data as well as the model structure
- the (stochastic) gradient function: `grad = DataModel.getgrad(dm)`
- a sampler state `s`

The function sample!(s,grad) then performs a single update of a sampler state.

Check out some of the examples or have a look at the code!


This package was put together by Leonard Hasenclever based research code from various projects in the Oxford Machine Learning and Computational Statistics group. Contributors include Valerio Perrone, Xiaoyu Lu, Yee Whye Teh and Sebastian Vollmer. Some of the matrix factorization code is based on code by Sungjin Ahn.