Heart Attack Prediction Using Machine Learning โ A Complete Project Overview
Heart disease is one of the leading causes of death globally. Early detection can save lives. To address this, I developed a Heart Attack Prediction System using Machine Learning, integrated into a beautiful, user-friendly interactive web interface using Streamlit.
โ Project Objective
The primary goal of this project is to predict the likelihood of a heart attack based on patient data. It analyzes various health parameters using machine learning models trained on a comprehensive heart disease dataset.
๐ง Tools & Technologies Used
- Python
- Pandas, NumPy
- Scikit-learn
- Random Forest Classifier
- Streamlit
- HTML/CSS (for styling)
- Pickle
๐ Dataset Details
I used a health dataset containing various medical features like age, cholesterol levels, blood pressure, and more, categorized by the presence or absence of heart disease.
๐ ๏ธ Steps Involved
1. Data Preprocessing
- Dropped unnecessary identifiers like
id. - Converted the target variable 'Heart Disease' (Presence/Absence) into binary format (1 or 0).
- Sampled the dataset for efficient training.
- Split data into training and testing sets (80/20 split).
2. Feature Selection
Extracted the most significant features and saved them as features.pkl for consistent
prediction in the deployment phase.
3. Model Training
- Implemented Random Forest Classifier with 100 estimators and max depth of 10.
- Achieved high accuracy on both training and test datasets safely avoiding overfitting.
The Random Forest model proved to be highly effective and robust.
4. Web App with Streamlit
Built a modern user interface where users can enter health metrics. On submission, the application uses the trained model to instantly predict the likelihood of a heart attack.
5. Model Deployment
Deployed the interactive web application seamlessly using Streamlit.
๐ User Interface Preview
A highly responsive and clean dashboard. Users input medical details and get instant prediction feedback.
๐งช Try It Live
Click here to try the Heart Attack Predictor App
๐ Final Thoughts
This project not only strengthened my understanding of machine learning algorithms like Random Forest, but also gave me hands-on experience with Streamlit app deployment. I believe predictive models in healthcare can serve as an excellent preliminary diagnostic tool.
๐ Connect with Me
๐ www.tauqueeralam.com
๐ฑ LinkedIn | GitHub
View a live demo below:
View Demo
Discussion