Common#

Functions stored here for use in model aggregation.

fma_core.algorithms.aggregators.common.avg_values_if_data(model, model_updates)#

Averages values together if data exists within model_updates.

Parameters:
  • model (task_queue_base.models.FederatedModel) – Database FederatedModel object

  • model_updates (task_queue_base.models.ModelUpdate) – Database objects containing the original weights used to initialize the shape of the layers

Returns:

The average value for each update

Return type:

List[Any]

fma_core.algorithms.aggregators.common.average_layers(model, model_updates)#

Takes in the weights of multiple models and averages across layers.

Parameters:
  • model (task_queue_base.models.FederatedModel) – Database FederatedModel object

  • model_updates (task_queue_base.models.ModelUpdate) – Database objects containing the original weights used to initialize the shape of the layers

Returns:

A weights obj that is the average of all weights across layers

Return type:

List[List[Any]]