GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com β€” GitHub - Shotza247/Chronic_Kidney_Disease_ClassV1: A machine learning project using anonymized blood sample data to classify and predict Chronic Kidney Disease across different age groups and medical aid membership bands.

BranchesTags
Open more actions menu

Latest commit

 

History

33 Commits
33 Commits

Folders and files

NameName
Last commit message
Last commit date
.vscode
.vscode
 
 
CKD_Dataset
CKD_Dataset
 
 
mlartifacts/1
mlartifacts/1
 
 
mlruns/0
mlruns/0
 
 
.gitignore
.gitignore
 
 
CKD_Observation.ipynb
CKD_Observation.ipynb
 
 
README.md
README.md
 
 
mlflow.db
mlflow.db
 
 

Repository files navigation

🩺 Chronic Kidney Disease (CKD) Classification Model

A machine learning project using anonymized blood sample data to classify and predict Chronic Kidney Disease across different age groups and medical aid membership bands β€” sourced from a private hospital in Krugersdorp, South Africa.


πŸ“Œ Table of Contents

  • Project Overview
  • Background & Motivation
  • Dataset Description
  • Project Structure
  • Notebook Walkthrough
  • Tech Stack & Dependencies
  • Getting Started
  • Model Summary
  • Results & Evaluation
  • Ethical Considerations
  • Acknowledgements
  • License

πŸ“– Project Overview

This project applies supervised machine learning to classify patients as having Chronic Kidney Disease (CKD) or not, based on 158 anonymized blood sample data. The goal is to assist medical researchers and healthcare practitioners in identifying CKD patterns early across different demographic segments β€” particularly age groups and medical aid membership bands.

The model was developed as part of a support effort for a master's research project focused on chronic disease analysis within a South African community healthcare context.


🌍 Background & Motivation

Chronic Kidney Disease is a progressive condition that often goes undiagnosed until it reaches advanced stages. In South African communities, access to timely diagnostics is limited, making predictive modelling a valuable supplement to clinical practice.

This dataset was sourced through a collaboration with a medical staff member at a private hospital in Krugersdorp, who required data science support for their research. As someone embedded in both the local community and the Data Science & AI space, this project presented a meaningful opportunity to:

  • Apply machine learning to a real-world healthcare problem
  • Support academic research with practical tooling
  • Demonstrate responsible and ethical use of patient data

πŸ“Š Dataset Description

Property Detail
Source Private hospital, Krugersdorp, South Africa
Collection Method Blood sample analysis
Anonymization Full β€” all PII removed (patient IDs, names, ID numbers, addresses, medical aid details)
Segmentation Age groups & medical aid membership bands
Target Variable CKD Class (positive / negative)

⚠️ Note: The raw dataset is not included in this repository in compliance with the data privacy agreement under which it was shared. All analysis is performed on the anonymized version only.

Key Features (Blood Markers & Clinical Indicators)

The dataset includes a combination of clinical and demographic features. Common blood-based CKD indicators used in the model include:

  • Serum Creatinine
  • Blood Urea Nitrogen (BUN)
  • Glomerular Filtration Rate (GFR / eGFR)
  • Haemoglobin levels
  • Sodium, Potassium, and other electrolytes
  • Blood Pressure readings
  • Albumin / Protein levels
  • Age group band
  • Diabetes Mellitus, Coronary Artery Disease, Appetite
  • etc...

Feature names may differ slightly depending on how they appear in the notebook β€” refer to the data exploration section for exact column names.


πŸ—‚οΈ Project Structure

Chronic_Kidney_Disease_Class/
β”‚
β”œβ”€β”€ README.md                   # Project documentation (you are here)
β”œβ”€β”€ CKD_Observation.ipynb    # Main Jupyter Notebook
β”œβ”€β”€ CKD_Dataset/
β”‚   └── ckd.csv      # Anonymized dataset
β”œβ”€β”€ mlruns/
β”‚   └── Experiment_ID
β”‚   └── models/0
β”‚       └── m-Experiement_ID
β”‚           └── MLmodel
|           └── conda.yaml
|           └── model.pkl
|           └── python_env.yaml
|           └── requirements.txt
β”œβ”€β”€ mlaftifacts/1
β”‚   └── Experiemtn_ID
β”‚       └── m-Experiemtn_ID/artifacts
β”‚           └── estimator.html
|           └── metric_info.json
|           └── training_confusion_matrix.png
|           └── training_precision_recall.png
|           └── training_roc_curve.png
β”‚   └── models
β”‚       └── m-Experiement_ID/artifacts
β”‚           └── MLmodel
|           └── conda.yaml
|           └── model.pkl
|           └── python_env.yaml
|           └── requirements.txt

πŸ““ Notebook Walkthrough

The main notebook CKD_Observation.ipynb is structured into the following sections:

1. πŸ“₯ Data Loading & Initial Inspection

  • Loading the 158 anonymized CSV dataset
  • Viewing the first few rows, shape, and column types
  • Checking for missing values and duplicates

2. πŸ” Exploratory Data Analysis (EDA)

  • Analyzed statisticals
  • Distribution of the target variable (CKD vs non-CKD)
  • Feature distributions across age groups and medical aid bands
  • Correlation heatmaps -> evaluated high correlations
  • Box plots and histograms for key blood markers

