fedlib.datasets.ShardPartitioner
- class fedlib.datasets.ShardPartitioner(num_clients, random_seed=123, client_id_generator=None, num_shards=4)[source]
Bases:
DatasetPartitionerPartitioner that splits a dataset into shards and assigns shards to clients.
- split_dataset(dataset)[source]
Split a single dataset into multiple subsets, each keyed by a unique client_id.
- split_datasets(train_dataset, test_dataset)[source]
Split two keyconcepts (e.g., training and testing keyconcepts) into multiple pairs of subsets, each keyed by a unique client_id.
- Parameters:
train_dataset (Dataset) – The training dataset to be split.
test_dataset (Dataset) – The testing dataset to be split.
- Returns:
- A dictionary where the key is a string
client_id and the value is a tuple of two Subsets (training and testing).
- Return type:
Dict[str, Tuple[Subset, Subset]]
- Return type: