The function that planar flow uses doesn't have analytic inverse which makes it unsuitable for direct likelihood estimation using the data. It can work well in VAEs though because inversion isn't required. However, for cases when the analytic target density is available, KL-divergence can be minimized explicitly (excluding constant terms). Following are the results for two complex 2D densities similar to the ones in the paper. The second column shows samples obtained using MCMC (See notebooks/Metropolis-Hastings.ipynb
). The third and fourth columns show results using planar flows of different lengths (see notebooks/PlanarFlow-Example1.ipynb
and notebooks/PlanarFlow-Example2.ipynb
). During the experiments I found that minimizing KL is not always stable and doesn't always reach a good solution (especially for density 2).
True Density | Samples (using Metropolis-Hastings) | Samples (using Planar Flow; K = 4) | Samples (using Planar Flow; K = 16) |
---|---|---|---|
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Following are the results for vanilla VAE and VAE with planar flows. Note that these results are just for one random run.
Model | Latent Space Size | Test Lower Bound | Test Reconstruction Error | Latent Space |
---|---|---|---|---|
VAE | 2 | -138.5 | 131.3 | ![]() |
VAE | 20 | -98.1 | 75.9 | -- |
VAE-PF (K=16) | 2 | -136.0 | 130.6 | ![]() |
VAE-PF (K=16) | 20 | -79.4 | 77.7 | -- |
Originally, this repository contained notes and code on normalizing flows which we did as a part of a course project (CS6202 @ NUS). Some ideas are borrowed from this repo.