Skip to content

Selection

Table of Contents

selection.min_cpu

Example of a custom client selection algorithm Not available for testing - can be used as a template for implementing new algorithms

MinCPU Objects

class MinCPU(ClientSelection)

select_clients

def select_clients(client_manager: fl.server.ClientManager,
                   parameters: fl.common.Parameters,
                   server_round: int) -> List[Tuple[ClientProxy, FitIns]]

Select clients based on the MinCPU algorithm

Arguments:

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

Returns:

Selected clients

selection.active

ActiveFL Client Selection Algorithm Based on Goetz, Jack, Kshitiz Malik, D. Bui, Seungwhan Moon, Honglei Liu, and Anuj Kumar. 2019. “Active Federated Learning.” arXiv.org. https://www.semanticscholar.org/paper/36b9b82b607149f160abde58db77149c6de58c01.

ActiveFL Objects

class ActiveFL(ClientSelection)

ActiveFL Client Selection Algorithm

select_clients

def select_clients(client_manager: fl.server.ClientManager,
                   parameters: fl.common.Parameters,
                   server_round: int) -> List[Tuple[ClientProxy, FitIns]]

Select clients based on the CEP algorithm

Arguments:

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

Returns:

Selected clients

calculate_valuation

def calculate_valuation(server_round)

Calculate the valuation of each client

Arguments:

  • server_round: The current server round

selection.client_selection

Abstract class for client selection algorithms

ClientSelection Objects

class ClientSelection(ABC)

Abstract class for client selection algorithms

select_clients

@abstractmethod
def select_clients(client_manager: fl.server.ClientManager,
                   parameters: fl.common.Parameters, server_round: int)

Core function used to select client utilizing the existing client manager and the current parameters.

Arguments:

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

Returns:

Selected clients

run_task_get_properties

def run_task_get_properties(
    clients: List[ClientProxy]
) -> Tuple[List[Tuple[ClientProxy, GetPropertiesRes]], List[Union[Tuple[
        ClientProxy, GetPropertiesRes], BaseException]], ]

Run the get properties task on the given clients

Arguments:

  • clients: List of clients

Returns:

successful and failed executions

run_task_evaluate

def run_task_evaluate(
    clients: List[ClientProxy], parameters: Parameters
) -> Tuple[List[Tuple[ClientProxy, EvaluateRes]], List[Union[Tuple[
        ClientProxy, EvaluateRes], BaseException]], ]

Run the evaluate task on the given clients

Arguments:

  • clients: List of clients
  • parameters: Current global network parameters

Returns:

successful and failed executions

selection.powd

Client selection algorithm based on the Pow-D algorithm Power of Choice Cho, Yae Jee, Jianyu Wang, and Gauri Joshi. 2020. “Client Selection in Federated Learning: Convergence Analysis and Power-of-Choice Selection Strategies.” arXiv.org. https://www.semanticscholar.org/paper/e245f15bdddac514454fecf32f2a3ecb069f6dec.

PowD Objects

class PowD(ClientSelection)

Pow-D algorithm for client selection

select_clients

def select_clients(client_manager: fl.server.ClientManager,
                   parameters: fl.common.Parameters,
                   server_round: int) -> List[Tuple[ClientProxy, FitIns]]

Select clients based on the Pow-D algorithm

Arguments:

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

Returns:

Selected clients

selection.fedcs

This file implements the FedCS algorithm for client selection Nishio, Takayuki, and Ryo Yonetani. 2018. “Client Selection for Federated Learning with Heterogeneous Resources in Mobile Edge.” arXiv [cs.NI]. arXiv. http://arxiv.org/abs/1804.08333.

FedCS Objects

class FedCS(ClientSelection)

FedCS algorithm for client selection

select_clients

def select_clients(client_manager: fl.server.ClientManager,
                   parameters: fl.common.Parameters,
                   server_round: int) -> List[Tuple[ClientProxy, FitIns]]

Select clients based on the FedCS algorithm

Arguments:

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

Returns:

Selected clients

selection.cep

Client Eligibility Protocol (CEP) algorithm for client selection in federated learning Asad, Muhammad, Safa Otoum, and Saima Shaukat. 2022. “Resource and Heterogeneity-Aware Clients Eligibility Protocol in Federated Learning.” In GLOBECOM 2022 - 2022 IEEE Global Communications Conference, 1140–45.

unique

def unique(s)

Check if all elements in a list are unique

Arguments:

  • s: List

Returns:

True if all elements are unique, False otherwise

CEP Objects

class CEP(ClientSelection)

Client Eligibility Protocol (CEP) algorithm for client selection in federated learning

select_clients

def select_clients(client_manager: fl.server.ClientManager,
                   parameters: fl.common.Parameters,
                   server_round: int) -> List[Tuple[ClientProxy, FitIns]]

Select clients based on the CEP algorithm

Arguments:

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

Returns:

Selected clients

calculate_ces

def calculate_ces(possible_clients, server_round)

Calculate the Client Eligibility Score (CES) for each client

Arguments:

  • possible_clients: List of possible clients
  • server_round: The current server round

selection.random_selection

Random Selection algorithm Provided as a baseline for comparison 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.

RandomSelection Objects

class RandomSelection(ClientSelection)

Random Selection algorithm

select_clients

def select_clients(client_manager: fl.server.ClientManager,
                   parameters: fl.common.Parameters,
                   server_round: int) -> List[Tuple[ClientProxy, FitIns]]

Select clients based on random selection

Arguments:

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

Returns:

Selected Clients

selection.helpers

Helper functions for selection algorithms

get_client_properties

def get_client_properties(client: ClientProxy, property_ins: GetPropertiesIns,
                          timeout: int)

Get the properties of a client

Arguments:

  • client: The client proxy (for ray)
  • property_ins: Config for getting properties (not used)
  • timeout: Timeout for getting properties

Returns:

The client proxy and the properties