Class ModelCheckpoint
Inherits From: Callback
Defined in tensorflow/python/keras/callbacks.py.
Save the model after every epoch.
filepath can contain named formatting options,
which will be filled the value of epoch and
keys in logs (passed in on_epoch_end).
For example: if filepath is weights.{epoch:02d}-{val_loss:.2f}.hdf5,
then the model checkpoints will be saved with the epoch number and
the validation loss in the filename.
Arguments:
filepath: string, path to save the model file.monitor: quantity to monitor.verbose: verbosity mode, 0 or 1.save_best_only: ifsave_best_only=True, the latest best model according to the quantity monitored will not be overwritten.mode: one of {auto, min, max}. Ifsave_best_only=True, the decision to overwrite the current save file is made based on either the maximization or the minimization of the monitored quantity. Forval_acc, this should bemax, forval_lossthis should bemin, etc. Inautomode, the direction is automatically inferred from the name of the monitored quantity.save_weights_only: if True, then only the model's weights will be saved (model.save_weights(filepath)), else the full model is saved (model.save(filepath)).period: Interval (number of epochs) between checkpoints.
__init__
__init__(
filepath,
monitor='val_loss',
verbose=0,
save_best_only=False,
save_weights_only=False,
mode='auto',
period=1
)
Initialize self. See help(type(self)) for accurate signature.
Methods
tf.keras.callbacks.ModelCheckpoint.on_batch_begin
on_batch_begin(
batch,
logs=None
)
tf.keras.callbacks.ModelCheckpoint.on_batch_end
on_batch_end(
batch,
logs=None
)
tf.keras.callbacks.ModelCheckpoint.on_epoch_begin
on_epoch_begin(
epoch,
logs=None
)
tf.keras.callbacks.ModelCheckpoint.on_epoch_end
on_epoch_end(
epoch,
logs=None
)
tf.keras.callbacks.ModelCheckpoint.on_train_batch_begin
on_train_batch_begin(
batch,
logs=None
)
tf.keras.callbacks.ModelCheckpoint.on_train_batch_end
on_train_batch_end(
batch,
logs=None
)
tf.keras.callbacks.ModelCheckpoint.on_train_begin
on_train_begin(logs=None)
tf.keras.callbacks.ModelCheckpoint.on_train_end
on_train_end(logs=None)
tf.keras.callbacks.ModelCheckpoint.set_model
set_model(model)
tf.keras.callbacks.ModelCheckpoint.set_params
set_params(params)