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

The generative loss in implementation #76

Open
uuutty opened this issue Mar 14, 2019 · 4 comments
Open

The generative loss in implementation #76

uuutty opened this issue Mar 14, 2019 · 4 comments

Comments

@uuutty
Copy link

uuutty commented Mar 14, 2019

In the paper, the objective function to minimize is
image
However in the code, objective first add this constant c, logpz, and then apply a negative sign to the objective to get generate loss

glow/model.py

Line 172 in eaff217

objective += - np.log(hps.n_bins) * np.prod(Z.int_shape(z)[1:])

glow/model.py

Line 181 in eaff217

objective += logp(z)

glow/model.py

Line 184 in eaff217

nobj = - objective

It seems to minimize -logpx+Mlog(a), not the loss writed in paper which is -logpx-Mlog(a)
Do you ignore the constant because it will not affect the training or I missed something in the code?

@uuutty uuutty closed this as completed Mar 14, 2019
@uuutty uuutty changed the title implementation The generative loss in implementation Mar 14, 2019
@uuutty uuutty reopened this Mar 14, 2019
@gerbenvv
Copy link

gerbenvv commented May 4, 2019

It's an optimization:

log(a) = log(1 / n_bins) = -log(n_bins)

@christabella
Copy link

Just to clarify, the purpose of the constant "scaling penalty" c is just to ensure accurate likelihood computations? Since the minimum would be the same with or without c. Comparison or model selection on the basis of likelihood computation is also iffy though isn't it?

@gerbenvv
Copy link

Giving that a normalizing flow gives you a correct log-likelihood of your data under your model it would be a shame to omit c even though technically not required for optimization. Model scoring/selection can be done using the log-likelihood of test data under the model. Superiority of a model can for example be proven with a likelihood-ratio test.

@christabella
Copy link

Thank you for the explanation!

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