openfl.interface.aggregation_functions
- class openfl.interface.aggregation_functions.AdagradAdaptiveAggregation(*args, **kwargs)
Adagrad adaptive Federated Aggregation funtcion.
- class openfl.interface.aggregation_functions.AdamAdaptiveAggregation(*args, **kwargs)
Adam adaptive Federated Aggregation funtcion.
- class openfl.interface.aggregation_functions.AggregationFunction(*args, **kwargs)
Interface for specifying aggregation function.
- abstract call(local_tensors: List[LocalTensor], db_iterator: Iterator[Series], tensor_name: str, fl_round: int, tags: Tuple[str]) ndarray
Aggregate tensors.
- Parameters:
local_tensors (list[openfl.utilities.LocalTensor]) – List of local tensors to aggregate.
db_iterator –
An iterator over history of all tensors. Columns: - ‘tensor_name’: name of the tensor.
Examples for `torch.nn.Module`s: ‘conv1.weight’,’fc2.bias’.
- ’round’: 0-based number of round corresponding to this
tensor.
- ’tags’: tuple of tensor tags. Tags that can appear:
’model’ indicates that the tensor is a model parameter.
- ’trained’ indicates that tensor is a part of a training
result. These tensors are passed to the aggregator node after local learning.
- ’aggregated’ indicates that tensor is a result of
aggregation. These tensors are sent to collaborators for the next round.
- ’delta’ indicates that value is a difference between
rounds for a specific tensor.
also one of the tags is a collaborator name if it corresponds to a result of a local task.
’nparray’: value of the tensor.
tensor_name – name of the tensor
fl_round – round number
tags – tuple of tags for this tensor
- Returns:
np.ndarray – aggregated tensor
- class openfl.interface.aggregation_functions.FedCurvWeightedAverage(*args, **kwargs)
Aggregation function of FedCurv algorithm.
Applies weighted average aggregation to all tensors except Fisher matrices variables (u_t, v_t). These variables are summed without weights.
FedCurv paper: https://arxiv.org/pdf/1910.07796.pdf
- call(local_tensors, tensor_db, tensor_name, fl_round, tags)
Apply aggregation.
- class openfl.interface.aggregation_functions.GeometricMedian(*args, **kwargs)
Geometric median aggregation.
- call(local_tensors, *_) ndarray
Aggregate tensors.
- Parameters:
local_tensors (list[openfl.utilities.LocalTensor]) – List of local tensors to aggregate.
db_iterator –
iterator over history of all tensors. Columns: - ‘tensor_name’: name of the tensor.
Examples for `torch.nn.Module`s: ‘conv1.weight’, ‘fc2.bias’.
- ’round’: 0-based number of round corresponding to this
tensor.
- ’tags’: tuple of tensor tags. Tags that can appear:
’model’ indicates that the tensor is a model parameter.
- ’trained’ indicates that tensor is a part of a training
result. These tensors are passed to the aggregator node after local learning.
- ’aggregated’ indicates that tensor is a result of
aggregation. These tensors are sent to collaborators for the next round.
- ’delta’ indicates that value is a difference between
rounds for a specific tensor.
also one of the tags is a collaborator name if it corresponds to a result of a local task.
’nparray’: value of the tensor.
tensor_name – name of the tensor
fl_round – round number
tags – tuple of tags for this tensor
- Returns:
geometric_median (np.ndarray) – aggregated tensor
- class openfl.interface.aggregation_functions.Median(*args, **kwargs)
Median aggregation.
- call(local_tensors, *_) ndarray
Aggregate tensors.
- Parameters:
local_tensors (list[openfl.utilities.LocalTensor]) – List of local tensors to aggregate.
db_iterator –
iterator over history of all tensors. Columns: - ‘tensor_name’: name of the tensor.
Examples for `torch.nn.Module`s: ‘conv1.weight’,’fc2.bias’.
- ’round’: 0-based number of round corresponding to this
tensor.
- ’tags’: tuple of tensor tags. Tags that can appear:
’model’ indicates that the tensor is a model parameter.
- ’trained’ indicates that tensor is a part of a training
result. These tensors are passed to the aggregator node after local learning.
- ’aggregated’ indicates that tensor is a result of
aggregation. These tensors are sent to collaborators for the next round.
- ’delta’ indicates that value is a difference between
rounds for a specific tensor.
also one of the tags is a collaborator name if it corresponds to a result of a local task.
’nparray’: value of the tensor.
tensor_name – name of the tensor
fl_round – round number
tags – tuple of tags for this tensor
- Returns:
np.ndarray – aggregated tensor
- class openfl.interface.aggregation_functions.WeightedAverage(*args, **kwargs)
Weighted average aggregation.
- call(local_tensors, *_) ndarray
Aggregate tensors.
- Parameters:
local_tensors (list[openfl.utilities.LocalTensor]) – List of local tensors to aggregate.
db_iterator –
iterator over history of all tensors. Columns: - ‘tensor_name’: name of the tensor.
Examples for `torch.nn.Module`s: ‘conv1.weight’,’fc2.bias’.
- ’round’: 0-based number of round corresponding to this
tensor.
- ’tags’: tuple of tensor tags. Tags that can appear:
’model’ indicates that the tensor is a model parameter.
- ’trained’ indicates that tensor is a part of a training
result. These tensors are passed to the aggregator node after local learning.
- ’aggregated’ indicates that tensor is a result of
aggregation. These tensors are sent to collaborators for the next round.
- ’delta’ indicates that value is a difference between
rounds for a specific tensor.
also one of the tags is a collaborator name if it corresponds to a result of a local task.
’nparray’: value of the tensor.
tensor_name – name of the tensor
fl_round – round number
tags – tuple of tags for this tensor
- Returns:
np.ndarray – aggregated tensor
- class openfl.interface.aggregation_functions.YogiAdaptiveAggregation(*args, **kwargs)
Yogi adaptive Federated Aggregation funtcion.
|
Adagrad adaptive aggregation module. |
|
Adam adaptive aggregation module. |
|
FedCurv Aggregation function module. |
|
Geometric median module. |
|
Median module. |
|
Federated averaging module. |
|
Yogi adaptive aggregation module. |