Table of Contents

Class LeafFederatedDatasetLoader<T>

Namespace
AiDotNet.FederatedLearning.Benchmarks.Leaf
Assembly
AiDotNet.dll

Loads LEAF benchmark JSON files into per-client datasets suitable for federated learning simulation.

public sealed class LeafFederatedDatasetLoader<T> : FederatedLearningComponentBase<T>

Type Parameters

T

The numeric type for features/labels (for example, double).

Inheritance
LeafFederatedDatasetLoader<T>
Inherited Members

Remarks

LEAF stores federated datasets in a JSON structure containing: - users: user/client IDs - num_samples: declared sample counts per user - user_data: per-user objects with x (features) and y (labels)

For Beginners: This loader reads one LEAF JSON file and converts it into a set of "client datasets" — one dataset per user — so federated learning trainers can run simulations.

Methods

LoadDatasetFromFiles(string, string?, LeafFederatedDatasetLoadOptions?)

Loads a LEAF train dataset and optional test dataset from files.

public LeafFederatedDataset<Matrix<T>, Vector<T>> LoadDatasetFromFiles(string trainFilePath, string? testFilePath = null, LeafFederatedDatasetLoadOptions? options = null)

Parameters

trainFilePath string

Path to the train JSON split.

testFilePath string

Optional path to the test JSON split.

options LeafFederatedDatasetLoadOptions

Optional load options (subset, validation).

Returns

LeafFederatedDataset<Matrix<T>, Vector<T>>

A dataset with train and optional test splits.

LoadSplitFromFile(string, LeafFederatedDatasetLoadOptions?)

Loads a LEAF split (train/test) from a JSON file.

public LeafFederatedSplit<Matrix<T>, Vector<T>> LoadSplitFromFile(string filePath, LeafFederatedDatasetLoadOptions? options = null)

Parameters

filePath string

Path to a LEAF JSON split file.

options LeafFederatedDatasetLoadOptions

Optional load options (subset, validation).

Returns

LeafFederatedSplit<Matrix<T>, Vector<T>>

A per-user federated split with numeric features and labels.

LoadSplitFromJson(string, LeafFederatedDatasetLoadOptions?)

Loads a LEAF split (train/test) from a JSON string.

public LeafFederatedSplit<Matrix<T>, Vector<T>> LoadSplitFromJson(string json, LeafFederatedDatasetLoadOptions? options = null)

Parameters

json string

The LEAF JSON content.

options LeafFederatedDatasetLoadOptions

Optional load options (subset, validation).

Returns

LeafFederatedSplit<Matrix<T>, Vector<T>>

A per-user federated split with numeric features and labels.