This project focuses on the implementation of logistic regression models on 10 different clients, utilizing the concept of federated learning. The Flower framework is employed to simulate federated learning on a local machine, providing a convenient environment for experimentation and evaluation.
- Every client trains the model locally on their local machine with their part of the dataset.
- The server aggregates the model weights with taking the weighted average of the client's data portion, then sends the updated model back to the clients.
- The clients then update their local model with the new model weights and repeat the process until the model converges.
The dataset used in this project consists of 2 classes and 21 features. Each client in the federated learning setup possesses an identical number of features, ensuring consistency across the clients' data.
Moreover, the clients' datasets exhibit varying sizes of imbalanced data points. For a more detailed understanding of the dataset distribution, please refer to the dirichlet_dist.py file in the project directory.
The example uses the "Diabetes Health Indicators Dataset" from Kaggle. For more information about the dataset: https://www.kaggle.com/datasets/alexteboul/diabetes-health-indicators-dataset
To aggregate the individual client models effectively, the project adopts the Federated Averaging strategy. This approach allows for the collaborative combination of the locally trained models, leading to a robust and accurate global model.
Federated Averaging is a simple yet effective strategy that is widely used in federated learning. The strategy consists of the following steps:
- Initialize the global model with random weights
- Send the global model to the clients.
- Train the local model on the client's data.
- Send the updated local model to the server.
- Aggregate the local models by taking the weighted average of the local models' weights based on their data proportion.
- Send the updated global model to the clients.
- Repeat the process until the model converges.
- Clone the repository
- Install the the environment with the following command:
poetry install
- Run the example with the following command:
poetry ./run.sh
Contributions to this project are always welcome. If you find any issues or have ideas for enhancements, please submit a pull request or open an issue on the GitHub repository.
This project is licensed under the MIT License. Feel free to use and modify the code for your own purposes.