"""
Normal Parallel Plot
====================

_thumb: .2, .5
"""
import arviz as az

data = az.load_arviz_data("centered_eight")
ax = az.plot_parallel(data,
                      var_names=["theta", "tau", "mu"],
                      norm_method="normal",
                      backend="bokeh")
示例#2
0
"""
Parallel Plot
=============

_thumb: .2, .5
"""
import arviz as az

az.style.use("arviz-darkgrid")

data = az.load_arviz_data("centered_eight")
ax = az.plot_parallel(data, var_names=["theta", "tau", "mu"])
ax.set_xticklabels(ax.get_xticklabels(), rotation=70)
示例#3
0
az.plot_trace(fit,var_names=['home_score_new', 'away_score_new'])
az.plot_trace(fit, var_names=['att', 'def'], combined=True)

plt.style.use('ggplot')
_, ax = plt.subplots(1, 2, figsize=(15, 6))
az.plot_forest(fit, var_names="att",combined=True, ax=ax[0], kind='ridgeplot', ridgeplot_alpha=.5, ridgeplot_overlap=1.5, hdi_prob=.999, linewidth=.5)
ax[0].set_yticklabels(sorted(names, reverse=True))
ax[0].set_title('Estimated Attack Effect (Positive is Better)', loc='left')
ax[0].grid(True)
az.plot_forest(fit, var_names="def", combined=True, ax=ax[1], kind='ridgeplot', ridgeplot_alpha=.5, ridgeplot_overlap=1.5, colors='#99c2ff', hdi_prob=.999,
               linewidth=.5)
ax[1].set_yticklabels(sorted(names, reverse=True))
ax[1].set_title('Estimated Defense Effect (Negative is Better)', loc='left')
ax[1].grid(True)

az.plot_parallel(inf_data, var_names=['sigma_att','sigma_def'])

az.plot_posterior(fit)

"""### **PREDICTING NEW SCORES**"""

fitdf = fit.to_dataframe()
score_preds = fitdf.filter(regex='_score_new*')

dict_list = []
OU_dict = {}
ML_dict = {}

for i in range(1, npredict + 1):
  mydict = {}
  OU_list = []
示例#4
0
"""
Parallel Plot
=============

_thumb: .2, .5
"""
import arviz as az

az.style.use('arviz-darkgrid')

data = az.load_arviz_data('centered_eight')
ax = az.plot_parallel(data, var_names=['theta', 'tau', 'mu'])
ax.set_xticklabels(ax.get_xticklabels(), rotation=70)
示例#5
0
# %%
az.plot_trace(trace_ncm, var_names=['a'])

# %%
az.plot_forest(trace_cm, var_names=['a'], r_hat=True, ess=True)

# %%
summaries = pd.concat([az.summary(trace_cm, var_names=['a']), az.summary(trace_ncm, var_names=['a'])])
summaries.index = ['centered', 'non_centered']
summaries

# %%
az.plot_autocorr(trace_cm, var_names=['a'])

# %%
az.plot_autocorr(trace_ncm, var_names=['a'])

# %%
_, ax = plt.subplots(1, 2, sharey=True, sharex=True, figsize=(10, 5), constrained_layout=True)

for idx, tr in enumerate([trace_cm, trace_ncm]):
    az.plot_pair(tr, var_names=['b', 'a'], coords={'b_dim_0':[0]}, kind='scatter',
                 divergences=True, contour=False, divergences_kwargs={'color':'C1'},
                 ax=ax[idx])
    ax[idx].set_title(['centered', 'non-centered'][idx])

# %%
az.plot_parallel(trace_cm)

# %%
示例#6
0
"""
MinMax Parallel Plot
====================

_thumb: .2, .5
"""
import matplotlib.pyplot as plt

import arviz as az

az.style.use("arviz-darkgrid")

data = az.load_arviz_data("centered_eight")
ax = az.plot_parallel(data,
                      var_names=["theta", "tau", "mu"],
                      norm_method="minmax")
ax.set_xticklabels(ax.get_xticklabels(), rotation=70)

plt.show()
示例#7
0
"""
Parallel Plot
=============

_thumb: .2, .5
"""
import arviz as az

data = az.load_arviz_data("centered_eight")
ax = az.plot_parallel(data, var_names=["theta", "tau", "mu"], backend="bokeh")