Client¶

class Client[source]¶

Bases: ABC

Abstract base class for Flower clients.

Methods

evaluate(ins)

Evaluate the provided parameters using the locally held dataset.

fit(ins)

Refine the provided parameters using the locally held dataset.

get_context()

Get the run context from this client.

get_parameters(ins)

Return the current local model parameters.

get_properties(ins)

Return set of client's properties.

set_context(context)

Apply a run context to this client.

to_client()

Return client (itself).

Attributes

context

Getter for Context client attribute.

property context: Context¶

Getter for Context client attribute.

evaluate(ins: EvaluateIns) EvaluateRes[source]¶

Evaluate the provided parameters using the locally held dataset.

Parameters:

ins (EvaluateIns) – The evaluation instructions containing (global) model parameters received from the server and a dictionary of configuration values used to customize the local evaluation process.

Returns:

The evaluation result containing the loss on the local dataset and other details such as the number of local data examples used for evaluation.

Return type:

EvaluateRes

fit(ins: FitIns) FitRes[source]¶

Refine the provided parameters using the locally held dataset.

Parameters:

ins (FitIns) – The training instructions containing (global) model parameters received from the server and a dictionary of configuration values used to customize the local training process.

Returns:

The training result containing updated parameters and other details such as the number of local training examples used for training.

Return type:

FitRes

get_context() Context[source]¶

Get the run context from this client.

get_parameters(ins: GetParametersIns) GetParametersRes[source]¶

Return the current local model parameters.

Parameters:

ins (GetParametersIns) – The get parameters instructions received from the server containing a dictionary of configuration values.

Returns:

The current local model parameters.

Return type:

GetParametersRes

get_properties(ins: GetPropertiesIns) GetPropertiesRes[source]¶

Return set of client’s properties.

Parameters:

ins (GetPropertiesIns) – The get properties instructions received from the server containing a dictionary of configuration values.

Returns:

The current client properties.

Return type:

GetPropertiesRes

set_context(context: Context) None[source]¶

Apply a run context to this client.

to_client() Client[source]¶

Return client (itself).