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 reporting likelihoods in bits per dim #51

Open
Mattias421 opened this issue Dec 19, 2023 · 4 comments
Open

Question about reporting likelihoods in bits per dim #51

Mattias421 opened this issue Dec 19, 2023 · 4 comments

Comments

@Mattias421
Copy link

Hi all,

Thank you for providing this code, it's very educational :)

I am interested in reporting likelihoods but I don't fully understand how bits per dim are calculated. In the code this is

bpd = -(prior_logp + delta_logp) / np.log(2)
N = np.prod(shape[1:])
bpd = bpd / N
# A hack to convert log-likelihoods to bits/dim
offset = 7. - inverse_scaler(-1.)
bpd = bpd + offset

Would you be able to elaborate on how this hack works and if it applies to other image dimensions?

Best,
Matt

@zen-d
Copy link

zen-d commented Jan 12, 2024

same question here.

@mareikethies
Copy link

mareikethies commented Feb 5, 2024

same question here as well
Edit: I think this hack applies to images which originally have discrete pixel intensities from 0 to 255. See, e.g., equations 3 to 5 in Danihelka et al. (https://arxiv.org/pdf/1705.05263.pdf).

@zen-d
Copy link

zen-d commented Mar 17, 2024

@mareikethies Thanks a lot! I got it.

@Mattias421
Copy link
Author

@mareikethies Thank you, it looks like this offset doesn't apply to other data types :0

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