openfl.interface.aggregation_functions.yogi_adaptive_aggregation.YogiAdaptiveAggregation

openfl.interface.aggregation_functions.yogi_adaptive_aggregation.YogiAdaptiveAggregation#

class openfl.interface.aggregation_functions.yogi_adaptive_aggregation.YogiAdaptiveAggregation(*args, **kwargs)[source]#

Bases: AdaptiveAggregation

Yogi adaptive Federated Aggregation funtcion.

__init__(*, agg_func=<openfl.interface.aggregation_functions.weighted_average.WeightedAverage object>, params=None, model_interface=None, learning_rate=0.01, betas=(0.9, 0.999), initial_accumulator_value=0.0, epsilon=1e-08)[source]#

Initialize the YogiAdaptiveAggregation object.

Parameters:
  • agg_func (AggregationFunction) – Aggregate function for aggregating parameters that are not inside the optimizer (default: WeightedAverage()).

  • params (Optional[Dict[str, np.ndarray]]) – Parameters to be stored for optimization.

  • model_interface – Model interface instance to provide parameters.

  • learning_rate (float) – Tuning parameter that determines the step size at each iteration.

  • betas (Tuple[float, float]) – Coefficients used for computing running averages of gradient and its square.

  • initial_accumulator_value (float) – Initial value for gradients and squared gradients.

  • epsilon (float) – Value for computational stability.

Return type:

None

Methods

__init__(*[, agg_func, params, ...])

Initialize the YogiAdaptiveAggregation object.

call(local_tensors, db_iterator, ...)

Aggregate tensors.

call(local_tensors, db_iterator, tensor_name, fl_round, tags)[source]#

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’.

    • ’fl_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:

aggregated tensor

Return type:

np.ndarray