Class Callback
Defined in tensorflow/python/keras/callbacks.py
.
Abstract base class used to build new callbacks.
Attributes:
params
: dict. Training parameters (eg. verbosity, batch size, number of epochs...).model
: instance ofkeras.models.Model
. Reference of the model being trained.
The logs
dictionary that callback methods
take as argument will contain keys for quantities relevant to
the current batch or epoch.
Currently, the .fit()
method of the Sequential
model class
will include the following quantities in the logs
that
it passes to its callbacks:
on_epoch_end
: logs includeacc
andloss
, and optionally includeval_loss
(if validation is enabled infit
), andval_acc
(if validation and accuracy monitoring are enabled).on_batch_begin
: logs includesize
, the number of samples in the current batch.on_batch_end
: logs includeloss
, and optionallyacc
(if accuracy monitoring is enabled).
__init__
__init__()
Initialize self. See help(type(self)) for accurate signature.
Methods
tf.keras.callbacks.Callback.on_batch_begin
on_batch_begin(
batch,
logs=None
)
tf.keras.callbacks.Callback.on_batch_end
on_batch_end(
batch,
logs=None
)
tf.keras.callbacks.Callback.on_epoch_begin
on_epoch_begin(
epoch,
logs=None
)
tf.keras.callbacks.Callback.on_epoch_end
on_epoch_end(
epoch,
logs=None
)
tf.keras.callbacks.Callback.on_train_batch_begin
on_train_batch_begin(
batch,
logs=None
)
tf.keras.callbacks.Callback.on_train_batch_end
on_train_batch_end(
batch,
logs=None
)
tf.keras.callbacks.Callback.on_train_begin
on_train_begin(logs=None)
tf.keras.callbacks.Callback.on_train_end
on_train_end(logs=None)
tf.keras.callbacks.Callback.set_model
set_model(model)
tf.keras.callbacks.Callback.set_params
set_params(params)