bayesiains / nflows

Normalizing flows in PyTorch
MIT License
849 stars 118 forks source link

Base of resulting BPD in transformations #40

Closed aryanshomray closed 3 years ago

aryanshomray commented 3 years ago

Hi, I am using nflows in my project to construct normalizing flows and it is very easy and helped me to prototype my experiments rapidly. However, while going through the source code I am unable to find where the logabsdet is converted to base 2. So, I just want to ask that the results from the model are either base 2 or base e.

arturbekasov commented 3 years ago

Hello,

Thanks for getting in touch. Happy you're finding the framework useful!

We're using the natural log throughout the framework, so the resulting log likelihoods are in nats, not bits. When we want to report BPD we'd change the base as needed, e.g. see here.

Hope this helps.

Artur

aryanshomray commented 3 years ago

Thanks for responding @arturbekasov. Your reply really helped me in removing ambiguities in my project.

imurray commented 3 years ago

@aryanshomray another tip for setting up experiments with any framework is to run it on a small toy problem where you know the answer by other means.

For example, fit samples from a one- or two-dimensional Gaussian, and compare to the performance under the true model, and a Gaussian that matches the mean and variance of the samples. You should be able to draw enough samples to convince yourself you're fitting the right model, and reporting the correct numbers.

Similarly if you were testing out a classifier from a new package, you could draw synthetic data from two overlapping Gaussian classes, and compare metrics to the Bayes classifier.

No amount of careful looking at the code, or appeals to authority, really replaces a quick check that the setup you've put together isn't obviously broken, or out by a constant factor.