Learning Absorption Rates in Glucose-Insulin Dynamics from Meal Covariates
Abstract
Traditional models of glucose-insulin dynamics rely on heuristic parameterizations chosen to fit observations within a laboratory setting.
However, these models cannot describe glucose dynamics in daily life.
One source of failure is in their descriptions of glucose absorption rates after meal events.
A meal’s macronutritional content has nuanced effects on the absorption profile, which is difficult to model mechanistically.
In this paper, we propose to learn the effects of macronutrition content from glucose-insulin data and meal covariates.
Given macronutrition information and meal times, we use a neural network to predict an individual’s glucose absorption rate.
We use this neural rate function as the control function in a differential equation of glucose dynamics, enabling end-to-end training.
On simulated data, our approach is able to closely approximate true absorption rates, resulting in better forecast than heuristic parameterizations, despite only observing glucose, insulin, and macronutritional information.
Our work readily generalizes to meal events with higher-dimensional covariates, such as images, setting the stage for glucose dynamics models that are personalized to each individual’s daily life.
Introduction
Type-1 diabetes is a chronic condition of glucose dysregulation that affects 9 million people around the world.
Decades of research have produced dozens of glucose-insulin dynamics models in order to understand the condition and help diabetics manage their daily lives.
These models are typically developed using physiological knowledge and validated in laboratory settings.
However, these mechanistic models are incomplete; they are not flexible enough to fit observations outside of controlled settings, due to unmodelled variables, unmodelled dynamics, and external influences.
As a result, these mechanistic models fail to fully describe an individual’s glycemic response to external inputs like nutrition.
Standard models, such as Dalla Man et al.
[10], focus on the glycemic impact of carbohydrates in a meal—carbohydrates are broken down into glucose molecules, then absorbed into blood.
However, these models typically ignore other macronutrients, such as fat, fiber, and protein, which are known to contribute substantially to the amount and timing of glucose absorption into the blood.
Indeed, this phenomenon is the basis for the glycemic index of various foods.
In reality, individual glycemic responses to nutrition go beyond such a simple characterization.
For example, Zeevi et al.
[28] identified multiple patient sub-groups with different glycemic responses to complex foods.
In our paper, we propose a method that can leverage real-world nutrition and glucose-insulin measurements to improve the fidelity of existing mechanistic models.
While we tailor this approach to the specific application of type-1 diabetes, we note that our methodology fits within a broad paradigm of hybrid modeling of dynamical systems [19, 22, 24, 27].
These approaches can improve mechanistic
ODEs using flexible components that learn from observations of the system and its external controls.
Background on modelling glucose-insulin dynamics
Our paper builds on the tradition of modelling physiological dynamics via ordinary differential equations (ODEs), [5, 10, 16, 21, 26].
Traditional models consider ODEs of the form ˙ x ( t ) =
f ( t, x ( t ))
+ u ( t ) , where x ∈ R n denotes physiologic states, f : R n → R n encodes mechanistic knowledge of their interactions, and u : R → R n represents external time-varying inputs into the system.
Significant effort has gone towards identifying u from insulin, exercise, and meal data, but u is typically represented via a gastrointestinal ODE model [9, 11] or via hand-chosen functional forms [14, 15, 20].
Both approaches for representing meals depend only on carbohydrate consumption and do not consider other macronutrient quantities.
Our paper considers the minimal model of glucose-insulin dynamics by Bergman et al.
[Equation]
where x = ( G, X, I ) and u = ( u G , u I ) .
Here, G : R → R represents plasma glucose concentration,
I : R → R represents plasma insulin concentration, X : R → R represents the effect of insulin on glucose, G b , I b ∈ R represent basal glucose and insulin levels, respectively, and c 1 , c 2 , c 3 , c 4 ∈ R represent rate constants for the interactions.
Importantly, u G : R → R represents the appearance of glucose in the blood (e.g. absorbed from nutrition in the gut) and u I : R → R represents the appearance of insulin in the blood (e.g. absorbed from subcutaneous injection or drip).
See
Gallardo-Hernández et al.
[13] for a modern exposition and the units of each quantity.
Modelling nutrition absorption from discrete meal events.
When simulating the daily management of diabetes, the continuous functions u G , u I are typically derived from observed discrete events (e.g. meals and insulin injections).
Each discrete-time event e i =
( t i , m i ) consists of a timestamp t i and a covariate m i .
If e i is a meal event, m i may consist of macronutritional information, an image of the food, or both.
Pharmacodynamics models are often used to map the insulin dose to a continuous absorption profile u
I that is compatible with the above model.
However, the dependence of glucose absorption u G on full macronutritional content of a meal event is less well-understood; thus we focus on modelling u G in this paper .
Mechanistic u G models often derive u G as the solution to another set of heuristic ODEs[10].
However, this approach introduces additional handcrafted parameterizations to explain quantities that are unobservable outside of the lab setting, such as the glucose concentration in the stomach over time after a meal.
A simpler yet effective approach is to directly model u G phenomenologically, and estimate it from data [14, 20].
Instead of deriving u G from an intricate model of the human body, this approach represents u G directly using a parametric function adapted from data.
Phenomenologically modelling the absorption rate
Let each meal event i be e i
= ( t i , m i ) where t i ∈ R is the meal time and
m i ∈
R M is a vector of meal covariates, such as its macronutrition content or even a photo of the food.
We assume we have data on a set E of these meal events.
For each meal i , we associate a parametric function a i : R + → R + , such that a i ( t ) is the absorption rate of the meal at time t .
The overall control function u G is then a sum over the events:
[Equation]
a i is usually compactly supported, since meals only affects glucose locally in time.
Decomposing u G into a sum allows us to model the effect of each meal individually, instead of all at once.
A simple heuristic choice is a square function a i ( t ) =
g i 1 [0 ,w ) ( t − t i ) /w where w is the width of the square as a free parameter and
g i ∈ R is the amount of glucose produced from the meal.
Another choice is the bump function a i ( t ) =
g i 1 [0 , ∞ ) ( t − t i )( e − b 1 ( t − t i ) − e − b 2 ( t − t i ) ) /b 3 where b 1 and bare free parameters and b 3 is a normalization constant [1, 2].
For both choices, g i must be estimated by the patient or by a nutritionist (e.g. when m i is a food image), which can be highly inaccurate.
More importantly, the shape of these parameterizations does not depend on m i , even though foods vary in absorption profiles.
A neural phenomenological model.
The form of Equation (2) suggests a natural extension that takes advantage of the flexiblity of neural networks.
Given a meal event e i =
( t i , m i ) , we model its absorption rate using a neural network a θ such that
[Equation]
We make use of the estimated glucose content g i following prior approaches since it is often already available in the meals dataset, and gives an expert-informed glucose absorption scale factor.
Alternatively, g i can be included as another input to a θ instead of being a multiplicative constant.
Even if the estimated g i is inaccurate, a θ has the flexiblity to rescale g i based on the observed m i .
Most importantly, our parameterization differs in that its shape can adapt to the meal covariates m i .
We share one neural network a θ across all meal events, allowing it to generalize to macronutritional information similar to, but not exactly the same as, meals from the training set.
Altogether, Equations (1),(2),(3) define our neural differential equation model.
End-to-end training on partial observations.
Having defined our parametric function, we now discuss how to learn the parameters θ in a setting that is realistic to settings outside of the laboratory.
Recent technologies like continuous glucose monitors and artificial pancreases enable real-time measurements of glucose levels and insulin dosage.
However, most of a patient’s physiological state is unobserved.
Within Equation (1), we do not observe insulin I and its effect X .
Let x be the state of our differential equation from Equation (1).
We assume our temporal data consists of noisy partial observations over time { ( t k , y k ) } Tk =1 , where y k =
Hx ( t k ) + ε .
We assume the projection operator H : ( G, X, I ) (cid:55)→ ( G, 0 , 0) and ε is a zero-mean i.i.d.
noise process..
Given initial condition x ( t 0 ) =
x 0 , we can numerically integrate Equation (1) with a given u I and our parameterized u G ( · ; θ ) to obtain an estimate ˆ y ( t k ) =
H ˆ x ( t k ) where ˆ x ( t k ) =
Integrate ( f, u, x 0 , t 0 , t k ) .
We then minimize the mean squared error objective L ( θ )
= (cid:80) Tk =1 ∥
ˆ y ( t k ) − y k ∥ 22 /T with respect to θ to fit our parametric model [12].
However, this procedure requires us to know x 0 , which is not fully observed in practice.
Many methods exist for performing such under-determined state and parameter estimation; often, the state-estimation component is performed using filtering or smoothing [6–8, 19, 25], but can also be learnt through other data-driven [4, 17] or gradient-descent [23] methods.
In our experiments, we estimate an initial state x 0 by using a sequence of F observations ( G ( t − F +1 ) , G ( t − F +2 ) , . . .
, G ( t 0 ))
as a forcing function when forward integrating Equation (1), described in Section 4.3 of Levine and
Stuart [19].
This simple procedure was sufficient for our model to learn a good θ , likely due to the rapidly decaying autocorrelation of (1).
Experiments
We evaluate our proposed method on simulated data.
We simulate 28 days worth of glucose, insulin, and meal data for one virtual patient using Equation (1).
We evaluate our method against baseline methods with and without glucose observation noise.
We also evaluate each method in the realistic setting where the time of each meal is noisily reported, since in daily life, the recorded meal time is often only approximately correct.
Data generation.
For each day, we generate four meals: breakfast, lunch, dinner, and a late snack.
Meals occur uniformly at random within 6-9AM, 11AM-2:30PM, 5-8PM, and 10-11PM, respectively.
Each meal contains a glucose amount uniformly random within 5-65g, 20-70g, 40-100g, and 5-15g respectively.
For each meal event i , we convert grams of glucose to plasma glucose concentration, assuming the individual has 50dl of blood, and use the result as g i .
To simulate different absorption profiles, each meal is a convex mixture of three “absorption templates”.
Each template j is given
u G ( t ) ( m g/ d l / m i n )
[Figure]
( t ) (
[Figure]
/ d l / m i n )
[Figure]
by delayed bump function a j ( t ) ∝ g i 1 [0 , ∞ ) ( t − t i − d )( e
[Equation]
[Equation]
d ) − e − b 2 ( t − t i − d ) ) , each with its own set of parameters ( b 1 , b 2 , d ) ∈ { (0 . 04 , 0 .
09 , 5 min ) , (0 .
13 , 5 min ) , (0 . 03 , 0 .
04 , 30 min ) } , visualized in Figure 1.
The templates represent regular absorption, fast absorption, and slow absorption, respectively.
The macronutrition of meal i is then the vector of mixture coefficients m i ∈ R 3 such that meal i has absorption profile a i ( t )
= (cid:80) 3 j =1 m ij a j ( t ) .
To ensure a i is smooth, we average each value a i ( t ) with a grid of 50 points from the past 5 minutes.
For each meal time t i , we simulate an insulin bolus dose at a time sampled from N ( t i , (10 min ) 2 ) .
We sample a glucose to insulin conversion for each meal from N (7 g/U , (1 g/U ) 2 ) .
To simulate imperfect measurements, we add a relative N (0 , 0 .
05 2 ) observation noise.
To simulate imperfect meal time recordings, we add N (5 min , (2 . 5 min ) 2 ) noise to meal times.
We use a square function u I , corresponding to a constant insulin absorption rate, over 30 minutes, which we assume to be known to every model.
We use parameters from Andersen and Højbjerre [3] for Equation 1, and we use
Euler integration with a step size of 0 .
1 minutes to produce an observation every 5 minutes.
Experimental setup.
We split our generated data temporally into 3 disjoint training, validation, and testing trajectories.
We optimize using Adam [18] for 1000 iterations, with a half-period cosine learning rate schedule following a linear ramp up to 0 .
2 over the first 30 iterations.
We use minibatches of 512 sequences of 4 hour windows (48 observations) and use 10 observations for estimating the initial condition.
We minimize the mean squared error on the observed glucose values with respect to the parameters θ of a θ , keeping the other parameters of Equation (1) fixed.
We parameterize our neural a θ using a feedforward network with 2 hidden layers of 64 units and GELU activations.
We found that appropriately scaling the input and outputs of a i is crucial for stable optimization.
[Table]
Evaluations.
We compare our neural absorption function against the two common parameterizations of u G from Section 3, fit via gradient-based optimization.
We approximate the piece-wise constant square function using a difference of sigmoids; otherwise the width cannot be learned.
Our neural model is able to closely approximate the ground truth u G , especially in the tails, as shown in Figure(left).
This results in significantly better forecasts, and our neural model closely tracks the ground truth glucose values and absorption rates, even extrapolating to durations much longer than what was seen in training .
We visualize such long term forecasts in Figure 1 (right).
We also report the forecast
RMSE on the test set in Table 1.
Our neural model attains lower forecast errors across all settings.
In the noiseless case, our neural model is 10x more accurate than heuristic parameterizations.
The
RMSEs generally increase as we add noise, though the bump and square functions are already such poor forecasters that noise does not worsen their errors significantly.
Discussion
Our experiments show that our proposed method is a promising way to learn absorption profiles that depend on macronutritional information.
Our approach readily generalizes to handle arbitrary meal covariates beyond macronutritional information, such as food images or descriptions.
Although this paper only uses synthetic data, our method can complement any glucose dynamics model of real-world data.
Learning accurate dynamics from data, however, remains a challenging problem.
We see our method as a vital component in future data-driven hybrid models of glucose-insulin dynamics.
Acknowledgments and Disclosure of Funding
This work was supported in part by AFOSR Grant FA9550-21-1-0397, ONR Grant N00014-22-12110, and the Stanford Institute for Human-Centered Artificial Intelligence (HAI).
KAW was partially supported by Stanford Data Science as a Data Science Scholar.
MEL was supported by the National Science Foundation Graduate Research Fellowship under Grant No. DGE-1745301.
EBF is a Chan Zuckerberg Biohub investigator.