nvflare.app_opt.sklearn.svm_assembler module

class SVMAssembler(kernel: str = 'rbf')[source]

Bases: Assembler

Assembler for federated SVM using support vector aggregation.

This assembler implements the aggregation logic for federated SVM training. The approach is to: 1. Each client trains a local SVM on their data 2. Each client sends their support vectors (and labels) to the server 3. Server concatenates all support vectors from all clients 4. Server trains a global SVM on the aggregated support vectors 5. Server extracts final global support vectors and sends back to clients

This approach only requires one round of training since SVM is not an iterative algorithm in the federated setting.

Parameters:

kernel – Kernel type to use in SVM. Options include ‘linear’, ‘poly’, ‘rbf’, ‘sigmoid’. Default is ‘rbf’.

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 federated SVM model from client contributions.

This method implements the core SVM aggregation logic: - Round 0: Collects support vectors from all clients, trains a global SVM

on the concatenated support vectors, and extracts global support vectors

  • Round 1+: Returns the previously computed global support vectors

Parameters:
  • data – Dictionary mapping client names to their data (not used directly; self.collection contains the processed client models)

  • fl_ctx – FLContext containing federated learning context information (e.g., current round number)

Returns:

DXO containing the global support vectors (‘support_x’ and ‘support_y’)

Note

self.collection is populated by the parent Assembler class before this method is called. It contains the processed client models from get_model_params().

get_model_params(dxo: DXO)[source]

Extract support vectors from the DXO.

Parameters:

dxo – DXO containing model data with ‘support_x’ (support vectors) and ‘support_y’ (support vector labels)

Returns:

Dictionary with keys ‘support_x’ and ‘support_y’ containing the support vectors and their labels