This repository contains a series of small exercises to walk you, dear reader, through some of the core concepts of Variational Auto-Encoders (VAEs) by having you implement your own miniature VAE library in Keras. Completing this tutorial will give you a better understanding not only of how probabilistic deep-learning libraries like Edward, PyRo, ZhuSuan, or others work under the hood, but also of how to write custom extensions in Keras in general.
- Familiarity with core concepts in Keras - make sure you understand what is happening in Keras' getting started and functional API documentation.
- Familiarity with keras backend functions like
K.dot()
,K.mean()
,K.exp()
, etc., and how they are used inside keras'Layer
objects. - Familiarity with VAEs - read an introduction such as this one.
Since the data/
directory and visualize.py
are shared by all exercises, start by putting the project's root directory in your PYTHONPATH
(this will allow other scripts to do from data import ...
from within other directories). In a terminal, run
export PYTHONPATH=$PWD:$PYTHONPATH
Next, use virtualenv to create a python environment and install the necessary dependencies (solutions were written in Python 3.5 but should work in Python 2.7):
virtualenv vae-tutorial
pip install -r requirements.txt
This tutorial is broken into a series of ordered "exercises," each building on the previous. In the solutions/
directory, each solution's source files build on the previous ones by only a small "diff". Each exercise contains an "instructions.md" file outlining what you need to implement and giving helpful tips. These are best viewed in-browser - click here to go to exercise 01.
Each exercise contains # YOUR CODE HERE
comments across various files indicating parts you must implement.