We have provided some sample code to help you understand MCMC techniques such as Gibbs sampling, Metropolis, and Gibbs-Metropolis.

Note that all of the faculty examples use the data in faculty.dat

Gibbs Sampling

In the following example, Gibbs sampling is used with sampling from the complete conditionals.

fac-gibbs.py

Metropolis

In the following example, the Metropolis algorithm is used to sample from a Cauchy distribution.

cauchy.py

Gibbs-Metropolis Combo

This code implements a combo MCMC algorithm using Gibbs sampling, with Metropolis sampling at each node:

fac-combo.py

Evilplot

Evilplot files are listed below. A simple way to get everything needed for evilplot is to run the following command:

  git clone git://aml.cs.byu.edu/evilplot.git

__init__.py

param.py

plot.py

plotitems.py

util.py

cs-677sp2010/mcmc-sample-code.txt · Last modified: 2014/12/12 20:34 by ryancha
Back to top
CC Attribution-Share Alike 4.0 International
chimeric.de = chi`s home Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0