Upload folder using huggingface_hub
Browse files- README.md +87 -0
- model.joblib +3 -0
README.md
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language: en
|
| 3 |
+
license: mit
|
| 4 |
+
library_name: scikit-learn
|
| 5 |
+
tags:
|
| 6 |
+
- tabular-classification
|
| 7 |
+
- healthcare
|
| 8 |
+
- clinical-prediction
|
| 9 |
+
- risk-stratification
|
| 10 |
+
- explainable-ai
|
| 11 |
+
metrics:
|
| 12 |
+
- roc_auc
|
| 13 |
+
- accuracy
|
| 14 |
+
- recall
|
| 15 |
+
- f1
|
| 16 |
+
model-index:
|
| 17 |
+
- name: heart-attack-risk-classifier
|
| 18 |
+
results:
|
| 19 |
+
- task:
|
| 20 |
+
type: tabular-classification
|
| 21 |
+
metrics:
|
| 22 |
+
- type: roc_auc
|
| 23 |
+
value: 0.912
|
| 24 |
+
- type: recall
|
| 25 |
+
value: 0.923
|
| 26 |
+
- type: f1
|
| 27 |
+
value: 0.884
|
| 28 |
+
---
|
| 29 |
+
|
| 30 |
+
# ❤️ Clinical Heart Attack Risk Prediction Model
|
| 31 |
+
|
| 32 |
+
## 📌 Model Overview
|
| 33 |
+
This calibrated tabular gradient boosting classifier predicts acute myocardial infarction (heart attack) probability from non-invasive clinical intake markers.
|
| 34 |
+
|
| 35 |
+
The model is tuned for clinical triage sensitivity, achieving **>92% Recall / Sensitivity** to minimize life-threatening false negatives.
|
| 36 |
+
|
| 37 |
+
---
|
| 38 |
+
|
| 39 |
+
## 📋 Features Required for Inference
|
| 40 |
+
1. **`age`:** Patient age (years).
|
| 41 |
+
2. **`sex`:** Biological sex (1 = male, 0 = female).
|
| 42 |
+
3. **`cp`:** Chest Pain type (0: Typical Angina, 1: Atypical Angina, 2: Non-Anginal, 3: Asymptomatic).
|
| 43 |
+
4. **`trtbps`:** Resting blood pressure (mm Hg).
|
| 44 |
+
5. **`chol`:** Serum cholesterol (mg/dL).
|
| 45 |
+
6. **`fbs`:** Fasting blood sugar > 120 mg/dL (1 = true, 0 = false).
|
| 46 |
+
7. **`restecg`:** Resting electrocardiographic results (0, 1, 2).
|
| 47 |
+
8. **`thalachh`:** Maximum heart rate achieved during stress test.
|
| 48 |
+
9. **`exng`:** Exercise-induced angina (1 = yes, 0 = no).
|
| 49 |
+
10. **`oldpeak`:** ST depression induced by exercise relative to rest.
|
| 50 |
+
11. **`slp`:** Slope of peak exercise ST segment (0, 1, 2).
|
| 51 |
+
12. **`caa`:** Number of major vessels (0-3) colored by fluoroscopy.
|
| 52 |
+
13. **`thall`:** Thalassemia rate (0-3).
|
| 53 |
+
|
| 54 |
+
---
|
| 55 |
+
|
| 56 |
+
## 🚀 Quick Start with Python
|
| 57 |
+
|
| 58 |
+
```python
|
| 59 |
+
import joblib
|
| 60 |
+
import pandas as pd
|
| 61 |
+
from huggingface_hub import hf_hub_download
|
| 62 |
+
|
| 63 |
+
# Download model from Hugging Face Hub
|
| 64 |
+
model_path = hf_hub_download(repo_id="Jayan12321/heart-attack-risk-classifier", filename="model.joblib")
|
| 65 |
+
model = joblib.load(model_path)
|
| 66 |
+
|
| 67 |
+
# Sample Patient Vector (High Risk Profile)
|
| 68 |
+
sample_patient = pd.DataFrame([{
|
| 69 |
+
'age': 63, 'sex': 1, 'cp': 3, 'trtbps': 145, 'chol': 233, 'fbs': 1,
|
| 70 |
+
'restecg': 0, 'thalachh': 150, 'exng': 0, 'oldpeak': 2.3, 'slp': 0,
|
| 71 |
+
'caa': 0, 'thall': 1
|
| 72 |
+
}])
|
| 73 |
+
|
| 74 |
+
prob = model.predict_proba(sample_patient)[0, 1]
|
| 75 |
+
print(f"Predicted Cardiac Event Probability: {prob * 100:.1f}%")
|
| 76 |
+
```
|
| 77 |
+
|
| 78 |
+
---
|
| 79 |
+
|
| 80 |
+
## 🔬 Benchmark Performance (5-Fold Stratified CV)
|
| 81 |
+
* **ROC-AUC:** `0.912`
|
| 82 |
+
* **Sensitivity / Recall:** `0.923`
|
| 83 |
+
* **Precision:** `0.851`
|
| 84 |
+
* **F1-Score:** `0.884`
|
| 85 |
+
|
| 86 |
+
---
|
| 87 |
+
*Authored and published by [Jayan Gupta](https://huggingface.co/Jayan12321) • Data Scientist & AI Engineer*
|
model.joblib
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:09fbad512111272ad9fe4c7a43bac32eaebef44c38befc2567850f926cf6a264
|
| 3 |
+
size 208649
|