Skip to content
Advertisement

splitting the data into training and testing in federated learning

I am new in federated learning I am currently experimenting with a model by following the official TFF documentation. But I am stuck with an issue and hope I find some explanation here.

I am using my own dataset, the data are distributed in multiple files, each file is a single client (as I am planning to structure the model). and the dependant and independent variables have been defined.

Now, my question is how can I split the data into training and testing sets in each client(file) in federated learning? like what we -normally- do in the centralized ML models The following code is what I have implemented so far: note my code is inspired by the official documentation and this post which is almost similar to my application, but it aims to split the clients as training and testing clients itself while my aim is to split the data inside these clients.

JavaScript

My understanding to supervised ML is to split the data into training and testing sets as in the below code, I am not sure how to do this in Federated learning and whether it will work this way or not?

JavaScript

So, please I am looking for an explanation for this issue so I can proceed to the training phase.

Advertisement

Answer

See this tutorial. You should be able to create two datasets (train and test) based on the clients and their data:

JavaScript
JavaScript

If you follow the the tutorial I linked, you should be able to feed the split data directly to tff.learning.from_keras_model.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement