The minimum of a linear autoencoder, step by step
symbolic▲▲▲Exact values where possible; six decimal places otherwise.
STATEMENT
Prove that the smallest loss of a linear autoencoder is the sum of the discarded eigenvalues, find every pair of matrices that attains it, and evaluate the result on four points.
GIVEN
Centred data with covariance , where and the are orthonormal. The loss is the first line of (I.12.2), with , and . Assume . For the numbers, use the four points of I.12.B01 with .
FIND
(a) The best encoder for a fixed decoder, and the end-to-end map it gives. (b) The loss of that map in terms of an orthonormal basis. (c) The lower bound and the condition for equality. (d) All minimising pairs. (e) The eigenvalues, the optimal map, its loss and two different factorisations for the four points. (f) The other stationary projection and a path that leaves it downhill.
STRATEGY
Reduce pairs of matrices to subspaces by solving for the encoder. Then write the retained variance as a weighted sum of eigenvalues and bound the weights.
SOLUTION
(a) Fix with independent columns. For one input, the derivative of with respect to is . It vanishes at
which is the unique minimum because is positive definite. The same matrix serves every input, so and
Direct multiplication gives and : the orthogonal projection onto the columns of . No other encoder gives any input a better code, so no encoder has a smaller loss than . Because the data span every direction, and a different encoder gives some of them a strictly worse one.
(b) Choose with orthonormal columns spanning the same subspace. Then , and is symmetric with . Moving one factor around the trace,
This is (I.12.4).
(c) Substitute the eigendecomposition:
Since is a projection and a unit vector, . Since the are an orthonormal basis, . Therefore , and
So the retained variance is at most , and
Because , equality requires for every , hence for every . A unit vector whose projection has length one lies in the subspace. The subspace is therefore the span of , and .
(d) A decoder attains the bound exactly when its columns span that subspace, that is, with invertible. By (a) the encoder must then be
Every invertible gives a minimiser, and these are all of them. This is (I.12.5).
A decoder of rank below spans fewer than dimensions. Its retained variance is at most , which is strictly less because .
(e) For the four points, has trace and determinant , so its eigenvalues solve : they are and . Solving gives , and then . With ,
For the point the code under is , the reconstruction is and the residual is , of squared length . The same holds at every corner.
Two factorisations of the same map: gives and . gives and .
(f) Setting and makes both gradients of (I.12.2) vanish, with loss . Rotate the direction to . By (b) the loss is . At it is . The point is stationary and is not a minimum.
Answer
The minimum is , attained exactly by , for invertible . For the four points the eigenvalues are and , the optimal map is and the loss is . The projection onto is a saddle with loss .
Check — sanity
The optimal map has trace , the dimension of the subspace, and squares to itself: its first entry is . The retained variance and the loss add to the total .
Where this breaks
With the last step fails: weight can move between the tied directions without changing the sum, and the optimal subspace is not unique (I.12.X05). With a zero eigenvalue the encoder is determined only on the directions in which the data vary. With uncentred data is not a covariance and the subspace found is a different one (I.12.X03).
Variation
The script scans directions and confirms that the loss of the projection onto each lies between and , the two eigenvalues. For the bound is an empty sum: the loss is and the map is the identity (I.12.X04).