flox.logic.base_client.FloxClientLogic¶
- class FloxClientLogic[source]¶
Bases:
objectAbstract base class for FLoX Clients
Methods
Retrieves data for training the model.
Fit the provided global model using a local dataset
Parses & decrypts the received data from a controller
Final data processing before sending the results back, such as encryption.
Combines the rest of the functions to run a single Federated Learning round
- on_data_retrieve(config)[source]¶
Retrieves data for training the model.
- Return type:
Parameters¶
- config: ConfigFile
a dictionary with values necessary to retrieve the data, such as the data source and preprocessing parameters
Returns¶
- XYData
data for evaluating the model. This can take different forms depending on the ML framework you use. For Tensorflow, it would look as x_test and y_test, while for PyTorch, it would look as a single DataLoader instance.
- on_model_fit()[source]¶
Fit the provided global model using a local dataset
Parameters¶
Parameters for fitting the model. This might take different forms depending on the ML framework. For Tensorflow, it might look like this:
model: keras.Sequential ModelTrainer: Class config: ConfigFile x_train: NDArrays y_train: Union[NDArray, NDArrays]
Returns¶
- NDArrays
new model weights as Numpy arrays
- on_model_send()[source]¶
Final data processing before sending the results back, such as encryption.
- Return type:
Returns¶
- results: dict
FL results formatted as a dictionary. For example: results = {
“model_weights”: model_weights, “samples_count”: samples_count, “bias_weights”: fractions,
}
- run_round(model_trainer, config)[source]¶
Combines the rest of the functions to run a single Federated Learning round
- Return type:
Parameters¶
- model_trainer
instance of a class based on BaseModelTrainer that implements .fit(), .evaluate(), .get_weights(), and .set_weights()
- config: dict
a dictionary with all the necessary parameters for retrieving data and training the model
Returns¶
- results: dict
FL results formatted as a dictionary. For example: results = {
“model_weights”: model_weights, “samples_count”: samples_count, “bias_weights”: fractions,
}