I was diagnosed with Type 1 about a year and a half ago. This means that I have only scratched the surface of things to know and understand about my body in comparison to some of the more experienced users on this forum. That is why I am using this as an outlet for discussion.
A little background about myself. I am a 25 year old electrical engineer working in the Molecular Imaging division of Siemens Healthineers (we all hate the new name). Basically we design PET scanners. I recently decided to continue my education by enrolling in an Online Masters of Computer Science program at Georgia Tech specializing in Machine Learning. The program is tailored to full time individuals who still want to further their education, and I think it is truly the first of its class.
I started learning about a technique called Multivariate Linear Regression in my program. It is basically like finding a line of best-fit for an X-Y scatter plot and then projecting both the independent variable and dependent variable into multiple dimensions.
For example, if you were to plot the price of a house vs. the size in square feet, you would likely see data points that generally trend upwards (price of house increases with the size in square feet). You could then find a linear equation that approximates the data and use it to predict the price of a house given just the size in square feet. This equation probably would not be very accurate, because the price of a house depends on more than just one factor. That is were multiple variable linear regression comes in. You could incorporate the year that the house was built, the number of bedrooms, the size of the lot, etc… to generate an equation with multiple predictor variables. Using this, you could better predict the price of a house given a set of known factors.
For the past few months, I have been playing with my blood sugar and macro-nutrient data to build a model that basically leverages multivariate linear regression to have an idea of how much insulin to take with my meals to stay in my post-meal BG range. I am using sugars, carbs (total - sugars - fiber), protein, fat, and insulin as my variables to predict what my 1.5hr BG and 3.0hr post-meal glucose is.
Some things to consider. Linear regression assumes that everything is linear (I know I probably didn’t need to say that). That is, the model assumes that for each gram of carb that I consume, my post-meal will be x amount higher at a given time. In reality it doesn’t quite work like that. A body can only digest so fast, and the rate at which each gram of carbohydrate will raise glucose depends on several factors. Therefore I have begun to cluster my data into sets. Right now I am clustering based on the number of carbs in a meal.
I am still in the honeymoon phase. Therefore, anything less than 30 carbs my pancreas can handle completely on its own. So I separate that data from the rest. After 30 carbs it is as if external insulin injected is the only way to lower my blood sugar. So between 30 carbs and 60 carbs is my second set of data. After 60 carbs, my insulin to carb ratio seems to increase, so I have separated that data into a third set.
This means that I have three equations that I use to predict my postmeal blood sugars depending on the carb load of the meal. After I log each premeal BG, meal macronutrients, and postmeal BGs the model “learns” a little bit about how my body works and updates the equation coefficients. Of course this is all automated by the App/software I am working on.
I have been having a lot of fun with this project, and I would like to just open up a discussion of what everyone thinks about using the system that I am developing. The correlation of my three data sets isn’t very good right now (67% and 55% for meals between 0-30 and 31-60 carbs respectively). However, the more data I take the higher the correlation gets, because I introduce new predictor variables with every 5 data points to prevent over-fitting of the linear regression model. So the goal is to continue improving and finding out smart ways for the model to learn and cluster data to suit each individual’s personal Diabetes.
My Nutritionist basically told me I’m an idiot for thinking I can automate this stuff, and she was actually really offended when I told her about my idea. Perhaps I am wasting my time on all this, but at least I’m having fun applying my theoretical knowledge to something practical for me personally. My thoughts are endless on this topic so even writing this post was a challenge. Last thought… If you have a CGM or pump I don’t think this really provides any benefits. I think everyone’s goal should be obtaining a CGM and then a pump. In fact, I get my Dexcom G5 early next week and I can’t wait! I want to make a live feed of my predictions vs. actual blood glucose to show my model working.
Thanks for taking the time to hear my rant.