Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

callback_lambda

Create a custom callback


Description

This callback is constructed with anonymous functions that will be called at the appropriate time. Note that the callbacks expects positional arguments, as:

  • on_epoch_begin and on_epoch_end expect two positional arguments: epoch, logs

  • on_batch_*, on_train_batch_*, on_predict_batch_* and on_test_batch_*, expect two positional arguments: batch, logs

  • on_train_*, on_test_* and on_predict_* expect one positional argument: logs

Usage

callback_lambda(
  on_epoch_begin = NULL,
  on_epoch_end = NULL,
  on_batch_begin = NULL,
  on_batch_end = NULL,
  on_train_batch_begin = NULL,
  on_train_batch_end = NULL,
  on_train_begin = NULL,
  on_train_end = NULL,
  on_predict_batch_begin = NULL,
  on_predict_batch_end = NULL,
  on_predict_begin = NULL,
  on_predict_end = NULL,
  on_test_batch_begin = NULL,
  on_test_batch_end = NULL,
  on_test_begin = NULL,
  on_test_end = NULL
)

Arguments

on_epoch_begin

called at the beginning of every epoch.

on_epoch_end

called at the end of every epoch.

on_batch_begin

called at the beginning of every training batch.

on_batch_end

called at the end of every training batch.

on_train_batch_begin

called at the beginning of every batch.

on_train_batch_end

called at the end of every batch.

on_train_begin

called at the beginning of model training.

on_train_end

called at the end of model training.

on_predict_batch_begin

called at the beginning of a batch in predict methods.

on_predict_batch_end

called at the end of a batch in predict methods.

on_predict_begin

called at the beginning of prediction.

on_predict_end

called at the end of prediction.

on_test_batch_begin

called at the beginning of a batch in evaluate methods. Also called at the beginning of a validation batch in the fit methods, if validation data is provided.

on_test_batch_end

called at the end of a batch in evaluate methods. Also called at the end of a validation batch in the fit methods, if validation data is provided.

on_test_begin

called at the beginning of evaluation or validation.

on_test_end

called at the end of evaluation or validation.

See Also


keras

R Interface to 'Keras'

v2.4.0
MIT + file LICENSE
Authors
Daniel Falbel [ctb, cph, cre], JJ Allaire [aut, cph], François Chollet [aut, cph], RStudio [ctb, cph, fnd], Google [ctb, cph, fnd], Yuan Tang [ctb, cph] (<https://orcid.org/0000-0001-5243-233X>), Wouter Van Der Bijl [ctb, cph], Martin Studer [ctb, cph], Sigrid Keydana [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.