Class - Assigner#
- class openfl.component.assigner.assigner.Assigner(tasks, authorized_cols, rounds_to_train, selected_task_group=None, **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.
- Parameters:
selected_task_group (str)
- 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, selected_task_group=None, **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.
selected_task_group (str, optional) – Selected task_group.
**kwargs – Additional keyword arguments.
Methods
__init__(tasks, authorized_cols, rounds_to_train)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.
Check if the selected task group is for 'evaluation' run.
with_selected_task_group(func)Decorator to filter task groups based on selected_task_group.
- 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
- get_all_tasks_for_round(round_number)[source]#
Return tasks for the current round.
Currently all tasks are performed on each round, But there may be a reason to change this.
- Parameters:
round_number (int) – Round number.
- Returns:
List of tasks for the current round.
- Return type:
list