VerticalPartyLabelHolder<T>
Models & Types · AiDotNet.FederatedLearning.Vertical
Represents the label-holding party in vertical federated learning.
Inheritance: FederatedLearningComponentBase<T> → VerticalPartyLabelHolder<T>
Implements: IVerticalParty<T>
For Beginners
In VFL, one special party holds the labels (prediction targets). For example, a hospital knows patient outcomes while partner banks only have financial data. The label holder plays a unique role:
How It Works
Security note: The label holder’s gradients can reveal label information. For example, large gradient magnitudes suggest the model made a large error, which hints at the true label. Always use label protection in production deployments.
Constructors
| Constructor | Summary |
|---|---|
VerticalPartyLabelHolder(string partyId, Tensor<T> localData, Tensor<T> labels, IReadOnlyList<string> entityIds, int embeddingDimension, int? seed) |
Initializes a new instance of VerticalPartyLabelHolder. |
Properties
| Property | Summary |
|---|---|
bool IsLabelHolder { get; } |
|
int EmbeddingDimension { get; } |
|
int FeatureCount { get; } |
|
string PartyId { get; } |
Methods
| Method | Summary |
|---|---|
IReadOnlyList<Tensor<T>> GetParameters() |
|
IReadOnlyList<string> GetEntityIds() |
|
Tensor<T> ComputeForward(IReadOnlyList<int> alignedIndices) |
|
Tensor<T> GetLabels(IReadOnlyList<int> alignedIndices) |
Gets the labels for the specified aligned entity indices. |
ValueTuple<double, Tensor<T>> ComputeLoss(Tensor<T> predictions, Tensor<T> batchLabels) |
Computes the mean squared error loss and its gradient. |
void ApplyBackward(Tensor<T> gradients, double learningRate) |
|
void SetParameters(IReadOnlyList<Tensor<T>> parameters) |