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

Negative Log Sigmoid Log Likelihood Loss? #23

Open
marco-rudolph opened this issue Mar 28, 2022 · 2 comments
Open

Negative Log Sigmoid Log Likelihood Loss? #23

marco-rudolph opened this issue Mar 28, 2022 · 2 comments

Comments

@marco-rudolph
Copy link

Hi Denis!
According to your code, you use some "negative log sigmoid log likelihood loss":

decoder_log_prob = get_logp(C, z, log_jac_det)

loss = -log_theta(log_prob)

with
log_theta = torch.nn.LogSigmoid()

What is the motivation behind using this kind of loss?

Thanks in advance,
Marco

@gudovskiy
Copy link
Owner

@marco-rudolph well, flows can minimize KL-divergence up to the constant or, alternatively, can have log-likelihoods larger than 0.0 which is not desirable. So, to prevent this and to avoid negative loss I added sigmoid. In practice, it can help to improve performance a bit.

@marco-rudolph
Copy link
Author

Why are likelihoods larger than 0.0 not desireable? Negative loss itself should not be a problem as long as it does not lead to instabilities which is not really the case here.
But it is an interesting finding that this improves the performance :)

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

2 participants