File size: 3,011 Bytes
6fa14c7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
---
language: en
license: mit
library_name: scikit-learn
tags:
- tabular-classification
- healthcare
- clinical-prediction
- risk-stratification
- explainable-ai
metrics:
- roc_auc
- accuracy
- recall
- f1
model-index:
- name: heart-attack-risk-classifier
  results:
  - task:
      type: tabular-classification
    metrics:
    - type: roc_auc
      value: 0.912
    - type: recall
      value: 0.923
    - type: f1
      value: 0.884
---

# Clinical Heart Attack Risk Prediction Model 🫀

A calibrated tabular gradient boosting classifier trained to predict acute myocardial infarction risk from non-invasive clinical intake markers.

- **Associated Space**: [Clinical Heart Attack Risk Triage Calculator](https://huggingface.co/spaces/Jayan12321/clinical-heart-risk-calculator)
- **Author**: [Jayan Gupta](https://huggingface.co/Jayan12321)

---

## 🎯 Clinical Sensitivity & Objective
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.

---

## 📊 Features Required for Inference

| Feature | Description | Values / Range |
|---|---|---|
| `age` | Patient age | Years |
| `sex` | Biological sex | `1` = male, `0` = female |
| `cp` | Chest Pain type | `0`: Typical Angina, `1`: Atypical, `2`: Non-anginal, `3`: Asymptomatic |
| `trestbps` | Resting Blood Pressure | mm Hg on admission |
| `chol` | Serum Cholesterol | mg/dl |
| `fbs` | Fasting Blood Sugar | `1` if > 120 mg/dl, `0` otherwise |
| `restecg` | Resting ECG results | `0`: Normal, `1`: ST-T wave abnormality, `2`: Left ventricular hypertrophy |
| `thalach` | Maximum Heart Rate achieved | bpm |
| `exang` | Exercise Induced Angina | `1` = yes, `0` = no |
| `oldpeak` | ST depression induced by exercise | Relative to rest (float) |
| `slope` | Slope of peak exercise ST segment | `0`: Upsloping, `1`: Flat, `2`: Downsloping |
| `ca` | Number of major vessels colored by flourosopy | `0-3` |
| `thal` | Thalassemia status | `1`: Normal, `2`: Fixed defect, `3`: Reversible defect |

---

## 💻 Python Quickstart

```python
import joblib
from huggingface_hub import hf_hub_download

# Download model from Hugging Face
model_path = hf_hub_download(
    repo_id="Jayan12321/heart-attack-risk-classifier",
    filename="model.joblib"
)

# Load classifier
model = joblib.load(model_path)

# Sample patient features
# [age, sex, cp, trestbps, chol, fbs, restecg, thalach, exang, oldpeak, slope, ca, thal]
patient_features = [[57, 1, 2, 130, 236, 0, 0, 174, 0, 0.0, 1, 1, 2]]

# Predict calibrated risk probability
risk_prob = model.predict_proba(patient_features)[0, 1]
print(f"Predicted Cardiac Event Probability: {risk_prob:.2%}")
```

---

## ⚠️ Educational Disclaimer
*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.*