Encode input data
Z = encode(autoenc,Xnew)
Load the sample data.
X = digitTrainCellArrayData;
X is a 1-by-5000 cell array, where each cell contains a 28-by-28 matrix representing a synthetic image of a handwritten digit.
Train an autoencoder with a hidden size of 50 using the training data.
autoenc = trainAutoencoder(X,50);
Encode decoded data for new image data.
Xnew = digitTestCellArrayData; Z = encode(autoenc,Xnew);
Xnew is a 1-by-5000 cell array.
Z is a 50-by-5000 matrix, where each column represents the image data of one handwritten digit in the new data
If the input to an autoencoder is a vector , then the encoder maps the vector x to another vector as follows:
where the superscript (1) indicates the first layer. is a transfer function for the encoder, is a weight matrix, and is a bias vector.