Skip to main content
. 2023 Dec 17;11(24):3185. doi: 10.3390/healthcare11243185
Algorithm 3 Federated Learning Algorithm
  •   1: 

    Input: Local datasets Di=(Xi,yi) for clients i, Mmissing, Ooutliers, label encoder L

  •   2: 

    Output: Federated model Mfed

  •   3: 

    procedure  Data Acquisition and Pre-processing

  •   4:

        for each client i do

  •   5:

            Load local dataset Di=(Xi,yi)

  •   6:

            Clean Di using Mmissing, Ooutliers

  •   7:

            Encode labels: y^i=L(yi)

  •   8:

        end for

  •   9: 

    end procedure

  • 10: 

    procedure  Local Model Training

  • 11:

        for each client i do

  • 12:

            Initialize local model: Mi

  • 13:

            Train Mi using DNN with Xi and y^i

  • 14:

        end for

  • 15: 

    end procedure

  • 16: 

    procedure  Model Aggregation

  • 17:

        Initialize federated model: Mfed

  • 18:

        Aggregate local models: Mfed=Aggregate_Models({M1,M2,,Mn})

  • 19: 

    end procedure

  • 20: 

    procedure  Global Model Training

  • 21:

        Compile Mfed with optimizer (e.g., Adam) and loss (e.g., Sparse Categorical Cross-Entropy)

  • 22:

        Train Mfed using global data

  • 23: 

    end procedure

  • 24: 

    procedure  Final Classifier

  • 25:

        Output: Final classifier Mfed

  • 26: 

    end procedure

  • 27: 

    Return  Mfed