DifferentialPrivacyClientSideFixedClippingยถ

class DifferentialPrivacyClientSideFixedClipping(strategy: Strategy, noise_multiplier: float, clipping_norm: float, num_sampled_clients: int)[์†Œ์Šค]ยถ

๊ธฐ๋ฐ˜ ํด๋ž˜์Šค: DifferentialPrivacyFixedClippingBase

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

Use fixedclipping_mod modifier at the client side.

In comparison to DifferentialPrivacyServerSideFixedClipping, which performs clipping on the server-side, DifferentialPrivacyClientSideFixedClipping expects clipping to happen on the client-side, usually by using the built-in fixedclipping_mod.

๋งค๊ฐœ๋ณ€์ˆ˜:
  • 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.serverapp.FedAvg(...)

Wrap the strategy with the DifferentialPrivacyClientSideFixedClipping wrapper:

dp_strategy = DifferentialPrivacyClientSideFixedClipping(
    strategy, cfg.noise_multiplier, cfg.clipping_norm, cfg.num_sampled_clients
)

On the client, add the fixedclipping_mod to the client-side mods:

app = fl.client.ClientApp(mods=[fixedclipping_mod])

๋ฉ”์†Œ๋“œ

aggregate_evaluate(server_round, replies)

Aggregate MetricRecords in the received Messages.

aggregate_train(server_round, replies)

Aggregate ArrayRecords and MetricRecords in the received Messages.

configure_evaluate(server_round, arrays, ...)

Configure the next round of federated evaluation.

configure_train(server_round, arrays, ...)

Configure the next round of training.

start(grid, initial_arrays[, num_rounds, ...])

Execute the federated learning strategy.

summary()

Log summary configuration of the strategy.

aggregate_evaluate(server_round: int, replies: Iterable[Message]) MetricRecord | Noneยถ

Aggregate MetricRecords in the received Messages.

aggregate_train(server_round: int, replies: Iterable[Message]) tuple[ArrayRecord | None, MetricRecord | None][์†Œ์Šค]ยถ

Aggregate ArrayRecords and MetricRecords in the received Messages.

configure_evaluate(server_round: int, arrays: ArrayRecord, config: ConfigRecord, grid: Grid) Iterable[Message]ยถ

Configure the next round of federated evaluation.

configure_train(server_round: int, arrays: ArrayRecord, config: ConfigRecord, grid: Grid) Iterable[Message][์†Œ์Šค]ยถ

Configure the next round of training.

start(grid: Grid, initial_arrays: ArrayRecord, num_rounds: int = 3, timeout: float = 3600, train_config: ConfigRecord | None = None, evaluate_config: ConfigRecord | None = None, evaluate_fn: Callable[[int, ArrayRecord], MetricRecord] | None = None) Resultยถ

Execute the federated learning strategy.

Runs the complete federated learning workflow for the specified number of rounds, including training, evaluation, and optional centralized evaluation.

๋งค๊ฐœ๋ณ€์ˆ˜:
  • grid (Grid) โ€“ The Grid instance used to send/receive Messages from nodes executing a ClientApp.

  • initial_arrays (ArrayRecord) โ€“ Initial model parameters (arrays) to be used for federated learning.

  • num_rounds (int (default: 3)) โ€“ Number of federated learning rounds to execute.

  • timeout (float (default: 3600)) โ€“ Timeout in seconds for waiting for node responses.

  • train_config (ConfigRecord, optional) โ€“ Configuration to be sent to nodes during training rounds. If unset, an empty ConfigRecord will be used.

  • evaluate_config (ConfigRecord, optional) โ€“ Configuration to be sent to nodes during evaluation rounds. If unset, an empty ConfigRecord will be used.

  • evaluate_fn (Callable[[int, ArrayRecord], MetricRecord], optional) โ€“ Optional function for centralized evaluation of the global model. Takes server round number and array record, returns a MetricRecord. If provided, will be called before the first round and after each round. Defaults to None.

๋ฐ˜ํ™˜:

Results containing final model arrays and also training metrics, evaluation metrics and global evaluation metrics (if provided) from all rounds.

๋ฐ˜ํ™˜ ํ˜•์‹:

Results

summary() Noneยถ

Log summary configuration of the strategy.