How to get named means and sds from ADVI fit?

Hey all,

Quick question: I used to be able to extract the means and sds of the variational approximation in ADVI as a dictionary using: How to extract the variational posterior expected --matrix-- of regression weights from a categorical model? - #4 by Martin_Ingram

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

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)

However, in the latest pymc, it seems res.bij no longer exists. How can I now get mean and sd dictionaries from the flat vectors means_pymc3 and sds_pymc3?

Thanks a lot for your help :slight_smile:

All the best,
Martin

Would this be make vi (posterior) mean and std accessible as a structured xarray by fonnesbeck · Pull Request #6387 · pymc-devs/pymc · GitHub?

3 Likes

Yes, that looks exactly like what I need, thank you! :slight_smile: