Obtaining the actual Vi curve instead of samples

I am using the advi method for finding the posterior distribution. I want to know if it is possible to obtain the actual Gaussian curve after the transformation that we transform to decrease the KL divergence, instead of just the samples? Or is it possible to obtain the mean and the standard deviation of that curve instead of the samples?

You can see the approach you describe detailed in this notebook. Note that this notebook has yet to be updated to reflect v4, so I’m not 100% that it will work exactly as illustrated in that notebook, but hopefully it gets you in the right direction. Feel free to here if something seems off.

Thanks, for the link, but even in the link, there is no method shown to get the parameters of mean and Standard deviation of the normal distribution which is obtained in the variational inference.

@ferrine

These don’t work?

advi.approx.mean.eval()
advi.approx.std.eval()

Tried this out, but the answer that these are giving is deviating a lot from the expected answer.

Oh ok. That’s a different problem then. Is the “expected answer” the mean/SD are deviating from based on using MCMC or sampling from the ADVI solution?

Yes, when I plot the normal distribution from the mean and the SD obtained from the above mentioned method, it comes out to be completely different from the distribution of the samples obtained using MCMC

Got it. You can also see in this notebook that there are some potential bijections to deal with/reverse. That might be relevant as well.

Thanks for the article, I went through it and figured out that the parameters mean and standard deviation that I am getting are in the transformed space. But, I am unable to understand how are they transforming it back to normal space for plotting it in the next snippet. @cluhmann Can you please help me by telling the exact conversion formulas for the mean and standard deviation?