openfl.component.assigner.custom_assigner.Assigner#
- class openfl.component.assigner.custom_assigner.Assigner(*, assigner_function, aggregation_functions_by_task, authorized_cols, rounds_to_train)[source]#
Bases:
objectCustom assigner class.
- agg_functions_by_task#
Dictionary mapping tasks to their respective aggregation functions.
- Type:
dict
- agg_functions_by_task_name#
Dictionary mapping task names to their respective aggregation functions.
- Type:
dict
- authorized_cols#
List of authorized collaborators.
- Type:
list of str
- rounds_to_train#
Number of rounds to train.
- Type:
int
- all_tasks_for_round#
Dictionary mapping round numbers to tasks.
- Type:
defaultdict
- collaborators_for_task#
Dictionary mapping round numbers to collaborators for each task.
- Type:
defaultdict
- collaborator_tasks#
Dictionary mapping round numbers to tasks for each collaborator.
- Type:
defaultdict
- assigner_function#
Function to assign tasks to collaborators.
- Type:
function
- __init__(*, assigner_function, aggregation_functions_by_task, authorized_cols, rounds_to_train)[source]#
Initialize the Custom assigner object.
- Parameters:
assigner_function (function) – Function to assign tasks to collaborators.
aggregation_functions_by_task (dict) – Dictionary mapping tasks to their respective aggregation functions.
authorized_cols (list of str) – List of authorized collaborators.
rounds_to_train (int) – Number of rounds to train.
Methods
__init__(*, assigner_function, ...)Initialize the Custom assigner object.
Define task assignments for each round and collaborator.
get_aggregation_type_for_task(task_name)Get the aggregation type for a specific task (from self.tasks).
get_all_tasks_for_round(round_number)Get all tasks for a specific 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.
- 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.
Abstract method.
- Parameters:
None
- Returns:
None
- get_aggregation_type_for_task(task_name)[source]#
Get the aggregation type for a specific task (from self.tasks).
- Parameters:
task_name (str) – Name of the task.
- Returns:
Aggregation function for the task.
- Return type:
function
- get_all_tasks_for_round(round_number)[source]#
Get all tasks for a specific 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 all tasks for the specified round.
- Return type:
list
- get_collaborators_for_task(task_name, round_number)[source]#
Get collaborators for a specific task in a specific round.
Abstract method.
- 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.
Abstract method.
- 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