openfl.component.assigner.assigner.Assigner#
- class openfl.component.assigner.assigner.Assigner(tasks, authorized_cols, rounds_to_train, **kwargs)[source]#
Bases:
objectThe task assigner maintains a list of tasks.
Also it decides the policy for which collaborator should run those tasks. There may be many types of policies implemented, but a natural place to start is with a:
- RandomGroupedTaskAssigner :
Given a set of task groups, and a percentage, assign that task group to that percentage of collaborators in the federation. After assigning the tasks to collaborator, those tasks should be carried out each round (no reassignment between rounds).
- GroupedTaskAssigner :
Given task groups and a list of collaborators that belong to that task group, carry out tasks for each round of experiment.
- tasks*
List of tasks to assign.
- Type:
list of object
- authorized_cols#
Collaborators.
- Type:
list of str
- rounds#
Number of rounds to train.
- Type:
int
- all_tasks_in_groups#
All tasks in groups.
- Type:
list
- task_group_collaborators#
Task group collaborators.
- Type:
dict
- collaborators_for_task#
Collaborators for each task.
- Type:
dict
- collaborator_tasks#
Tasks for each collaborator.
- Type:
dict
Note
* -
tasksargument is taken fromtaskssection of FL plan YAML file.- __init__(tasks, authorized_cols, rounds_to_train, **kwargs)[source]#
Initializes the Assigner.
- Parameters:
tasks (list of object) – List of tasks to assign.
authorized_cols (list of str) – Collaborators.
rounds_to_train (int) – Number of training rounds.
**kwargs – Additional keyword arguments.
Methods
__init__(tasks, authorized_cols, ...)Initializes the Assigner.
Abstract method.
get_aggregation_type_for_task(task_name)Extract aggregation type from self.tasks.
get_all_tasks_for_round(round_number)Return tasks for the current round.
get_collaborators_for_task(task_name, ...)Abstract method.
Abstract method.
- get_aggregation_type_for_task(task_name)[source]#
Extract aggregation type from self.tasks.
- Parameters:
task_name (str) – Name of the task.
- Returns:
Aggregation type for the task.
- Return type:
str