tf.keras.callbacks.History
Stay organized with collections
Save and categorize content based on your preferences.
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
View source
set_model(
model
)
set_params
View source
set_params(
params
)
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2023-10-06 UTC.
[null,null,["Last updated 2023-10-06 UTC."],[],[],null,["# tf.keras.callbacks.History\n\n\u003cbr /\u003e\n\n|----------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/keras-team/keras/tree/v2.14.0/keras/callbacks.py#L1184-L1221) |\n\nCallback that records events into a `History` object.\n\nInherits From: [`Callback`](../../../tf/keras/callbacks/Callback) \n\n tf.keras.callbacks.History()\n\nThis callback is automatically applied to\nevery Keras model. The `History` object\ngets returned by the `fit` method of models.\n\n#### Example:\n\n model = tf.keras.models.Sequential([tf.keras.layers.Dense(10)])\n model.compile(tf.keras.optimizers.SGD(), loss='mse')\n history = model.fit(np.arange(100).reshape(5, 20), np.zeros(5),\n epochs=10, verbose=1)\n print(history.params)\n {'verbose': 1, 'epochs': 10, 'steps': 1}\n # check the keys of history object\n print(history.history.keys())\n dict_keys(['loss'])\n\nMethods\n-------\n\n### `set_model`\n\n[View source](https://github.com/keras-team/keras/tree/v2.14.0/keras/callbacks.py#L694-L695) \n\n set_model(\n model\n )\n\n### `set_params`\n\n[View source](https://github.com/keras-team/keras/tree/v2.14.0/keras/callbacks.py#L691-L692) \n\n set_params(\n params\n )"]]