DifferentialPrivacyServerSideFixedClipping

class DifferentialPrivacyServerSideFixedClipping(strategy: Strategy, noise_multiplier: float, clipping_norm: float, num_sampled_clients: int)[소스]

기반 클래스: Strategy

Strategy wrapper for central DP with server-side fixed clipping.

매개변수:
  • strategy (Strategy) – The strategy to which DP functionalities will be added by this wrapper.

  • noise_multiplier (float) – The noise multiplier for the Gaussian mechanism for model updates. A value of 1.0 or higher is recommended for strong privacy.

  • clipping_norm (float) – 클리핑 기준값입니다.

  • num_sampled_clients (int) – The number of clients that are sampled on each round.

예제

Create a strategy:

>>> strategy = fl.server.strategy.FedAvg( ... )

Wrap the strategy with the DifferentialPrivacyServerSideFixedClipping wrapper

>>> dp_strategy = DifferentialPrivacyServerSideFixedClipping(
>>>     strategy, cfg.noise_multiplier, cfg.clipping_norm, cfg.num_sampled_clients
>>> )

메소드

aggregate_evaluate(server_round, results, ...)

Aggregate evaluation losses using the given strategy.

aggregate_fit(server_round, results, failures)

Compute the updates, clip, and pass them for aggregation.

configure_evaluate(server_round, parameters, ...)

Configure the next round of evaluation.

configure_fit(server_round, parameters, ...)

Configure the next round of training.

evaluate(server_round, parameters)

Evaluate model parameters using an evaluation function from the strategy.

initialize_parameters(client_manager)

Initialize global model parameters using given strategy.

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]][소스]

Aggregate evaluation losses using the given strategy.

aggregate_fit(server_round: int, results: list[tuple[ClientProxy, FitRes]], failures: list[tuple[ClientProxy, FitRes] | BaseException]) tuple[Parameters | None, dict[str, bool | bytes | float | int | str]][소스]

Compute the updates, clip, and pass them for aggregation.

Afterward, add noise to the aggregated parameters.

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

Configure the next round of evaluation.

configure_fit(server_round: int, parameters: Parameters, client_manager: ClientManager) list[tuple[ClientProxy, FitIns]][소스]

Configure the next round of training.

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

Evaluate model parameters using an evaluation function from the strategy.

initialize_parameters(client_manager: ClientManager) Parameters | None[소스]

Initialize global model parameters using given strategy.