Assignment 6: Variational Autoencoders & Parzen Windows

Discussion: June 8th

In this assignment, we will implement a variational autoencoder (VAE). Furthermore, we will have a look at Parzen windows, which are a popular (albeit flawed) method of evaluating generative models.

Implementing a VAE

From an implementation standpoint, a VAE is pretty much just an autoencoder with a stochastic encoder and a regularized latent space. As such, you might want to proceed as follows:

You will likely find many VAE implementations around the web. Feel free to use these for “inspiration”, but make sure you understand what you are doing!

Depending on the details of the data, loss function etc. you might need to scale down the regularizer significantly (by multiplying with a number much smaller than 1) to achieve any learning at all. A typical sign of “overregularization” is when all reconstructions look the same.

Train your VAE and generate some samples, perhaps trying out multiple architectures and datasets. Think about the following issues:

Density Estimation Using Parzen Windows

Sometimes you might be wondering how to evaluate a generative model. Evaluating whatever loss function you trained with might be a start, but it is often not very informative. Also, this precludes comparison between different frameworks (e.g. RBMs vs VAEs). Looking at samples is cumbersome and highly subjective. An objective measure of the “goodness of fit” of the model would be nice. One attempt at such a measure uses kernel density estimation, in particular the method of Parzen Windows. Read this short doc for a simple explanation of the method. If you prefer a more detailed explanation, check this one. You can use Parzen windows to evaluate your models as follows: