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