I am building a federated learning model using my own dataset. I aim to build a multi classification model. The data are presented in separate 8 CSV files.
I followed the instructions in this post As shown in the code below.
dataset_paths = {
'client_0': '/content/ds1.csv',
'client_1': '/content/ds2.csv',
'client_2': '/content/ds3.csv',
'client_3': '/content/ds4.csv',
'client_4': '/content/ds5.csv',
}
def create_tf_dataset_for_client_fn(id):
path = dataset_paths.get(id)
if path is None:
raise ValueError(f'No dataset for client {id}')
return tf.data.Dataset.TextLineDataset(path)
source = tff.simulation.datasets.ClientData.from_clients_and_fn(
dataset_paths.keys(), create_tf_dataset_for_client_fn)
but it gave me this error
AttributeError: type object 'ClientData' has no attribute 'from_clients_and_fn'
I was reading this documentation and found that .datasets
methods would work, so I replaced with .from_clients_and_fn
and the error disappeared but I dont know if it is right and what is next?
My questions are:
- it this is a right method to upload the data to the clients?
- if it is not possible to upload the CSV files separately, can I combine all of the data into one CSV file and then consider them as a non-IID data and train them accordingly? I need some guidance here
and thanks in advance