How does a linear autoencoder trained with mean squared error relate to PCA?
Role: Machine Learning Engineer
Category: Machine Learning
Difficulty: hard
Interview Round: Other
How does a linear autoencoder trained with mean squared error relate to PCA?
Assume the autoencoder has a k-unit bottleneck, no activation functions, and is trained to minimize mean squared reconstruction error. What does it learn, and how do its weights compare with the principal components?
```hint Look at the composite map
Encoder followed by decoder is one linear map of rank at most k. Which classical result gives the best rank-k approximation under squared error?
```
```hint Check the factorization
Insert a k by k matrix and its inverse between the encoder and the decoder. Does the loss change, and what does that tell you about the individual weight matrices?
```
### What a Strong Answer Covers
- Which subspace or projection the optimal linear autoencoder learns, and the result that justifies it.
- Whether the learned encoder and decoder weights equal the principal directions, and why or why not.
- The shape of the loss landscape (local minima and saddle points) and how gradient training compares with computing PCA directly.
- The conditions the equivalence needs (centering or bias terms, linear maps, an eigenvalue gap) and what changes with non-linear layers.
- How to recover ordered, orthonormal components and explained variance if they are needed.
### Follow-up Questions
- You trained a linear autoencoder and now need the actual principal directions and their explained variance. How do you get them from the learned weights?
- What changes if the decoder weights are tied to the transpose of the encoder weights?
- Why does a sigmoid at a single bottleneck layer, followed by a linear decoder, still fail to beat PCA's reconstruction error?
- When would you train a linear autoencoder with SGD instead of running an SVD?
Overview: Asks how a linear autoencoder with a k-unit bottleneck, trained on squared reconstruction error, compares with principal component analysis. Tests understanding of low-rank approximation, weight identifiability, the loss landscape, and when the equivalence breaks.