← Back to the universe 10 / 13

10 / MACHINE LEARNING

VAE from scratch

A variational autoencoder with backpropagation written by hand — no PyTorch, no auto-grad library.

Code on GitHub ↗
Five grayscale clothing images generated by the VAE
Five Fashion-MNIST samples decoded from random draws from the standard normal prior.
PythonNumPyMatplotlib

Exploring the latent space

Grid of decoded clothing images with one latent coordinate varied per row
Latent traversal. Each row varies one coordinate from −3 to 3 while holding the others fixed at a validation image’s encoded means.
Scatterplots comparing the first latent coordinate with the others, colored by clothing class
Latent scatterplots. Each panel compares the first encoded coordinate with another, colored by Fashion-MNIST class.
A separate histogram of the encoded means for each latent coordinate
Latent histograms. Each panel shows the distribution of one encoded mean across the validation set.