Keep one coordinate, then repair each half
numeric▲△△Exact values where possible; six decimal places otherwise.
STATEMENT
Run a width-one linear autoencoder by hand on four points. Then improve the decoder alone, and after it the encoder alone, using their closed forms.
GIVEN
The data are , , and . They are centred, with
The autoencoder starts at and : it keeps the first coordinate and writes it back.
FIND
The four codes, the reconstructions and the loss. The best decoder for this encoder and its loss. The best encoder for that decoder and its loss. Where the sequence goes if the two repairs are alternated.
STRATEGY
Evaluate (I.12.1) directly, then apply the two lines of (I.12.3) in turn. After a decoder repair the loss is .
SOLUTION
The starting point. The codes are the first coordinates: , , and . Each reconstruction is , so each error is the square of the second coordinate: , , and . The loss is their mean, . That is , the variance of the coordinate that was dropped.
Repair the decoder. With the code variance is and . The first line of (I.12.3) gives
The decoder now predicts the second coordinate from the first by regression. The loss falls to
Repair the encoder. For this decoder , and the second line of (I.12.3) gives
The autoencoder is now the projection onto the direction of . By (I.12.4) its loss is minus the variance along that direction, which is .
Alternate. Two more repairs give and , and the sequence converges to .
The reason is visible in the two formulas. The decoder repair sets proportional to , and the encoder repair sets proportional to . One full sweep therefore multiplies the direction by , which is the power method. The starting direction equals for the eigenvectors and of , with eigenvalues and . Each sweep divides the tangent of the angle to by : it is , then , then . A projection at angle to has loss , which reproduces and .
Answer
Codes and loss . Best decoder with loss . Best encoder with loss . Then , , and the limit , the smaller eigenvalue of .
Check — sanity
The losses decrease at every step, because each repair is an exact minimisation over one matrix with the other held fixed. None falls below , the bound of I.12.T1.
Check — numeric · i-12-autoencoders-checks.py
The complete reproduction script uses only the Python standard library. From a checkout of the repository, run:
python3 scripts/snippets/i-12-autoencoders-checks.pyIt checks all fifteen problems of the chapter and the numbers quoted in its four propositions. Its first line reports the losses above. Before that it confirms that has eigenvalues and with the stated eigenvectors, and later that the gradients of (I.12.2) match central finite differences for untied and for tied weights.
Executed in CI. The digits above are the digits it printed.
Where this breaks
Start the encoder at . Then is a multiple of , the repaired decoder is again, and the alternation never moves. The loss stays at . This is the saddle of I.12.T2, and an exact start on it is the only way to remain there.
Variation
Keep the second coordinate instead, and . The loss is , worse than before because the first coordinate has the larger variance. One decoder repair gives and a loss of .