A machine learning web app that predicts whether a patient has heart disease based on their medical details.
Built as Project 1 of a 4-project Machine Learning series using the Zero to Mastery ML course as a learning foundation.
- Takes 13 patient health inputs (age, cholesterol, blood pressure, etc.)
- Uses a trained Random Forest Classifier to predict heart disease
- Shows the result with a confidence percentage
- Green banner = No heart disease detected
- Red banner = Heart disease detected
| Metric | Score |
|---|---|
| Algorithm | Random Forest Classifier |
| Training samples | 242 patients |
| Testing samples | 61 patients |
| Accuracy | 83.61% |
| Tool | Purpose |
|---|---|
| Python | Programming language |
| Scikit-Learn | Machine learning model |
| Pandas & NumPy | Data handling |
| Flask | Web server |
| HTML & CSS | Frontend UI |
| Joblib | Saving/loading the model |
pip install flask scikit-learn pandas numpy joblibpython3 train_model.pypython3 app.pyhttp://127.0.0.1:5000
project1-heart-disease/
├── train_model.py # Downloads data, trains and saves the model
├── app.py # Flask web server
├── model.joblib # Saved trained model (generated after training)
├── templates/
│ └── index.html # Web page with input form and result
└── static/
└── style.css # Styling
| Feature | Description |
|---|---|
| Age | Patient age in years |
| Sex | Male or Female |
| Chest Pain Type | Type of chest pain (4 categories) |
| Resting Blood Pressure | In mm Hg |
| Cholesterol | Serum cholesterol in mg/dl |
| Fasting Blood Sugar | Whether > 120 mg/dl |
| Resting ECG | Heart electrical activity result |
| Max Heart Rate | Maximum heart rate achieved |
| Exercise Induced Angina | Chest pain during exercise |
| ST Depression (Oldpeak) | Depression relative to rest |
| Slope | Slope of peak ST segment |
| Major Vessels | Number of vessels colored by fluoroscopy (0-3) |
| Thalassemia | Blood disorder type |
Heart Disease Dataset from the Zero to Mastery ML course (originally from UCI Machine Learning Repository).
This tool is for educational purposes only. Always consult a qualified medical professional for health decisions.
| Project | Description | Status |
|---|---|---|
| Project 1 | Heart Disease Predictor | Done |
| Project 2 | Car Price Predictor | Coming soon |
| Project 3 | House Price Predictor | Coming soon |
| Project 4 | Custom Dataset Predictor | Coming soon |