Skip to main content
. 2025 May 12;25(10):3043. doi: 10.3390/s25103043
Algorithm 1 FedAvg: federated averaging algorithm.
  • 1:

    Input: Number of rounds T, number of clients K, learning rate η

  • 2:

    Initialize global model weights w0

  • 3:

    for each round t=1,,T do

  • 4:

         Sample a subset St of K clients

  • 5:

         for each client kSt in parallel do

  • 6:

               Download global model weights wt

  • 7:

               Compute local model weights wt+1k by performing E epochs of SGD on local data

  • 8:

         end for

  • 9:

         Aggregate local models: wt+1=1KkStwt+1k

  • 10:

    end for

  • 11:

    Return: final global model weights wT