Skip to content

Commit

Permalink
✨ Introduce krum aggregation
Browse files Browse the repository at this point in the history
  • Loading branch information
futabato committed Jul 26, 2024
1 parent f426320 commit ebdb2ed
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/federatedlearning/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
)
from federatedlearning.server.aggregations.aggregators import (
average_weights,
krum,
median_weights,
)
from federatedlearning.server.inferencing import inference
Expand Down Expand Up @@ -283,6 +284,10 @@ def main(cfg: DictConfig) -> float: # noqa: C901
global_weights = average_weights(local_weights)
elif cfg.federatedlearning.aggregation == "median":
global_weights = median_weights(local_weights)
elif cfg.federatedlearning.aggregation == "krum":
global_weights = krum(
local_weights, cfg.federatedlearning.num_byzantines
)
else:
global_weights = average_weights(local_weights)
# Save updated global model weights
Expand Down

0 comments on commit ebdb2ed

Please # to comment.