About the Dataset

The dataset used for maternal health risk prediction consists of 6 vital health features and a target label. These features include: Blood Pressure (Diastolic and Systolic), Body Temperature, Glucose Level, Pulse Rate, Age, and Risk Level. The target label categorizes risks into three classes: High Risk, Mid Risk, and Low Risk.

The aim is to predict maternal risk as either low, mid, or high risk.

1014

Rows

0

Missing Rows

7

Columns

433

Outliers

Steps for Preprocessing

Data Loading

1. Data Loading

- The dataset is loaded to Pandas dataframe.

- This is done by reading the csv allowing us to easily manipulate the data.

Inspect Data

2. Inspecting Data

We inspect the dataset to understand the distributions, missing values, and general structure of the data. This includes using statistical summaries and visualization tools.

- From the graph, we can pick out for example that the age distribution is skewed towards younger individuals.

- Body Temp: This is generally consistent with a normal of 98.6 degrees F but shows some cases of fever of 103 degrees.

Encoding

3. Encoding Categorical Variables

Categorical variable(risklevel) is encoded into numerical representations using label encoding for it to be fit for training.

4. Checking for Outliers

- Using boxplots, we identify the outliers.

- We then cap them to ensure the data is robust and avoids skewing the model's performance.

Scaling

5. Scaling the Data

To normalize feature ranges, the scaling technique Standard Scaling was applied. This ensures uniformity across all features.

Balancing Using SMOTE

6. Balancing the Dataset

- There was an imbalance in the classes.

- This was addressed using the Synthetic Minority Oversampling Technique (SMOTE), generating synthetic samples for underrepresented classes.

Split Data

7. Splitting the Data

The df is split into training, validation, and testing sets to evaluate the model's performance on unseen data.

Feature Selection

8. Feature Selection

Features were ranked based on importance and selected only those that significantly contribute to the model's predictions.

Save Scaler

9. Saving the Scaler and Sets

The preprocessing pipeline, including scalers and data splits, is saved for reproducibility and consistency during model training and deployment.