Path: blob/master/notebooks/misc/beta_binom_approx_post_pymc.ipynb
1192 views
Kernel: Python 3
Posterior for Beta-binomial distribution
We compare various approximations to the exact 1d distribution.
In [3]:
Exact
In [4]:
Out[4]:
Grid
In [5]:
Out[5]:
Laplace
In [6]:
Out[6]:
[array(0.09090909), array([0.08667842])]
ADVI
In [9]:
Out[9]:
Finished [100%]: Average Loss = 4.9281
In [10]:
Out[10]:
Finished [100%]: Average Loss = 4.9367
In [12]:
Out[12]:
HMC
In [14]:
Out[14]:
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:6: FutureWarning: In v4.0, pm.sample will return an `arviz.InferenceData` object instead of a `MultiTrace` by default. You can pass return_inferencedata=True or return_inferencedata=False to be safe and silence this warning.
Auto-assigning NUTS sampler...
Initializing NUTS using jitter+adapt_diag...
Sequential sampling (2 chains in 1 job)
NUTS: [theta]
Sampling 2 chains for 1_000 tune and 1_000 draw iterations (2_000 + 2_000 draws total) took 3 seconds.
Got error No model on context stack. trying to find log_likelihood in translation.
/usr/local/lib/python3.7/dist-packages/arviz/data/io_pymc3_3x.py:102: FutureWarning: Using `from_pymc3` without the model will be deprecated in a future release. Not using the model will return less accurate and less useful results. Make sure you use the model argument or call from_pymc3 within a model context.
FutureWarning,
Got error No model on context stack. trying to find log_likelihood in translation.