lib.sedna.algorithms.aggregation

Submodules

Package Contents

Classes

FedAvg

Federated averaging algorithm

MistNet

Abstract class of aggregator

AggClient

Client that interacts with cloud aggregator

FedAvgV2

Abstract class of aggregator

class lib.sedna.algorithms.aggregation.FedAvg[source]

Bases: BaseAggregation, abc.ABC

Federated averaging algorithm

aggregate(self, clients: List[AggClient])

Calculate the average weight according to the number of samples

Parameters

clients (List) – All clients in federated learning job

Returns

update_weights – final weights use to update model layer

Return type

Array-like

class lib.sedna.algorithms.aggregation.MistNet(cut_layer, epsilon=100)[source]

Bases: BaseAggregation, abc.ABC

Abstract class of aggregator

aggregate(self, clients: List[AggClient])

Some algorithms can be aggregated in sequence, but some can be calculated only after all aggregated data is uploaded. therefore, this abstractmethod should consider that all weights are uploaded.

Parameters

clients (List) – All clients in federated learning job

Returns

final weights use to update model layer

Return type

Array-like

class lib.sedna.algorithms.aggregation.AggClient[source]

Client that interacts with cloud aggregator

Parameters
  • num_samples (int) – number of samples for the current weights

  • weights (List) – weights of the layer as a list of number-like array, such as [[0, 0, 0, 0], [0, 0, 0, 0] … ]

num_samples :int
weights :List
class lib.sedna.algorithms.aggregation.FedAvgV2[source]

Bases: BaseAggregation, abc.ABC

Abstract class of aggregator

aggregate(self, clients: List[AggClient])

Some algorithms can be aggregated in sequence, but some can be calculated only after all aggregated data is uploaded. therefore, this abstractmethod should consider that all weights are uploaded.

Parameters

clients (List) – All clients in federated learning job

Returns

final weights use to update model layer

Return type

Array-like