Strategy
Table of Contents
- strategy.adjusted_fed_med
- AdjustedFedMedian
- strategy.adjusted_fed_avg
- AdjustedFedAvg
- strategy.common
- weighted_average
- strategy.adjusted_fed_avg_m
- AdjustedFedAvgM
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
configure_fit
Configure the fit process and select clients
Arguments:
server_round: The current server roundparameters: The current model parametersclient_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 roundresults: The results from the clientsfailures: 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
configure_fit
Configure the fit process
Arguments:
server_round: Current server roundparameters: Current model parametersclient_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 roundresults: List of results from clientsfailures: List of failures from clients
Returns:
Aggregated parameters and metrics
strategy.common
Common functions for strategies
weighted_average
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
configure_fit
Configure the fit process
Arguments:
server_round: The current server roundparameters: The current model parametersclient_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 roundresults: The results from the clientsfailures: The failures from the clients
Returns:
The aggregated parameters and metrics