WHY three components? The encoder discovers what's important, the bottleneck forces compression (preventing the network from just memorizing), and the decoder tests if the compressed representation is sufficient.
WHAT makes it "auto"? The network teaches itself – the target output is the input. No labeled data required.
Information content: I(x)≤dxlog2(L) bits (for L quantization levels per dimension).
Bottleneck capacity: I(z)≤dzlog2(Lz) bits.
For perfect reconstruction: dzlog2(Lz)≥I(x) (Shannon's source coding theorem).
WHY can we compress? Real data has intrinsic dimensionalitydintrinsic≪dx. Images of faces live on a low-dimensional manifold (face space), not uniformly filling R784.
Minimize L=∥x−WTx∥2 where W∈Rn×k (encoder), WT (decoder).
Taking gradient: ∂W∂L=0 gives eigenvectors of covariance matrixE[xxT].
This is PCA. WHY use autoencoders then? Nonlinear activations let them learn curved manifolds, not just hyperplanes.
Recall Explain to a 12-Year-Old
Imagine you're sending photos to a friend, but the internet is slow. You can't send the full 1MB photo. So you write down: "It's a cat, orange, lying on a couch, sunlight from left." That's maybe 50bytes! Your friend reads this description and draws a picture. It won't be perfect, but it'll capture the main idea.
That's an autoencoder! The encoder (you) looks at the photo and writes down the key facts. The decoder (friend) reads those facts and recreates the photo. The latent code is the short description.
Training is like practicing: You send the photo, friend draws it, you compare. If the cat looks like a dog, you adjust your description ("add: pointy ears, whiskers"). After many tries, the descriptions get better, and the drawings look more like the originals.
The magic: the description is tiny compared to the photo, but contains everything important!
Dimensionality reduction: Visualize high-D data (alternative to PCA, t-SNE)
Anomaly detection: High reconstruction error → outlier (e.g., fraud detection)
Denoising: Train on noisy inputs, clean targets (denoising autoencoders)
Pretraining: Encoder as initialization for supervised task (transfer learning)
Data compression: Losy compression (though not competitive with JPEG/H.264)
WHY anomaly detection? Network learns "normal" data distribution. Unusual inputs (anomalies) reconstruct poorly because they don't fit learned patterns.
Unsupervised Learning: Autoencoders require no labels
#flashcards/ai-ml
What are the three components of an autoencoder? :: Encoder (maps input to latent code), Latent space (compressed representation), Decoder (reconstructs input from latent code)
What is the training objective of an autoencoder?
Minimize reconstruction loss between input x and reconstructed output x̂, typically using MSE or BCE depending on data type
Why is the bottleneck dimension important in autoencoders?
It must be smaller than input dimension to force compression and prevent memorization. If too large, network learns identity mapping; if too small, loses important information.
What loss function should be used for binary data in autoencoders?
What loss function should be used for continuous data in autoencoders?
Mean Squared Error (MSE): (1/n)Σ(x_i - x̂_i)², derived from Gaussian likelihood assumption
What is the relationship between linear autoencoders and PCA?
Linear autoencoders are mathematically equivalent to PCA—they learn eigenvectors of the data covariance matrix that capture maximum variance
How does interpolation work in autoencoder latent space?
Encode two inputs to z_A and z_B, interpolate linearly z_t = (1-t)z_A + t z_B, then decode z_t to get smooth transitions between original inputs
Why do autoencoders work for data compression?
Real data has intrinsic dimensionality much lower than ambient dimensionality due to redundancy and structure. Autoencoders discover this low-dimensional manifold.
What is a common mistake when setting bottleneck size?
Making it too large (d_z ≥ d_x) allows identity mapping without learning useful compressed representations. Fix: set d_z significantly smaller than d_x
How are autoencoders used for anomaly detection?
Network learns to reconstruct "normal" data well. Anomalies have high reconstruction error because they don't fit the learned distribution, making them detectable.
What activation function is typically used in the decoder output layer for image reconstruction?
Sigmoid for binary/normalized images (outputs in [0,1]), or linear/tanh depending on data range. Must match the expected output distribution.
What prevents an autoencoder from learning the identity function?
The dimensionality bottleneck constraint (d_z < d_x) and/or regularization techniques (sparsity penalties, noise injection, KL divergence in VAEs)
Autoencoder ek neural network hai jo data ko compress karke chota representation banata hai (encoding), phir wapas original form mein reconstruct karta hai (decoding). Sochiye jaise ap ek bada suitcase pack kar rahe ho – apko decide karna padta hai ki kya zaroori hai, kya redundant hai, aur destination pe jake sab kaise wapas unpack karenge. Real-world data mein bohot redundancy hoti hai – images mein spatial patterns, text mein semantic structure. Autoencoder ek information bottleneck create karta hai, jisse network ko underlying structure discover karna force hota hai.
Teen components hote hain: Encoder input ko latent space mein map karta hai (compressed form), Latent space woh small representation hai (jaise 784 pixels ko 32 numbers mein compress karna), aur Decoder us compressed code se original input ko reconstruct karta hai. Training objective simple hai: reconstruction loss minimize karo – matlab input aur reconstructed output ka difference kam karo, using MSE (continuous data ke liye) ya BCE (binary data ke liye).
Autoencoder ka magic bottleneck dimension mein hai. Agar latent space bohot bada hai toh network sirf memorize kar lega (identity mapping), kuch seekhega nahi. Agar bohot chota hai toh important details kho jayengi. Sahi size se network ko data ka intrinsic structure seekhna padta hai – jaise MNIST digits mein 784 pixels hain but actually wo 10-20 dimensions ki manifold pe live karte hain (digit identity, rotation, thickness). Latent space mein similar inputs (jaise different "3"s) pas-paas cluster hote hain, aur interpolation se smooth transitions milte hain (jaise "3" gradually "8" mein morph ho). Ye unsupervised learning hai – koi labels nahi chahiye, network khud seekhta hai ki data mein kya important hai!