Skip to main content
. 2022 Sep 18;22(18):7061. doi: 10.3390/s22187061
Algorithm 2 Algorithm of CATA-Fed
Input: Set of connected clients C , the number of global iteration E , deadline T, the number of cluster P, learning rate η, the number of participating clients N, lower limit size of sub-dataset π
Output: Global model W
  • 1:

      procedure Server(E,k)

  • 2:

        Initialize W0,Ai[0](1i|C|)

  • 3:

        Xm(1mP) client clustering according to Equation (20)

  • 4:

        for global iteration 0tE1 do

  • 5:

         if 0<t , St1D and detect report of client ciSt1S then

  • 6:

          Reclustering Xm(1mP) according to Equation (20)

  • 7:

         end if

  • 8:

         Update Ai[t] of client ciC according to Equation (21)

  • 9:

         Grouping clients Gx according to Equation (23)

  • 10:

       Calculate priority px according to Equation (24)

  • 11:

       StGx* according to Equation (25)

  • 12:

       for each client ciSt in parallel do

  • 13:

        Broadcast Wt,T to client ci

  • 14:

        Wti,Ii ClientUpdate (ci,Wt,T)

  • 15:

       end for

  • 16:

       Update global model Wt+1i=1|St|ψiIiWti

  • 17:

       CCStD

  • 18:

      end for

  • 19:

    end procedure

  • 20:

       

  • 21:

    procedureclientupdate(ci,Wt,T)

  • 22:

      Initialize Ii=1

  • 23:

      nini+1

  • 24:

      Select training data Di,j, j=nimod(2ui,t)+1

  • 25:

      Replace local model wtiWt

  • 26:

      Check start training time τstart

  • 27:

      Working BreakProcess(T,τstart,Ii) in parallel

  • 28:

      for local epoch 0e do

  • 29:

       if (Tεi)u=0e1τui<τmeani then

  • 30:

        Break training

  • 31:

       else

  • 32:

        wt,e+1i=wt,eiηFi(wt,ei,Di,j)×Ii

  • 33:

        Get training time τei

  • 34:

        Update average of training time τmeani

  • 35:

       end if

  • 36:

      end for

  • 37:

      Upload Wti,Ix to server

  • 38:

      ifIx is 0 then

  • 39:

       Update ui,t according to Equation (10)

  • 40:

       Partitioning sub-dataset Di,j,j[1,2ui,t] according to Equation (11)

  • 41:

       Report |Di,j|,j[1,2ui,t] to server

  • 42:

      end if

  • 43:

    end procedure

  • 44:

       

  • 45:

    procedurebreakprocess(T,τstart,Ii)

  • 46:

      if (Tεi)τnowτstart then

  • 47:

       Break training & Ii=0

  • 48:

      end if

  • 49:

    end procedure