February 2019
Beginner to intermediate
308 pages
7h 42m
English
First, let's start building our basic autoencoder in Keras. As always, we'll use the Sequential class in Keras to build our model.
We'll start by importing and defining a new Sequential class in Keras:
from keras.models import Sequentialmodel = Sequential()
Next, we'll add the hidden layer to our model. From the previous diagram, we can clearly see that the hidden layer is a fully connected layer (that is, a Dense layer). From the Dense class in Keras, we can define the size of the hidden layer through the units parameter. The number of units is a hyperparameter that we will be experimenting with. For now, let's use a single node (units=1) as the hidden layer. The input_shape to the Dense layer is a vector of ...