Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@siakon89
Last active August 23, 2018 10:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save siakon89/08edd89bdcf42fb1ca90e149d1f6e26f to your computer and use it in GitHub Desktop.
Save siakon89/08edd89bdcf42fb1ca90e149d1f6e26f to your computer and use it in GitHub Desktop.
# Compile the model
batch_size = 86
opt_rms = keras.optimizers.RMSprop(lr=0.0001, rho=0.9, epsilon=1e-08, decay=0.0)
# opt_rms = keras.optimizers.Adam(lr=0.001, decay=1e-6)
model.compile(loss='categorical_crossentropy',
optimizer=opt_rms,
metrics=['accuracy'])
from time import time
epochs = 50
tbCallBack = keras.callbacks.TensorBoard(log_dir='./Graph/{}'.format(time()),
histogram_freq=0,
write_graph=True,
write_images=True)
checkpoint = ModelCheckpoint('model-{epoch:03d}.h5',
verbose=1,
monitor='val_acc',
save_best_only=True,
mode='auto')
learning_rate_reduction = ReduceLROnPlateau(monitor='val_acc',
patience=3,
verbose=1,
factor=0.5,
min_lr=0.00001)
model.fit(x_train,
y_train,
batch_size=batch_size,
epochs=epochs,
verbose=1,
validation_data=(x_test, y_test),
callbacks=[tbCallBack, checkpoint])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment