-
-
Notifications
You must be signed in to change notification settings - Fork 216
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #578 from Avdhesh-Varshney/cardio
Cardiovascular Disease Analysis and Prediction Model
- Loading branch information
Showing
8 changed files
with
107 additions
and
0 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
Cardiovascular Disease Analysis and Prediction/Dataset/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Cardiovascular Disease Analysis and Prediction Model | ||
|
||
The Dataset used here is taken from the Kaggle database website. You can download the file from the link given here, [Cardiovascular Disease Analysis and Prediction](https://www.kaggle.com/datasets/jocelyndumlao/cardiovascular-disease-dataset) | ||
|
||
## About the dataset | ||
|
||
There are 14 features and 1000 entries in this dataset. | ||
|
||
|
||
- `patiendid` - **Patient Identification Number** | ||
- `age` - **Age of the patient** | ||
- `gender` - **Gender of the patient** - (0 => Female, 1 => Male) | ||
- `chestpain` - **Chest pain type** - (0 => typical angina, 1 => atypical angina, 2 => non-anginal pain, and 3 => asymptomatic) | ||
- `restingBP` - **Resting Blood Pressure** - (94-200 in mm HG) | ||
- `serumcholestrol` - **Serum Cholesterol** - (126-564 in mg/dl) | ||
- `fastingbloodsugar` - **Fasting blood sugar** - (0, 1 > 120 mg/dl) - (0 => false, 1 => true) | ||
- `restingelectro` - **Resting electrocardiogram results** - (Value 0: normal, Value 1: having ST-T wave abnormality, and Value 2: showing probable or definite left ventricular hypertrophy by Estes' criteria) | ||
- `maxheartrate` - **Maximum heart rate achieved** - (71-202) | ||
- `exerciseangia` - **Exercise induced angina** - (0 => no, 1 => yes) | ||
- `oldpeak` - **Oldpeak=ST** - (0 - 6.2) | ||
- `slope` - **Slope of the peak exercise ST segment** - (1-upsloping, 2-flat, 3-downsloping) | ||
- `noofmajorvessels` - **Number of major vessels** - 0, 1, 2, 3 | ||
- `target` - **Classification** - (0 => absence of heart disease, 1 => presence of heart disease) | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+142 KB
Cardiovascular Disease Analysis and Prediction/Images/correlation_heatmap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+17.6 KB
Cardiovascular Disease Analysis and Prediction/Images/restingrelectro_feature.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+44.3 KB
Cardiovascular Disease Analysis and Prediction/Images/target_correlation.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions
1
...isease Analysis and Prediction/Model/cardiovascular-disease-analysis-and-prediction.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<h1>Cardiovascular Disease Analysis and Prediction</h1> | ||
|
||
**GOAL** | ||
|
||
The aim of this project is to analyze and predict the disease based on the given dataset. | ||
|
||
**DATASET** | ||
|
||
https://www.kaggle.com/datasets/jocelyndumlao/cardiovascular-disease-dataset | ||
|
||
**DESCRIPTION** | ||
|
||
To analyze the dataset of Cardiovascular Disease and build and train the model on the basis of different features and variables. | ||
|
||
There are 14 features and 1000 entries in this dataset. | ||
|
||
|
||
### Visualization and EDA of different attributes: | ||
|
||
<img alt="heatmap" src="./Images/correlation_heatmap.png"> | ||
|
||
<img alt="graph" src="./Images/target_correlation.png"> | ||
|
||
<img alt="graph" src="./Images/age_feature.png"> | ||
|
||
<img alt="graph" src="./Images/restingrelectro_feature.png"> | ||
|
||
|
||
**MODELS USED** | ||
|
||
| Model | MSE_train | R2_train | MSE_test | R2_test | | ||
|-----------------------------|-----------|----------|-----------|-----------| | ||
| Random Forest Regression | 0.002946 | 0.987915 | 0.023432 | 0.903483 | | ||
| XG Boost Regression | 0.000002 | 0.999993 | 0.027463 | 0.886879 | | ||
| Decision Tree Regression | 0.000000 | 1.000000 | 0.035000 | 0.855834 | | ||
| Ridge Regression | 0.063654 | 0.738905 | 0.059288 | 0.755792 | | ||
| Linear Regression | 0.063654 | 0.738907 | 0.059305 | 0.755721 | | ||
| KNN Regression | 0.094450 | 0.612590 | 0.125600 | 0.482649 | | ||
| Elastic Net Regression | 0.180585 | 0.259287 | 0.155394 | 0.359926 | | ||
|
||
|
||
|
||
**WHAT I HAD DONE** | ||
|
||
* Load the dataset which contains 1000 entries in it and having 14 columns in it. | ||
* Checked for missing values and cleaned the data accordingly. | ||
* Analyzed the data, found insights and visualized them accordingly. | ||
* Plotting heatmap using correlation and checking the relation between different features. | ||
* Found detailed insights of different columns with target variable using plotting libraries. | ||
* Train the datasets by different models and saves their accuracies into a dataframe. | ||
|
||
|
||
**LIBRARIES NEEDED** | ||
|
||
1. Pandas | ||
2. Matplotlib | ||
3. Sklearn | ||
4. NumPy | ||
5. XGBoost | ||
6. Sci-py | ||
7. Seaborn | ||
|
||
|
||
**CONCLUSION** | ||
|
||
- Random Forest and XG Boost Regression models show promising performance with lower MSE and higher R2 values. | ||
- Decision Tree Regression achieved perfect R2 on the training set but performed poorly on the test set, indicating overfitting. | ||
|
||
|
||
**YOUR NAME** | ||
|
||
*Avdhesh Varshney* | ||
|
||
[![LinkedIn](https://img.shields.io/badge/linkedin-%230077B5.svg?style=for-the-badge&logo=linkedin&logoColor=white)](https://www.linkedin.com/in/avdhesh-varshney-5314a4233/) [![GitHub](https://img.shields.io/badge/github-%23121011.svg?style=for-the-badge&logo=github&logoColor=white)](https://github.com/Avdhesh-Varshney) | ||
|
7 changes: 7 additions & 0 deletions
7
Cardiovascular Disease Analysis and Prediction/requirements.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
numpy==1.19.2 | ||
pandas==1.4.3 | ||
matplotlib==3.7.1 | ||
scikit-learn~=1.0.2 | ||
scipy==1.5.0 | ||
seaborn==0.10.1 | ||
xgboost~=1.5.2 |