openfl.callbacks.Callback

openfl.callbacks.Callback#

class openfl.callbacks.Callback[source]#

Base class for callbacks.

Callbacks can be used to perform actions at different stages of the Federated Learning process. To create a custom callback, subclass openfl.callbacks.Callback and implement the necessary methods.

Callbacks can be triggered on the aggregator and collaborator side for the following events:

  • At the beginning of an experiment

  • At the beginning of a round

  • At the beginning of a task^

  • At the end of a task^

  • At the end of a round

  • At the end of an experiment

^ These events are only triggered for the collaborator.

params#

Additional parameters saved for use within the callback.

tensor_db#

The TensorDB instance of the respective participant.

__init__()[source]#

Methods

__init__()

on_experiment_begin([logs])

Callback function to be executed at the beginning of an experiment.

on_experiment_end([logs])

Callback function to be executed at the end of an experiment.

on_round_begin(round_num[, logs])

Callback function to be executed at the beginning of a round.

on_round_end(round_num[, logs])

Callback function to be executed at the end of a round.

on_task_begin(task_name, round_num[, logs])

Callback function to be executed at the beginning of a task.

on_task_end(task_name, round_num[, logs])

Callback function to be executed at the end of a task.

set_params(params)

set_tensor_db(tensor_db)