LeafFederatedDataLoader<T>

Models & Types · AiDotNet.Data.Loaders

Data loader that reads LEAF benchmark JSON splits and exposes both aggregated (X, Y) data and per-client partitions.

Inheritance: DataLoaderBase<T> → InputOutputDataLoaderBase<T, Matrix<T>, Vector<T>> → LeafFederatedDataLoader<T>

Implements: IFederatedClientDataLoader<T, Matrix<T>, Vector<T>>

For Beginners

Use this loader when you want to run federated learning with realistic per-user splits provided by LEAF datasets.

How It Works

LEAF is a federated learning benchmark suite where each user corresponds to one client. This loader preserves that structure through ClientData while also providing aggregated Features/Labels for compatibility with the standard training facade.

Constructors

Constructor Summary
LeafFederatedDataLoader(string trainFilePath, string testFilePath, LeafFederatedDatasetLoadOptions options) Initializes a new instance of the LeafFederatedDataLoader class from LEAF JSON files.

Properties

Property Summary
IReadOnlyDictionary<int, FederatedClientDataset<Matrix<T>, Vector<T>>> ClientData { get; }
IReadOnlyDictionary<int, string> ClientIdToUserId { get; } Gets the mapping from internal client IDs (0..N-1) to original LEAF user IDs.
LeafFederatedSplit<Matrix<T>, Vector<T>> TestSplit { get; } Gets the loaded optional test split (one dataset per LEAF user).
LeafFederatedSplit<Matrix<T>, Vector<T>> TrainSplit { get; } Gets the loaded training split (one dataset per LEAF user).
int FeatureCount { get; }
int OutputDimension { get; }
int TotalCount { get; }
string Description { get; }
string Name { get; }

Methods

Method Summary
ValueTuple<IInputOutputDataLoader<T, Matrix<T>, Vector<T>>, IInputOutputDataLoader<T, Matrix<T>, Vector<T>>, IInputOutputDataLoader<T, Matrix<T>, Vector<T>>> Split(double trainRatio, double validationRatio, int? seed)