Last active
October 27, 2018 10:43
-
-
Save mirrornerror/b41848739ddf03e405578afb0e72424b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from keras.callbacks import EarlyStopping, ModelCheckpoint, ReduceLROnPlateau | |
reduce_lr = ReduceLROnPlateau(monitor='val_loss', factor=0.2, patience=3, min_lr=0.000001,verbose=1) | |
checkpointer = ModelCheckpoint(filepath='checkpoint.hdf5', verbose=1, save_best_only=True) | |
early_stopping = EarlyStopping(patience=10, verbose=1) | |
history = model.fit(x_train, y_train, | |
epochs=300, | |
batch_size=32, | |
verbose=1, | |
validation_split=0.1, | |
callbacks=[reduce_lr, early_stopping, checkpointer]) | |
model.load_weights('checkpoint.hdf5') | |
pred = model.predict(x_test) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment