Inspiration

This project was inspired by my younger cousin Eli, who was diagnosed with diabetes at a young age. Seeing the struggle and unpredictability of dealing with glucose levels inspired me to try to make his and other diabetics lives a little bit easier. GlucoML is a personalized machine learning model made to suite you. We recognize that often current methods of glucose level forecasting can be lacking, and decided to do something about it.

What it does

GlucoML comes prepackaged with a generalized machine learning model that adapts to your body to better predict your glucose levels. Anyone with a continuous glucose monitor (CGM) can use it by simply outputting the data into our model.

The first step is to prepare some training data for your model. We found that roughly 3-4 days worth of glucose concentration, basal and bolus insulin input, and carbohydrate intake were sufficient for an accurate model. Just use personal_trainer() in model.py to have your personalized model in minutes.

Then it is as simple as adding

predictor = model.glucose_predictor("<YOUR-MODEL-PATH>") 
data = <YOUR-DATA-HERE>

to main.py. Run the script, and view the forecast and target range for your glucose.

How we built it

We use a recurrant neural network (GRU specifically) with an auxilary layer to predict the next data point from the last 2 hours of historical data

class ForecastRNN(nn.Module):
    def __init__(self, 
                 input_size = 3,
                 hidden_size = 256,
                 num_layers = 3):
        super(ForecastRNN, self).__init__()
        self.hidden_size = hidden_size
        self.num_layers = num_layers

        self.gru = nn.GRU(input_size, hidden_size, num_layers, batch_first= True)
        self.fc = nn.Linear(hidden_size, 1)

To train our general model, we utilized the we utilized the HUPA-UCM Diabetes Dataset. Specifically, patients 1 through 7, 9 and 10. We targeted CGM users specifically in this project.

We then freeze the weights of our GRU layers, and train only the last linear fc to fine tune for specific patients. We fine tuned our general model for patiens 11, 16, 22, 26 on the first 1000 data points available. Then we validated each model on the remaining data points of their respective patient

Lastly, we made a simple and intuitive GUI utilizing a matplotlib graph window to present the forecasting and historical data, using our RNN to recursively predict the next 30 minutes of glucose trajectory.

Challenges we ran into

Our first thoughts were to treat this like an inverse problem, treating the data as a time series of the system

equation

However, we found that the solutions were too volitile for our methods and decided to take a more direct approach of recurrant neural net.

The second problem we ran into was the accuracy of our model, the general model, while an improvement over some current methods, did not predict as accurately as we hoped. Realizing that everyone responds to glucose and insulin differently, that is when we decided to take a personalized approach to training the model.

Accomplishments that we're proud of

We are proud to have a completed project in any capacity. However, having a project that is functional and could impact a lot of people in the future is the most fulfilling.

What we learned

We learned machine learning concepts, how diabetics manage their glucose, user interface design, and how to utilize neural nets for everyday use.

What's next for GlucoML

In the future, we hope to make our model even more seamless and accurate so that it is more accessable to those without sufficient python programming skills.

Built With

Share this project:

Updates