How to extract the variational posterior expected --matrix-- of regression weights from a categorical model?

Hi ashman,

I came across this problem a while back too. What worked for me was to first run ADVI:

res = pm.fit(method='advi', n=100000)

And then use the following code to get the mean and standard deviation dictionaries:

means_pymc3 = res.params[0].eval()
sds_pymc3 = res.std.eval()

pymc3_mean_dict = res.bij.rmap(means_pymc3)
pymc3_sd_dict = res.bij.rmap(sds_pymc3)

Hope this helps, let me know.

3 Likes