Predict the coronary heart disease (chd: 1/0) for males in a heart-disease high-risk region of the Western Cape, South Africa
# Predicting Coronary Heart Disease
A machine learning pipeline to predict coronary heart disease (CHD) in males from a high-risk region of the Western Cape, South Africa.
**Module:** SMM748 Machine Learning For Quantitative Professionals — Individual Coursework
**Live App:**
predict-coronary-heart-dise…
## Dataset
**Source:** `input_data/heart-disease.csv` — 462 patients, 9 clinical features, binary target (`chd`: 1 = disease, 0 = no disease).
| Feature | Description |
|---|---|
| `sbp` | Systolic blood pressure |
| `tobacco` | Cumulative tobacco consumption (kg) |
| `ldl` | Low density lipoprotein cholesterol |
| `adiposity` | Adiposity index |
| `famhist` | Family history of heart disease (Present/Absent) |
| `typea` | Type-A behaviour score |
| `obesity` | Obesity index |
| `alcohol` | Current alcohol consumption |
| `age` | Age in years |
---
## Key Results
- **Ridge Logistic Regression** achieves the highest test accuracy (**0.753**) across all 12 classifiers.
- AdaBoost, QDA, and SVM (RBF) tie at 0.742.
- Log1p preprocessing benefits generative classifiers (QDA +3.2%) but does not affect Ridge LR's result.
- `age`, `age_famhist`, and `ldl` are consistently the strongest CHD predictors (confirmed by ridge coefficients, feature importance, and SHAP analysis).
---
## Project Structure
```
predict_coronary_heart_disease/
├── chd_main.py # Main entry point — runs full pipeline
├── config.py # Project-wide constants (features, paths, seeds)
├── requirements.txt # Python dependencies
├── input_data/
│ └── heart-disease.csv
├── feature_engineering/ # Derived interaction features
│ ├── fe.py # age_tobacco, age_famhist
│ ├── fe_age_tobacco.py
│ └── fe_age_famhist.py
├── exploratory_data_analysis/ # Section 1: EDA
│ ├── eda.py # Orchestrator
│ ├─ …