Skip to content

Repository files navigation

🩺 Diabetes AI Diagnostics

An End-to-End Machine Learning System for Early Diabetes Detection

Python License: MIT ROC-AUC CI XGBoost

Turning routine clinical measurements into early, explainable risk signals.


📌 Overview

Diabetes AI Diagnostics is a complete, production-minded machine learning pipeline for early detection of diabetes from clinical data. Built on the well-known Pima Indians Diabetes Dataset (included in this repository — no external download required), this project goes beyond a single model — it engineers 15 new predictive features, systematically benchmarks 12 different algorithms, and delivers a tuned XGBoost classifier reaching 0.92 ROC-AUC.

Every prediction is paired with an explanation: using SHAP, the system doesn't just flag risk — it shows why, offering interpretability that matters in a clinical context. Hyperparameters are tuned automatically with Optuna, and the codebase is organized into clean, modular, tested components suitable for extension into a real deployment pipeline.


✨ Key Features

🧬 Advanced Feature Engineering 15 engineered features, including interaction terms and clinically-informed ratios
⚔️ Multi-Model Benchmarking 12 algorithms compared head-to-head — from logistic regression to gradient boosting and deep neural networks
🎯 Automated Hyperparameter Tuning Optuna-driven search for optimal model configuration
🔍 Explainable Predictions SHAP values reveal the reasoning behind every individual risk assessment
🧱 Modular, Production-Ready Code Clear separation of data, feature, model, and visualization layers
Automated Testing & CI Unit tests + GitHub Actions run on every push
🐳 Containerized One-command reproducible environment via Docker

📊 Model Performance

Model Accuracy Precision Recall F1 Score ROC-AUC
XGBoost (Tuned) 0.88 0.86 0.85 0.85 0.92
Random Forest 0.85 0.83 0.82 0.82 0.89
Neural Network (TensorFlow) 0.84 0.84 0.81 0.82 0.88

The tuned XGBoost model consistently outperforms alternative approaches across every metric, making it the pipeline's production candidate.


🚀 Getting Started

Prerequisites

  • Python 3.10 or later
  • Git

Installation

git clone https://github.com/jjagent13/diabetes-ai-diagnostics.git
cd diabetes-ai-diagnostics
pip install -r requirements.txt

Option A — Explore the full analysis (notebook)

jupyter notebook notebooks/MyProject.ipynb

Option B — Train from the command line

python -m src.models.train_model

This runs the reusable pipeline in src/ (data loading → feature engineering → training → evaluation) and saves the fitted model to models/diabetes_model.pkl.

Option C — Run inside Docker

docker build -t diabetes-ai-diagnostics .
docker run -p 8888:8888 diabetes-ai-diagnostics

Then open the Jupyter URL printed in the terminal.


🧪 Running Tests

pip install -r requirements-dev.txt
pytest tests/ --verbose

Tests run automatically on every push via GitHub Actions (see badge above).


🛠️ Tech Stack

  • Python — core language
  • Scikit-learn — classical ML models
  • XGBoost / CatBoost — gradient boosting
  • TensorFlow — deep neural network
  • SHAP — model interpretability
  • Optuna — hyperparameter optimization
  • Docker — reproducible environment
  • GitHub Actions — continuous integration

📁 Project Structure

diabetes-ai-diagnostics/
├── .github/workflows/     # CI pipeline (lint, test, Docker build)
│   └── ci.yml
├── configs/                # Project configuration
│   └── config.yaml
├── data/                   # Dataset (Pima Indians Diabetes, included)
│   └── diabetes.csv
├── models/                 # Saved trained models (generated, gitignored)
├── notebooks/               # Exploratory & end-to-end analysis
│   └── MyProject.ipynb
├── src/                    # Reusable, tested source code
│   ├── data/                 # Loading & cleaning
│   ├── features/             # Feature engineering
│   ├── models/                # Training & evaluation
│   └── visualization/         # Plotting utilities
├── tests/                  # Unit tests (pytest)
├── Dockerfile
├── .dockerignore
├── .gitignore
├── LICENSE
├── README.md
├── requirements.txt
└── requirements-dev.txt

📄 License

This project is released under the MIT License. See LICENSE for details.


👤 Author

Sajjad Sormalipour GitHub


🙏 Acknowledgements

  • The Pima Indians Diabetes Dataset
  • The open-source Scikit-learn and XGBoost communities

If this project helped you, consider giving it a ⭐ on GitHub.

Releases

Packages

Contributors

Languages