nvflare.app_common.aggregators.dxo_aggregator module

class DXOAggregator(exclude_vars: Optional[str] = None, aggregation_weights: Optional[Dict[str, Any]] = None, expected_data_kind: DataKind = 'WEIGHT_DIFF', name_postfix: str = '')[source]

Bases: FLComponent

Perform accumulated weighted aggregation for one kind of corresponding DXO from contributors.

Parameters
  • exclude_vars (str, optional) – Regex to match excluded vars during aggregation. Defaults to None.

  • aggregation_weights (Dict[str, Any], optional) – Aggregation weight for each contributor. Defaults to None.

  • expected_data_kind (DataKind) – Expected DataKind for this DXO.

  • name_postfix – optional postfix to give to class name and show in logger output.

accept(dxo: DXO, contributor_name, contribution_round, fl_ctx: FLContext) bool[source]

Store DXO and update aggregator’s internal state :param dxo: information from contributor :param contributor_name: name of the contributor :param contribution_round: round of the contribution :param fl_ctx: context provided by workflow

Returns

The boolean to indicate if DXO is accepted.

aggregate(fl_ctx: FLContext) DXO[source]

Called when workflow determines to generate DXO to send back to contributors :param fl_ctx: context provided by workflow :type fl_ctx: FLContext

Returns

the weighted mean of accepted DXOs from contributors

Return type

DXO

reset_aggregation_helper()[source]