This project implements a federated learning approach using LSTM (Long Short-Term Memory) neural networks for time series forecasting. The system is built using TensorFlow and Flower (flwr) for federated learning.
This federated learning system allows multiple clients to collaboratively train an LSTM model without sharing their raw data. The model is designed to forecast time series data, specifically tailored for energy-related predictions.
- LSTM Model: Defined in
lstm_model.py - Federated Learning Client: Implemented in
client.py - Data Preparation: Handled by
prepare_data.py - Federated Learning Server: Set up in
server.py - Main Execution Script:
run_federated_learning.py
git clone https://github.com/KaavinB/Wind-Prediction-LSTM-Federated-Learning.gitpip install tensorflow pandas numpy scikit-learn flwr- Ensure
jandata.csvis in the project directory. - Start the server: python server.py
- Run clients in separate terminals: python run_federated_learning.py
client.py: Federated learning client (Flower'sNumPyClient)lstm_model.py: LSTM model architecture and utilitiesprepare_data.py: Data loading, preprocessing, and splittingrun_federated_learning.py: Main script to start a clientserver.py: Federated learning server setup and execution
Use jandata.csv with columns:
- Datetime
- Region
- Grid connection type
- Offshore/onshore
- Most recent forecast (target variable)
- Other relevant features
- Adjust client numbers, LSTM architecture, or training parameters in respective files
- Modify data preprocessing in
prepare_data.pyfor different datasets
Contributions welcome! Fork the repo and submit a pull request with your changes.
Built with Flower - a friendly federated learning framework.
Made with ❤️ by Kaavin