An end-to-end Machine Learning project for predicting the stage of Chronic Kidney Disease (CKD) using clinical and laboratory data.
Streamlit App: https://ckd-multi-stage-classification-using-machine-learning-dgahtk2y.streamlit.app
The project demonstrates the complete machine learning workflow, from data preprocessing and exploratory data analysis (EDA) to feature engineering, dimensionality reduction, model optimization, and evaluation using a robust Scikit-Learn pipeline.
Chronic Kidney Disease (CKD) is a progressive medical condition that can lead to kidney failure if not detected early. Accurate stage classification enables timely intervention and improved patient outcomes.
The objective of this project is to classify patients into one of five CKD stages:
- 🟢 Healthy Kidney
- 🟡 Stage 2
- 🟠 Stage 3
- 🔴 Stage 4
- ⚫ Kidney Failure (Stage 5)
using supervised machine learning techniques.
- Perform comprehensive data preprocessing.
- Analyze feature distributions and correlations.
- Reduce dimensionality while preserving useful information.
- Select the most informative features.
- Build an optimized machine learning pipeline.
- Evaluate the model using multiple classification metrics.
The dataset contains clinical and laboratory measurements collected from CKD patients.
- Age
- Blood Pressure
- Albumin
- Creatinine
- Blood Urea
- Hemoglobin
- eGFR
- Diabetes
- Hypertension
- Smoking Status
- Family History
- and additional laboratory measurements.
Target Variable
CKD Stage (5 Classes)
Performed comprehensive preprocessing including:
- Data inspection
- Missing value analysis
- Duplicate detection
- Outlier detection
- Feature encoding
- Feature scaling
- Class distribution analysis
- RobustScaler
- Label Encoding
Performed extensive EDA to better understand the dataset.
Analysis included:
- Distribution analysis
- Histograms
- Boxplots
- Correlation Heatmaps
- Skewness Analysis
- Kurtosis Analysis
- Outlier Detection
- Target Class Distribution
Multiple feature selection techniques were applied.
- Variance Threshold
- Correlation Analysis
- Mutual Information
- Chi-Square Test
- Sequential Forward Selection
These methods helped identify the most informative features while reducing redundancy.
Principal Component Analysis (PCA) was applied to reduce feature dimensionality while preserving 95% of the dataset variance.
Benefits:
- Reduced computational cost
- Lower overfitting risk
- Faster model training
- Better model generalization
A Scikit-Learn Pipeline was built consisting of:
Raw Dataset
│
▼
Data Preprocessing
│
▼
RobustScaler
│
▼
PCA
│
▼
Support Vector Machine (SVC)
│
▼
Prediction
Model optimization was performed using:
- GridSearchCV
- 5-Fold Cross Validation
| Parameter | Value |
|---|---|
| Kernel | RBF |
| C | 10 |
| Gamma | 0.01 |
| PCA Components | 10 |
| Metric | Score |
|---|---|
| Accuracy | 96.08% |
| Macro Recall | 96.69% |
Additional evaluation metrics:
- Precision
- Recall
- F1-Score
- Classification Report
- Confusion Matrix
- Python
- Pandas
- NumPy
- Matplotlib
- Seaborn
- Scikit-Learn
Algorithms & Techniques
- Support Vector Machine (SVC)
- Principal Component Analysis (PCA)
- GridSearchCV
- Cross Validation
- Sequential Feature Selection
- Chi-Square Test
- Variance Threshold
- Mutual Information
- Data Cleaning
- Exploratory Data Analysis (EDA)
- Statistical Analysis
- Feature Engineering
- Feature Selection
- Dimensionality Reduction
- Machine Learning
- Multi-Class Classification
- Hyperparameter Optimization
- Model Evaluation
- Pipeline Development
✅ Built a complete end-to-end machine learning workflow.
✅ Applied multiple feature selection techniques.
✅ Reduced dimensionality using PCA.
✅ Optimized the model with GridSearchCV.
✅ Achieved 96.08% Accuracy.
✅ Achieved 96.69% Macro Recall across five CKD stages.
- Compare additional ensemble models (XGBoost, LightGBM, Random Forest).
- Deploy the model using Streamlit.
- Apply Explainable AI techniques (SHAP, LIME).
- Address class imbalance using SMOTE.
- Build a web application for real-time prediction.