5.1.1.8.1.6. FedEval.strategy.FedSVD
5.1.1.8.1.6.1. Module Contents
5.1.1.8.1.6.1.1. Classes
Generic enumeration. |
|
the basic class of federated strategies. |
5.1.1.8.1.6.1.2. Functions
|
|
|
- FedEval.strategy.FedSVD.generate_orthogonal_matrix(n=1000, reuse=False, block_reduce=None, random_seed=None, only_inverse=False, file_name=None, offload_to_disk=False, clear_cache=False)
- FedEval.strategy.FedSVD.retrieve_array_from_list(q, start, end)
- class FedEval.strategy.FedSVD.FedSVDStatus
Bases:
enum.EnumGeneric enumeration.
Derive from this class to define new enumerations.
- Init = 'init'
- SendMask = 'send_mask'
- ApplyMask = 'apply_mask'
- Factorization = 'factorization'
- RemoveMask = 'remove_mask'
- Evaluate = 'evaluate'
- class FedEval.strategy.FedSVD.FedSVD(*args, **kwargs)
Bases:
FedEval.strategy.FederatedStrategy.FedStrategythe basic class of federated strategies.
- _log_hardware_usage()
- _init_model()
- host_select_train_clients(ready_clients: List[FedEval.config.ClientId]) List[FedEval.config.ClientId]
select clients from the given ones for training purpose.
- Parameters:
ready_clients (List[ClientId]) – the id list of clients that are ready for training.
- Raises:
NotImplementedError – raised when called but not overriden.
- Returns:
the id list of the selected clients.
- Return type:
List[ClientId]
- 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
- update_host_params(client_params, *args)
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.
- safe_memmap_matmul(a, b, step_size=1000)
- _server_svd(data_matrix)
- set_host_params_to_local(host_params, **kwargs)
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.
- _generate_masked_data_in_secure_agg(shape, base=None)
- 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)
- local_evaluate()
evaluate and test the model received from the central server.
Called by the selected clients.
- Raises:
NotImplementedError – raised when called but not overriden.
- Returns:
evaluation & test metrics.
- Return type:
Mapping[str, Union[int, float]]
- client_exit_job(client)
do self-defined finishing jobs before the shutdown of the local clients.
- Parameters:
client – TODO(fgh)
- Raises:
NotImplementedError – raised when called but not overriden.
- 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
- host_exit_job(host)
do self-defined finishing jobs before the shutdown of the central server.
- Parameters:
host – TODO(fgh)
- Raises:
NotImplementedError – raised when called but not overriden.