Note: If the author has requested for "Expert Guidance" and you can help, please start a New Topic in the "Discussions" Tab

Prasad Chaskar's other Models Reports

Major Concepts


Sign-Up/Login to access Several ML Models and also Deploy & Monetize your own ML solutions for free

Models Home » Domain Usecases » Health Care and Pharmaceuticals » Maternal Health Risk Data Prediction

Maternal Health Risk Data Prediction

Models Status

Model Overview

What is maternal health?

Maternal health refers to the health of women during pregnancy, childbirth and the postnatal period. Each stage should be a positive experience, ensuring women and their babies reach their full potential for health and well-being. Ending preventable maternal death must remain at the top of the global agenda.

Importance of Maternal Health:

Good maternal health care and nutrition are important contributors to child survival; maternal infections and other poor conditions often contribute to indices of neonatal morbidity and mortality (including stillbirths, neonatal deaths and other adverse clinical outcomes).

  • Age: Age in years when a woman is pregnant.

  • SystolicBP: Upper value of Blood Pressure in mmHg, another significant attribute during pregnancy.

  • DiastolicBP: Lower value of Blood Pressure in mmHg, another significant attribute during pregnancy.

  • BS: Blood glucose levels is in terms of a molar concentration, mmol/L.

  • HeartRate: A normal resting heart rate in beats per minute.

  • Risk Level: Predicted Risk Intensity Level during pregnancy considering the previous attribute.

Dataset Link:


Import Libraries:

import pandas as pd 
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.svm import SVC
from sklearn.ensemble import RandomForestClassifier
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import classification_report
import warnings

Load Dataset:

health_df = pd.read_csv('Maternal Health Risk.csv')

Dataset contains 1014 rows and 7 column.


Risk Level:

plt.title("Risk Level Feature",{'fontsize':20});

high_risk = health_df[health_df.RiskLevel == 'high risk']
low_risk = health_df[health_df.RiskLevel == 'low risk']
mid_risk = health_df[health_df.RiskLevel == 'mid risk']


fig, axes = plt.subplots(1, 3, figsize=(15, 5), sharey=True)
axes[0].set_title("High Risk Level");

axes[1].set_title("Low Risk Level");

axes[2].set_title("Mid Risk Level");


fig, axes = plt.subplots(1, 3, figsize=(15, 5), sharey=True)
axes[0].set_title("High Risk Level");

axes[1].set_title("Low Risk Level");

axes[2].set_title("Mid Risk Level");​

Split Dataset:

X = health_df.drop('RiskLevel',axis=1)
y = health_df.RiskLevel

Convert Categorical variables into Numeric:

def fun(df):
if df == 'high risk':
return 0
elif df == 'low risk':
return 1
return 2
y = y.apply(fun)

X_train,X_test,y_train,y_test = train_test_split(X,y,test_size=0.1)

Scale Data:

scalar = StandardScaler()
X_train = scalar.fit_transform(X_train)
X_test = scalar.transform(X_test)

Model Training:

models = {
SVC():"Support Vector Machine",
RandomForestClassifier():'Random Forest',
LogisticRegression(max_iter=3000):'Logistic Regression'
for m in models.keys():,y_train)
for model,name in models.items():
print(f"Accuracy Score for {name} is : ",model.score(X_test,y_test)*100,"%")

Model Evaluation:
Classification Report:
Class 0 : High Risk
Class 1 : Low Risk
Class 2 : Mid Risk

for model,name in models.items():
y_pred = model.predict(X_test)
print(f"Classification Report for {name}")

Random forest performs better and gives high accuracy on test data as compared to other models (Logistic Regression,SVM).
So, we use Random Forest for our prediction.

Thank You ):