3. 🧹 Data Preprocessing

  • Encoding categorical variables (e.g. age bands, medical aid tiers)
  • Droping Highly correlated column samples
  • Feature scaling / normalization for Logistic and KNN algorithms
  • Train-test split using an array of test_sizes 0.2, 0.25, 0.3

4. βš™οΈ Feature Engineering

  • Selecting the most predictive features

5. πŸ€– Model Building

  • Baseline model selection and rationale
  • Models trained (e.g. Logistic Regression, KNN, Random Forest, Gradient Boosting, etc.)
  • Hyperparameter tuning (solver, metric, max_depth, learning_rate, class_weight)
  • Cross-validation
Model evaluations can be high based on the small dataset. This does not mean our model is able to predict CKD cases perfectly it means that these evaluations are what we observe when we work on a sampled dataset.
Version 2 of the project will use a larger dataset to test our models performances and we can them observe and compare the performance of our V1 models and V2 models.

6. πŸ“ˆ Model Evaluation

  • Evaluations metrics
  • Confusion Matrix
  • Classification Report (Precision, Recall, F1-Score)
  • ROC-AUC Curve
  • Feature importance plot

7. πŸ’Ύ Model Export (pplicable doe model.pkl files)

  • Saving the models using pickle
  • Notes on how to load and run inference, coming soon with a Streamlit Application

8. 🧾 Conclusions & Recommendations

  • Key findings from the model
  • Clinical implications
  • Limitations and next steps for research

πŸ› οΈ Tech Stack & Dependencies

Tool Purpose
Python 3.9+ Core language
Pandas Data manipulation
NumPy Numerical operations
Matplotlib / Seaborn Visualizations
Scikit-learn ML models, preprocessing, evaluation
DecisionTree / RandomForest Gradient boosting models
Joblib / Pickle Model serialization
Jupyter Notebook Development environment
Install all dependencies via:
bash
pip install -r requirements.txt

πŸš€ Getting Started

1. Clone the repository

git clone https://github.com/your-username/ckd-classification.git
cd ckd-classification

2. Set up a virtual environment (recommended)

python -m venv venv
source venv/bin/activate        # On Windows: venv\Scripts\activate

3. Install dependencies

pip install -r requirements.txt

4. Launch the notebook

jupyter notebook ckd_classification.ipynb

If you don't have access to the dataset, you can still explore the notebook structure, visualizations, and model outputs already rendered in the cells.


🧠 Model Summary

Model Accuracy F1-Score AUC-ROC
Logistic Regression β€” β€” β€”
KNNeighbour β€” β€” β€”
Random Forest β€” β€” β€”
GradientBoost β€” β€” β€”
Best Model TBD TBD TBD
To Be Determined

πŸ“‰ Results & Evaluation

The best performing model achieved the following on the held-out test set:

Key takeaway: One of the biggest insights from this project was understanding how different model families respond to feature preparation and dataset size.

For this experiment:

  • I used scaled features for Logistic Regression and K-Nearest Neighbors (KNN)

  • I used the original/non-scaled features for tree-based models

  • Based on the dataset, model evaluation, and performance metrics, the tree-based models performed better overall

  • A major reason for this is that the dataset is relatively small, and tree-based models were able to capture the structure of the data more effectively in this case. This reinforced an important lesson for me: model performance is not just about the algorithm itself, but also about the nature of the data, preprocessing choices, and how well the model fits the problem context.

  • Accuracy: 100%

  • Precision: 100%

  • Recall: 100%

  • F1-Score: 100%

  • AUC-ROC: 1.00

Key observations:

  • The models performed particularly well in identifying CKD-positive cases with high recall, which is critical in a clinical screening context.
  • Age group and specific blood markers (e.g. serum creatinine, eGFR) were among the top predictive features.
  • Medical aid membership band showed a moderate correlation with CKD prevalence, likely reflecting access to care patterns.

βš–οΈ Ethical Considerations

This project was conducted with a strong commitment to responsible data use:

  • βœ… All patient data was fully anonymized prior to being shared β€” no personally identifiable information (PII) was retained or used.
  • βœ… The dataset was shared under a research collaboration agreement with a medical professional for academic purposes.
  • βœ… No attempt was made to re-identify individuals from the dataset.
  • βœ… The model is intended as a research and screening aid, not a replacement for clinical diagnosis.
  • βœ… Results and findings are shared purely for academic and public health awareness purposes.

πŸ™ Acknowledgements

  • The medical staff member at the Krugersdorp private hospital who facilitated access to the anonymized dataset and whose master's research inspired this project.
  • The hospital administration for permitting responsible, anonymized data use for research.
  • The open-source community for the tools and libraries that made this project possible.

πŸ“„ License

This project is licensed under the MIT License. The dataset itself is not covered under this license and may not be redistributed.


Built with purpose β€” bridging Data Science and community healthcare in South Africa. πŸ‡ΏπŸ‡¦

About

A machine learning project using anonymized blood sample data to classify and predict Chronic Kidney Disease across different age groups and medical aid membership bands.

Topics

data-analysis-pythondata-sciencedecision-tree-classifierexploratory-data-analysisexploratory-data-visualizationsgradient-boostinghyperparameter-tuningjupyter-notebookkneighborsclassifierkneighborsclassifier-modellogistic-regressionmlflowmlflow-trackingpython3random-forest-classifier

Resources

Readme
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 β€” GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800Γ—600. No cookies required.