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 , emdi from client i |
end for |
P←g(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-η∇g(ωt, θ) |
end for |
end for |
Calculate |
Transmit and emdi to Central Server |