LightweightShapleyEvaluator<T>

Models & Types · AiDotNet.FederatedLearning.Fairness

Implements Lightweight Shapley — O(n) Shapley value approximation using gradient similarity.

Inheritance: FederatedLearningComponentBase<T> → LightweightShapleyEvaluator<T>

Implements: IClientContributionEvaluator<T>

For Beginners

Exact Shapley values require evaluating all 2^n subsets of clients — impossibly expensive for even 20 clients. Lightweight Shapley approximates each client’s contribution by measuring how similar their gradient is to the ideal global gradient. Clients whose updates are well-aligned with the consensus get high Shapley values, while adversarial or low-quality updates get low values. This runs in O(n) time.

How It Works

Approximation:

Reference: Lightweight Shapley for Federated Contribution Evaluation (2024).

Constructors

Constructor Summary
LightweightShapleyEvaluator(double freeRiderThreshold) Creates a new Lightweight Shapley evaluator.

Properties

Property Summary
double FreeRiderThreshold { get; } Gets the free-rider threshold.
string MethodName { get; }

Methods

Method Summary
Dictionary<int, double> EvaluateContributions(Dictionary<int, Tensor<T>> clientModels, Tensor<T> globalModel, Dictionary<int, List<Tensor<T>>> clientHistories)
HashSet<int> IdentifyFreeRiders(Dictionary<int, double> contributionScores)