Skip to main content
. 2024 Dec 23;14(24):2891. doi: 10.3390/diagnostics14242891
Algorithm 1 The FedAvg algorithm. K clients are indexed by k, B is the local minibatch size, E is the number of local epochs, and η is the learning rate.
  • 1:

    Server executes:

  • 2:

    initialize w0

  • 3:

    for eachroundt=1,2, do

  • 4:

         mmax(C·K,1)

  • 5:

         St (random set of m clients)

  • 6:

         for eachclientkStinparallel do

  • 7:

              wt+1kClientUpdate(k,wt)

  • 8:

         end for

  • 9:

         wt+1k=1Knknwt+1k

  • 10:

    end for

  • 11:

    ClientUpdate(k,w):    //run on client k

  • 12:

    B (split Pk into batches of size B)

  • 13:

    for  eachlocalepochifrom1toE  do

  • 14:

         for eachbatchbB do

  • 15:

             wwη·l(w,b)

  • 16:

         end for

  • 17:

    end for

  • 18:

    return w to Server