FedSelectPersonalization<T>
Models & Types · AiDotNet.FederatedLearning.Personalization
Implements FedSelect — learned sparse binary masks for personalization.
Inheritance: FederatedLearningComponentBase<T> → FedSelectPersonalization<T>
For Beginners
Instead of deciding up-front which layers to personalize, FedSelect learns a binary mask for each client that determines, for each parameter, whether it should be shared (aggregated globally) or personalized (kept local). The mask itself is learned during training using straight-through estimator gradients. This gives each client a different “personalization pattern” that best fits their data.
How It Works
Algorithm:
Reference: FedSelect: Personalizing FL with Learned Parameter Selection (2023).
Constructors
| Constructor | Summary |
|---|---|
FedSelectPersonalization(double maskThreshold, double maskRegularization) |
Creates a new FedSelect personalization strategy. |
Properties
| Property | Summary |
|---|---|
double MaskRegularization { get; } |
Gets the mask regularization weight. |
double MaskThreshold { get; } |
Gets the mask binarization threshold. |
Methods
| Method | Summary |
|---|---|
Dictionary<string, T[]> ExtractSharedParameters(Dictionary<string, T[]> fullParameters) |
Extracts shared parameters (where mask is 0) for aggregation. |
double ComputeRegularizationLoss() |
Computes the L1 regularization loss on the mask to encourage sparsity (fewer personalized params). |
double GetPersonalizationRatio() |
Computes the mask sparsity (fraction of parameters that are personalized). |
void InitializeMasks(Dictionary<string, T[]> modelStructure, double initialBias) |
Initializes mask logits for a model structure. |
void UpdateMask(string layerName, T[] parameterGradients, T[] personalizedValues, T[] sharedValues, double learningRate) |
Updates mask logits using straight-through estimator (STE) gradients. |