You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The HMC class allows accessing the log-joint probability before and after the update step through the log_prob and orig_log_prob attributes of the HMCInfo class. However, the stochastic gradient MCMC classes in zhusuan don't expose these two log-joint probabilities.
Is it possible to get a tensorflow operation for the log-joint probability at the end of the update step in SGMCMC? Or alternatively Is it possible to get a tensorflow operation for the value of the parameters before the update step?
The text was updated successfully, but these errors were encountered:
Hello, I think it is not difficult to get the value of the parameters as long as you perform something like sess.run(latent). About the log-joint probability, since in SGMCMC algorithm we do not need to compute it (unlike in HMC, since we need to perform the Metropolis-Hastings step there), by default the log_prob is not returned (to reduce the size of computation graph).
If you want to get log_prob given the value of parameters stored in a dictionary latent, you could add some codes in your script as follows:
In the end, I modify my joint_prob function and the SGHMC class to store the logp and parameters at the half step. For my case, I only need to do one additional sum to get the logp after calculating the gradient. So it make sense to calculate the gradient and logp at the same time t.
I use SGHMC to fit 1000 chains with the approximate logp and gradient. For every n steps, I calculate the accurate logp for the approximately best chain.
The
HMC
class allows accessing the log-joint probability before and after the update step through thelog_prob
andorig_log_prob
attributes of theHMCInfo
class. However, the stochastic gradient MCMC classes in zhusuan don't expose these two log-joint probabilities.Is it possible to get a tensorflow operation for the log-joint probability at the end of the update step in
SGMCMC
? Or alternatively Is it possible to get a tensorflow operation for the value of the parameters before the update step?The text was updated successfully, but these errors were encountered: