October 2018
Intermediate to advanced
252 pages
6h 49m
English
Create a sequential model with the appropriate share:
from keras.optimizers import RMSpropmodel = Sequential()model.add(Dense(512, activation='relu', input_shape=(784,)))model.add(Dropout(0.2))model.add(Dense(512, activation='relu'))model.add(Dropout(0.2))model.add(Dense(num_classes, activation='softmax'))model.summary()model.compile(loss='categorical_crossentropy', optimizer=RMSprop(), metrics=['accuracy'])history = model.fit(x_train, y_train, batch_size=batch_size, epochs=epochs, verbose=1, validation_data=(x_test, y_test))
Here we are creating a network with two hidden layers and a dropout of 0.2.
Optimizer used in RMSProp.
The following is the output of the preceding code:
Layer (type) Output Shape Param #================================================================= ...