IFairnessConstraint<T>

Interfaces · AiDotNet.FederatedLearning.Fairness

Defines and enforces fairness constraints during federated learning aggregation.

Known implementations: GroupFairnessConstraint<T>

For Beginners

A fairness constraint ensures the global model works well for ALL client groups, not just the majority. Without it, a model trained across 10 urban hospitals and 2 rural hospitals might be great for urban patients but poor for rural ones. Fairness constraints rebalance the aggregation to protect underrepresented groups.

How It Works

Common fairness measures:

Properties

Property Summary
string ConstraintName { get; } Gets the name of this fairness constraint.

Methods

Method Summary
Dictionary<int, double> AdjustWeights(Dictionary<int, double> originalWeights, Dictionary<int, Tensor<T>> clientModels, Tensor<T> globalModel, Dictionary<int, int> clientGroups) Adjusts aggregation weights to enforce fairness constraints.
bool IsSatisfied(double fairnessViolation) Gets whether the current model satisfies the fairness constraint.
double EvaluateFairness(Dictionary<int, Tensor<T>> clientModels, Tensor<T> globalModel, Dictionary<int, int> clientGroups) Evaluates the current fairness metric across client groups.