Defining and training the autoencoder
In this section, we will create, train, and test the autoencoder.
An autoencoder will encode the input data using a CNN with the same type of layers as the CNN we created in the Defining and training the CNN model section of this chapter.
However, there is a fundamental difference compared with the CNN:
An autoencoder encodes the data and then decodes the result to match the input data.
We are not trying to classify the inputs. We are finding a set of weights that guarantees that if we apply that set of weights to a perturbation of an image, we will remain close to the original.
The perturbations are ways to find the missing feature in an instance that produced a prediction. For example, in the The contrastive explanation method section of this chapter, we examined the following possible symptoms of the patient described as features:
Features for label 1 = {cough, fever, number of days=5}
The label of the diagnosis...