This project implements Federated Learning (FL) models—both Horizontal and Vertical—for diabetes prediction while ensuring secure client-server communication using Solidity-based smart contracts. It aims to preserve data privacy while enabling collaborative model training.
- Introduction
- Problem Statement
- Fundamentals
- Dataset
- Implementation
- Deployment & Execution
- Conclusion
- References
Traditional machine learning approaches require centralized data collection, posing security and compliance risks. Federated Learning (FL) addresses this by training models locally and only exchanging model updates. This project integrates Solidity smart contracts to enhance FL security.
Medical data privacy is critical. This project focuses on federated learning for diabetes prediction using a dataset where data remains distributed among multiple institutions, ensuring compliance with regulations like GDPR and HIPAA.
- Decentralized ML approach that enables collaborative training without sharing raw data.
- Types of FL:
Solidity is used to implement smart contracts for securing FL communication. The contract records participant consent on the blockchain, ensuring trust and data integrity.
- Source: Diabetes Prediction in America dataset (Kaggle)
- Features: Pregnancies, Glucose, Blood Pressure, BMI, Insulin, Age, etc.
- Target Variable: Diabetes Diagnosis (1 = diabetic, 0 = non-diabetic)
Implemented baseline classifiers:
- Random Forest Classifier
- Gradient Boosting Classifier
- Stacking Ensemble (Meta-Model)
Implemented both Horizontal FL (HFL) and Vertical FL (VFL) using PyTorch.
- HFL: Clients train models locally, updates are aggregated using Federated Averaging.
- VFL: Clients contribute different features, with a central model aggregating partial outputs.
A Solidity smart contract (FLConsent.sol) ensures:
- Immutable consent storage for FL participants.
- Tamper-proof data integrity using Ethereum blockchain.
- Secure authentication of participating clients.
- Compile and Deploy Solidity Contract
- Use Remix IDE with Solidity v0.8.19.
- Deploy on Ganache for local testing.
- Train Federated Learning Model
- Split dataset for multiple clients.
- Train models locally and aggregate weights.
- Integrate Smart Contract
This project successfully integrates Federated Learning and Blockchain to enable privacy-preserving AI in healthcare. Future work includes:
- Enhancing security with cryptographic techniques (e.g., Secure Multi-Party Computation).
- Extending the framework to other medical datasets.
- Incorporating incentive mechanisms for participant engagement.