My first question is: what’s the relationship between guide_lop_p and the KL divergence term in the loss function?
My second question is: Sometimes I observe guide_log_p to be a positive value, which does not make sense because log likelihood should always be a negative value. Is my understanding wrong? Or, if my understanding is correct, how could I debug in this situation?
a single-sample estimator of that KL divergence looks like
KL = log(q(z|x) / p(z))
with z ~ q(z|x)
so that’s exactly -model_log_p + guide_log_p contains (except it also contains additional log p(x|z) terms that enter into the expected log likelihood term).
as for your second question, for continuous random variables guide_log_p is actually the logarithm of a probability density and as such it can take on either sign.
Thanks for your explanation! Did you mean that guide_log_p is the estimate of the expected log(q(z|x)) and model_log_p is the estimate of the expected log(p(x|z)) term plus the log(p(z)) term?
If this is the case, how can I calculate the value of the expected log likelihood, i.e., the first term in my loss function?
Thanks for your explanation! Did you mean that guide_log_p is the estimate of the expected log(q(z|x)) and model_log_p is the estimate of the expected log(p(x|z)) term plus the log(p(z)) term?
yes that’s right
If this is the case, how can I calculate the value of the expected log likelihood, i.e., the first term in my loss function?