Class - RandomGroupedAssigner#
- class openfl.component.assigner.random_grouped_assigner.RandomGroupedAssigner(task_groups, **kwargs)[source]#
Bases:
AssignerThe 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.
- task_groups*
Task groups to assign.
- Type:
list of object
Note
* - Plan setting.
- __init__(task_groups, **kwargs)[source]#
Initializes the RandomGroupedAssigner.
- Parameters:
task_groups (list of object) – Task groups to assign.
**kwargs – Additional keyword arguments, including mode.
Methods
__init__(task_groups, **kwargs)Initializes the RandomGroupedAssigner.
Define task assignments for each round and collaborator.
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, ...)Get collaborators for a specific task in a specific round.
Get tasks for a specific collaborator in a specific round.
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.
- define_task_assignments()[source]#
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_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
- get_collaborators_for_task(task_name, round_number)[source]#
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 of collaborators for the task in the specified round.
- Return type:
list
- get_tasks_for_collaborator(collaborator_name, round_number)[source]#
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 of tasks for the collaborator in the specified round.
- Return type:
list