This project develops two production‑ready AI systems—one Machine Learning (ML) and one Deep Learning (DL)—to predict Type 2 Diabetes using structured clinical data from the Pima Indians Diabetes Dataset. The work emphasizes clinical validity, responsible AI practices, and real‑world deployment workflows.
Diabetes is a rapidly growing global health challenge, affecting over 500 million adults worldwide. Early detection is critical for preventing complications such as cardiovascular disease, kidney failure, neuropathy, and blindness. However, traditional diagnostic pathways can be resource‑intensive and inaccessible in many settings.
This capstone builds two independent AI systems capable of predicting diabetes risk using routinely collected clinical variables such as:
- Glucose
- BMI
- Insulin
- Blood Pressure
- Age
- Pregnancy history
- Diabetes pedigree function
The project follows a full CRISP‑DM pipeline, from data wrangling to deployment, with strong emphasis on:
- Clinical interpretability
- Imbalance handling
- Ethical considerations
- Robust evaluation
- Real‑world deployment
- Logistic Regression, Random Forest, and Gradient Boosting models
- Hyperparameter tuning with cross‑validation
- SMOTE, class weights, and threshold tuning
- SHAP‑based interpretability
- FastAPI endpoint + Streamlit UI
- Dockerized and deployed on Render
- Fully connected neural network with ≥3 hidden layers
- Dropout + L2 regularization
- Class‑weighted loss + oversampling
- Learning curves and generalization analysis
- FastAPI endpoint + Streamlit UI
- Dockerized and deployed on Render
Source: Pima Indians Diabetes Dataset
Link: https://www.kaggle.com/datasets/uciml/pima-indians-diabetes-database/data
Target Variable:
Outcome(1 = diabetic, 0 = non‑diabetic)
Predictor Variables:
- Pregnancies
- Glucose
- BloodPressure
- SkinThickness
- Insulin
- BMI
- DiabetesPedigreeFunction
- Age
Important Note: Several physiological features contain zero values representing missingness. These are handled carefully during preprocessing.
├── 📁 artifacts # ML/DL artifacts (models, scalers, etc.)
├── 📁 data # Raw and processed datasets
├── 📁 dl_system # Deep Learning system (API + Streamlit Client)
├── 📁 ml_system # Machine Learning system (API + Streamlit Client)
├── 📁 models # Trained model files
├── 📁 notebooks # Jupyter notebooks for EDA, preprocessing, and training
├── 📁 plots # Generated plots and visualizations
├── 📁 reports # Reports and ethical analysis
├── 📝 FILETREE.md # Full file structure
├── 📝 LICENSE.md # License information
└── 📝 README.md # Project documentation
Note: For a comprehensive view of the project structure, including all files and subdirectories, please refer to the FILETREE.md.
- Replace physiologically impossible zeros with NaN
- Median imputation for skewed variables
- Outlier detection using IQR and clinical thresholds
- Ensure no data leakage via pipelines
- Class imbalance visualization
- Feature distributions (stratified by Outcome)
- Correlation heatmaps
- Clinical insights from patterns
- Scaling with StandardScaler
- Train/validation/test split (stratified)
- Imbalance handling:
- SMOTE
- Random oversampling
- Class‑weighted loss
- Threshold tuning
- Logistic Regression
- Random Forest
- Gradient Boosting / XGBoost
- Hyperparameter tuning
- SHAP interpretability
- Dense neural network (≥3 layers)
- Dropout + L2 regularization
- Class‑weighted BCE loss
- Early stopping
- Learning curves
- FastAPI endpoints for ML and DL
- Streamlit apps for interactive prediction
- Dockerized services
- Render deployment
Primary metrics (clinical priority):
- Recall (Sensitivity)
- ROC‑AUC
Secondary metrics:
- Precision
- F1‑Score
- PR‑AUC
- Confusion Matrix
Clinical justification:
Missing a diabetic patient (false negative) can delay treatment and cause severe complications.
Therefore, Recall is prioritized over Accuracy.
- Streamlit App: https://diabetes-ml-system.streamlit.app/
- FastAPI Endpoint: https://statogale-diabetes-disease-outcome-ai-system-ml.hf.space
- Swagger Docs: https://statogale-diabetes-disease-outcome-ai-system-ml.hf.space/docs
- Streamlit App: https://diabetes-dl-system.streamlit.app/
- FastAPI Endpoint: https://statogale-diabetes-disease-outcome-ai-system-dl.hf.space
- Swagger Docs: https://statogale-diabetes-disease-outcome-ai-system-dl.hf.space/docs
This project uses uv for fast and efficient dependency management. Each system component (ML/DL API & Client) maintains its own pyproject.toml for isolation.
(If not already installed)
pip install uvgit clone https://github.com/D0nG4667/Diabetes_Disease_Outcome_AI_System.git
cd Diabetes_Disease_Outcome_AI_SystemML API:
cd ml_system/api
uv run uvicorn app:app --reloadML Client: (Open a new terminal)
cd ml_system/client
uv run streamlit run Home.pyDL API:
cd dl_system/api
uv run uvicorn app:app --reloadDL Client: (Open a new terminal)
cd dl_system/client
uv run streamlit run Home.pyTo add a package to a specific component:
cd <component_directory>
uv add <package_name>- Dataset is limited to Pima Indian women → limited demographic generalizability
- Risk of algorithmic bias if deployed without external validation
- Models should support—not replace—clinical judgment
- Requires calibration and prospective evaluation before real‑world use
Alghamdi, M., Al‑Muhtadi, J., & Al‑Ghamdi, A. (2017). A comparative study of machine learning algorithms for predicting diabetes. IJACSA, 8(6).
Han, L., Luo, S., Yu, J., Pan, L., Chen, S., & Yang, D. (2020). Rule extraction from SVMs for diabetes diagnosis. Healthcare, 8(3), 247.
Rahman, M. M., & Islam, M. M. (2020). Exploring machine learning approaches for diabetes prediction. Diabetes & Metabolic Syndrome, 14(5), 1021–1025.
This project is licensed under the Creative Commons Attribution-NonCommercial 4.0 International License.
You are free to:
- Share — copy and redistribute the material in any medium or format
- Adapt — remix, transform, and build upon the material
Under the following terms:
- Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made.
- NonCommercial — You may not use the material for commercial purposes.
For more details, see the LICENSE.md file.
For commercial licensing, custom implementations, or collaboration opportunities, please contact the author.
Made with ❤️ by Dr. Gabriel Okundaye
🌐 gabcares.xyz | 🐙 GitHub
