nvflare.app_opt.sklearn.kmeans_assembler module
- class KMeansAssembler[source]
Bases:
AssemblerAssembler for K-Means clustering using mini-batch aggregation strategy.
This assembler implements the aggregation logic for federated K-Means clustering following the Mini-Batch K-Means approach where: - Round 0: Collect initial centers from all clients and perform one round of K-Means
to generate the initial global centers
Subsequent rounds: Aggregate centers using weighted averaging based on counts, following the mini-batch update rule
The assembler maintains: - center: Global cluster centers - count: Per-center counts for weighted 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.
- assemble(data: dict[str, dict], fl_ctx: FLContext) DXO[source]
Assemble the collected submissions. This will be specified according to the specific algorithm E.g. global svm round on the collected local supporting vectors; global k-means step on the local centroids and counts
- Returns:
A DXO containing all information ready to be returned to clients