xain_fl.fl.coordinator package¶
Contains coordinator logic which runs the central server in federated learning. It consists of the following modules:
aggregate
controller
Submodules¶
xain_fl.fl.coordinator.aggregate module¶
Provides an abstract base class Aggregator and multiple sub-classes such as FederatedAveragingAgg.
-
class
xain_fl.fl.coordinator.aggregate.
Aggregator
¶ Bases:
abc.ABC
Abstract base class which provides an interface to the coordinator that enables different aggregation implementations.
-
class
xain_fl.fl.coordinator.aggregate.
FederatedAveragingAgg
¶ Bases:
xain_fl.fl.coordinator.aggregate.Aggregator
Provides federated averaging aggregation, i.e. a weighted average.
-
class
xain_fl.fl.coordinator.aggregate.
IdentityAgg
¶ Bases:
xain_fl.fl.coordinator.aggregate.Aggregator
Provides identity aggregation, i.e. the aggregate method expects a list containing a single element and returns that element.
-
class
xain_fl.fl.coordinator.aggregate.
ModelSumAgg
¶ Bases:
xain_fl.fl.coordinator.aggregate.Aggregator
Provides a sum-of-models aggregation.
-
xain_fl.fl.coordinator.aggregate.
federated_averaging
(thetas, weighting)¶ - Calculates weighted averages of provided list of thetas, as proposed by McMahan et al. in:
xain_fl.fl.coordinator.controller module¶
Provides an abstract base class Controller and the RandomController currently used by the Coordinator.
-
class
xain_fl.fl.coordinator.controller.
Controller
(fraction_of_participants=1.0)¶ Bases:
abc.ABC
Abstract base class which provides an interface to the coordinator that enables different selection strategies.
-
fraction_of_participants
¶ The fraction of total participant IDs to be selected. Defaults to 1.0, meaning that all participant IDs will be selected. It must be in the (0.0, 1.0] interval.
- Type
float
, optional
-
get_num_ids_to_select
(len_participant_ids)¶ Calculates how many participant IDs need to be selected.
-
-
class
xain_fl.fl.coordinator.controller.
IdController
(fraction_of_participants=1.0)¶ Bases:
xain_fl.fl.coordinator.controller.Controller
[summary
… todo: Advance docstrings (https://xainag.atlassian.net/browse/XP-425)
-
class
xain_fl.fl.coordinator.controller.
RandomController
(fraction_of_participants=1.0)¶ Bases:
xain_fl.fl.coordinator.controller.Controller
[summary]
- Parameters
Controller ([type]) – [description]
-
select_ids
(participant_ids)¶ Randomly samples self.num_ids_to_select from the population of participants_ids, without replacement.