Model parameters for neural net training.
The aim of modern science in diabetes therapy is to develop a closed-loop system to control blood glucose (BG) (“artificial pancreas”). Such a system includes glucose monitor, insulin pump and algorithms of their interaction and blood glucose (BG) dynamics analysis. Current work is devoted to mathematic modeling of BG dynamics, development of BG prediction algorithm and its approbation on clinical data Diabetes Research in Children Network (DirecNet). Prediction algorithm is based on sigma model of BG regulation and is supposed to be used for “artificial pancreas” system. The algorithm was tested under condition of possible errors in glucometer and/or insulin pump operation. Root-mean-square error of BG prediction is 15.7 mg/dl. Algorithm corrects 97.5% errors.
- artificial pancreas
- mathematical model
- blood glucose dynamics
- glucose meter
- diabetes mellitus
Diabetes mellitus is one of the most widespread and serious diseases. Diabetes mellitus type 1 means that the pancreas loses its ability to produce insulin. The aim of modern science in diabetes therapy is to develop a closed-loop system («Artificial Pancreas»), which can compensate such an insufficiency. «Artificial Pancreas» is a system combining a glucose sensor, a control algorithm and an insulin infusion device . In the case of diabetes mellitus (type 2), pump insulin therapy is not relevant due to metabolism disorder, whereas in the case of insulin-dependent one (type 1), it is the most effective method of diabetes compensation.
Modern systems for blood glucose (BG) monitoring concentration and insulin pumps for subcutaneous insulin injection have certain potential for raising the level of diabetes mellitus therapy. However, any errors in such a system can cause dangerous consequences for the patient’s health: hypo- or hyperglycemia.
Some errors occur due to biomechanics of the sensor-tissue area (e.g., mechanical pressure in the sensor implantation zone) . In clinical practice, there are two types of errors associated with glucose monitoring: abrupt fluctuations of BG and short-term decrease in the BG sensor sensitivity. Incorrect functioning of BG sensor can be associated with failure in insulin injection rate caused by tubing occlusion.
Moreover insulin and glucose have delays in absorption and action (about 30–100 min for insulin and 5–15 min for glucose) . Thus, insulin should be injected in the way to prevent hyperglycemia.
2. Modeling of blood glucose dynamics
2.1. Mathematic models of blood glucose and insulin dynamics
In the human body, glucose is the main and the most multifunctional energy source for metabolic processes. Due to utmost importance of stable blood glucose level, there is a complicated regulation system. The scheme of blood glucose and insulin regulation is represented in Figure 1.
Most BG dynamics models tend to describe physiological processes of glucose and insulin regulation. The simplest model describing BG dynamics is the Bergman’s minimal model . It is a system of three ordinary differential equations (ODE) (Eq. (1)):
The advantage of the model (Eq. (1)) is in proper description of BG and insulin dynamics. However, under some circumstances, it behaves incorrectly. The model describes BG peak with returning to the initial BG level
Sturis’ model  includes two negative feedbacks, describing glucose absorption due to insulin action and insulin secretion as a reaction to BG rising. The model is described by the following ODE system (Eq. (2)):
Engelborghs’ model  is based on Sturis’ model (Eq. (1)) and takes into account time delay of insulin secretion and of BG ascent. Insulin injections can be described in the following way (Eq. (3)) (with an assumption that it equals patient’s pancreas insulin):
where is the fraction of insulin delivered by the pancreas of a normal subject into the circulation to maintain blood sugar at its physiological level, is pancreatic insulin production time delay and is hepatic glucose production delay. In contrast with Sturis’ model, Engelborghs’ model is sustainable.
where is constant. The Bennett-Gourley’s model has no sustained oscillations.
Despite significant international experience in modeling of blood glucose and insulin dynamics, there are a number of individual peculiarities of patient that effect BG like his/her physical activity, stresses, etc. Possible ways of taking into account such a variety of factors are in using of indistinct logic and neural networks. As input data for neural networks, information could be used that can have any influence on BG dynamics. The output data are blood glucose concentration or amount of insulin to infuse to normalize BG.
However, processing of neural network algorithms is even more consuming than systems of ordinary differential equations of high orders.
2.2. Sigma model
Direct application of mathematic model for BG dynamics is in its predicting capabilities. On its basis, one can make an algorithm for BG prediction that can be used as a part of “artificial pancreas” system. Mathematic models on the basis of high-order differential equations are rather complicated to be used in a processing unit of a portable glucometer, especially when they are complexificated with additional data about numerous factors effecting blood glucose concentration. That is why simple empirical mathematic models  for such calculations are more preferable.
Let us consider independently BG ascent and descent processes. The main factor effecting BG increase is food intake. Food can be characterized by amount of carbohydrates and glycemic index. Thus, food intake can be described by three parameters: is food mass, is relative carbohydrate coefficient and
For BG analysis precise track form during BG ascent is not important, only amplitude and assimilation time. The function of accumulating glucose in the blood can be expressed in the following way (Eq. (5)):
where is BG value
Function of insulin effect on BG can be described as follows (Eq. (6)):
The model is based on logistic function or sigma function. That is why it is call sigma model.
Eq. (7) is the simplest variant of BG dynamics model. However, there are other independent factors affecting BG dynamics:
–Glucose elimination by kidneys
–Glucose accumulation in the liver in the form of glycogen
–Glycogenolysis driven by glucagon
–Natural residual insulin secretion by pancreas β-cells
In current approach, we do not take into account glucose accumulation and glycogenolysis in the human body. These processes do not change BG rapidly and can be evaluated from blood glucose measurements.
As shown in Figure 2, the model (Eq. (7)) describes ascent and descent of BG track quite accurately. It should be noted that model provides better results in the diabetes mellitus type 1 case, because it is characterized by very little or even no insulin secretion. Sigma model appears to be applicable for BG prediction.
2.3. BG profile database
For experimental evaluation of developed mathematic model and the prediction algorithm, we need BG tracks with information about factors that affect BG dynamics. Protocols of Diabetes Research in Children Network (DirecNet) are used for that purpose. DirecNet investigates the potential use of glucose monitoring technologies and its impact on the compensation of type 1 diabetes in children . Investigations with completed protocols were directed to estimate accuracy of constant glucose monitor system (CGMS) [11–14], especially of FreeStyle Navigator sensor [15–17] and evaluate physical activities on BG [18, 19] and basal insulin injection  influence on hypoglycemia in children with type 1 diabetes.
Experimental results are represented as a number of tables, reports about patient anamnesis and received data. Data protocols include detailed description of experiments. Tables contain the following information: BG measurements, insulin injections, initial patient data, calibrating BG tracks, anamnesis, meal, physical activity, dawn phenomenon, blood counts (CBC, hormones, biochemical, clinical BG), medicines, stress, etc. Database includes more than 4000 records about food intake, insulin injections and physical activity and more than 2000 glucose daily tracks. This available data can be used for approbation of mathematic models and prediction algorithm.
DirecNet data was structured, analyzed and filtered; daily BG tracks, provided by different glucose meters and clinical blood analysis, were synchronized (Figure 3).
In Figure 4, there is a BG track with information about food intake and insulin injection. BG growth and reduction accurately correlate with food and insulin intake time and amount.
Clinical analyses were taken as the most precise. Measurement results provided by noninvasive glucometers FreeStyle Flash and One Touch Ultra (measurements were performed once in a 30–60 minutes) match with each other and in the case of no clinical data, their arithmetic mean value was taken as a true one. Supporting track was formed according to these data. Medtronic CGMS and FreeStyle Navigator data (measurements were performed once in a 1–5 minutes) are less accurate and have noticeable value drift; however, due to higher digitalization, they make it possible to reconstruct precise BG track form. Tracks provided by glucose monitors were corrected in accordance with a supporting track. As a result, a set of BG tracks with higher digitalization (1–5 min step) and accuracy was obtained (Figure 5).
Obtained data were used for approbation mathematic models and prediction algorithm.
2.4. Mathematic model approbation
DirecNet databases give enough information for sigma model approbation. However, it is necessary to define a wide range of parameters for other models of BG dynamics.
In particular, Sturis’, Engelborghs’ and Bennett-Gourley’s models require such parameters as quantities of plasma insulin, interstitial insulin and glucose, pancreatic insulin production, insulin-independent glucose utilization, insulin-dependent glucose utilization, the influence of insulin on hepatic glucose production, distribution volumes for insulin in plasma and interstitial fluid.
These parameters were obtained from BG tracks using a neural network. Bennett-Gourley’s model has broader set of parameters in comparison with Sturis’ and Engelborghs’ models. The purpose of the neural network was to reconstruct Bennett-Gourley’s model parameters by an input track. Neural network was trained in the following way. Randomly generated set of parameters for Bennett-Gourley’s model (from physiological range of values) was used to reconstruct BG track. This track was included in training sample as a stimuli vector and model parameters as a response vector. After training the neural network, it was used to define necessary parameters for models by analyzing track from DirecNet. Neural network processing was implemented by Matlab Neural Net Toolbox using FeedForwardNet, Elman Recurrent Neural Network and embedded neural network. The best efficiency was demonstrated by training algorithm “trainbr” with 14 neurons in the hidden layer and activation functions “logsig” and “purelin” combination. Average error of model parameter determination was 14%. Elman Recurrent Neural Net provided the best accuracy; RMSE was equaled to 27 mg/dl.
It should be noted that track representation by all models appeared to be more precise when neural network was trained by Bennett-Gourley’s model. The model parameters are presented in Table 1 and its description is represented in the work of Tolic et al. .
We compared results of track modeling by Engelborghs’, Bennett-Gourley’s and sigma model parameters with BG tracks for T1DM patients from DirecNet databases. Missing parameters of first three models were defined by neural network; sigma model was built according to parameters specified in experiment protocols. Results are represented in Figure 6. Moments of food intake and insulin injections with corresponding doses are also marked on the plot.
As it turned out, Sturis’ model is highly oscillating and has significant dips on the track after food intake. Engelborghs’, Bennett-Gourley’s and sigma models describe BG track form rather accurately; nevertheless, due to the fact that these models show better results in the case of healthy subjects, it can be noticed that BG tends to return to initial value. Moreover, sigma model is more accurate in describing BG track. Model error in the physiological blood glucose concentration range was equal to 15.7 mg/dl. It makes the model applicable for BG prediction algorithm development on its bases. It should be noted that presented RMSE is average for the whole day. The accuracy is higher for short-term prediction (30 min) and model iterative correction.
The disadvantage of the model is its ability to predict only growth or reduction of BG induced by food intake or insulin injection, respectively. As there are a lot of other BG-affecting factors , sigma model can be extended and improved but is applicable for prediction algorithm development as is.
3. Predictive algorithm
BG prediction algorithm is needed for adjusting the rate of insulin injection and detection of insulin pump or glucometer failure.
Algorithm is based on sigma model  and calculates BG dynamics for 2 hours in advance. Initial BG level is measured by invasive glucose meter in the fasting state. On receiving new data (from glucose monitor or from patient), a new prediction is made and previous predictions are erased. After each measurement made by BG monitor, the model analyses received data. Incorrect system operation cases and algorithm response on that are described below. If there are no errors in measurement process, new BG dynamic prediction is performed on the base of received data. Linear shift of predicted track toward measured value is calculated as follows (Eq. (8)):
where is glucose monitor value error and is averaged error of mathematic model for the period between two measurements.
In order to evaluate measured BG adequacy, we consider two types of prediction: short-term and long-term predictions, to detect local errors and systematic ones, respectively.
3.1. Error detecting and correction
The first type of errors is related to possible spikes due to BG monitor software or hardware failure during BG measurements. Such kind of errors is revealed to single value of glucometer data that differ significantly from predicted one. Threshold for taking measured value as falling can be expressed as (Eq. (9))
where is the total tolerance and is the theoretical tolerance of BG data deviation from values obtained by the model when accurate measurement and modeling occur.
When such an error takes place, algorithm ignores the data from glucose monitor and considers predicted data as true. Error signalization is not obligatory in this case. During the period of seven measurements, only three falling out values are allowed. If incorrect values appear, too often algorithm makes a report about possible system failure. Algorithm operation example with such type of errors is represented in Figure 7.
The second error type is connected to damage (split or disconnection) or cross clamping of insulin pump infusion set. Because of undelivered insulin, BG systematically increases. If long-term prognosis differs from glucometer data with insulin being infused, the algorithm sends a signal about possible error and suggests patient to check an infusion set (Figure 8).
It also may happen that a patient for some reason did not enter meal data. In this case, as well as in the previous one, significant deviation of glucometer measurements from long-term prediction occurs. If insulin was not infused, algorithm sends a signal about the error (Figure 9) and suggests patient to confirm that he/she didn’t have a meal during last 60 minutes.
In the case of sharp reduction of sensor sensibility, insulin pump breakdown, or other system operation failure, systematical deviations occur and there is no possibility to eliminate them by prior mentioned methods. Then algorithm reports about system failure, turns off automatic insulin infusion and suggests a patient to consult his/her doctor.
3.2. Insulin dosage calculation
The aim of insulin pump is automatic insulin infusion in two regimes: basal and bolus. The pancreas produces insulin in advance so that BG would be in certain range of values. There are several schemes for individual insulin injections and in most cases, it should be injected before BG meal. Rapid-acting insulin should be infused straight after the meal but before blood glucose increase. Moreover, patients often need basal insulin infusion twice a day, but with insulin pump, it is infused continuously . Bolus insulin dose is calculated in accordance to meal composition and product glycemic index.
Using such data and sigma model, one can calculate BG dynamics and evaluate dose and time of insulin injection to make BG normal after food assimilation. As a rule a standard value is used, for instance, 80 mg/dl. As sigma model is sensible only to food intake and insulin injection, BG with
Insulin infusion time depends on type of insulin used in the insulin pump. Selection of insulin infusion pattern is performed according to definite kind of insulin. The pattern is selected to minimize BG deviation from normal range of values. It is important to prevent hypoglycemic values of BG, because lack of insulin can be compensated by additional bolus, but extra BG reduction caused by insulin over-infusion cannot be balanced automatically.
Predicting track is shifted depending on measured BG values. As a result, it may happen that real BG value after some time will be lower than it was initially predicted. Meanwhile a new prediction will contain a zone where predicting value will appear in hypoglycemia area. Insulin and food have assimilation delays. If insulin of extra value is infused, it will be impossible to register and correct appropriate BG changes and a patient will have hypoglycemia after a while. In order to avoid hypoglycemia, it was offered to infuse only 75% of bolus value at once and the rest after increase of BG.
3.3. Concept of predictive algorithm work principles
General concept of predictive algorithm operation is represented by the flowchart (Figure 10).
3.4. Experimental tests
Algorithm was approbated using BG tracks from DirecNet database.
Algorithm successfully detected cases of meal data absence. In the case further data input and algorithm operation were impossible to perform. As all tests were performed under the medical supervision, DirecNet protocols have no data about possible insulin infusion system failure.
However, measured BG tracks had many spikes. Results of such kind of error elimination are represented in Table 2.
|Correct||1102 (96.3%)||42 (3.7%)|
|Error||4 (2.5%)||152 (97.5%)|
Algorithm corrected 97.5% of BG monitor errors. Meanwhile only 3.7% of correct BG monitor data was detected as errors. Generally, measurements were taken as errors in the ranges of BG sharp ascent and descent due to food intake or insulin infusion, respectively. That is explained by high track differential. Having that, little variations of delays in food uptake and in insulin infusion lead to significant difference of predicted and real BG values. Uncorrected errors of BG appeared, when spikes had deviated toward the predicted track and then had fallen into algorithm’s correct values zone. Along with real errors of BG monitor, the synthetic errors were included in tracks. Approbation of the algorithm confirmed its sensibility to mentioned situations; however, they rarely happen in practice.
4. Results and discussion
Sigma model rather accurately describes BG dynamics in patients with diabetes mellitus. For initial model approbation, only food intake and insulin injection data were taken into account. Other factors affecting BG dynamics can be included in the model after additional research. In this case, more precise clinical data will be needed for mathematic model approbation. Nevertheless, the advantage of sigma model is that it does not require a lot of physiological parameters of patient and can be used for BG prediction as is.
Described model approbation shows that RMSE of Bennett-Gourley model is 18.21 mg/dl. In spite of its simplicity, sigma model has the lowest RMSE among all tested models—15.7 mg/dl. This model contains no differential equations and requires minimal computing power in “artificial pancreas” technical embodiment.
Developed predictive algorithm is based on the sigma model. The algorithm estimates the difference between theoretical and experimental tracks with possibility of further correction. BG prediction algorithm is needed for detection of incorrect measurements and correction spikes on BG track. That allows patient to avoid incorrect insulin infusion or glucose intake and reduce possible risks.
Moreover, the algorithm alerts about closed-loop BG control system failures. It allows patient to detect damage or cross clamping of insulin pump infusion set and actualize meal data. Meanwhile patient at his own risk can continue system operation.
The algorithm allows making glucometer-insulin pump system automatic and its work more physiological. Due to insulin doses and injection time calculation, it is infused in advance (before patient BG ascent). Automatic system avoids errors when patient calculates insulin doses and injects it himself.
The algorithm was tested using 52 tracks with full information about the patient’s schedule of food intake, insulin injections, etc. Thus, the algorithm suggested in this work makes it possible to avoid 97.5% cases of incorrect operation of the BG monitor. In this case, the RMSE of the calculated blood glucose concentration values was 11.06 mg/dl.
This work was supported by the Russian Ministry of Education and Science. Project number 14.578.21.0186. Identifier of the project RFMEFI57816X0186.
Cobelli C., Renard E., Kovatchev B. Artificial Pancreas: Past, Present, Future. Diabetes. 2011; 60(11):2672–2682. DOI: 10.2337/db11-0654
Helton K.L., Ratner B.D., Wisniewski N.A. Biomechanics of the Sensor-Tissue Interface-Effects of Motion, Pressure and Design on Sensor Performance and Foreign Body Response-Part II: Examples and Application. Junior Diabetes Science Technology. 2011; 5(3):632–646. DOI: 10.1177/193229681100500317
Bergman R.N. Toward Physiological Understanding of Glucose Tolerance: Minimal-Model Approach. Diabetes. 1989; 38(12):1512–1527. DOI: 10.2337/diab.38.12.1512
Derouich M., Boutayeb A. The Effect of Physical Exercise on the Dynamics of Glucose and Insulin. Journal of Biomechanics. 2002; 35(7):911–917. DOI: 10.1016/S0021-9290(02)00055-6
DeGaetano A., Arino O. Mathematical Modelling of the Intravenous Glucose Tolerance Test. Journal of Mathematical Biology. 2000; 40(2):136–168. DOI: 10.1007/s002850050007
Sturis J., Polonsky K.S., Mosekilde E., Van Cauter E. Computer Model for Mechanisms Underlying Ultradian Oscillations of Insulin and Glucose. American Journal of Physiology. 1991; 260(5):E801–E809.
Engelborghs K., Lemaire V., Belair J., Roose D. Numerical Bifurcation Analysis of Delay Differential Equations Arising from Physiological Modelling. Journal of Mathematical Biology. 2001; 42(4):361–385. DOI: 10.1007/s002850000072
Bennett D.L., Gourley S.A. Asymptotic Properties of a Delay Differential Equation Model for the Interaction of Glucose with the Plasma and Interstitial Insulin. Applied Mathematics and Computation. 2004; 151(1):189–207. DOI: 10.1016/S0096-3003(03)00332-1
Bazaev N.A., Pozhar K.V., Rudenko P.A. Mathematical Modeling of Blood Glucose Concentration Dynamics. Biomedical Engineering. 2015; 48(6):292–296. DOI: 10.1007/s10527-015-9472-3
Ruedy K.J., Beck R.W., Xing D., Kollman C. Diabetes Research in Children Network: Availability of Protocol Data Sets. Journal of Diabetes Science and Technology. 2007; 1(5):38–745. DOI: 10.1177/193229680700100519
Diabetes Research in Children Network (DirecNet) Study Group. The Accuracy of the CGMS™ in Children with Type 1 Diabetes: Results of the Diabetes Research in Children Network (DirecNet) Accuracy Study. Diabetes Technology & Therapeutics. 2003; 5(5):781–789. DOI: 10.1089/152091503322526987
Diabetes Research in Children Network (DirecNet) Study Group. The Accuracy of the GlucoWatch® G2™ Biographer in Children with Type 1 Diabetes: Results of the Diabetes Research in Children Network (DirecNet) Accuracy Study. Diabetes Technology & Therapeutics. 2003; 5(5):791–800. DOI: 10.1089/152091503322526996
Diabetes Research in Children Network (DirecNet) Study Group. A Multicenter Study of the Accuracy of the One Touch Ultra Home Glucose Meter in Children with Type 1 Diabetes. Diabetes Technology & Therapeutics. 2003; 5(6):933–941. DOI: 10.1089/152091503322640971
Diabetes Research in Children Network (DirecNet) Study Group. The Effects of Aerobic Exercise on Glucose and Counterregulatory Hormone Concentrations in Children with Type 1 Diabetes. Diabetes Care. 2006; 29(1):20–25. DOI: 10.2337/diacare.29.01.06.dc05-1192
Diabetes Research in Children Network (DirecNet) Study Group. Continuous Glucose Monitoring in Children with Type 1 Diabetes. The Journal of Pediatrics. 2007; 151(4):388–393. DOI: 10.1016/j.jpeds.2007.03.047
Diabetes Research in Children Network (DirecNet) Study Group. FreeStyle Navigator Continuous Glucose Monitoring System Use in Children with Type 1 Diabetes Using Glargine-Based Multiple Daily Dose Regimens: Results of a Pilot Tria. Diabetes Care. 2008; 31(3):525–527.
Diabetes Research in Children Network (DirecNet) Study Group. Relationship of A1C to Glucose Concentrations in Children with Type 1 Diabetes: Assessments by High-Frequency Glucose Determinations by Sensors. Diabetes Care. 2008; 31(3):381–385. DOI: 10.2337/dc07-1835
Diabetes Research in Children Network (DirecNet) Study Group. Accuracy of Newer-Generation Home Blood Glucose Meters in a Diabetes Research in Children Network (DirecNet) Inpatient Exercise Study. Diabetes Technology & Therapeutics. 2005; 7(5):675–680. DOI: 10.1089/dia.2005.7.675
Diabetes Research in Children Network (DirecNet) Study Group. Impact of Exercise on Overnight Glycemic Control in Children with Type 1 Diabetes Mellitus. The Journal of Pediatrics. 2005; 147(4):528–534. DOI: 10.1016/j.jpeds.2005.04.065
Diabetes Research in Children Network (DirecNet) Study Group. Prevention of Hypoglycemia During Exercise in Children with Type 1 Diabetes by Suspending Basal Insulin. Diabetes Care. 2006; 29(10):2200–2204. DOI: 10.2337/dc06-0495
Tolic I.M., Mosekilde E., Sturis J. Modeling the Insulin–Glucose Feedback System: The Significance of Pulsatile Insulin Secretion. Journal of Theoretical Biology. 2000; 207(3):361–375. DOI: 10.1006/jtbi.2000.2180
Bazaev N.A., Pozhar K.V., Pletenev A.N. Classification of Factors Affecting Blood Glucose Concentration Dynamics. Biomedical Engineering. 2013; 47(2):100–103.
Bazaev N.A., Pozhar K.V., Pletenev A.N. An Algorithm for Short-Term Prediction of Blood Glucose Concentration. Biomedical Engineering. 2014; 47(6):312–314.
Pickup J.C., Renard E. Long-Acting Insulin Analogs versus Insulin Pump Therapy for the Treatment of Type 1 and Type 2 Diabetes. Diabetes Care. 2008; 31(2):S140–S145. DOI: 10.2337/dc08-s235