Research Article
Genetic CFL: Hyperparameter Optimization in Clustered Federated Learning
Algorithm 2
Genetic optimization based FL on clustered data.
| | rounds: Number of loops for training the federated model | | (1) | function Mutate () | | (2) | factor random () | | (3) | | | (4) | return | | (5) | function Crossover () | | (6) | Initialize temporary array to store | | (7) | | | (8) | for to do | | (9) | | | (10) | | | (11) | return | | (12) | function Evolve () | | (13) | , | | (14) | | | (15) | return Crossover () | | (16) | procedure Train | | (17) | | | (18) | to len | | (19) | Initialize with shape (len, size (clusters ) | | (20) | | | (21) | for to rounds do | | (22) | for to do | | (23) | ind = [clusters.index (cluster[i])] | | (24) | | | (25) | Empty arrays losses, | | (26) | for to n do | | (27) | , losses[k], | | (28) | |
|