Path: blob/master/deprecated/notebooks/hmc_beta_binom_blackjax.ipynb
1192 views
Kernel: Python [conda env:pymc_exp]
Hamiltonian Monte Carlo (HMC) approximation for beta-bernouli model
In this notebook, we approximate posterior of beta-bernouli model using HMC approximation. HMC is markov chain monte carlo (MCMC) algorithm.
In [43]:
In [44]:
In [2]:
Dataset
In [3]:
Out[3]:
WARNING:absl:No GPU/TPU found, falling back to CPU. (Set TF_CPP_MIN_LOG_LEVEL=0 and rerun for more info.)
Prior, Likelihood, and True Posterior
For coin toss problem, since we know the closed form solution of posterior, we compare the distributions of Prior, Likelihood, and True Posterior below.
In [81]:
Out[81]:
HMC using Blackjax
Reference: https://blackjax-devs.github.io/blackjax/examples/Introduction.html
In [5]:
In [33]:
In [34]:
In [35]:
In [36]:
Density of samples and True posterior
In [80]:
Out[80]:
Trace plot
In [38]:
Out[38]:
In [51]:
Out[51]:
In [ ]: