An autoencoder is a neural network that learns to compress and reconstruct data by minimizing the reconstruction error. To approximately factorize a data matrix 𝐷 as 𝑈𝑉𝑇, where 𝑈 is the encoding matrix and 𝑉 is the decoding matrix, you can build an autoencoder with a bottleneck layer. Here's a step-by-step explanation:
-
Input layer (n x d): The input matrix 𝐷 has 𝑛 samples of 𝑑 dimensions.
-
Encoder (encoder network): The autoencoder consists of an encoder part with a hidden layer (often a smaller dimension k than 𝑑). The hidden layer reduces the dimensionality from 𝑑 to k. The encoding operation is represented by the matrix 𝑈 of dimensions 𝑛 x k. The process can be represented as:
Xencoded=U×H
Here, H is the hidden layer's activation, which is a matrix of size n x k.
-
Bottleneck layer: The decoder network contains a hidden layer of the same size as the encoding layer (k) followed by an output layer to reconstruct the original data. The decoder matrix 𝑉 is a transpose of 𝑈, as it maps the lower-dimensional space back to the original 𝑑 dimensions:
H′=VT
-
Loss function: The autoencoder is trained using a reconstruction loss (e.g., mean squared error) to minimize the difference between the input and the reconstructed data. This helps learn the optimal 𝑈 and 𝑉.
-
Training: The autoencoder is trained iteratively, backpropagating the error from the reconstructed output to adjust the weights in both 𝑈 and 𝑉.
In terms of dimensionality, the inputs (𝐷) and outputs of the autoencoder are both 𝑛 x 𝑑. The encoding matrix 𝑈 has dimensions 𝑛 x k, and the decoding matrix 𝑉 is k x 𝑑.
After training, the encoder 𝑈 acts as a compressed representation of the data, while the decoder 𝑉 can be used to approximately reconstruct the original data from its lower-dimensional encoding. The dimensionality of the hidden layer k is chosen to strike a balance between compression and reconstruction quality. If k is too small, the reconstruction may not be accurate; if it's too large, the compression may not be effective.