Every architecture so far has taken an input and produced a different kind of output — a class label, a next character, a translation. An autoencoder does something stranger: it tries to reproduce its own input, after being forced through a narrower pipe than the input itself.
These are the same seven points from Part II's PCA — short for Principal Component Analysis — chapter. The encoder compresses each 2D point down to a single number — its position along one direction. The decoder expands that one number back out to 2D, by placing it back on that same line. Drag the direction: every point snaps onto whatever line you've chosen, and the gap between a point and its snapped-back position is exactly what got lost by compressing.
With a 1D bottleneck and linear encoder/decoder, encoding is a projection and decoding places the result back on the line:
- — one input data point (2D here).
- — the unit direction defining the bottleneck: the line the encoder projects onto and the decoder places points back on.
- — the encoded value: 's position along , the single-number bottleneck.
- — the reconstruction: placed back on the line, the autoencoder's best guess at .
- — the reconstruction loss: mean squared distance between each point and its reconstruction.
- — the number of data points being averaged over.
- Reconstruction error is maximizing variance in disguise
For a unit direction , because is the closest point on the line to , Pythagoras gives — so minimizing reconstruction error is exactly the same problem as maximizing , the projected variance from Part II.
- A linear autoencoder is PCA
A linear autoencoder with one bottleneck dimension is PCA.
Drag along this curve — it's reconstruction error as a function of the bottleneck direction's angle. There's exactly one minimum, and it's a real critical point: the tangent is flat right at the bottom, not just low. Autoencoders only get interesting when the encoder and decoder stop being linear — then this single smooth bowl can become a much more complicated surface, capable of capturing bends and curves a straight line never could.
- At the true PCA direction (0.6, 0.8)
Reconstruction error is the mean of each point's squared distance to its own projection — exactly the variance left over in the perpendicular direction . Projecting the seven points onto that perpendicular direction (dot product ) gives (mean ), so the mean squared error is — and every other direction does strictly worse.
- Rotate away
Even a small rotation away from makes the error rise immediately, because you're no longer capturing the one direction these seven points actually vary along.
Drag the bottleneck direction until the reconstruction error drops to within 0.05 of the best possible value, 0.571.
A linear, 1D-bottleneck autoencoder rediscovers PCA's principal direction purely by trying to minimize reconstruction error — nobody told it to maximize variance. Swap the linear encoder/decoder for the nonlinear networks built throughout this course, and the same idea compresses far richer data — images, audio, whatever — into a bottleneck that still tries to keep only what's needed to reconstruct. The next two chapters ask what happens when, instead of reconstructing real data, a network tries to generate new data that never existed.