Spaces:
				
			
			
	
			
			
		Runtime error
		
	
	
	
			
			
	
	
	
	
		
		
		Runtime error
		
	
		iaravagni
		
	commited on
		
		
					Commit 
							
							ยท
						
						a68be9c
	
1
								Parent(s):
							
							6e8eb41
								
Add Hugging Face Space configuration
Browse files
    	
        README.md
    CHANGED
    
    | 
         @@ -1,126 +1,14 @@ 
     | 
|
| 1 | 
         
            -
            # ๐ฉธ Blood Glucose Level Prediction
         
     | 
| 2 | 
         
            -
             
     | 
| 3 | 
         
            -
            This project explores multiple approaches for predicting blood glucose levels using multimodal data from the Big Ideas dataset. It includes data from wearables (accelerometer), nutritional inputs, and demographic/medical history features. Our goal is to evaluate and compare naive, machine learning, and deep learning methods to provide personalized and accurate glucose level forecasts.
         
     | 
| 4 | 
         
            -
             
     | 
| 5 | 
         
             
            ---
         
     | 
| 6 | 
         
            -
             
     | 
| 7 | 
         
            -
             
     | 
| 8 | 
         
            -
             
     | 
| 9 | 
         
            -
             
     | 
| 10 | 
         
            -
             
     | 
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 11 | 
         
             
            ---
         
     | 
| 12 | 
         | 
| 13 | 
         
            -
             
     | 
| 14 | 
         
            -
             
     | 
| 15 | 
         
            -
            Data is structured from the **Big Ideas dataset** to include the following features:
         
     | 
| 16 | 
         
            -
             
     | 
| 17 | 
         
            -
            - Glucose Level (target)
         
     | 
| 18 | 
         
            -
            - Accelerometer
         
     | 
| 19 | 
         
            -
            - Calories
         
     | 
| 20 | 
         
            -
            - Carbs
         
     | 
| 21 | 
         
            -
            - Sugar
         
     | 
| 22 | 
         
            -
            - Gender
         
     | 
| 23 | 
         
            -
            - HbA1c
         
     | 
| 24 | 
         
            -
            - Age
         
     | 
| 25 | 
         
            -
             
     | 
| 26 | 
         
            -
            The dataset is split as follows:
         
     | 
| 27 | 
         
            -
            - **Train:** 13 patients (~80%)
         
     | 
| 28 | 
         
            -
            - **Validation:** 2 patients from the training set (~15%)
         
     | 
| 29 | 
         
            -
            - **Test:** 3 patients (~20%)
         
     | 
| 30 | 
         
            -
             
     | 
| 31 | 
         
            -
            ### Generated Files:
         
     | 
| 32 | 
         
            -
            - Individual CSV for each patient
         
     | 
| 33 | 
         
            -
            - Combined dataset CSV
         
     | 
| 34 | 
         
            -
            - Train/Validation/Test CSVs
         
     | 
| 35 | 
         
            -
             
     | 
| 36 | 
         
            -
            ---
         
     | 
| 37 | 
         
            -
             
     | 
| 38 | 
         
            -
            ## ๐ง  Modeling Approaches
         
     | 
| 39 | 
         
            -
             
     | 
| 40 | 
         
            -
            We evaluated 3 approaches to predict glucose levels:
         
     | 
| 41 | 
         
            -
             
     | 
| 42 | 
         
            -
            ### 1. ๐งฎ Naive Approach
         
     | 
| 43 | 
         
            -
            - Model: `ibm-granite/granite-timeseries-ttm-r2` (zero-shot)
         
     | 
| 44 | 
         
            -
            - No fine-tuning
         
     | 
| 45 | 
         
            -
             
     | 
| 46 | 
         
            -
            ### 2. ๐ฒ Machine Learning
         
     | 
| 47 | 
         
            -
            - **Model:** XGBoost Regressor
         
     | 
| 48 | 
         
            -
            ```python
         
     | 
| 49 | 
         
            -
            xgb_model = xgb.XGBRegressor(
         
     | 
| 50 | 
         
            -
                n_estimators=50, 
         
     | 
| 51 | 
         
            -
                learning_rate=0.2, 
         
     | 
| 52 | 
         
            -
                max_depth=5, 
         
     | 
| 53 | 
         
            -
                objective='reg:squarederror', 
         
     | 
| 54 | 
         
            -
                random_state=42
         
     | 
| 55 | 
         
            -
            )
         
     | 
| 56 | 
         
            -
            ```
         
     | 
| 57 | 
         
            -
             
     | 
| 58 | 
         
            -
            ### 3. ๐ค Deep Learning
         
     | 
| 59 | 
         
            -
            - **Model:** Fine-tuned `granite-timeseries-ttm-r2` on the structured dataset
         
     | 
| 60 | 
         
            -
             
     | 
| 61 | 
         
            -
            ---
         
     | 
| 62 | 
         
            -
             
     | 
| 63 | 
         
            -
            ## ๐ Results
         
     | 
| 64 | 
         
            -
             
     | 
| 65 | 
         
            -
            | Approach | RMSE |
         
     | 
| 66 | 
         
            -
            |----------|------|
         
     | 
