Algorithm 3 Federated Learning Algorithm |
-
1:
Input: Local datasets for clients i, , , label encoder L
-
2:
Output: Federated model
-
3:
procedure
Data Acquisition and Pre-processing
-
4:
for each client i do
-
5:
Load local dataset
-
6:
Clean using ,
-
7:
Encode labels:
-
8:
end for
-
9:
end procedure
-
10:
procedure
Local Model Training
-
11:
for each client i do
-
12:
Initialize local model:
-
13:
Train using DNN with and
-
14:
end for
-
15:
end procedure
-
16:
procedure
Model Aggregation
-
17:
Initialize federated model:
-
18:
Aggregate local models:
-
19:
end procedure
-
20:
procedure
Global Model Training
-
21:
Compile with optimizer (e.g., Adam) and loss (e.g., Sparse Categorical Cross-Entropy)
-
22:
Train using global data
-
23:
end procedure
-
24:
procedure
Final Classifier
-
25:
Output: Final classifier
-
26:
end procedure
-
27:
Return
|