Autoencoders
Related: 3. Unsupervised Learning | 8. Convolutional Neural Networks | 6. Loss Functions and Backpropagation | 4. Deep Learning and FCNs | Artificial Intelligence
The Curse of Dimensionality
As the number of features increases without increasing training samples, the feature space becomes sparse. Distance metrics lose meaning, and models overfit easily.
Solution: Dimensionality reduction.
What is an Autoencoder?
An unsupervised neural network (related to 3. Unsupervised Learning) that learns a compressed representation of input data and then reconstructs it.
Components:
| Component | Role |
|---|---|
| Encoder | Compresses input into lower-dimensional latent space |
| Latent space (code) | Compressed representation |
| Decoder | Reconstructs input from latent representation |
Loss function (MSE):
Key idea: The network is trained to reproduce its own input (), forcing the latent space to capture essential features.
Types of Autoencoders
1. Vanilla Autoencoder
Fully connected layers. Input → Encoder (Dense) → Latent code → Decoder (Dense) → Reconstructed output.
2. Denoising Autoencoder
Input is a noisy version of the data; the network learns to reconstruct the clean version. This improves robustness.
3. Convolutional Autoencoder (CAE)
Uses Conv2D layers in the encoder and either UpSampling2D (fixed) or Conv2DTranspose (learnable) in the decoder. This builds on convolution concepts from 8. Convolutional Neural Networks.
Encoder: Conv2D + MaxPooling (downsample)
Decoder: Conv2D + UpSampling/Conv2DTranspose (upsample)
Applications
- Denoising — remove noise/artefacts from images
- Image colourisation — convert grayscale to colour
- Dimensionality reduction — alternative to PCA
- Anomaly detection — high reconstruction error = anomaly