fedn
fedn copied to clipboard
Feature/SK-946 | Add functionality for user defined aggregation
Adds functionality for user-defined aggregation (could be extended to more user-defined hooks in the future).
Adds a new option to the start_session() CLI command: client.start_session(aggregator="custom", function_provider_path="client/aggregator.py")
This will set the aggregator to a new custom aggregator which will use the new "hook" container to perform aggregation. The aggregation code will be read as a string and distributed to the hooks container.
This PR also finished functionality to send the "model_metadata" dictionary from the server to each client. Aggregator classes can now add a "get_model_metadata()" function, which should return a dictionary containing only primitive types. "get_model_metadata()" gets called at the beginning of each round and the returned dictionary gets distributed to the clients. The dictionary defaults to {} if no implementation is done.
One example implementation for hyperparameter tuning is made. See examples/custom-aggregator/client/aggregator.py