5.1.1.8.1.4. FedEval.strategy.FedSCA

5.1.1.8.1.4.1. Module Contents

5.1.1.8.1.4.1.1. Classes

FedSCAOptimizer

FedSCAParser

an implentation of ParamParserInterface.

FedSCA

the basic class of federated strategies.

class FedEval.strategy.FedSCA.FedSCAOptimizer(learning_rate=0.01, name='FedSCAOptimizer', **kwargs)

Bases: tensorflow.keras.optimizers.Optimizer

create_slots(var_list)
get_config()
_resource_apply_dense(grad, handle, apply_state)
class FedEval.strategy.FedSCA.FedSCAParser

Bases: FedEval.utils.ParamParser

an implentation of ParamParserInterface.

static parse_model(client_id=None)

construct a tensorflow model according to the model configuration.

Raises:

NotImplementedError – raised when called but not overriden.

Returns:

the model constructed.

Return type:

tf.keras.Model

class FedEval.strategy.FedSCA.FedSCA(**kwargs)

Bases: FedEval.strategy.FedAvg.FedAvg

the basic class of federated strategies.

retrieve_host_download_info()
get the host download information,

e.g., model params/weights from its machine/deep learning model.

Raises:

NotImplementedError – raised when called but not overriden.

Returns:

the weights/params of its inner machine/deep learning model. TODO(fgh): the meaning of the str in the return type/

Return type:

ModelWeights

set_host_params_to_local(host_params, current_round)

update the current local ML/DL model’s params with params received from the central server.

Parameters:
  • host_params (ModelWeights) – params received from the central server.

  • current_round (int) – the current round number

Raises:

NotImplementedError – raised when called but not overriden.

update_host_params(client_params, aggregate_weights)

update central server’s model params/weights with the aggregated params received from clients.

Parameters:
  • client_params (Iterable[ModelWeights]) – the weights form different clients, ordered like [params1, params2, …]

  • aggregate_weights (Iterable[Union[float, int]]) – aggregate weights of different clients, usually set according to the clients’ training sample size. E.g., A, B, and C have 10, 20, and 30 images, then the aggregate_weights can be [1/6, 1/3, 1/2] or [10, 20, 30].

Raises:

NotImplementedError – raised when called but not overriden.

fit_on_local_data()

fit model with local data at client side.

Called by the selected clients.

Raises:

NotImplementedError – raised when called but not overriden.

Returns:

TODO(fgh)

retrieve_local_upload_info()

return the information aggregated from local model for uploading to the central server.

Called by the selected clients.

Raises:

NotImplementedError – raised when called but not overriden.

Returns:

the local model weights/params.

Return type:

ModelWeights