Central Shapley Value Strategy

Central Shapley Value Strategy#

Centralized Shapley value strategy implementation.

This module implements a centralized version of the Shapley value strategy where coalition evaluation is performed on the server side. The server evaluates each coalition’s model parameters directly instead of distributing evaluation tasks to clients.

This approach is possible when the server has access to a validation dataset

class rizemind.strategies.contribution.shapley.centralized.shapley_value_strategy.CentralShapleyValueStrategy(strategy: Strategy, model: SupportsShapleyValueStrategy, **kwargs)[source]

Bases: ShapleyValueStrategy

Centralized Shapley value strategy with server-side evaluation.

aggregate_evaluate(server_round: int, results: list[tuple[ClientProxy, EvaluateRes]], failures: list[tuple[ClientProxy, EvaluateRes] | BaseException]) tuple[float | None, dict[str, bool | bytes | float | int | str]][source]

Aggregate client evaluation results (not used in centralized mode).

Returns None and empty metrics since evaluation is handled by the evaluate method.

Parameters:
  • server_round – The current server round number.

  • results – List of client evaluation results (unused).

  • failures – List of failed evaluations (unused).

Returns:

Tuple of (None, empty dict) as no client evaluation is performed.

configure_evaluate(server_round: int, parameters: Parameters, client_manager: ClientManager) list[tuple[ClientProxy, EvaluateIns]][source]

Configure client evaluation (not used in centralized mode).

Returns an empty list since evaluation is performed centrally on the server.

Parameters:
  • server_round – The current server round number.

  • parameters – Current model parameters.

  • client_manager – Manager handling available clients.

Returns:

Empty list as no client evaluation is needed.

evaluate(server_round: int, parameters: Parameters) tuple[float, dict[str, bool | bytes | float | int | str]] | None[source]

Evaluate all coalitions on the server and close the round.

Evaluates each coalition’s parameters using the underlying strategy’s evaluation method and finalizes the round by computing contributions and distributing rewards.

Parameters:
  • server_round – The current server round number.

  • parameters – Current model parameters (unused, each coalitions parameter

  • object). (is available in its own)

Returns:

Tuple containing the best coalition loss and aggregated metrics.

Raises:

ValueError – If any coalition evaluation returns None.