-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/SK-732 | Introduces FedYogi and FedAdaGrad aggregators #580
Conversation
@@ -102,36 +114,128 @@ def combine_models(self, helper=None, delete_models=True): | |||
"AGGREGATOR({}): Error encoutered while processing model update {}, skipping this update.".format(self.name, e)) | |||
self.model_updates.task_done() | |||
|
|||
model = self.serveropt_adam(helper, pseudo_gradient, model_old) | |||
if params['serveropt'] == 'adam': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would also catch KeyError if something unexpected changes, like default_params
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor changes requested
docs/aggregators.rst
Outdated
see compute package). The base class implements a default callback that checks that all metadata assumed by the aggregation algorithms FedAvg and FedOpt | ||
is present in the metadata. However, the callback could also be used to implement custom preprocessing and additional checks including strategies | ||
The ``on_model_update`` callback recieves the model update messages from clients (including all metadata) and can be used to perform validation and | ||
potential transformation of the model update before it is places on the aggregation queue (see image above). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo, "placed"
docs/aggregators.rst
Outdated
The ``on_model_update`` callback recieves the model update messages from clients (including all metadata) and can be used to perform validation and | ||
potential transformation of the model update before it is places on the aggregation queue (see image above). | ||
The base class implements a default callback that checks that all metadata assumed by the aggregation algorithms FedAvg and FedOpt | ||
is available. The callback could also be used to implement custom pre-processing and additional checks including strategies |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new line should not be here?
:param params: Additional key-word arguments. | ||
:type params: dict | ||
:param parameters: Aggregator hyperparameters. | ||
:type parameters: `fedn.utils.parmeters.Parameters`, optional |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:class: then reference to the class
@@ -10,8 +10,12 @@ class Aggregator(AggregatorBase): | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
class name should be somethiing more related to FedOpt? like FedOptAggregator?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this is how the plugin architecture is implemented, it has to be called Aggregator.
if key not in params: | ||
params[key] = value | ||
# Define parameter schema | ||
parameter_schema = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would have this a required attribute of AggregatorBase, even if it can be empty
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's think about this for a bit longer, I think we should discuss this whole Parameter thing in more depth and make sure we have something that we want to use across the whole code-base.
elif parameters['serveropt'] == 'yogi': | ||
model = self.serveropt_yogi(helper, pseudo_gradient, model_old, parameters) | ||
elif parameters['serveropt'] == 'adagrad': | ||
model = self.serveropt_adagrad(helper, pseudo_gradient, model_old, parameters) | ||
else: | ||
logger.error("Unsupported server optimizer passed to FedOpt.") | ||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should it not return None, data?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, good catch.
I have activated the docs for this branch: https://fedn.readthedocs.io/en/feature-sk-732/aggregators.html |
Description
Introduces new features related to model aggregation: