October 2018
Intermediate to advanced
472 pages
10h 57m
English
With the model defined, compile the model with 'categorical_crossentropy' as loss and optimizer as Adam, as defined by the optimizer variable in the hyperparameters section. We will also define ReduceLROnPlateau to reduce the learning rate as needed when training, as follows:
# compile modelmodel.compile(loss="categorical_crossentropy", optimizer=Adam(lr=0.002), metrics=["accuracy"])# use ReduceLROnPlateau to adjust the learning ratereduceLROnPlat = ReduceLROnPlateau(monitor='val_acc', factor=0.75, patience=5, min_delta=0.005, mode='max', cooldown=3, verbose=1)callbacks_list = [reduceLROnPlat]
Read now
Unlock full access