nvflare.app_common.aggregators.collect_and_assemble_model_aggregator module

class CollectAndAssembleModelAggregator(assembler_id: str)[source]

Bases: ModelAggregator

ModelAggregator adapter for CollectAndAssemble pattern.

This aggregator bridges the gap between FLModel-based workflows (FedAvg) and Assembler-based custom aggregation logic (e.g., K-Means, SVM).

It wraps an Assembler component and: 1. Collects FLModel results from clients 2. Converts them to the format expected by the Assembler 3. Delegates aggregation to the Assembler 4. Returns the aggregated result as FLModel

This enables custom aggregation algorithms to work with the modern FedAvg workflow while maintaining InTime aggregation where possible.

Parameters:

assembler_id – ID of the Assembler component to use for aggregation.

Init FLComponent.

The FLComponent is the base class of all FL Components. (executors, controllers, responders, filters, aggregators, and widgets are all FLComponents)

FLComponents have the capability to handle and fire events and contain various methods for logging.

accept_model(model: FLModel) None[source]

Accept one FLModel from a client.

Parameters:

model – FLModel received from a client

aggregate_model() FLModel[source]

Aggregate all accepted models using the Assembler.

Returns:

Aggregated model

Return type:

FLModel

reset_stats() None[source]

Reset aggregation statistics for next round.