5.1.1.1.1.5. FedEval.aggregator.median

5.1.1.1.1.5.1. Module Contents

5.1.1.1.1.5.1.1. Functions

coordinate_wise_median(...)

return the coordinate-wise median of the given client-side params.

trimmed_coordinate_wise_median(...)

Return the coordinate-wise median of the given client-side params after trimming a certain ratio

FedEval.aggregator.median.coordinate_wise_median(client_params: Iterable[FedEval.aggregator.ModelWeight.ModelWeights]) FedEval.aggregator.ModelWeight.ModelWeights

return the coordinate-wise median of the given client-side params.

Parameters:

client_params (Iterable[ModelWeights]) – the weights form different clients, ordered like [params1, params2, …]

Returns:

the aggregated parameters which have the same format with any instance from the client_params

Return type:

ModelWeights

FedEval.aggregator.median.trimmed_coordinate_wise_median(client_params: Iterable[FedEval.aggregator.ModelWeight.ModelWeights], ratio: float = 0.05) FedEval.aggregator.ModelWeight.ModelWeights

Return the coordinate-wise median of the given client-side params after trimming a certain ratio of the extreme parameter values.

Parameters:
  • client_params (Iterable[ModelWeights]) – The weights from different clients, ordered like [params1, params2, …].

  • ratio (float, optional) – The ratio of extreme parameter values to trim. Should be between 0 and 0.5. Defaults to 0.05.

Raises:

ValueError – If trim_ratio is in [0, 0.5).

Returns:

The aggregated parameters which have the same format with any instance from the client_params.

Return type:

ModelWeights