client_participation_scheduling.py 411 B

12345678910
  1. import numpy as np
  2. def client_selection(num_clients, client_selection_frac, client_selection_strategy, other_info=None):
  3. np.random.seed(other_info)
  4. if client_selection_strategy == "random":
  5. num_selected = max(int(client_selection_frac * num_clients), 1)
  6. selected_clients_set = set(np.random.choice(np.arange(num_clients), num_selected, replace=False))
  7. return selected_clients_set