How it works...

In step 1, we built a Keras functional autoencoder model. We first defined an input layer and an encoder and decoder network and then combined them to create a deep autoencoder. The encoder network reduces the input of 784 dimensions to 32 dimensions. The decoder network reconstructs 32 dimensions (the input to the decoder) to 784 dimensions. In step 2, we built a separate encoder model. The encoder model shared the encoder layers of the autoencoder, which means the weights are shared.

In the next step, we defined a separate decoder model. This model shared the decoder layers of the autoencoder. We first defined an encoded input layer and then extracted dense layers from the autoencoder to create the decoder. In step 4, we configured our model to minimize binary cross-entropy loss with the Adadelta optimizer and then trained the model for 50 epochs. In step 5, we encoded the test images into reduced dimensions.

 In step 6, we used the decoder model to reconstruct the test data and calculated the reconstruction error. In the next step, we encoded training images. In step 8, we configured and compiled a classification network for digit recognition. In step 9, we processed train labels and trained the network. In the last step, we evaluated the performance of our digit classification model. 

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset