Decentral Shapley Value Client

Decentral Shapley Value Client#

class rizemind.strategies.contribution.shapley.decentralized.shapley_value_client.DecentralShapleyValueClient(client: NumPyClient)[source]

Bases: NumPyClient

Client wrapper for decentralized Shapley value evaluation.

This wrapper extends a NumPyClient to support coalition evaluation in decentralized Shapley value calculation. It passes through all client operations while adding coalition metadata to evaluation results.

client

The underlying NumPyClient being wrapped.

Type:

flwr.client.numpy_client.NumPyClient

client: NumPyClient
evaluate(parameters: list[ndarray[tuple[Any, ...], dtype[Any]]], config: dict[str, bool | bytes | float | int | str]) tuple[float, int, dict[str, bool | bytes | float | int | str]][source]

Evaluate coalition parameters and return results with coalition ID.

Evaluates the provided model parameters using the underlying client and augments the results with the coalition ID from the configuration.

Parameters:
  • parameters – Model parameters to evaluate as numpy arrays.

  • config – Configuration dictionary containing the coalition ID.

Returns:

Tuple containing loss value, number of examples, and metrics dictionary with the coalition ID included.

fit(parameters: list[ndarray[tuple[Any, ...], dtype[Any]]], config: dict[str, bool | bytes | float | int | str]) tuple[list[ndarray[tuple[Any, ...], dtype[Any]]], int, dict[str, bool | bytes | float | int | str]][source]

Train the model using the underlying client.

Parameters:
  • parameters – Model parameters as numpy arrays.

  • config – Configuration dictionary for training.

Returns:

Tuple containing updated parameters, number of examples, and metrics.

get_parameters(config: dict[str, bool | bytes | float | int | str]) list[ndarray[tuple[Any, ...], dtype[Any]]][source]

Get model parameters from the underlying client.

Parameters:

config – Configuration dictionary.

Returns:

Model parameters as numpy arrays.

get_properties(config: dict[str, bool | bytes | float | int | str]) dict[str, bool | bytes | float | int | str][source]

Get client properties from the underlying client.

Parameters:

config – Configuration dictionary.

Returns:

Dictionary of client properties.