This function performs up to total_rounds updates to the state of the
given training_process. At each training round, this update occurs by
invoking training_process.next with state and the output of
training_selection_fn. Depending on rounds_per_evaluation and
rounds_per_saving_program_state, each training round may be followed by an
invocation of the evaluation_fn and by saving the program state.
In addition to the training metrics and evaluation metrics, this function adds
the following performance metrics (key and descriptions):
tff.simulation.ROUND_NUMBER_KEY: The round number.
tff.simulation.TRAINING_TIME_KEY: The amount of time (in seconds) it takes
to run one round of training.
tff.simulation.EVALUATION_TIME_KEY: The amount of time (in seconds) it takes
to run one round of evaluation.
A Callable accepting an integer round number, and
returning a list of client data to use for trainig in that round.
total_rounds
The number of training rounds to run.
evaluation_fn
An optional callable accepting the state of
training_process and the output of evaluation_selection_fn, and
returning a mutable mapping with string-valued keys.
evaluation_selection_fn
A optional Callable accepting an integer round
number, and returning a list of client data to use for evaluation in that
round.
rounds_per_evaluation
The number of training rounds to run between each
invocation of evaluation_fn.
[null,null,["Last updated 2024-09-20 UTC."],[],[],null,["# tff.simulation.run_training_process\n\n\u003cbr /\u003e\n\n|-------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/federated/blob/v0.87.0 Version 2.0, January 2004 Licensed under the Apache License, Version 2.0 (the) |\n\nRuns a federated `training_process`. \n\n tff.simulation.run_training_process(\n training_process: ../../tff/templates/IterativeProcess,\n training_selection_fn: Callable[[int], Any],\n total_rounds: int,\n evaluation_fn: Optional[Callable[[Any, Any], MetricsType]] = None,\n evaluation_selection_fn: Optional[Callable[[int], Any]] = None,\n rounds_per_evaluation: int = 1,\n program_state_manager: Optional[../../tff/program/ProgramStateManager] = None,\n rounds_per_saving_program_state: int = 1,\n metrics_managers: Optional[Iterable[release_manager_lib.ReleaseManager]] = None\n )\n\nThe following [`tff.Computation`](../../tff/Computation) types signaures are required:\n\n- `training_process.initialize`: `( -\u003e state)`.\n- `training_process.next`: `\u003cstate, client_data\u003e -\u003e \u003cstate, metrics\u003e`\n- `evaulation_fn`: `\u003cstate, client_data\u003e -\u003e metrics`\n\nThis function performs up to `total_rounds` updates to the `state` of the\ngiven `training_process`. At each training round, this update occurs by\ninvoking `training_process.next` with `state` and the output of\n`training_selection_fn`. Depending on `rounds_per_evaluation` and\n`rounds_per_saving_program_state`, each training round may be followed by an\ninvocation of the `evaluation_fn` and by saving the program state.\n| **Note:** Round 0 represents saving an initial program model state and computing initial evaluation metrics and round 1 through total_rounds + 1 represent the training rounds.\n\nIn addition to the training metrics and evaluation metrics, this function adds\nthe following performance metrics (key and descriptions):\n\n- tff.simulation.ROUND_NUMBER_KEY: The round number.\n- tff.simulation.TRAINING_TIME_KEY: The amount of time (in seconds) it takes to run one round of training.\n- tff.simulation.EVALUATION_TIME_KEY: The amount of time (in seconds) it takes to run one round of evaluation.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|-----------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `training_process` | A [`tff.templates.IterativeProcess`](../../tff/templates/IterativeProcess) to run for training. |\n| `training_selection_fn` | A `Callable` accepting an integer round number, and returning a list of client data to use for trainig in that round. |\n| `total_rounds` | The number of training rounds to run. |\n| `evaluation_fn` | An optional callable accepting the state of `training_process` and the output of `evaluation_selection_fn`, and returning a mutable mapping with string-valued keys. |\n| `evaluation_selection_fn` | A optional `Callable` accepting an integer round number, and returning a list of client data to use for evaluation in that round. |\n| `rounds_per_evaluation` | The number of training rounds to run between each invocation of `evaluation_fn`. |\n| `program_state_manager` | An optional [`tff.program.ProgramStateManager`](../../tff/program/ProgramStateManager) to use to save program state for fault tolerance. |\n| `rounds_per_saving_program_state` | The number of training rounds to run between saving program state. |\n| `metrics_managers` | An optional list of `tff.program.ReleaseManagers`s to use to save metrics. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| The `state` of the training process after training. ||\n\n\u003cbr /\u003e"]]