Open cheng-w-liu opened 6 years ago
Is there a way to convert the posterior values back to the original scale after the sampling is done?
Yes! See http://edwardlib.org/tutorials/automated-transformations.
Thanks @dustinvtran for the info!
Actually, looking at the code more closely, https://github.com/blei-lab/edward/blob/master/edward/inferences/inference.py#L247-L253
it seems that qz_constrained
is transformed and put back to self.latent_vars[z]
.
Shouldn't that make the samples stored in qz
in the original scale?
I'm using Edward to run a simple Bayesian linear regression, which has three parameters: intercept, slope, and sigma (the standard deviation of the y-value). The intercept and slope are modeled as normal distributions, and sigma is modeled as Chi-squared distribution as it should be positive:
However, Edward's HMC sampling shows a lot of negative values in sigma's posterior distribution, as the above plot shows. Is that because the current version of HMC will transform the latent variables to unconstrained space? Is there a way to convert the posterior values back to the original scale after the sampling is done? Happy to help but just wanted to know the difficulty level and need some guidance.