Skip to main content
. 2022 Jun 9;13:908814. doi: 10.3389/fpls.2022.908814

Algorithm 1.

Adaptive client selection enabling federated learning (ACSFed). K clients are selected from N clients with fraction c; η is the learning rate, P is the probability matrix; H is the cumulative model strength matrix.

   Central Server:
   Initialize model ω0, P and H
   K←max(c·N, 1)
   while t in total communication rounds do:
    if t=0:
    client_set = {randomly selected K clients}
    else:
    client_set = {select K clients based on probability matrix P}
    for each client i in client_set parallel do:
    Transmit ωt to client i
    Receive ωt+1i,||lossi||22, emdi from client i
    end for
    Hif(||lossi||22,emdi)
    Pg(P, H)
   end while
   Distributed Client:
   Receive model ωt from the central server
   Calculate emdi based on local data distribution
   Initialize loss list lossi = {}
   Θ← {split local data into batches with size B}
   for local epoch 1,2,…, E do:
    for θ∈Θ do:
    Add training loss toloss
    ωt←ωt-η∇gt, θ)
   end for
  end for
  ωt+1iωt
  Calculate||lossi||22
  Transmit ωt+1i||lossi||22 and emdi to Central Server