Byte2Beat Hackathon Project

AI-Based
Heart Disease
Risk Predictor

A Machine Learning model trained on 918 de-identified patient records using Random Forest Classifier with SHAP Explainable AI — achieving 87.5% accuracy in heart disease detection.

87.5%
Accuracy
918
Patients
16
Features
0.87
F1 Score
Model Performance Snapshot
Accuracy
87.5%
Precision
0.87
Recall
0.87
F1-Score
0.87
Test Patients
184
01 — Dataset
Patient Data
Overview
918
Total Patients
16
Features
410
Healthy (0)
508
Sick (1)

Source: Byte2Beat Hackathon Dataset — No missing values. Well-balanced distribution (44.7% healthy / 55.3% sick) ensures unbiased AI training.

Algorithm: Random Forest Classifier | Libraries: Python, Sklearn, SHAP | Split: 80% train / 20% test

AgeBPCholesterolMaxHRResult
40140289172Healthy
49160180156Sick
3713028398Healthy
48138214108Sick
54150195122Healthy
65178340102Sick
42118172168Healthy
02 — Analysis
Data Analysis
& Visualizations
Figure 1 — Heart Disease Distribution
Healthy: 410 patients (44.7%) · Sick: 508 patients (55.3%) — Well balanced for AI training.
Figure 2 — Average Age vs Heart Disease
Healthy avg age: 50 · Sick avg age: 57 — Older patients have significantly higher risk.
Figure 4 — Feature Importance (Random Forest Model)
ST Slope (ECG pattern) is the single most important predictor — longer bar means more impact on the prediction.
ST Slope Up (ECG)
12.0%
Exercise Angina
8.8%
ST Slope Flat
8.4%
Oldpeak
5.0%
Cholesterol
4.8%
Max Heart Rate
4.5%
Age
3.6%
Fasting Blood Sugar
2.6%
Chest Pain Type
2.5%
Resting BP
2.0%
Figure 5 — SHAP Explainable AI Analysis
SHAP explains WHY the AI makes each prediction. This allows doctors to understand and trust the model's decisions.
03 — Results
Model Performance
Results
87.5%
Overall Accuracy
0.87
Precision
0.87
Recall
0.87
F1 Score
184
Patients Tested
161
Correct Predictions

Confusion Matrix

66
✅ True Healthy
Correctly identified
11
❌ False Positive
Healthy → Sick
12
❌ False Negative
Sick → Healthy
95
✅ True Sick
Correctly identified

Total: 184 patients tested · Correct: 161 (87.5%)

Figure 3 — Performance Chart

Try the AI
Heart Checker

Enter your vitals and get an instant AI-powered heart disease risk assessment using our trained Random Forest model.

Patient Vitals Input

Fill in your details below for an AI risk assessment

Normal: 120 mmHg
Normal: below 200 mg/dL
Normal: 150–170 bpm
Enter your vitals on the left and click Analyze to get your personalized AI-powered heart disease risk assessment.
05 — Conclusion
Our Findings &
Conclusion

Our AI model successfully predicts heart disease with 87.5% accuracy using Random Forest Classifier trained on 918 de-identified patient records. With SHAP Explainable AI, doctors can understand exactly why the model makes each decision — building trust between AI and healthcare professionals. This tool can help identify high-risk patients early and save lives.

01
ST Slope is the #1 predictor
ECG patterns (ST Slope Up and Flat) are by far the most critical indicators — contributing over 20% of the model's total decision weight.
02
Age gap of 7 years
Sick patients average age 57 vs healthy patients' average age 50 — confirming that age is a significant but not dominant risk factor.
03
Well-balanced dataset
410 healthy vs 508 sick patients ensures the model is not biased toward either class during training.
04
SHAP makes AI trustworthy
SHAP analysis shows exactly why each prediction is made — making the model interpretable and usable in real clinical settings.
🐍 Python  ·  🤖 Scikit-learn  ·  📊 SHAP  ·  📓 Jupyter Notebook  ·  🏗️ Coder (Terraform)
⚠️ This tool is for educational and hackathon purposes only. It is not a substitute for professional medical advice. Always consult a qualified healthcare provider.