Extract point estimates after fitting model with ADVI

Is it possible to extract the point estimates from the model fitted using ADVI? I would like to extract something like expected value, or maybe mode of the posterior distribution, after fitting the model. I would like to do this before doing any sampling.

Yes, you can follow this post: Saving ADVI results and reloading

1 Like

Thanks for response @junpenglao. This seems to extract the variables “as ADVI sees them”, in the “real coordinate space” (as named in the ADVI paper), doesn’t it? How to back transform them to the “latent variable space”? What I need is to extract the point estimates, I do not need to plug-in them to the PyMC3 model at this moment.

inference.approx.params are in real coordinate space, but when you do the below:

logp = model.logp_dlogp_function()
saveparam = {param.name : logp.array_to_dict(param.eval())
               for param in inference.approx.params}

it will map it to the latent variable space.