You really don’t want to miss Chi Feng‘s absolutely wonderful interactive demos.

**(1) Markov chain Monte Carlo sampling**

I believe this is exactly what Andrew was asking for a few Stan meetings ago:

- Chi Feng’s Interactive MCMC Sampling Visualizer

This tool lets you explore a range of sampling algorithms including random-walk Metropolis, Hamiltonian Monte Carlo, and NUTS operating over a range of two-dimensional distributions (standard normal, banana, donut, multimodal, and one squiggly one). You can control both the settings of the algorithms and the settings of the visualizations. As you run it, it even collects the draws into a sample which it summarizes as marginal histograms.

*Source code*

The demo is implemented in Javascript with the source code on Chi Feng’s GitHub organization:

*Wish list*

- 3D (glasses or virtual reality headset)
- multiple chains in parallel
- scatterplot breadcrumbs
- Gibbs sampler
- Ensemble samplers
- User-pluggable densities (Andrew really wants this for Stan where you’d choose two dimensions of N to visualize)

**(2) Gaussian Process visualization**

This one’s also really elegant.

- Chi Feng’s Gaussian process demo

It lets you lay down a few points and fit a 1D GP. It lets you choose kernel and hperparameters, and even sample regression functions from it conditioned on the data you provide.

*Wish list*

- 3D (OK, I’m obssesed, but this one would be great on a 2D grid with a 3D visualization of a GP being fit)
- Estimating hyperparameters (didn’t seem like it was doing this—may be a bit challenging for Javascript!)

*Source code*

mcmc visualizer is fantastic! it would be great to see two different samplers go head-to-head, eg, RWMH in blue vs. NUTS in red

Is it just me or the GP demo doesn’t work right now? (tried with Chrome and Firefox)

And yes the MCMC demos are stunning!

It worked on my machine (Mac OS X, Safari)—I wrote the post after running the demos!

Worked on Chrome. [Android OS]

Thank you for this post. I was looking to better understand the different algorithms and these demo’s really help!

I embedded the MCMC demos into a blog post that tries to explain, without mathematics, why HMC is useful and why NUTS is even better. http://elevanth.org/blog/2017/11/28/build-a-better-markov-chain/

I hacked the source a bit to make the lines thicker and colors stronger. The code is actually very easy to figure out, in case anyone is thinking of adding new densities or algorithms.

+1

Here’s another, similar GP visualization (as mentioned in this blog previously: http://andrewgelman.com/2015/03/07/interactive-demonstrations-linear-gaussian-process-regressions/):

http://www.tmpl.fi/gp/

It can also show HMC samples. Source code is at https://github.com/to-mi/gp-demo-js

Another Gaussian process demo with cool animation by Tomi Peltola

http://www.tmpl.fi/gp/