Skip to content

Strategy

Table of Contents

strategy.adjusted_fed_med

Adjusted FedMedian strategy Based on the FedMedian strategy from Flower Yin, Dong, Yudong Chen, Kannan Ramchandran, and Peter Bartlett. 2018. “Byzantine-Robust Distributed Learning: Towards Optimal Statistical Rates.” arXiv [cs.LG]. arXiv. http://arxiv.org/abs/1803.01498.

AdjustedFedMedian Objects

class AdjustedFedMedian(fl.server.strategy.FedMedian)

configure_fit

def configure_fit(server_round: int, parameters: Parameters,
                  client_manager: ClientManager)

Configure the fit process and select clients

Arguments:

  • server_round: The current server round
  • parameters: The current model parameters
  • client_manager: The client manager

Returns:

List of clients to train on

aggregate_fit

def aggregate_fit(
    server_round: int, results: List[Tuple[ClientProxy, fl.common.FitRes]],
    failures: List[Union[Tuple[ClientProxy, FitRes], BaseException]]
) -> Tuple[Optional[Parameters], Dict[str, Scalar]]

Aggregate model weights using weighted average and store checkpoint, update state, set current round

Arguments:

  • server_round: The current server round
  • results: The results from the clients
  • failures: The failures from the clients

Returns:

The aggregated parameters and metrics

strategy.adjusted_fed_avg

Adjusted FedAvg strategy Based on the FedAvg strategy from Flower McMahan, H. Brendan, Eider Moore, Daniel Ramage, Seth Hampson, and Blaise Agüera y. Arcas. 2016. “Communication-Efficient Learning of Deep Networks from Decentralized Data.” arXiv [cs.LG]. arXiv. http://arxiv.org/abs/1602.05629.

AdjustedFedAvg Objects

class AdjustedFedAvg(fl.server.strategy.FedAvg)

configure_fit

def configure_fit(server_round: int, parameters: Parameters,
                  client_manager: ClientManager)

Configure the fit process

Arguments:

  • server_round: Current server round
  • parameters: Current model parameters
  • client_manager: Client manager

Returns:

List of clients to train

aggregate_fit

def aggregate_fit(
    server_round: int, results: List[Tuple[ClientProxy, fl.common.FitRes]],
    failures: List[Union[Tuple[ClientProxy, FitRes], BaseException]]
) -> Tuple[Optional[Parameters], Dict[str, Scalar]]

Aggregate model weights using weighted average and store checkpoint, update state, set current round

Arguments:

  • server_round: Current server round
  • results: List of results from clients
  • failures: List of failures from clients

Returns:

Aggregated parameters and metrics

strategy.common

Common functions for strategies

weighted_average

def weighted_average(metrics: List[Tuple[int, Metrics]]) -> Metrics

Calculate weighted average of accuracy

Arguments:

  • metrics: Metrics including accuracy and number of examples

Returns:

weighted metrics

strategy.adjusted_fed_avg_m

Adjusted FedAvgM strategy Based on the FedAvgM strategy from Flower Hsu, Tzu-Ming Harry, Hang Qi, and Matthew Brown. 2019. “Measuring the Effects of Non-Identical Data Distribution for Federated Visual Classification.” arXiv [cs.LG]. arXiv. http://arxiv.org/abs/1909.06335.

AdjustedFedAvgM Objects

class AdjustedFedAvgM(fl.server.strategy.FedAvgM)

configure_fit

def configure_fit(server_round: int, parameters: Parameters,
                  client_manager: ClientManager)

Configure the fit process

Arguments:

  • server_round: The current server round
  • parameters: The current model parameters
  • client_manager: The client manager

Returns:

List of clients to train on

aggregate_fit

def aggregate_fit(
    server_round: int, results: List[Tuple[ClientProxy, fl.common.FitRes]],
    failures: List[Union[Tuple[ClientProxy, FitRes], BaseException]]
) -> Tuple[Optional[Parameters], Dict[str, Scalar]]

Aggregate model weights using weighted average and store checkpoint, update state, set current round

Arguments:

  • server_round: The current server round
  • results: The results from the clients
  • failures: The failures from the clients

Returns:

The aggregated parameters and metrics