Musabbirkm commited on
Commit
e6059c8
Β·
verified Β·
1 Parent(s): 8d85da5

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +121 -0
README.md CHANGED
@@ -10,5 +10,126 @@ pinned: false
10
  license: mit
11
  short_description: 'Predict heart disease risk in seconds using clinical data '
12
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
 
14
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
10
  license: mit
11
  short_description: 'Predict heart disease risk in seconds using clinical data '
12
  ---
13
+ # ❀️ HeartGuard AI - Cardiovascular Risk Prediction System
14
+
15
+ ![Project Banner](assets/banner.png)
16
+
17
+ **Developed by Musabbir KM**
18
+
19
+ ## πŸš€ Overview
20
+
21
+ An end-to-end machine learning system that predicts heart disease risk using clinical features, featuring:
22
+ - **XGBoost Classifier** with automated threshold optimization
23
+ - **Streamlit Web Application** for interactive predictions
24
+ - **Comprehensive Model Evaluation** (ROC AUC: 0.909)
25
+ - **Production-Ready Pipeline** with feature engineering
26
+
27
+ ## 🌟 Key Features
28
+ | Feature | Description |
29
+ |---------|-------------|
30
+ | **Clinical Risk Assessment** | Classifies patients into High/Medium/Low risk categories |
31
+ | **Batch Processing** | Handles CSV uploads for multiple predictions |
32
+ | **Interactive Interface** | User-friendly Streamlit dashboard |
33
+ | **Model Explainability** | Detailed feature importance analysis |
34
+ | **Medical Recommendations** | Actionable insights based on risk level |
35
+
36
+ ## πŸ“Š Dataset Information
37
+ **Source:** [UCI Heart Disease Dataset](https://archive.ics.uci.edu/dataset/45/heart+disease)
38
+ **Samples:** 303 patients (Cleaned: 297)
39
+ **Features:** 13 clinical + 3 engineered features
40
+ **Attributes**:
41
+ - Demographic: Age, Sex
42
+ - Medical:
43
+ - cp (Chest Pain Type)
44
+ - trestbps (Resting Blood Pressure)
45
+ - chol (Serum Cholesterol)
46
+ - fbs (Fasting Blood Sugar)
47
+ - restecg (Resting ECG)
48
+ - thalach (Maximum Heart Rate)
49
+ - exang (Exercise Induced Angina)
50
+ - oldpeak (ST Depression)
51
+ - slope (ST Segment Slope)
52
+ - ca (Major Vessels)
53
+ - thal (Thalassemia)
54
+
55
+
56
+ ## πŸ“Š Feature Description
57
+
58
+ -age Age in years
59
+ sex Gender (1 = male, 0 = female)
60
+ cp Chest pain type (1 = typical angina, 2 = atypical angina, 3 = non-anginal pain, 4 = asymptomatic)
61
+ trestbps Resting blood pressure (in mm Hg)
62
+ chol Serum cholesterol level (in mg/dl)
63
+ fbs Fasting blood sugar > 120 mg/dl (1 = true, 0 = false)
64
+ restecg Resting electrocardiographic results (0, 1, or 2)
65
+ thalach Maximum heart rate achieved
66
+ exang Exercise-induced angina (1 = yes, 0 = no)
67
+ oldpeak ST depression induced by exercise relative to rest
68
+ slope Slope of the peak exercise ST segment (1, 2, 3)
69
+ ca Number of major vessels (0–3) colored by fluoroscopy
70
+ thal Thalassemia (3 = normal, 6 = fixed defect, 7 = reversible defect)
71
+
72
+ ## πŸ“Š Performance Metrics
73
+
74
+ | Metric | Score |
75
+ |---------------|--------|
76
+ | Accuracy | 85.2% |
77
+ | Precision | 84.7% |
78
+ | Recall | 87.5% |
79
+ | F1-Score | 85.2% |
80
+
81
+ (Validation set performance)
82
+
83
+
84
+ # πŸ† Model Performance
85
+
86
+ ## === Optimized Performance Metrics ===
87
+
88
+ - **Optimal Threshold:** `0.327`
89
+ - **Evaluation on Test Set:** `n = 46`
90
+
91
+ ### πŸ“Š Classification Report
92
+
93
+ | Class | Precision | Recall | F1-Score | Support |
94
+ |----------------|-----------|--------|----------|---------|
95
+ | Healthy | 0.95 | 0.76 | 0.84 | 25 |
96
+ | Heart Disease | 0.77 | 0.95 | 0.85 | 21 |
97
+
98
+ ### βœ… Overall Metrics
99
+
100
+ - **Accuracy:** `0.85`
101
+ - **Macro Average:**
102
+ - Precision: `0.86`
103
+ - Recall: `0.86`
104
+ - F1-Score: `0.85`
105
+ - **Weighted Average:**
106
+ - Precision: `0.87`
107
+ - Recall: `0.85`
108
+ - F1-Score: `0.85`
109
+
110
+ ---
111
+
112
+ πŸ“Œ This optimized threshold enhances **Heart Disease detection** (high recall) while maintaining high precision for **Healthy** predictions.
113
+
114
+
115
+ ## ⚠️ Important Disclaimer
116
+
117
+ **This is NOT a medical diagnostic device.** By using this model, you agree that:
118
+
119
+ - It should not replace professional medical advice
120
+ - It is not for use in emergency situations
121
+ - Treatment decisions should not be based solely on its outputs
122
+ - Always consult qualified healthcare professionals
123
+
124
+ **Dataset Source**: [UCI Machine Learning Repository](https://archive.ics.uci.edu/dataset/45/heart+disease)
125
+
126
+ ## πŸ› οΈ Installation
127
+
128
+ 1. Clone repository:
129
+ ```bash
130
+ git clone https://github.com/yourusername/heartguard.git
131
+ pip install -r requirements.txt
132
+ cd heartguard
133
+
134
 
135
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference