Julia
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

README.md

Turing.jl

Build Status Build status Coverage Status Turing Turing Gitter Wiki Status

Turing.jl is a Julia library for (universal) probabilistic programming. Current features include:

  • Universal probabilistic programming with an intuitive modelling interface
  • Hamiltonian Monte Carlo (HMC) sampling for differentiable posterior distributions
  • Particle MCMC sampling for complex posterior distributions involving discrete variables and stochastic control flows
  • Gibbs sampling that combines particle MCMC, HMC and many other MCMC algorithms

Here's a simple example showing the package in action:

using Turing
using Mamba:plot, describe
# Define a simple Normal model with unknown mean and variance.
@model gdemo(x) = begin
  s ~ InverseGamma(2,3)
  m ~ Normal(0,sqrt(s))
  x[1] ~ Normal(m, sqrt(s))
  x[2] ~ Normal(m, sqrt(s))
  return s, m
end

#  Run sampler, collect results
c1 = sample(gdemo([1.5, 2]), SMC(1000))
c2 = sample(gdemo([1.5, 2]), PG(10,1000))
c3 = sample(gdemo([1.5, 2]), HMC(1000, 0.1, 5))
c4 = sample(gdemo([1.5, 2]), Gibbs(1000, PG(10, 2, :m), HMC(2, 0.1, 5, :s)))
c5 = sample(gdemo([1.5, 2]), HMCDA(1000, 0.15, 0.65))
c6 = sample(gdemo([1.5, 2]), NUTS(1000,  0.65))

# Summarise results
Mamba.describe(c3)

# Plot results 
p = Mamba.plot(c3)
Mamba.draw(p, fmt=:pdf, filename="gdemo-plot.pdf")

News

Turing.jl is 0.6 compatible now!

Contributing

Turing was originally created and is now managed by Hong Ge. Current and past Turing team members include Hong Ge, Adam Scibior, Matej Balog, Zoubin Ghahramani, Kai Xu, Emma Smith, Emile Mathieu. You can see the full list of on Github: https://github.com/TuringLang/Turing.jl/graphs/contributors.

Turing is an open source project so if you feel you have some relevant skills and are interested in contributing then please do get in touch. See the Contribute wiki page for details on the process. You can contribute by opening issues on Github or implementing things yourself and making a pull request. We would also appreciate example models written using Turing.

Citing Turing.jl

To cite Turing, please refer to the technical report. Sample BibTeX entry is given below:

@inproceedings{turing18,
  title={{T}uring: a language for flexible probabilistic inference},
  author={Ge, Hong and Xu, Kai and Ghahramani, Zoubin},
  booktitle={International Conference on Artificial Intelligence and Statistics},
  pages={1682--1690},
  year={2018}
}