Strategyยถ

class Strategy[์†Œ์Šค]ยถ

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

Abstract base class for server strategy implementations.

๋ฉ”์†Œ๋“œ

aggregate_evaluate(server_round, replies)

Aggregate evaluation metrics from client nodes.

aggregate_train(server_round, replies)

Aggregate training results from client nodes.

configure_evaluate(server_round, arrays, ...)

Configure the next round of 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.

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

Aggregate evaluation metrics from client nodes.

๋งค๊ฐœ๋ณ€์ˆ˜:
  • server_round (int) โ€“ The current round of federated learning.

  • replies (Iterable[Message]) โ€“ Iterable of reply messages received from client nodes after evaluation. MetricRecords in the messages are aggregated.

๋ฐ˜ํ™˜:

Aggregated evaluation metrics from all participating clients, or None if aggregation failed.

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

Optional[MetricRecord]

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

Aggregate training results from client nodes.

๋งค๊ฐœ๋ณ€์ˆ˜:
  • server_round (int) โ€“ The current round of federated learning, starting from 1.

  • replies (Iterable[Message]) โ€“ Iterable of reply messages received from client nodes after training. Each message contains ArrayRecords and MetricRecords that get aggregated.

๋ฐ˜ํ™˜:

A tuple containing: - ArrayRecord: Aggregated ArrayRecord, or None if aggregation failed - MetricRecord: Aggregated MetricRecord, or None if aggregation failed

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

tuple[Optional[ArrayRecord], Optional[MetricRecord]]

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

Configure the next round of evaluation.

๋งค๊ฐœ๋ณ€์ˆ˜:
  • server_round (int) โ€“ The current round of federated learning.

  • arrays (ArrayRecord) โ€“ Current global ArrayRecord (e.g. global model) to be sent to client nodes for evaluation.

  • config (ConfigRecord) โ€“ Configuration to be sent to clients nodes for evaluation.

  • grid (Grid) โ€“ The Grid instance used for node sampling and communication.

๋ฐ˜ํ™˜:

An iterable of messages to be sent to selected client nodes for evaluation.

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

Iterable[Message]

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

Configure the next round of training.

๋งค๊ฐœ๋ณ€์ˆ˜:
  • server_round (int) โ€“ The current round of federated learning.

  • arrays (ArrayRecord) โ€“ Current global ArrayRecord (e.g. global model) to be sent to client nodes for training.

  • config (ConfigRecord) โ€“ Configuration to be sent to clients nodes for training.

  • grid (Grid) โ€“ The Grid instance used for node sampling and communication.

๋ฐ˜ํ™˜:

An iterable of messages to be sent to selected client nodes for training.

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

Iterable[Message]

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

abstract summary() None[์†Œ์Šค]ยถ

Log summary configuration of the strategy.