On this page
tf.keras.callbacks.History
Callback that records events into a History
object.
Inherits From: Callback
tf.keras.callbacks.History()
This callback is automatically applied to every Keras model. The History
object gets returned by the fit
method of models.
Example:
model = tf.keras.models.Sequential([tf.keras.layers.Dense(10)])
model.compile(tf.keras.optimizers.SGD(), loss='mse')
history = model.fit(np.arange(100).reshape(5, 20), np.zeros(5),
epochs=10, verbose=1)
print(history.params)
{'verbose': 1, 'epochs': 10, 'steps': 1}
# check the keys of history object
print(history.history.keys())
dict_keys(['loss'])
Methods
set_model
set_model(
model
)
set_params
set_params(
params
)
© 2022 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 4.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/versions/r2.9/api_docs/python/tf/keras/callbacks/History