https://github.com/avdvh/diabetes-prediction-model
A Python-based binary classification model built with TensorFlow and Keras, featuring hyperparameter optimization via RandomSearch, data preprocessing, visualization, and SHAP analysis. Achieves 99.58% test accuracy.
https://github.com/avdvh/diabetes-prediction-model
keras neural-network shap tensorflow
Last synced: about 2 months ago
JSON representation
A Python-based binary classification model built with TensorFlow and Keras, featuring hyperparameter optimization via RandomSearch, data preprocessing, visualization, and SHAP analysis. Achieves 99.58% test accuracy.
- Host: GitHub
- URL: https://github.com/avdvh/diabetes-prediction-model
- Owner: avdvh
- Created: 2025-02-25T12:57:06.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-25T15:14:28.000Z (over 1 year ago)
- Last Synced: 2025-02-25T16:24:34.744Z (over 1 year ago)
- Topics: keras, neural-network, shap, tensorflow
- Language: Jupyter Notebook
- Homepage:
- Size: 3.38 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Neural Network Classifier with Hyperparameter Tuning
## Project Overview
This repository contains a Python implementation of a neural network classifier designed for binary classification tasks. The model is built using TensorFlow and Keras, with hyperparameter optimization performed via Keras Tuner's RandomSearch. The project includes data preprocessing, visualization, model training, evaluation, and feature importance analysis using SHAP. The final model achieves a test accuracy of 99.58% on the provided dataset.
The codebase is structured to be modular and reproducible, making it suitable for machine learning practitioners and researchers working on classification problems.
## Features
- Data preprocessing: Handling missing values, encoding categorical variables, and feature scaling.
- Data visualization: Correlation heatmaps, pair plots, and histograms for exploratory data analysis.
- Model architecture: A deep neural network with configurable layers, dropout, batch normalization, and LeakyReLU activation.
- Hyperparameter tuning: Automated tuning of layer units, dropout rates, and learning rates using RandomSearch.
- Model evaluation: Accuracy, loss plots, classification report, and confusion matrix.
- Feature importance: SHAP analysis to interpret model predictions.
- Model persistence: Saving the optimized model for future use.
## Dataset
**Dataset Link**: [Click Here](https://www.kaggle.com/datasets/asinow/diabetes-dataset)
The code assumes a CSV dataset (`diabetes_dataset.csv`) with numerical and categorical features, including an `Outcome` column as the binary target variable. Example features include `Age`, `BMI`, `Glucose`, `BloodPressure`, `FamilyHistory`, `DietType`, `Hypertension`, and `MedicationUse`. Replace `diabetes_dataset.csv` with the path to your dataset and adjust feature names as needed.
Test Accuracy: 99.58%
precision recall f1-score support
0 0.99 1.00 1.00 1275
1 1.00 0.99 0.99 633
accuracy 1.00 1908
macro avg 1.00 0.99 1.00 1908
weighted avg 1.00 1.00 1.00 1908
The high precision, recall, and F1-scores indicate excellent performance across both classes, with minimal misclassifications.
## Acknowledgements
- Built with TensorFlow, Keras, and Keras Tuner.
- Feature importance analysis powered by SHAP.
- Dataset preprocessing and visualization supported by Pandas, NumPy, Matplotlib, and Seaborn.
## Notebook:
[notebook.pdf](https://github.com/user-attachments/files/18978875/notebook.pdf)