A machine learning project that predicts the presence of heart disease using patient medical data. The project explores the dataset, visualizes important relationships, compares multiple classification algorithms, and optimizes model performance through hyperparameter tuning.
The objective of this project is to build a classification model capable of predicting whether a patient has heart disease based on clinical attributes such as age, sex, chest pain type, cholesterol level, and maximum heart rate.
- Exploratory Data Analysis (EDA)
- Data visualization with Matplotlib & Seaborn
- Correlation heatmap
- Feature relationship analysis
- Multiple classification models
- Hyperparameter tuning
- Model evaluation and comparison
- Python
- Pandas
- NumPy
- Matplotlib
- Seaborn
- Scikit-learn
- Jupyter Notebook
The following models are implemented and compared:
- Logistic Regression
- K-Nearest Neighbors (KNN)
- Random Forest Classifier
Hyperparameter tuning is performed using:
- GridSearchCV
- RandomizedSearchCV
The project uses the Heart Disease Dataset, containing medical information about patients including:
- Age
- Sex
- Chest Pain Type
- Resting Blood Pressure
- Cholesterol
- Maximum Heart Rate
- Exercise Induced Angina
- ST Depression
- Number of Major Vessels
- Thalassemia
- Target (Heart Disease)
- Load and inspect the dataset
- Check for missing values
- Perform Exploratory Data Analysis
- Visualize feature relationships
- Create a correlation heatmap
- Split the data into training and testing sets
- Train multiple classification models
- Compare model performance
- Tune model hyperparameters
- Evaluate the final model
heart-disease-prediction/
│
├── data/
│ └── heart-disease.csv
├── main.ipynb
├── README.md
└── .gitignore
Clone the repository:
git clone https://github.com/danitdev/heart-project.gitInstall the required packages:
pip install pandas numpy matplotlib seaborn scikit-learn jupyterRun Jupyter Notebook:
jupyter notebookOpen main.ipynb and execute the notebook.
- Exploratory Data Analysis (EDA)
- Data Visualization
- Classification
- Logistic Regression
- K-Nearest Neighbors
- Random Forest
- Cross Validation
- Hyperparameter Tuning
- Model Evaluation
- Correlation Analysis
- Perform feature selection
- Try XGBoost and LightGBM
- Improve preprocessing pipeline
- Save the trained model with Joblib
- Build a web interface using Django or Flask
- Deploy the model online
Danial Hamidzadeh
GitHub: https://github.com/yourusername