| 67 | 
         
            -
            | Naive    | 3.7812 |
         
     | 
| 68 | 
         
            -
            | ML       | 3.9681 |
         
     | 
| 69 | 
         
            -
            | DL       | 3.8762 |
         
     | 
| 70 | 
         
            -
             
     | 
| 71 | 
         
            -
            ---
         
     | 
| 72 | 
         
            -
             
     | 
| 73 | 
         
            -
            ## ๐ Streamlit Web App
         
     | 
| 74 | 
         
            -
             
     | 
| 75 | 
         
            -
            The interactive app allows users to:
         
     | 
| 76 | 
         
            -
            - Upload the 3 required CSVs
         
     | 
| 77 | 
         
            -
            - Select preloaded patient samples
         
     | 
| 78 | 
         
            -
            - View and compare predictions from:
         
     | 
| 79 | 
         
            -
              - Naive model
         
     | 
| 80 | 
         
            -
              - Machine Learning model
         
     | 
| 81 | 
         
            -
              - Deep Learning model
         
     | 
| 82 | 
         
            -
             
     | 
| 83 | 
         
            -
            > ๐ A working version is deployed and publicly accessible [**here**](#) *(add your link)*
         
     | 
| 84 | 
         
            -
             
     | 
| 85 | 
         
            -
            ---
         
     | 
| 86 | 
         
            -
             
     | 
| 87 | 
         
            -
            ## ๐ฝ๏ธ Final Deliverables
         
     | 
| 88 | 
         
            -
             
     | 
| 89 | 
         
            -
            - ๐ [10-minute video presentation](#) 
         
     | 
| 90 | 
         
            -
            - ๐ [Live Streamlit app](#)
         
     | 
| 91 | 
         
            -
             
     | 
| 92 | 
         
            -
            ---
         
     | 
| 93 | 
         
            -
             
     | 
| 94 | 
         
            -
            ## ๐ Ethics Statement
         
     | 
| 95 | 
         
            -
             
     | 
| 96 | 
         
            -
            While this project focuses on non-invasive glucose prediction, it is not intended for real-time clinical use. Any deployment of such tools must undergo rigorous validation and ethical review. We aim to respect user privacy, and datasets used in this project are anonymized and publicly available.
         
     | 
| 97 | 
         
            -
             
     | 
| 98 | 
         
            -
            ---
         
     | 
| 99 | 
         
            -
             
     | 
| 100 | 
         
            -
            ## โถ๏ธ How to Run
         
     | 
| 101 | 
         
            -
             
     | 
| 102 | 
         
            -
            Follow these steps to set up the environment and launch the Streamlit app:
         
     | 
| 103 | 
         
            -
             
     | 
| 104 | 
         
            -
            1. **Clone the repository:**
         
     | 
| 105 | 
         
            -
            ```bash
         
     | 
| 106 | 
         
            -
            git clone https://github.com/your-username/glucose-prediction.git
         
     | 
| 107 | 
         
            -
            cd glucose-prediction
         
     | 
| 108 | 
         
            -
            ```
         
     | 
| 109 | 
         
            -
             
     | 
| 110 | 
         
            -
            2. **Create and activate a virtual environment:**
         
     | 
| 111 | 
         
            -
            ```bash
         
     | 
| 112 | 
         
            -
            python -m venv venv
         
     | 
| 113 | 
         
            -
            source venv/bin/activate  # On Windows use: venv\Scripts\activate
         
     | 
| 114 | 
         
            -
            ```
         
     | 
| 115 | 
         
            -
             
     | 
| 116 | 
         
            -
            3. **Install dependencies:**
         
     | 
| 117 | 
         
            -
            ```bash
         
     | 
| 118 | 
         
            -
            pip install -r requirements.txt
         
     | 
| 119 | 
         
            -
            ```
         
     | 
| 120 | 
         
            -
             
     | 
| 121 | 
         
            -
            4. **Run the Streamlit app:**
         
     | 
| 122 | 
         
            -
            ```bash
         
     | 
| 123 | 
         
            -
            streamlit run glucose_app.py --server.maxUploadSize=1000
         
     | 
| 124 | 
         
            -
            ```
         
     | 
| 125 | 
         | 
| 126 | 
         
            -
             
     | 
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 1 | 
         
             
            ---
         
     | 
| 2 | 
         
            +
            title: Blood Glucose Prediction
         
     | 
| 3 | 
         
            +
            emoji: ๐ฉธ
         
     | 
| 4 | 
         
            +
            colorFrom: blue
         
     | 
| 5 | 
         
            +
            colorTo: red
         
     | 
| 6 | 
         
            +
            sdk: streamlit
         
     | 
| 7 | 
         
            +
            sdk_version: 1.30.0
         
     | 
| 8 | 
         
            +
            app_file: glucose_app.py
         
     | 
| 9 | 
         
            +
            pinned: false
         
     | 
| 10 | 
         
             
            ---
         
     | 
| 11 | 
         | 
| 12 | 
         
            +
            # Blood Glucose Prediction
         
     | 
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 13 | 
         | 
| 14 | 
         
            +
            Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
         
     |