Welcome to the Glucose Level Prediction project. This repository provides a machine learning solution to predict future blood glucose levels based on physiological signals using XGBoost. It also includes a Streamlit web application that allows users to interact with the model in real-time.
- Overview
- Dataset Description
- Data Preprocessing
- Model Architecture
- Evaluation Metrics
- Sample Results
- Web Application (Streamlit)
- Getting Started
- Folder Structure
- License
This project aims to predict the blood glucose level (mmol/L) one hour into the future using a variety of physiological time-series features such as:
- Insulin intake
- Carbohydrate consumption
- Heart rate
- Step count
- Calories burned
- Activity level
The goal is to assist individuals and healthcare professionals in proactively managing blood glucose levels.
The dataset consists of time-lagged features representing past physiological readings. For instance:
bg-0:15
,hr-0:30
,insulin-1:00
, etc. represent the value at 15 minutes, 30 minutes, or 1 hour ago.- The target column is
bg+1:00
, representing the glucose level 1 hour into the future.
Feature | Description |
---|---|
bg |
Blood glucose level (mmol/L) |
insulin |
Insulin units taken |
carbs |
Carbohydrates consumed (grams) |
hr |
Heart rate (bpm) |
steps |
Number of steps |
cals |
Calories burned |
activity |
Categorical activity level |
Preprocessing steps included:
- Feature Aggregation: Time-series features were aggregated (mean, std, etc.).
- Missing Value Handling: Mean imputation grouped by participant (
p_num
). - Categorical Conversion: The
activity
feature was converted to the mode value per row. - Scaling: Numerical features were optionally scaled for model input.
We use XGBoost Regressor, a powerful gradient boosting model suitable for tabular data.
- Input: Cleaned physiological feature set
- Output: Predicted glucose level (
bg+1:00
) - Training: Hyperparameters tuned using cross-validation
Metric | Description | Example Value |
---|---|---|
MAE | Mean Absolute Error | 1.01 |
RMSE | Root Mean Squared Error | 1.65 |
These metrics help us assess the model's performance and its deviation from true glucose values.
Visualizations provided:
- ✅ Feature Importance Plot (from XGBoost)
- 📈 Actual vs Predicted Glucose Levels
- 📊 Error Distribution Histogram
These results demonstrate the interpretability and reliability of the model.
An interactive frontend built with Streamlit allows users to input their physiological parameters and get a real-time prediction of their blood glucose level.
- Displays predicted glucose level
- Easy-to-use and lightweight
- Clone the repository:
git clone https://github.com/arjunravi26/Glucose-Monitoring.git
cd Glucose-Monitoring
- Install dependencies:
pip install -r requirements.txt
- Run the Streamlit app:
streamlit run main.py
Glucose-Monitoring/
├── data/ # Dataset files
├── models/ # Trained model files
├── notebooks/ # Jupyter notebooks for EDA & training
├── app/ # Streamlit app files
├── main.py # Entry point for Streamlit app
├── utils.py # Helper functions
├── requirements.txt # Dependencies
└── README.md # Project overview
This project is licensed under the MIT License. Feel free to use, modify, and share with credit.
For questions, feedback, or collaboration:
- Author: Arjun Ravi
- GitHub Repo: Glucose-Monitoring
"Empowering personal health through predictive intelligence."