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

A bug in bitsback coding #10

Closed
bfs18 opened this issue Oct 4, 2023 · 3 comments
Closed

A bug in bitsback coding #10

bfs18 opened this issue Oct 4, 2023 · 3 comments

Comments

@bfs18
Copy link

bfs18 commented Oct 4, 2023

samples = norm.ppf(ppf_range, loc=mu, scale=np.exp(log_var))

scale should be standard deviation, not variance. changing scale to scale=np.exp(0.5. * log_var) improves the result a lot.

@bjlkeng
Copy link
Owner

bjlkeng commented Oct 6, 2023

Nice find, thank you!

I'll double check once I get a few minutes and fix the notebook and blog post up.

@bfs18
Copy link
Author

bfs18 commented Oct 9, 2023

@bjlkeng Thank you for the detailed introduction and concise code. It helped me understand bitsback encoding very well

bjlkeng added a commit to bjlkeng/bjlkeng.github.io that referenced this issue Oct 24, 2023
@bjlkeng
Copy link
Owner

bjlkeng commented Oct 24, 2023

Thanks for finding the bug @bfs18 ! I fixed the bug you mentioned and then realized I had some more issues with the encoding/decoding of the latent variables. So I fixed those too, and now I can achieve 1.53 bits/pixel! Much better (although not as good as the original paper). See: https://github.com/bjlkeng/sandbox/tree/master/bitsback

I also updated the blog post too for those who come across it in the future: https://bjlkeng.io/posts/lossless-compression-with-latent-variable-models-using-bits-back-coding/

Thanks again for finding that bug!

@bjlkeng bjlkeng closed this as completed Oct 24, 2023
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