Inspiration
Heart disease is one of the leading causes of death worldwide. I wanted to build a practical tool that uses machine learning to estimate heart attack risk from everyday health metrics, and make it accessible to anyone through a simple web interface.
What it does
The Heart Disease Prediction Web App takes 23 health and lifestyle inputs — age, cholesterol, blood pressure, BMI, smoking, exercise, diet, stress, and more — and classifies a patient as high or low risk for a heart attack in real time.
How I built it
- Dataset: 8,763 patient records from the Kaggle Heart Attack Prediction Dataset
- Preprocessing: Decomposed blood pressure into Systolic/Diastolic, encoded categorical features, scaled numerics, and handled missing values
- Models: Trained and compared Logistic Regression, Random Forest, and XGBoost with class-weight balancing to address a 64/36 class imbalance
- Metric focus: Prioritized Recall to minimize false negatives in a medical context
- Interface: Built an interactive Streamlit web app for real-time risk prediction
- Deployment: Containerized with Docker and deployed to Hugging Face Spaces
Challenges I ran into
- Class imbalance (64% vs 36%) required weighted loss functions and threshold tuning
- Preprocessing sequencing errors initially affected model training and had to be debugged
- Synthetic dataset limitations capped performance around 65% accuracy regardless of tuning
Accomplishments that I'm proud of
- Shipped a fully working end-to-end ML pipeline — from raw CSV to a live public demo
- Successfully containerized the app and deployed it to Hugging Face Spaces
- Built a clean, interactive UI that any non-technical user can use
What I learned
- How to handle class imbalance in real medical datasets
- End-to-end ML deployment using Docker and Hugging Face Spaces
- The importance of feature engineering (e.g., decomposing blood pressure into Systolic/Diastolic)
- How to balance Recall vs Precision in healthcare ML
What's next for Heart Disease Prediction Web App
- Train on a larger, real clinical dataset for stronger accuracy
- Add explainability with SHAP values so users can see why a prediction was made
- Integrate with wearables (Apple Health, WHOOP) for live vitals input
Built With
- docker
- hugging-face
- machine-learning
- matplotlib
- numpy
- pandas
- python
- scikit-learn
- seaborn
- streamlit
- xgboost

Log in or sign up for Devpost to join the conversation.