Dear all,
May I know is anyone has experience with setting var_names in sample posterior predictive?
I faced the error when I use it.
I tried change my data from series to tuple, it give me an error of inmutable data cannot be hashed.
Please help. Thanks alot.
Can we see the contents of final_train
?
Hi cluhmann,
Correct me if I am wrong.
We need to convert it into RV class?
Thanks
The var_names
argument to posterior_predictive()
should be a list of parameter names. See this notebook for some usages examples.
1 Like
thanks alot for your answer. I will take a look on that
Hello
I am trying to run the following code, where it keeps on giving “Keyerror: mu”. Though as can be seen that “mu” is declared as var_names. Need some suggestions to get rid of this error.
models = {1: first, 2: second, 3: third, 4: fourth} # dictionary of the models
samples = [
first_sample,
second_sample,
third_sample,
fourth_sample,
] # list the posterior samples
orders = [1, 2, 3, 4]
_, ax = plt.subplots()
for i, sample in zip(models.keys(), samples): # iterate through models and samples
with models[i]: # set the model
x = np.linspace(-3.1, 1.3, 100)
#pm.set_data({“x”: x})
ppc = pm.sample_posterior_predictive(sample, var_names=[“mu”])
ax.plot(x, ppc[“mu”].mean(0), label="order " + str(i))
sns.scatterplot(x=“s_taxRate”, y=“s_taxRevenue”, data=Laffer)
ax.set_title(“Weakly regularized models”);
az.summary(second_sample, var_names=[“b”])
mu
should be in ppc.posterior_predictive
1 Like
Thank you @ricardoV94. Your suggestion solved my issue.