Bulyan¶
- class Bulyan(*, fraction_fit: float = 1.0, fraction_evaluate: float = 1.0, min_fit_clients: int = 2, min_evaluate_clients: int = 2, min_available_clients: int = 2, num_malicious_clients: int = 0, evaluate_fn: ~typing.Callable[[int, list[~numpy.ndarray[~typing.Any, ~numpy.dtype[~typing.Any]]], dict[str, bool | bytes | float | int | str]], tuple[float, dict[str, bool | bytes | float | int | str]] | None] | None = None, on_fit_config_fn: ~typing.Callable[[int], dict[str, bool | bytes | float | int | str]] | None = None, on_evaluate_config_fn: ~typing.Callable[[int], dict[str, bool | bytes | float | int | str]] | None = None, accept_failures: bool = True, initial_parameters: ~flwr.common.typing.Parameters | None = None, fit_metrics_aggregation_fn: ~typing.Callable[[list[tuple[int, dict[str, bool | bytes | float | int | str]]]], dict[str, bool | bytes | float | int | str]] | None = None, evaluate_metrics_aggregation_fn: ~typing.Callable[[list[tuple[int, dict[str, bool | bytes | float | int | str]]]], dict[str, bool | bytes | float | int | str]] | None = None, first_aggregation_rule: ~typing.Callable = <function aggregate_krum>, **aggregation_rule_kwargs: ~typing.Any)[소스]¶
기반 클래스:
FedAvg
Bulyan strategy.
Implementation based on https://arxiv.org/abs/1802.07927.
- 매개변수:
fraction_fit (float, optional) – Fraction of clients used during training. Defaults to 1.0.
fraction_evaluate (float, optional) – Fraction of clients used during validation. Defaults to 1.0.
min_fit_clients (int, optional) – Minimum number of clients used during training. Defaults to 2.
min_evaluate_clients (int, optional) – Minimum number of clients used during validation. Defaults to 2.
min_available_clients (int, optional) – Minimum number of total clients in the system. Defaults to 2.
num_malicious_clients (int, optional) – Number of malicious clients in the system. Defaults to 0.
evaluate_fn (Optional[Callable[[int, NDArrays, Dict[str, Scalar]], Optional[Tuple[float, Dict[str, Scalar]]]]]) – Optional function used for validation. Defaults to None.
on_fit_config_fn (Callable[[int], Dict[str, Scalar]], optional) – Function used to configure training. Defaults to None.
on_evaluate_config_fn (Callable[[int], Dict[str, Scalar]], optional) – Function used to configure validation. Defaults to None.
accept_failures (bool, optional) – Whether or not accept rounds containing failures. Defaults to True.
initial_parameters (Parameters, optional) – Initial global model parameters.
first_aggregation_rule (Callable) – Byzantine resilient aggregation rule that is used as the first step of the Bulyan (e.g., Krum)
**aggregation_rule_kwargs (Any) – arguments to the first_aggregation rule
메소드
aggregate_evaluate
(server_round, results, ...)Aggregate evaluation losses using weighted average.
aggregate_fit
(server_round, results, failures)Aggregate fit results using Bulyan.
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.
initialize_parameters
(client_manager)Initialize global model parameters.
num_evaluation_clients
(num_available_clients)Use a fraction of available clients for evaluation.
num_fit_clients
(num_available_clients)Return the sample size and the required number of available clients.
- 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 weighted average.
- 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]] [소스]¶
Aggregate fit results using Bulyan.
- 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.
- initialize_parameters(client_manager: ClientManager) Parameters | None ¶
Initialize global model parameters.
- num_evaluation_clients(num_available_clients: int) tuple[int, int] ¶
Use a fraction of available clients for evaluation.
- num_fit_clients(num_available_clients: int) tuple[int, int] ¶
Return the sample size and the required number of available clients.