Researchers used to panic and suffer due to the lack of unsupervised approaches to train NNs prior to emergence of Autoencoders.
Autoencoder ~ (1991)
AEs were solely created to address unsupervised representation learning and data compression. Previous work on linear PCA and representation learning did lay out the backbone and it's not like AE came out of blue.
Is a neural network made up of two parts:
- Encoder network: compresses high-dimensional input data into low-dimensional embedding vector
- Decoder network: decompresses given embedding vector back to original domain.

Auto encoders were originally created for unsupervised representation learning and data compression as previous work in linear PCA only dealt in linear dimensions, real world data is however non-linear. Auto encoders quickly became used for pretraining classifiers. In early days of Deep learning(2006-2012) training deep networks was hard because of vanishing/exploding gradients, lack of labelled data, bad weight initialization. Bottleneck forces model to learn important features from raw data, once trained decoder was discarded, encoders weights were appended by a deep supervised classifier and entire model was fine-tuned with labelled data, the model converged faster and generalized better.
Plot of colored latent space of an AE that is trained on Fashion MNIST clothes.


Applications of Autoencoders
- Image denoising
Auto encoders were also used for image denoising and there are many examples of AE denoising in our slide


linear PCA vs Deep AE performance

- Principal component Analysis
Non-linear PCA arch. 1991 that was actually named as AE in recent times

- Text retrieval


- Similar Image Search

- Deconvolution
Technique is used to do image super-resolution, semantic segmentation


Sparse Autoencoders (SAEs) ~(mid-2000s)
Is a type of autoencoder that enforces sparsity constraints on hidden layer.
- Sparsity prevents overfitting,
- enhances feature extraction.
- We ensure that only a few neurons activate for any given input
Ways to achieve Sparsity
- L1 regularization
We achieve sparsity by adding a penalty term to loss function L1 regularization
: net output activation value of bottle neck layer's i'th neuron
Higher λ → more sparsity
- KL Divergence
Another way is to enforce sparsity by measuring difference between average neuron activation and target sparsity level p. KL Divergence enforces sparsity by penalizing neurons that are too active.
P is a percentage value which means only p% of neurons should be active at a time
: target activation value e.g. 5% of neurons should be active at a time
: actual activation of neuron j
measures how different actual neuron activation is from desired sparsity p
If too many neurons are active , KL loss is high, penalizing the network

| X1 | 0.55 |
| X2 | 0.72 |
| 11 | 0.42 |
| 12 | 0.72 |
| 21 | 0 |
| 22 | 0.3 |
| 31 | 0.15 |
| 32 | 0.09 |
| 41 | 0.44 |
| 42 | 0.03 |
| 43 | 0.55 |
| 51 | 0.55 |
| 61 | 0.71 |
| 71 | 0.29 |
| 81 | 0.97 |
| 82 | 0.55 |
| 83 | 0.97 |
| 91 | 0.71 |
| 92 | 0.7 |
| 93 | 0.22 |

Learning rate = 0.5, ReLU activation at each neuron

: pre activation values at layer n
: weight gradients at layer n
: activation function gradients
activation net output from previous layer
Z : pre activation value at neuron
A: activation output
Q1) Do forward pass
Q2) Compute reconstruction error
Q3) Perform backward pass, update weights
Ans1)
| Neuron | Calculation |
| 1 | 0.7494 |
| 2 | 0.216 |
| 3 | 0.1473 |
| 4 | 0.417231 |
| 5 | 0.22947705 |
| 6 | 0.29623401 |
| 7 | 0.12099699 |
| 8 | 0.50288852 |
| 9 | 0.39691185 |
Ans2)

| X1 | 0.55 |
| X2 | 0.72 |
Ans3)
