client module¶
-
class
client.
Client
(client_id, group=None, train_data={'x': [], 'y': []}, eval_data={'x': [], 'y': []}, model=None)[source]¶ Bases:
object
-
model
¶ Returns this client reference to model being trained
-
num_test_samples
¶ Number of test samples for this client.
Returns: Number of test samples for this client Return type: int
-
test
(model)[source]¶ Tests self.model on self.eval_data.
Returns: dict of metrics returned by the model.
-
train
(num_epochs=1, batch_size=10, minibatch=None)[source]¶ Trains on self.model using the client’s train_data.
Parameters: - num_epochs – Number of epochs to train. Unsupported if minibatch is provided (minibatch has only 1 epoch)
- batch_size – Size of training batches.
- minibatch – fraction of client’s data to apply minibatch sgd, None to use FedAvg
Returns: number of FLOPs executed in training process num_samples: number of samples used in training update: set of weights update_size: number of bytes in update
Return type: comp
-