openfl.component.assigner
- class openfl.component.assigner.Assigner(tasks, authorized_cols, rounds_to_train, **kwargs)
The 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.
- Class Attributes:
tasks* (list of object) – List of tasks to assign.
authorized_cols (list of str) – Collaborators.
rounds (int) – Number of rounds to train.
all_tasks_in_groups (list) – All tasks in groups.
task_group_collaborators (dict) – Task group collaborators.
collaborators_for_task (dict) – Collaborators for each task.
collaborator_tasks (dict) – Tasks for each collaborator.
Note
* -
tasksargument is taken fromtaskssection of FL plan YAML file.- define_task_assignments()
Abstract method.
- get_aggregation_type_for_task(task_name)
Extract aggregation type from self.tasks.
- Parameters:
task_name (str) – Name of the task.
- Returns:
str – Aggregation type for the task.
- get_all_tasks_for_round(round_number)
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 – List of tasks for the current round.
- get_collaborators_for_task(task_name, round_number)
Abstract method.
- get_tasks_for_collaborator(collaborator_name, round_number)
Abstract method.
- class openfl.component.assigner.RandomGroupedAssigner(task_groups, **kwargs)
The 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:
- RandomGroupedAssigner :
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).
- GroupedAssigner :
Given task groups and a list of collaborators that belong to that task group, carry out tasks for each round of experiment.
- Class Attributes:
task_groups* (list of object) – Task groups to assign.
Note
* - Plan setting.
- define_task_assignments()
Define task assignments for each round and collaborator.
This method uses the assigner function to assign tasks to collaborators for each round. It also maps tasks to their respective aggregation functions.
- Parameters:
None
- Returns:
None
- get_collaborators_for_task(task_name, round_number)
Get collaborators for a specific task in a specific round.
- Parameters:
task_name (str) – Name of the task.
round_number (int) – Round number.
- Returns:
list – List of collaborators for the task in the specified round.
- get_tasks_for_collaborator(collaborator_name, round_number)
Get tasks for a specific collaborator in a specific round.
- Parameters:
collaborator_name (str) – Name of the collaborator.
round_number (int) – Round number.
- Returns:
list – List of tasks for the collaborator in the specified round.
- class openfl.component.assigner.StaticGroupedAssigner(task_groups, **kwargs)
The 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:
- StaticGroupedAssigner :
Given a set of task groups, and a list of collaborators for that group, assign tasks for of collaborators in the federation. After assigning the tasks to collaborator, those tasks should be carried out each round (no reassignment between rounds).
- GroupedAssigner :
Given task groups and a list of collaborators that belong to that task group, carry out tasks for each round of experiment.
- Class Attributes:
task_groups* (list of object) – Task groups to assign.
Note
* - Plan setting.
- define_task_assignments()
Define task assignments for each round and collaborator.
This method uses the assigner function to assign tasks to collaborators for each round. It also maps tasks to their respective aggregation functions.
- Parameters:
None
- Returns:
None
- get_collaborators_for_task(task_name, round_number)
Get collaborators for a specific task in a specific round.
- Parameters:
task_name (str) – Name of the task.
round_number (int) – Round number.
- Returns:
list – List of collaborators for the task in the specified round.
- get_tasks_for_collaborator(collaborator_name, round_number)
Get tasks for a specific collaborator in a specific round.
- Parameters:
collaborator_name (str) – Name of the collaborator.
round_number (int) – Round number.
- Returns:
list – List of tasks for the collaborator in the specified round.
|
Assigner module. |
|
Custom Assigner module. |
|
Random grouped assigner module. |
|
Static grouped assigner module. |
|
Task module. |