A machine learning system that predicts diabetes risk with 85% accuracy, featuring an intuitive web interface with detailed risk analysis and personalized health recommendations.
- 🎯 Accurate Predictions: XGBoost model with 85% accuracy
- 💻 User-Friendly Interface: Clean Streamlit web app
- 📊 Detailed Analysis: Risk factors breakdown with visual indicators
- 💡 Personalized Recommendations: Actionable health advice
- 📱 Responsive Design: Works on desktop and mobile
- 🔍 Model Interpretability: Feature importance visualization
- Python 3.8+
- pip package manager
- Clone the repository:
git clone https://github.com/mdsaad31/diabetes-prediction.git
cd diabetes-prediction- Install dependencies:
pip install -r requirements.txt- Run the Streamlit app:
streamlit run app/diabetes_app.pyThe app will launch in your default browser at http://localhost:8501
- Fill in your health metrics in the web form
- Get your risk assessment with probability score
- Review detailed analysis of contributing factors
- Follow personalized recommendations for risk reduction
The trained XGBoost model achieved the following performance metrics on the test dataset:
| Metric | Score |
|---|---|
| Accuracy | 85.2% |
| AUC (ROC) | 0.91 |
| Precision | 0.83 |
| Recall | 0.76 |
| F1 Score | 0.79 |
For developers wanting to integrate with the prediction model:
import joblib
import numpy as np
import os
# Load model and scaler using relative paths
model_path = os.path.join(os.path.dirname(__file__), '..', 'models', 'diabetes_xgb_model.pkl')
scaler_path = os.path.join(os.path.dirname(__file__), '..', 'models', 'diabetes_scaler.pkl')
model = joblib.load(model_path)
scaler = joblib.load(scaler_path)
# Prepare input data (example)
input_data = np.array([[6, 148, 72, 35, 0, 33.6, 0.627, 50]])
# Standardize and predict
scaled_data = scaler.transform(input_data)
prediction = model.predict(scaled_data)
probability = model.predict_proba(scaled_data)[:, 1]We welcome contributions from the community to improve this project. To contribute:
- Fork the repository
- Clone your forked repo:
git clone https://github.com/your-username/diabetes-prediction.git
- Create a new branch for your feature or fix:
git checkout -b feature/your-feature-name
- Make your changes and commit them:
git commit -m "Add your message" - Push to your branch:
git push origin feature/your-feature-name
- Open a Pull Request and briefly describe your changes: Please make sure your code follows the existing style and passes all tests. Refer to the code of conduct for respectful collaboration.
- Pima Indians Diabetes Dataset – for providing the data used
- Streamlit – for powering the interactive web interface
- XGBoost – for the machine learning model
- Scikit-learn – for preprocessing and evaluation support
- All open-source contributors and libraries that made this project possible
If you have any questions, suggestions, or feedback, feel free to reach out:
Md Saad
📧 Email: [email protected]
💼 GitHub: @mdsaad31