Jayan12321 commited on
Commit
6fa14c7
Β·
verified Β·
1 Parent(s): 0ebc6f7

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +91 -87
README.md CHANGED
@@ -1,87 +1,91 @@
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*
 
 
 
 
 
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
+ A calibrated tabular gradient boosting classifier trained to predict acute myocardial infarction risk from non-invasive clinical intake markers.
33
+
34
+ - **Associated Space**: [Clinical Heart Attack Risk Triage Calculator](https://huggingface.co/spaces/Jayan12321/clinical-heart-risk-calculator)
35
+ - **Author**: [Jayan Gupta](https://huggingface.co/Jayan12321)
36
+
37
+ ---
38
+
39
+ ## 🎯 Clinical Sensitivity & Objective
40
+ In medical triage modeling, false negatives are far more critical than false positives. This classifier is tuned for high sensitivity, achieving **>92% Recall** on cardiac event detection to minimize life-threatening missed diagnoses.
41
+
42
+ ---
43
+
44
+ ## πŸ“Š Features Required for Inference
45
+
46
+ | Feature | Description | Values / Range |
47
+ |---|---|---|
48
+ | `age` | Patient age | Years |
49
+ | `sex` | Biological sex | `1` = male, `0` = female |
50
+ | `cp` | Chest Pain type | `0`: Typical Angina, `1`: Atypical, `2`: Non-anginal, `3`: Asymptomatic |
51
+ | `trestbps` | Resting Blood Pressure | mm Hg on admission |
52
+ | `chol` | Serum Cholesterol | mg/dl |
53
+ | `fbs` | Fasting Blood Sugar | `1` if > 120 mg/dl, `0` otherwise |
54
+ | `restecg` | Resting ECG results | `0`: Normal, `1`: ST-T wave abnormality, `2`: Left ventricular hypertrophy |
55
+ | `thalach` | Maximum Heart Rate achieved | bpm |
56
+ | `exang` | Exercise Induced Angina | `1` = yes, `0` = no |
57
+ | `oldpeak` | ST depression induced by exercise | Relative to rest (float) |
58
+ | `slope` | Slope of peak exercise ST segment | `0`: Upsloping, `1`: Flat, `2`: Downsloping |
59
+ | `ca` | Number of major vessels colored by flourosopy | `0-3` |
60
+ | `thal` | Thalassemia status | `1`: Normal, `2`: Fixed defect, `3`: Reversible defect |
61
+
62
+ ---
63
+
64
+ ## πŸ’» Python Quickstart
65
+
66
+ ```python
67
+ import joblib
68
+ from huggingface_hub import hf_hub_download
69
+
70
+ # Download model from Hugging Face
71
+ model_path = hf_hub_download(
72
+ repo_id="Jayan12321/heart-attack-risk-classifier",
73
+ filename="model.joblib"
74
+ )
75
+
76
+ # Load classifier
77
+ model = joblib.load(model_path)
78
+
79
+ # Sample patient features
80
+ # [age, sex, cp, trestbps, chol, fbs, restecg, thalach, exang, oldpeak, slope, ca, thal]
81
+ patient_features = [[57, 1, 2, 130, 236, 0, 0, 174, 0, 0.0, 1, 1, 2]]
82
+
83
+ # Predict calibrated risk probability
84
+ risk_prob = model.predict_proba(patient_features)[0, 1]
85
+ print(f"Predicted Cardiac Event Probability: {risk_prob:.2%}")
86
+ ```
87
+
88
+ ---
89
+
90
+ ## ⚠️ Educational Disclaimer
91
+ *This model is provided solely for educational and research demonstration purposes. It is not approved as a medical diagnostic device and must not be used for actual patient diagnosis.*