0% found this document useful (0 votes)
3 views11 pages

ICU Mortality Risk Prediction Model

This report explores the use of machine learning to predict mortality risk in ICU patients based on clinical indicators. A dataset of 60 patients was analyzed, resulting in a Random Forest model that achieved an accuracy of 78.3% and identified key predictors such as temperature, blood pressure, and age. Future work aims to enhance model reliability through larger datasets and real-time monitoring integration.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views11 pages

ICU Mortality Risk Prediction Model

This report explores the use of machine learning to predict mortality risk in ICU patients based on clinical indicators. A dataset of 60 patients was analyzed, resulting in a Random Forest model that achieved an accuracy of 78.3% and identified key predictors such as temperature, blood pressure, and age. Future work aims to enhance model reliability through larger datasets and real-time monitoring integration.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Name:Althaf khan.

Z
Reg no:RCAS2023BIT009
Dep:Bsc(IT)
Sub:Big Data
Q1) ICU Mortality Risk Forecasting using
Machine Learning

1. Introduction
This report focuses on applying machine learning techniques to predict mortality risk in ICU
patients. The prediction is made using a variety of clinical indicators including age, vital signs,
and treatment variables. By analyzing patient data, the aim is to support early medical
intervention and improve resource planning within critical care environments.

Objective
- Detect high-risk ICU patients early using predictive models.
- Identify medical parameters with the strongest impact on mortality.
- Achieve an accurate and explainable model using machine learning.

2. Methodology

2.1 Dataset Overview


The dataset comprises 60 ICU patients, each described by 13 clinical features and one target
variable: MortalityRisk (0 = Survived, 1 = Deceased). The class distribution is slightly
imbalanced with 37 survivors (61.7%) and 23 deceased (38.3%).

Key Features Include:


- Age: Mean = 53.0 ± 22.6 years
- Oxygen Saturation: Average = 91.4 ± 4.4%
- Comorbidities: Mean = 1.9 ± 1.5
- Ventilator Support: Yes = 28, No = 32

2.2 Initial Visualizations


The following graphs help us understand the relationship between clinical features and mortality
outcomes:

Figure 1: Mortality Risk Distribution


Figure 2: Age Distribution by Mortality Outcome

Figure 3: Oxygen Saturation Levels by Mortality Outcome


Figure 4: Ventilator Support across Mortality Classes

Figure 5: Correlation Matrix of Clinical Parameters


3. Conclusion

This project has demonstrated the potential of machine learning in healthcare, particularly for risk
assessment in ICU settings. By leveraging clinical data from 60 patients, a Random Forest model
was trained to predict mortality outcomes with an accuracy of 78.3% and an AUC of 0.85. The
most significant predictors were temperature, blood pressure, and patient age. This model can
help medical staff prioritize care and intervene earlier for high-risk individuals.

While results are promising, future work should focus on collecting larger datasets and
integrating real-time monitoring systems to improve model reliability and applicability in live
hospital environments.
Code:
# Import necessary libraries

import pandas as pd

import numpy as np

import [Link] as plt

import seaborn as sns

from sklearn.model_selection import train_test_split

from [Link] import StandardScaler

from [Link] import RandomForestClassifier

from [Link] import classification_report, confusion_matrix, accuracy_score,


roc_auc_score, roc_curve

from sklearn.model_selection import GridSearchCV

from imblearn.over_sampling import SMOTE

# Load the dataset

df = pd.read_csv('ICU_Patient_Mortality_Prediction.csv')

# Initial data exploration

print("Dataset shape:", [Link])

print("\nFirst 5 rows:")

print([Link]())

print("\nData types and missing values:")

print([Link]())

print("\nDescriptive statistics:")

print([Link]())

# Data Visualization
[Link](figsize=(15, 12))

# 1. Target variable distribution

[Link](3, 3, 1)

[Link](x='MortalityRisk', data=df)

[Link]('Mortality Risk Distribution')

# 2. Age distribution by mortality risk

[Link](3, 3, 2)

[Link](x='MortalityRisk', y='Age', data=df)

[Link]('Age Distribution by Mortality Risk')

