Hi guys again.
I am checking out the model averaging example but it is written with pymc3.
I have adjusted the code after each sample of each of the example three models with e.g.
trace_0.extend(pm.sample_prior_predictive(samples=2000, random_seed=58))
pm.sample_posterior_predictive(trace_0, extend_inferencedata=True, random_seed=58)
pm.compute_log_likelihood(trace_0)
used the traces with arviz compare to obtain the weight list and instead of pm.sample_posterior_predictive_w
I am using
ppc_w = az.weight_predictions(
[trace_0,trace_1,trace_2],
weights=list(comp.weight.values)
)
as it is suggested in Ch.5 of Bayesian Analysis with Python (3rd Edition). Is this a proper adjustment?
But i got stuck in adjusting
mean_w = ppc_w["kcal"].mean()
hpd_w = az.hdi(ppc_w["kcal"].flatten())
How can i adjust above lines of code to my pymc version (5.16.2)?
Is there an example of model averaging with newer versions of pymc instead of pymc3?
Thanks in advance.