A machine learning project that predicts whether a patient has heart disease based on their medical attributes using various classification algorithms.
This project uses Python-based machine learning libraries to build a predictive model capable of determining whether a patient has heart disease. The analysis follows a structured approach from problem definition through to model experimentation.
Given clinical parameters about a patient, can we predict whether or not they have heart disease?
Success Metric: Achieve 95% accuracy in predicting heart disease during the proof of concept phase.
The dataset originates from the Cleveland data from the UCI Machine Learning Repository:
- Source: UCI Machine Learning Repository - Heart Disease
- Alternative: Kaggle - Heart Disease Classification Dataset
The dataset includes 14 medical attributes:
- age - Age in years
- sex - Sex (1 = male; 0 = female)
- cp - Chest pain type (0-3)
- trestbps - Resting blood pressure (mm Hg)
- chol - Serum cholesterol (mg/dl)
- fbs - Fasting blood sugar > 120 mg/dl (1 = true; 0 = false)
- restecg - Resting electrocardiographic results (0-2)
- thalach - Maximum heart rate achieved
- exang - Exercise induced angina (1 = yes; 0 = no)
- oldpeak - ST depression induced by exercise
- slope - Slope of peak exercise ST segment (0-2)
- ca - Number of major vessels colored by fluoroscopy (0-3)
- thal - Thalium stress test result
- target - Heart disease present (1 = yes, 0 = no)
- Python 3.x
- Pandas - Data manipulation and analysis
- NumPy - Numerical computing
- Matplotlib & Seaborn - Data visualization
- Scikit-learn - Machine learning algorithms
- Logistic Regression
- K-Nearest Neighbors (KNN)
- Random Forest Classifier
Heart_disease_prediction/
│
├── end-to-end-heart-disease-classification.ipynb # Main analysis notebook
├── heart-disease.csv # Dataset
├── README.md # Project documentation
└── LICENSE # MIT License
pip install numpy pandas matplotlib seaborn scikit-learn jupyter- Clone the repository:
git clone https://github.com/Krishal-Modi/Heart_disease_prediction.git
cd Heart_disease_prediction- Install required packages:
pip install -r requirements.txt- Launch Jupyter Notebook:
jupyter notebook end-to-end-heart-disease-classification.ipynb- Problem Definition - Define the prediction goal
- Data Analysis - Explore and understand the dataset
- Evaluation Metrics - Define success criteria
- Feature Engineering - Understand feature importance
- Modeling - Train multiple classification models
- Experimentation - Hyperparameter tuning and optimization
The project evaluates models using:
- Cross-validation scores
- Confusion matrix
- Precision, Recall, and F1-Score
- Classification reports
This project is licensed under the MIT License - see the LICENSE file for details.
Krishal Modi
Contributions, issues, and feature requests are welcome!
Give a ⭐️ if this project helped you!