Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about marginal_likelihood in VAE #13

Open
dongfeng951 opened this issue Nov 7, 2017 · 3 comments
Open

Question about marginal_likelihood in VAE #13

dongfeng951 opened this issue Nov 7, 2017 · 3 comments

Comments

@dongfeng951
Copy link

dongfeng951 commented Nov 7, 2017

Thank you for your working and sharing. I learned a lot from them.
However, I have a question about the VAE implementation.
In VAE.py, you calculate the marginal_likelihood as an cross entropy:
marginal_likelihood = tf.reduce_sum(self.inputs * tf.log(self.out) + (1 - self.inputs) * tf.log(1 - self.out),[1, 2])
However, I am confusing as the formular is :
image
where the first item on the right side should correspond to the marginal_likelihood. I think the latent variable z should be included to calculate the likelihood but you use the initial input, self.inputs.
So I am a little confusing, can you explain it?
Thank you very much!

@hwalsuklee
Copy link
Owner

hwalsuklee commented Nov 7, 2017

Hi.

There are two tricks on implementation of marignal likelihood.
1st is to use Monte-carlo technique instead of integral.
2nd is to use only one sample for Monte-carlo technique.

With these tricks, marginal likelihood is approximated to log(p(x_i|z)).
Since p(x_i|z) is assumed to follow bernoulli distribution, log(p(x_i|z)) is cross entropy between network input and output.

Please check following.
crossentroy_vae

@dongfeng951
Copy link
Author

@hwalsuklee Hi, thanks for the explanation. I understand it.
I have another question. There is a KL gap between the ELBO and p(x), so how can I compute the p(x)?
Thank you!

@vedal
Copy link

vedal commented Nov 8, 2018

Dear @hwalsuklee:
do you know how negative log-likelihood for f.ex Cifar test set is reported in VAE-like models? Paper examples etc are included in my question here:
https://www.reddit.com/r/MLQuestions/comments/9sp6d3/how_to_calculate_log_likelihood_for_vaevqvae/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants