synthetic_dataset#

Module Contents#

class SyntheticDataset(root, path, preprocess=False)#

Bases: fedlab.contrib.dataset.basic_dataset.FedDataset

preprocess(root, path, partition=0.2)#

Preprocess the raw data to fedlab dataset format.

Parameters:
  • root (str) – path to the raw data.

  • path (str) – path to save the preprocessed datasets.

  • partition (float, optional) – The propotion of testset. Defaults to 0.2.

get_dataset(id, type='train')#

Get dataset class

Parameters:
  • id (int) – Client ID for the partial dataset to achieve.

  • type (str, optional) – Type of dataset, can be chosen from ["train", "val", "test"]. Defaults as "train".

Raises:

NotImplementedError

get_dataloader(id, batch_size, type='train')#

Get data loader