Tutorial on Probabilistic Programming with PyMC3

Similar documents
Bayesian Inference and MCMC

Probabilistic Machine Learning

Bayesian Methods for Machine Learning

Markov Chain Monte Carlo, Numerical Integration

Bayesian Phylogenetics:

MIT /30 Gelman, Carpenter, Hoffman, Guo, Goodrich, Lee,... Stan for Bayesian data analysis

Probabilistic Graphical Networks: Definitions and Basic Results

(5) Multi-parameter models - Gibbs sampling. ST440/540: Applied Bayesian Analysis

Markov chain Monte Carlo methods for visual tracking

Closed-form Gibbs Sampling for Graphical Models with Algebraic constraints. Hadi Mohasel Afshar Scott Sanner Christfried Webers

Hamiltonian Monte Carlo

CPSC 540: Machine Learning

MCMC and Gibbs Sampling. Kayhan Batmanghelich

Principles of Bayesian Inference

Reminder of some Markov Chain properties:

Probabilistic programming and Stan. mc-stan.org

MCMC algorithms for fitting Bayesian models

Probabilistic Graphical Models Lecture 17: Markov chain Monte Carlo

Hierarchical Bayesian Modeling

STA 4273H: Statistical Machine Learning

Machine Learning for Data Science (CS4786) Lecture 24

Chapter 4 Dynamic Bayesian Networks Fall Jin Gu, Michael Zhang

an introduction to bayesian inference

MCMC notes by Mark Holder

Introduction to Machine Learning

MCMC: Markov Chain Monte Carlo

17 : Optimization and Monte Carlo Methods

Pattern Recognition and Machine Learning. Bishop Chapter 11: Sampling Methods

Lecture 2: From Linear Regression to Kalman Filter and Beyond

BAYESIAN METHODS FOR VARIABLE SELECTION WITH APPLICATIONS TO HIGH-DIMENSIONAL DATA

Theory of Stochastic Processes 8. Markov chain Monte Carlo

LECTURE 15 Markov chain Monte Carlo

Computational statistics

DAG models and Markov Chain Monte Carlo methods a short overview

Markov Networks.

Principles of Bayesian Inference

Continuously tempered Hamiltonian Monte Carlo

Probabilistic Graphical Models

Topic Modelling and Latent Dirichlet Allocation

Pattern Recognition and Machine Learning

Topics in Natural Language Processing

Exercises Tutorial at ICASSP 2016 Learning Nonlinear Dynamical Models Using Particle Filters

NPFL108 Bayesian inference. Introduction. Filip Jurčíček. Institute of Formal and Applied Linguistics Charles University in Prague Czech Republic

Approximate Inference using MCMC

Lecture 2: From Linear Regression to Kalman Filter and Beyond

Monte Carlo in Bayesian Statistics

Markov Chain Monte Carlo methods

Afternoon Meeting on Bayesian Computation 2018 University of Reading

Lecture 7 and 8: Markov Chain Monte Carlo

Density Estimation. Seungjin Choi

Markov Chain Monte Carlo methods

Computer Vision Group Prof. Daniel Cremers. 10a. Markov Chain Monte Carlo

27 : Distributed Monte Carlo Markov Chain. 1 Recap of MCMC and Naive Parallel Gibbs Sampling

19 : Slice Sampling and HMC

Bayesian Learning. HT2015: SC4 Statistical Data Mining and Machine Learning. Maximum Likelihood Principle. The Bayesian Learning Framework

Monte Carlo Inference Methods

ST 740: Markov Chain Monte Carlo

Partial inconsistency and vector semantics: sampling, animation, and program learning

Part 1: Expectation Propagation

The Particle Filter. PD Dr. Rudolph Triebel Computer Vision Group. Machine Learning for Computer Vision

Paul Karapanagiotidis ECO4060

Example: Ground Motion Attenuation

Notes on pseudo-marginal methods, variational Bayes and ABC

Bayesian Linear Regression

STA 4273H: Statistical Machine Learning

Metropolis-Hastings Algorithm

Advanced Machine Learning

Algorithms other than SGD. CS6787 Lecture 10 Fall 2017


Introduction Probabilistic Programming ProPPA Inference Results Conclusions. Embedding Machine Learning in Stochastic Process Algebra.

Variational Scoring of Graphical Model Structures

Bayesian Networks in Educational Assessment

PROBABILISTIC PROGRAMMING: BAYESIAN MODELLING MADE EASY

A Review of Pseudo-Marginal Markov Chain Monte Carlo

Making rating curves - the Bayesian approach

Advanced Statistical Modelling

MCMC Methods: Gibbs and Metropolis

Part IV: Monte Carlo and nonparametric Bayes

Efficient Likelihood-Free Inference

17 : Markov Chain Monte Carlo

Bayesian Networks BY: MOHAMAD ALSABBAGH

Modelling Operational Risk Using Bayesian Inference

Learning the hyper-parameters. Luca Martino

Calibration of Stochastic Volatility Models using Particle Markov Chain Monte Carlo Methods

Markov Chains and MCMC

Bayesian Regression Linear and Logistic Regression

STA 4273H: Sta-s-cal Machine Learning

Sampling Methods (11/30/04)

Sampling Algorithms for Probabilistic Graphical models

Fitting Complex PK/PD Models with Stan

The Origin of Deep Learning. Lili Mou Jan, 2015

Bayes Nets: Sampling

Risk Estimation and Uncertainty Quantification by Markov Chain Monte Carlo Methods

The Metropolis-Hastings Algorithm. June 8, 2012

Principles of Bayesian Inference

PROBABILISTIC PROGRAMMING: BAYESIAN MODELLING MADE EASY. Arto Klami

Kernel adaptive Sequential Monte Carlo

VCMC: Variational Consensus Monte Carlo

arxiv: v1 [cs.lg] 2 Jan 2019

Bayesian Inference in GLMs. Frequentists typically base inferences on MLEs, asymptotic confidence

Transcription:

185.A83 Machine Learning for Health Informatics 2017S, VU, 2.0 h, 3.0 ECTS Tutorial 02-04.04.2017 Tutorial on Probabilistic Programming with PyMC3 florian.endel@tuwien.ac.at http://hci-kdd.org/machine-learning-for-health-informatics-course Holzinger Group hci-kdd.org 1

Schedule 01. Introduction to Probabilistic Programming 02. PyMC3 03. linear regression the Bayesian way 04. generalized linear models with PyMC3 Holzinger Group hci-kdd.org 2

01. Introduction and Overview Probabilistic Programming (PP) allows automatic Bayesian inference on complex, user-defined probabilistic models utilizing Markov chain Monte Carlo (MCMC) sampling PyMC3 a PP framework compiles probabilistic programs on-the-fly to C allows model specification in Python code Salvatier J, Wiecki TV, Fonnesbeck C. (2016) Probabilistic programming in Python using PyMC3. PeerJ Computer Science 2:e55 https://doi.org/10.7717/peerj-cs.55 Holzinger Group hci-kdd.org 3

Properties of Probabilistic Programs IS NOT Software that behaves probabilistically General programming language IS Toolset for statistical / Bayesian modeling Framework to describe probabilistic models Tool to perform (automatic) inference Closely related to graphical models and Bayesian networks Extension to basic language (e.g. PyMC3 for Python) does in 50 lines of code what used to take thousands Kulkarni, T. D., Kohli, P., Tenenbaum, J. B. & Mansinghka, V. Picture: A probabilistic programming language for scene perception. in Proceedings of the ieee conference on computer vision and pattern recognition 4390 4399 (2015). Holzinger Group hci-kdd.org 4

Probabilistic Programs Machine learning algorithms / models often a black box PP open box Simple approach 1. Define and build model 2. Automatic inference 3. Interpretation of results not much equations anymore! inference : guess latent variables based on observations, using e.g. MCMC Holzinger Group hci-kdd.org 5

Markov chain Monte Carlo (MCMC) Markov chain Stochastic process memoryless (Markov property) Conditional probability distribution of future states depends only upon the present state Sampling from probability distributions State of chain sample of distribution Quality improves with number of steps Class of algorithms / methods Numerical approximation of complex integrals Holzinger Group hci-kdd.org 6

Markov chain Monte Carlo (MCMC) (animated) Holzinger Group hci-kdd.org 7

Markov chain Monte Carlo (MCMC) Metropolis-Hastings: random walk Gibbs-sampling: popular, complex, no tuning PyMC3 No-U-Turn Sampler (NUTS) Hamiltonian Monte Carlo (HMC) Metropolis Slice BinaryMetropolis Holzinger Group hci-kdd.org 8

Prior & posterior distributions Quantity of interest: θ (theta) Prior = probability distribution Uncertainty before observation: p(θ) Belief in absence of data Posterior = probability distribution Uncertainty after observation X: p(θ X) Likelihood: p(x θ) Posterior Likelihood Prior p x θ p(θ) p θ x = p(x) Calculating posterior from observation and prior = updating beliefs Coin toss example Holzinger Group hci-kdd.org 9

PyMC3 Python 3 package / framework Probabilistic machine learning specification and fitting of Bayesian models Inference by MCMC & variational fitting algorithms Performance enhancements: cross-compilation to C (Python numerical computation package Theano ) Accessible, natural syntax Various capabilities: GPU computing, sampling backends, object-oriented, extendable design Holzinger Group hci-kdd.org 10

Live presentation PyMC3 syntax introduction linear regression the Bayesian way generalized linear models with PyMC3 Holzinger Group hci-kdd.org 11

Thank you! Holzinger Group hci-kdd.org 12

Sample Questions What is probabilistic programming? What type of problems can be solved? What are the typical steps in a probabilistic program? What is inference? What is PyMC3? What is the posterior distribution? Holzinger Group hci-kdd.org 13

Appendix Main sources Salvatier J, Wiecki TV, Fonnesbeck C. (2016) Probabilistic programming in Python using PyMC3. PeerJ Computer Science 2:e55 https://doi.org/10.7717/peerj-cs.55 Davidson-Pilon, C. Bayesian Methods for Hackers: Probabilistic Programming and Bayesian Inference. (Addison-Wesley Professional, 2015). PyMC3 s documentation http://pymc-devs.github.io/pymc3/index.html Holzinger Group hci-kdd.org 14