Skip to content

fonnesbeck/PyMC3_Oslo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Workshop: Probabilistic Programming using PyMC3

Oslo universitetssykehus HF, June 14, 2016

Binder

Probabilistic Programming allows for automatic Bayesian inference on user-defined probabilistic models. Recent advances in Markov chain Monte Carlo (MCMC) sampling allow inference on increasingly complex models. This class of MCMC, known as Hamiltonian Monte Carlo, requires gradient information which is often not readily available. PyMC3 is a new open source Probabilistic Programming framework written in Python that uses Theano to compute gradients via automatic differentiation as well as compile probabilistic programs on-the-fly to C for better performance. Contrary to other Probabilistic Programming languages, PyMC3 allows model specification directly in Python code. This workshop will introduce new users to the PyMC3 package, and demonstrate how to implement and fit models.

Schedule

Time Activity
09:30-10:30 Introduction to PyMC3, MCMC
10:30-10:45 Break
10:45-11:45 Theano, Approximation Methods
11:45-13:00 Lunch
13:00-14:00 Model Building with PyMC3, Model Checking
14:00-14:15 Break
14:15-15:15 Case Studies
15:15-15:30 Wrap-up

Syllabus

Introduction to PyMC3

  • Variable types
  • Probability models
  • Simple case studies

Markov Chain Monte Carlo

  • Metropolis sampling
  • Gradient-based sampling methods

Theano

  • Tensors
  • Automatic differentiation
  • Operations

Approximation Methods

  • MAP
  • Variational inference
  • ADVI

Model Building with PyMC3

  • Specifying priors and likelihoods
  • Deterministic variables
  • Factor potentials
  • Custom variables
  • Step methods
  • Generalized linear models
  • Missing Data

Model Checking and Output Processing

  • Storage backends
  • Convergence diagnostics
  • Goodness of fit
  • Plotting and summarization
  • Seaborn

Case Studies

  • BEST
  • Hierarchical models of radon contamination
  • Global burden of disease
  • Machine learning: Clustering and neural networks

Software Installation

Running PyMC3 requires a working Python interpreter, either version 2.7 (or more recent) or 3.4 (or more recent); we recommend that new users install version 3.5 (but see special note below if you are a Windows user). A complete Python installation for Mac OSX, Linux and Windows can most easily be obtained by downloading and installing the free Anaconda Python Distribution by ContinuumIO.

PyMC3 can be installed using pip. PyMC3 also depends on several third-party Python packages which will be automatically installed when installing via pip. The four required dependencies are: Theano, NumPy, SciPy, Matplotlib, and joblib. To take full advantage of PyMC3, the optional dependencies seaborn, pandas and Patsy should also be installed. You can install PyMC3 and its dependencies by cloning this repository:

git clone https://github.com/fonnesbeck/PyMC3_Oslo.git

Then move into the directory created by the clone, and install the required packages using pip:

cd PyMC3_Oslo
pip install -r requirements.txt

Depending on which Anaconda installation you might have chosen, several or all of the required packages may already have been installed.

If you would rather not install the software yourself, you can use the MyBinder.org link at the top of the page to run the course materials on a remote server

Windows Installation

If you are planning on using a Windows-based computer for the workshop, you may run into installation issues that are platform-specific. Hans Olav has provided these instructions for Windows users that may solve these issues.

About

Probabilistic programming in Python workshop at Oslo universitetssykehus HF

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published