Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Critically Ill Patients Analysis and Prediction Model #526

Merged
merged 1 commit into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Critically Ill Patients Analysis and Prediction/Dataset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Critically Ill Patients Dataset

The Dataset used here is taken from the Kaggle database website. You can download the file from the link given here, [Critically Ill Patients Analysis and Prediction](https://www.kaggle.com/datasets/margaritakholostova/support-ii-dataset-with-critically-ill-patients)

## About the dataset

There are 2 types of datasets:

- `columns_descriptions`: This dataset contains the description of all the features.
- `support2`: This dataset contains 9105 entries with 47 different features.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Large diffs are not rendered by default.

86 changes: 86 additions & 0 deletions Critically Ill Patients Analysis and Prediction/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<h1>Critically Ill Patients Analysis and Prediction</h1>

**GOAL**

To build a machine learning model for predicting the patient survival rate or probability.

**DATASET**

https://www.kaggle.com/datasets/margaritakholostova/support-ii-dataset-with-critically-ill-patients

**DESCRIPTION**

To analyze the dataset of Critically Ill Patients and build and train the model on the basis of different features and variables.

There are 2 types of datasets:

- `columns_descriptions`: This dataset contains the description of all the features.
- `support2`: This dataset contains 9105 entries with 47 different features.


### Visualization and EDA of different attributes:

<img alt="heatmap" src="./Images/correlation_heatmap.jpg">

<img alt="graph" src="./Images/age_plot.jpg">

<img alt="graph" src="./Images/diabetes_plot.jpg">

<img alt="graph" src="./Images/dnr_plot.jpg">

<img alt="graph" src="./Images/edu_plot.jpg">

<img alt="graph" src="./Images/temp_plot.jpg">

<img alt="graph" src="./Images/urine_plot.jpg">


**MODELS USED**

| Model | MSE_train | R2_train | MSE_test | R2_test |
|---------------------------|-----------|----------|-----------|-----------|
| Random Forest Regression | 9.52 | 0.88 | 66.02 | 0.14 |
| XG Boost Regression | 12.08 | 0.82 | 72.75 | 0.08 |
| Linear Regression | 76.54 | 0.07 | 74.91 | 0.06 |
| Ridge Regression | 76.54 | 0.07 | 74.91 | 0.06 |
| Elastic Net Regression | 77.70 | 0.03 | 75.98 | 0.03 |
| Decision Tree Regression | 0.00 | 1.00 | 127.30 | -0.68 |
| Deep NN | 211.83 | -2.24 | 201.13 | -2.35 |


**WHAT I HAD DONE**

* Load the dataset which contains 9105 entries in it and having 47 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. Tensorflow
7. Keras
8. Sci-py
9. 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.
- Deep Neural Network (NN) has a high MSE and negative R2, suggesting poor performance on both training and test sets.


**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)

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
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
tensorflow==2.4.1
keras==2.4.0
Loading