Skip to main content
. 2022 Dec 21;23(1):62. doi: 10.3390/s23010062
Algorithm 1 FedAvg [210]
Input:
  Nglobal: Maximum number of global iterations, n: The total number of participating clients, m: The number of clients used in each global iteration, Nlocal: The number of local epochs, and η: The local learning rate.
Output:
  Global model weight wG
Processing:
1: [Central Server]
2: Initialize wG0
3: for each iteration t from 1 to Nglobal do
4:  Mt includes m clients randomly selected from the n clients
5:  for each client iMt in parallel do
6:   wit,NiLocalTraining(i,wGt)
7:  end for
8:  wGt+1=1j=1mNji=1mNiwit
9: end for
10: [Each Participating Client]
11: LocalTraining(i,w):
12: Bi is the set of batches for the local dataset Di
13: for each epoch j from 1 to Nlocal do
14:  for each batch bBi do
15:   wwηL(w;b)
16:  end for
17: end for
18: return the weights w and Ni=|Di|