# 3. Comorbidities distribution

[Link](3, 3, 3)

[Link](x='Comorbidities', hue='MortalityRisk', data=df)

[Link]('Comorbidities Distribution by Mortality Risk')

# 4. Vital signs distribution

[Link](3, 3, 4)

[Link](x='MortalityRisk', y='HeartRate', data=df)

[Link]('Heart Rate by Mortality Risk')

[Link](3, 3, 5)

[Link](x='MortalityRisk', y='BloodPressure', data=df)

[Link]('Blood Pressure by Mortality Risk')


[Link](3, 3, 6)

[Link](x='MortalityRisk', y='OxygenSaturation', data=df)

[Link]('Oxygen Saturation by Mortality Risk')

# 5. Treatment factors

[Link](3, 3, 7)

[Link](x='VentilatorSupport', hue='MortalityRisk', data=df)

[Link]('Ventilator Support by Mortality Risk')

[Link](3, 3, 8)

[Link](x='Sedation', hue='MortalityRisk', data=df)

[Link]('Sedation by Mortality Risk')

[Link](3, 3, 9)

[Link](x='MortalityRisk', y='LengthOfStay', data=df)

[Link]('Length of Stay by Mortality Risk')

plt.tight_layout()

[Link]()

# Correlation matrix

[Link](figsize=(12, 8))

corr_matrix = [Link](numeric_only=True)

[Link](corr_matrix, annot=True, cmap='coolwarm', center=0)

[Link]('Correlation Matrix')

[Link]()
# Data Preprocessing

df['Gender'] = df['Gender'].map({'Male': 1, 'Female': 0})

df['VentilatorSupport'] = df['VentilatorSupport'].map({'Yes': 1, 'No': 0})

df['Sedation'] = df['Sedation'].map({'Yes': 1, 'No': 0})

X = [Link](['PatientID', 'MortalityRisk'], axis=1)

y = df['MortalityRisk']

print("\nClass distribution:")

print(y.value_counts())

smote = SMOTE(random_state=42)

X_res, y_res = smote.fit_resample(X, y)

X_train, X_test, y_train, y_test = train_test_split(X_res, y_res, test_size=0.3, random_state=42)

scaler = StandardScaler()

X_train_scaled = scaler.fit_transform(X_train)

X_test_scaled = [Link](X_test)

rf = RandomForestClassifier(random_state=42)

param_grid = {

'n_estimators': [100, 200, 300],

'max_depth': [None, 5, 10],

'min_samples_split': [2, 5],


'min_samples_leaf': [1, 2]

grid_search = GridSearchCV(rf, param_grid, cv=5, scoring='roc_auc')

grid_search.fit(X_train_scaled, y_train)

best_rf = grid_search.best_estimator_

print("\nBest parameters:", grid_search.best_params_)

y_pred = best_rf.predict(X_test_scaled)

y_pred_proba = best_rf.predict_proba(X_test_scaled)[:, 1]

print("\nClassification Report:")

print(classification_report(y_test, y_pred))

print("\nConfusion Matrix:")

print(confusion_matrix(y_test, y_pred))

print("\nAccuracy:", accuracy_score(y_test, y_pred))

print("ROC AUC Score:", roc_auc_score(y_test, y_pred_proba))

fpr, tpr, thresholds = roc_curve(y_test, y_pred_proba)

[Link](figsize=(8, 6))

[Link](fpr, tpr, label=f'Random Forest (AUC = {roc_auc_score(y_test, y_pred_proba):.2f})')

[Link]([0, 1], [0, 1], 'k--')

[Link]('False Positive Rate')


[Link]('True Positive Rate')

[Link]('ROC Curve')

[Link]()

[Link]()

feature_importance = [Link]({

'Feature': [Link],

'Importance': best_rf.feature_importances_

}).sort_values('Importance', ascending=False)

[Link](figsize=(10, 6))

[Link](x='Importance', y='Feature', data=feature_importance)

[Link]('Feature Importance')

plt.tight_layout()

[Link]()

print("\nFeature Importance:")

print(feature_importance)

You might also like