[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-1205":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":11,"openIssues":13,"contributorsCount":13,"subscribersCount":13,"size":13,"stars1d":13,"stars7d":13,"stars30d":13,"stars90d":13,"forks30d":13,"starsTrendScore":13,"compositeScore":14,"rankGlobal":9,"rankLanguage":9,"license":9,"archived":15,"fork":15,"defaultBranch":16,"hasWiki":17,"hasPages":15,"topics":18,"createdAt":9,"pushedAt":9,"updatedAt":19,"readmeContent":20,"aiSummary":21,"trendingCount":13,"starSnapshotCount":13,"syncStatus":22,"lastSyncTime":23,"discoverSource":24},1205,"ECG-Federated-Learning.","PoorvikaN\u002FECG-Federated-Learning.","PoorvikaN","Explainable Federated Learning for Secure and Transparent Medical Diagnosis in IoT-based Smart Hospitals ",null,"Python",305,1,0,0.9,false,"main",true,[],"2026-06-12 02:00:24","\u003Cp align=\"center\">\n  \u003Cimg src=\"results\u002Fdsu_logo.png\" width=\"100\"\u002F>\n  &nbsp;&nbsp;&nbsp;\n\u003C\u002Fp>\n\n\u003Ch2 align=\"center\">DAYANANDA SAGAR UNIVERSITY\u003C\u002Fh2>\n\n\u003Cp align=\"center\">\nSchool of Engineering \u003Cbr>\nDepartment of Computer Science and Engineering (Cyber Security)\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n(A State Private University under the Karnataka Act No. 20 of 2013) \u003Cbr>\nApproved by UGC & AICTE, New Delhi\n\u003C\u002Fp>\n\n---\n## Explainable Federated Learning for Secure and Transparent Medical Diagnosis in IoT-based Smart Hospitals \n\n**High-Fidelity ML-based ECG Classification using Federated Learning & Explainability**\n\n**TTEH Lab**\n                                  \n\n---\n\n## Badges\n\n![Python](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FPython-3.11-blue)\n![PyTorch](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FPyTorch-Supported-orange)\n![Federated Learning](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FFederated%20Learning-Enabled-yellow)\n![Explainability](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FExplainability-SHAP-green)\n![License](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLicense-MIT-blue)\n\n---\n\n\n## Overview\n\nThis project presents an **ECG classification system using Federated Learning combined with Explainable AI (XAI)** for secure and transparent medical diagnosis.\n\nElectrocardiogram (ECG) signals are widely used for detecting cardiac abnormalities, but sharing such sensitive patient data across hospitals raises serious privacy concerns. To address this, we implement a **Federated Learning framework** where multiple simulated hospitals (clients) train models locally on their own ECG data without sharing raw data.\n\nA global model is then constructed by aggregating the locally trained models using the Flower federated learning framework.\n\nIn addition to model training, this project integrates **Explainability techniques (SHAP)** to interpret model predictions, enabling better transparency and trust in clinical decision-making.\n\nThe system is evaluated in both **centralized and federated settings**, demonstrating that federated learning can achieve comparable performance while preserving data privacy.\n\nThis work aims to contribute toward **privacy-preserving, interpretable AI solutions for smart healthcare systems**.\n\n**Keywords:** `Federated Learning` `ECG Classification` `Explainable AI` `Healthcare AI` `Privacy-Preserving Machine Learning`\n\n---\n\n## Table of Contents\n\n1. [Problem Statement](#-problem-statement)\n2. [Proposed Architecture](#-proposed-architecture)\n3. [System Architecture](#-system-architecture)\n4. [Components](#components)\n5. [How It Works](#-how-it-works)\n6. [Performance Evaluation](#-performance-evaluation)\n7. [Explainability](#-explainability)\n8. [Code Architecture](#-code-architecture)\n9. [Core Modules](#-core-modules)\n10. [Setup & Usage](#-setup--usage)\n11. [Implementation Results](#-implementation-results)\n12. [Limitations](#-limitations)\n  \n---\n\n## Problem Statement\n\nCardiovascular diseases are one of the leading causes of mortality worldwide. Early detection using ECG signals is crucial for timely diagnosis. However, training machine learning models on ECG data requires access to large amounts of patient data, which raises serious privacy and security concerns.\n\nTraditional centralized learning approaches require data to be collected and stored in a single location, increasing the risk of data breaches and violating healthcare data regulations.\n\nTherefore, there is a need for a **privacy-preserving, scalable, and interpretable system** that can:\n\n- Train models without sharing sensitive medical data\n- Maintain high diagnostic accuracy\n- Provide transparency in model predictions\n\nThis project addresses these challenges using **Federated Learning and Explainable AI**.\n\n---\n\n## Proposed Architecture\n\nThe system follows a distributed federated learning pipeline where clients collaboratively train a global model without sharing raw data.\n\n| Component            | Description                                                                 | Technology Used        |\n|----------------------|-----------------------------------------------------------------------------|------------------------|\n| ECG Dataset          | Raw ECG signals from MIT-BIH Arrhythmia Dataset                             | PhysioNet              |\n| Data Preprocessing   | Signal extraction, segmentation, normalization, labeling                    | NumPy, WFDB            |\n| Clients (Hospitals)  | Simulated distributed nodes training on local ECG data                      | Flower Clients         |\n| Local Model          | ECG classification model trained independently at each client               | PyTorch                |\n| Server               | Central aggregator coordinating federated learning                          | Flower Server          |\n| Aggregation          | Combines model weights from all clients using Federated Averaging (FedAvg)  | Flower Strategy        |\n| Global Model         | Updated shared model distributed back to clients                            | PyTorch                |\n| Explainability       | Interprets model predictions using SHAP                                     | SHAP Library           |\n| Results Storage      | Stores training results, logs, and plots                                    | Local Storage          |\n\n---\n## System Architecture\n\nThe proposed system follows a federated learning architecture with explainability support.\n\n![System Architecture](results\u002Fsystem_architecture.png)\n\n---\n\n### Components:\n\n- **Clients (Hospitals)** → Local ECG training\n- **Server** → Model aggregation\n- **Global Model** → Shared knowledge\n- **Explainability Module** → SHAP-based interpretation\n\n---\n## How It Works\n\n1. ECG data is loaded from the MIT-BIH dataset\n2. Signals are preprocessed and converted into training samples\n3. Data is split into multiple clients (simulated hospitals)\n4. Each client trains a local model independently\n5. Flower framework coordinates training across clients\n6. Model weights are sent to the server\n7. Server aggregates updates to create a global model\n8. Process repeats for multiple rounds\n9. Final global model is evaluated\n10. SHAP is used to explain model predictions\n\n---\n\n## Performance Evaluation\n\n### Centralized Model\n- Trained on full dataset\n- Achieves stable accuracy\n- Serves as baseline for comparison\n\n### Federated Model\n- 3 simulated clients\n- Model trained without sharing raw data\n- Accuracy comparable to centralized approach\n\n### Key Findings:\n- Federated learning preserves privacy\n- Minimal drop in accuracy compared to centralized model\n- Model converges successfully across rounds\n\n### Metrics Used:\n- Accuracy\n- Loss\n\n### Conclusion:\nFederated learning is effective for ECG classification while maintaining data privacy.\n\n### Training Performance\n\n![Accuracy Graph](results\u002Faccuracy.png)\n\n---\n## Explainability (SHAP)\n\nTo improve model transparency, SHAP (SHapley Additive Explanations) is used to interpret predictions.\n\n- SHAP identifies which parts of the ECG signal contribute most to classification\n- Helps understand model decision-making\n- Important for clinical trust and validation\n\n### Observations:\n- Certain waveform regions (QRS complex) show higher importance\n- Model focuses on key ECG patterns for classification\n\n### Output:\n- SHAP summary plots are generated and stored in the `results\u002F` folder\n\n---\n\n## Code Architecture\n\n```bash\nECG-Federated-Learning\u002F\n│\n├── data\u002F\n├── notebooks\u002F\n├── results\u002F\n│   ├── .getkeep\n│   ├── accuracy.png\n│   ├── ecg_sample.png\n│   ├── shap_plot.png\n│   ├── system_architecture.png\n├── src\u002F\n│   ├── model.py\n│   ├── data_utils.py\n│   ├── train_baseline.py\n│   ├── federated_simulation.py\n│   ├── explain.py\n│   └── config.py\n│\n├── main.py\n├── requirements.txt\n└── README.md\n\n```\n---\n\n## Core Modules\n\n### 1. data_utils.py\nHandles:\n- Dataset loading\n- ECG signal extraction\n- Preprocessing\n- Label creation\n\n### 2. model.py\nDefines:\n- ECG classification model (1D CNN \u002F simple model)\n\n### 3. train_baseline.py\nImplements:\n- Centralized training\n- Performance comparison\n\n### 4. federated_simulation.py\nHandles:\n- Client creation\n- Flower simulation\n- Model aggregation\n\n### 5. explain.py\nImplements:\n- SHAP explainability\n- Visualization of feature importance\n\n### 6. config.py\nContains:\n- Hyperparameters\n- Training settings\n\n---\n\n## Setup & Usage\n\n### 1. Install dependencies\n```bash\npip install -r requirements.txt\n```\n### 2. Download dataset\n\nWe use the **MIT-BIH Arrhythmia Dataset**\n\n🔗 Download here:  \nhttps:\u002F\u002Fphysionet.org\u002Fcontent\u002Fmitdb\u002F1.0.0\n\nDataset is NOT included in this repository.\n\nAfter downloading, place it inside:\n\ndata\u002F\n└── mit-bih-arrhythmia-database-1.0.0\u002F\n\n### 3. Run centralized training\n```bash\npython src\u002Ftrain_baseline.py\n```\n### 4. Run federated learning\n```bash\npython src\u002Ffederated_simulation.py\n```\n### 5. Run explainability\n```bash\npython src\u002Fexplain.py\n```\n---\n\n## Implementation Results\n\n- Successfully implemented federated learning with 3 simulated clients\n- Verified model training across distributed datasets\n- Achieved stable convergence across training rounds\n- Demonstrated privacy-preserving training\n- Generated SHAP plots for interpretability\n- Compared centralized vs federated performance\n### Training Accuracy\n\n![Accuracy Graph](results\u002Faccuracy.png)\n\n### SHAP Feature Importance\n\n![SHAP Plot](results\u002Fshap_plot.png)\n\n### Sample ECG Signal\n\n![ECG Signal](results\u002Fecg_sample.png)\n\n\n---\n\n## Limitations\n\n- Simulation uses limited number of clients (3 hospitals)\n- Dataset size is relatively small\n- Model architecture is not too complex\n- Federated learning overhead increases computation time\n- SHAP explanations may be computationally expensive\n\n---\n\n## Contributors\n   \n| Name                 | USN         | Email                     |\n|----------------------|-------------|---------------------------|\n| Poorvika N           | ENG23CY0030 | poorvikan99@gmail.com     |\n| B.Tanusree reddy     | ENG23CY0054 | bojja104@gmail.com        |\n| D.Himaja Sri vyshnavi| ENG23CY0061 | himaja210205@gmail.com   |\n| K N Navya            | ENG23CY0019 | knnavya27@gmail.com       |\n| Pooja N              | ENG23CY0029 | poojanarayan0906@gmail.com|\n\n---\n\n## Mentor\n\n**Dr. Prajwalasimha S N**  \nAssociate Professor, Department of Computer Science and Engineering (Cyber Security)  \nSchool of Engineering, Dayananda Sagar University  \n\nEmail: prajwasimha.sn1@gmail.com\n\n\n","该项目是一个基于联邦学习和可解释性AI的ECG分类系统，旨在为物联网智能医院提供安全透明的医疗诊断。其核心功能包括使用联邦学习框架在多个模拟医院之间进行本地模型训练而不共享原始数据，以及通过SHAP等可解释性技术来解析模型预测结果，提高临床决策的透明度与可信度。该系统适用于需要保护患者隐私同时又追求高精度心电图分析的医疗场景，如智能医院或远程医疗服务。项目采用Python语言开发，并利用PyTorch支持深度学习模型构建。",2,"2026-06-11 02:42:19","CREATED_QUERY"]