p2pfl.learning.aggregators.fedavg moduleΒΆ

Federated Averaging (FedAvg) Aggregator.

class p2pfl.learning.aggregators.fedavg.FedAvg(disable_partial_aggregation=False)[source]ΒΆ

Bases: Aggregator

Federated Averaging (FedAvg) [McMahan et al., 2016].

Paper: https://arxiv.org/abs/1602.05629.

Parameters:

disable_partial_aggregation (bool)

SUPPORTS_PARTIAL_AGGREGATION: bool = TrueΒΆ
aggregate(models)[source]ΒΆ

Aggregate the models.

Parameters:

models (list[P2PFLModel]) – Dictionary with the models (node: model,num_samples).

Return type:

P2PFLModel

Returns:

A P2PFLModel with the aggregated.

Raises:

NoModelsToAggregateError – If there are no models to aggregate.