Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"""
LOO-PIT Overlay Plot
====================
_thumb: .5, .7
"""
import arviz as az
az.style.use("arviz-darkgrid")
idata = az.load_arviz_data("non_centered_eight")
az.plot_loo_pit(idata=idata, y="obs", color="indigo")
"""
Plot HPD
========
_thumb: .8, .8
"""
import matplotlib.pyplot as plt
import numpy as np
import arviz as az
az.style.use("arviz-darkgrid")
x_data = np.random.normal(0, 1, 100)
y_data = 2 + x_data * 0.5
y_data_rep = np.random.normal(y_data, 0.5, (200, 100))
plt.plot(x_data, y_data, "C6")
az.plot_hpd(x_data, y_data_rep, color="k", plot_kwargs={"ls": "--"})
"""
Hexbin PairPlot
===============
_thumb: .2, .5
"""
import arviz as az
az.style.use("arviz-darkgrid")
centered = az.load_arviz_data("centered_eight")
coords = {"school": ["Choate", "Deerfield"]}
az.plot_pair(
centered,
var_names=["theta", "mu", "tau"],
kind="hexbin",
coords=coords,
colorbar=True,
divergences=True,
)
"""
ESS Quantile Plot
=================
_thumb: .4, .5
"""
import arviz as az
az.style.use("arviz-darkgrid")
idata = az.load_arviz_data("radon")
az.plot_ess(idata, var_names=["sigma_y"], kind="quantile", color="C4")
"""
Posterior Plot
==============
_thumb: .5, .8
"""
import arviz as az
az.style.use("arviz-darkgrid")
data = az.load_arviz_data("centered_eight")
coords = {"school": ["Choate"]}
az.plot_posterior(data, var_names=["mu", "theta"], coords=coords, rope=(-1, 1))
"""
ESS Quantile Plot
=================
_thumb: .2, .8
"""
import arviz as az
az.style.use("arviz-darkgrid")
idata = az.load_arviz_data("radon")
az.plot_ess(idata, var_names=["b"], kind="evolution")
"""
ESS Local Plot
==============
_thumb: .6, .5
"""
import arviz as az
az.style.use("arviz-darkgrid")
idata = az.load_arviz_data("non_centered_eight")
az.plot_ess(idata, var_names=["mu"], kind="local", marker="_", ms=20, mew=2, rug=True)