I am trying to undersatnd what are lp__
, log_p__
and log_g__
. lp__
appears in both HMC and VB results while log_p__
and log_g__
appear only in VB result.
After I read How exactly is lp__ being calculated , I understood it is the log joint density of the model likelihood and the prior.
Then I also read this post Getting KL Divergence for Variational Bayes fit in RStan - #4 by dzl and understood that
-
log_p__
is also log joint density \mathrm{log}P(X, \theta) -
log_g__
is log density of the variational posterior \mathrm{log}Q(\theta).
Now here are my questions.
- Is my understanding correct?
- In VB result csv file, why are there both
lp__
andlog_p__
if they are the same? - I tried to calculate ELBO by taking mean of
(log_p__ - log_g__)
as the samples in the VB result csv are drawn from Q(\theta). However its result was different from the log file’s last part. What am I missing?
The ELBO output was taken from the last converged value of this part.
Begin stochastic gradient ascent.
iter ELBO delta_ELBO_mean delta_ELBO_med notes
100 -145.045 1.000 1.000
200 -145.134 0.500 1.000
300 -144.550 0.335 0.004 MEDIAN ELBO CONVERGED
Thank you.