<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>A Deep Learning Approach for Blood Glucose Prediction of Type 1 Diabetes</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Jonas Freiburghaus</string-name>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>HES-SO University of Applied Sciences and Arts of Western Switzerland</institution>
        </aff>
      </contrib-group>
      <abstract>
        <p>An essential part of this work is to provide a data-driven model for predicting blood glucose levels that will help to warn the person with type 1 diabetes about a potential hypo- or hyperglycemic event in an easy-to-manage and discreet way. In this work, we apply a convolutional recurrent neural network on a real dataset of 6 contributors, provided by the University of Ohio [5]. Our model is capable of predicting glucose levels with high precision with a 30minute horizon (RMSE = 17.45 [mg/dL] and MAE = 11.22 [mg/dL]), and RMSE = 33.67 [mg/dL] and MAE = 23.25 [mg/dL] for the 60minute horizon. We believe this precision can greatly impact the long-term health condition as well as the daily management of people with type 1 diabetes.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>INTRODUCTION</title>
      <p>Type 1 diabetes is a disease in which the cells responsible for insulin
production are destroyed. Because insulin is the hormone that
triggers absorption of glucose within the cells, people with diabetes need
to monitor their glucose concentration in the blood and readjust it by
frequent insulin injections, following a well-defined medical
protocol (e.g., once during the day and once before each meal, to keep
blood sugar levels within the normal range). The main challenge in
handling diabetes is the optimization of insulin injections in order
to avoid hypoglycemia and hyperglycemia. This is complicated by
the fact that besides insulin intake and diet, glucose levels are also
affected by several other factors such as physical activity, lifestyle,
mental state, stress, etc. Despite the various accomplishments made
in continuous diabetes monitoring (a.k.a. continuous glucose
monitoring, CGM), such methods remain invasive. Furthermore, they are
only able to provide the glycemic state at a given time, when the
insulin level may already be unacceptable (too high or too low). A
proactive detection could therefore dramatically improve the daily
handling of diabetes by the patients themselves.</p>
      <p>
        This work presents an approach based on deep learning algorithms
for predicting glucose levels in the future (30-minute and 60-minute
horizons). Our work is based on the architecture of a recurrent
neural network (CRNN) from [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ] and proposes certain variants, such as
multi-step predictions, regression model using blood glucose level
data for each person every 5 minutes, and the inclusion of other data
such as basal insulin, bolus insulin, and meal values.
      </p>
      <p>The goal of using a CRNN architecture is twofold. (1)
Convolutional layers act as filters and automatically learn to detect the
features of interest for prediction. They are also particularly convenient
for analyzing time series with little signal processing required. And
(2), recurrent neural network are well-known for the capacity to learn
long-term relationships between the different values. For instance, it
is necessary for the network to be able to capture a correlation
between the ingestion of carbohydrates now and a change in the blood
glucose level in a near future.</p>
      <p>This paper is organized as follows: Section 2 presents related work
for glucose prediction, Section 3 formulates the problem of glucose
prediction and our contribution, Section 4 details our methodology
and discuss experimental results. Finally, in Section 5 we summarize
the importance of our contribution and suggest some future work.
2
Predicting blood glucose levels for diabetes (type 1 or type 2)
using machine learning has gained a lot of attention and has resulted
in several methods and applications being proposed recently. They
are however either based on solely measuring the glucose levels or
the resulting prediction accuracy is not yet high enough to be
considered as a reliable predictor of a potential critical glycemic condition.
Several types of regression algorithms can be used, including SVR,
classic statistical methods such as ARIMA, deep learning neural
networks, or even a naive persistence algorithm, to name a few.</p>
      <p>
        Gu et al. [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ] propose a personalized smartphone-based
noninvasive blood glucose monitoring system that detects abnormal
blood glucose levels events by jointly tracking meal, drug and
insulin intake, as well as physical activity and sleep quality. It
automatically collects daily exercise and sleep quality, and predicts the current
blood glucose level of users, together with manual records of food,
drug and insulin intake. It needs re-calibration using CGM devices
once every three weeks and is based on multi-division deep dynamic
recurrent neural network framework. Plis et al. [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ] propose a solution
that uses a generic physiological model of blood glucose dynamics
to generate features for a SVR model that is trained on contributor
specific data. It is shown that, the model could be used to anticipate
almost a quarter of hypoglycemic events 30 minutes in advance,
however the demonstrated corresponding precision is 42%. Contreras et
al. [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] present an alternative approach to glucose levels prediction,
based on previous studies that incorporated medical knowledge into a
grammar aimed to build expression for glucose that considered
previous glucose values, carbohydrate intake, and insulin administration.
They extend the previous research to investigate a novel and
complementary approach that uses symbolic regression through
grammar evolution to determine an approximate glucose levels and
fluctuations using personalized blood glucose predictive models. In the
same order of topic, we note the work in [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ]. It also contains a
comparison with a prediction using latent variable with exogenous input
(LVX [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ]) model, in this model bolus insulin and meal are included
in the predictor matrix X but in this work only meal information is
added . We can see that the RMSE for a prediction horizon of 60 min
for clinical data, varies from 37.02 to 35.96 [mg/dL]. In [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ], they use
a deep learning architecture for predicting 30-minute and 60-minute
horizons on both real and simulated patients. For real patients and
a 30-minute horizon, they report an RMSE of 21.07 [mg/dL].
However, only a few approaches have used deep learning algorithms for
CGM on clinical data and more specifically for this dataset provided
by the University of Ohio [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ].
3
      </p>
    </sec>
    <sec id="sec-2">
      <title>Glucose Prediction</title>
      <p>The aim of this work is to predict glucose levels in advance in
order to avoid situations of hyperglycemia or hypoglycemia, as well
as others negative effects on the health. For instance, chronic
hyperglycemia may induce fatigue and vision problems among others. For
that purpose, we created a model capable of predicting the glycemia
of type 1 diabetes, where values must be as accurate as possible. In
this context, the metrics are the RMSE and the MAE. The smaller
these values, the more reliable the model. The real gain for a
patient is to be able to make decisions at any given time considering
the prediction of future values, and possibly avoid glycemia-related
discomforts while minimizing intrusive methods.
4
4.1</p>
    </sec>
    <sec id="sec-3">
      <title>METHODOLOGY</title>
    </sec>
    <sec id="sec-4">
      <title>Approach</title>
      <p>Our approach can be summarized by the following steps:
1. Data importation
2. Data preprocessing
3. Implementation of the CRNN prediction model with multi-step
forecasting
4. Training, testing and tuning on selected features
5. Delivery of the forecasted blood glucose levels</p>
      <p>Data importation involves loading, merging, and aligning values
from multiple sources under the same time scale. The selected
features are basal/bolus insulin, carbohydrates, and blood glucose levels.</p>
      <p>In the preprocessing step, all variables must have measurements
carried over at the same time. This requires the use of subsampling
or oversampling methods and, corollary, defining imputing methods.
Linear interpolation is used for the glucose level on the training set
to resample the time series at a frequency of 5 minutes. The others
features may be imputed with null values when required, as their
nature is sparse. We can also use domain-specific functions, such as an
equation describing the absorption rate over time for carbohydrates.
The preprocessing steps are summarized by :
1. Save all the blood glucose timestamps
2. Resample the features to a time delta of 1 second
3. Forward fill the missing values by using the last available values
4. Fill the left missing values with 0
5. Resample the features to a time delta of 5 minutes
6. Smooth each feature with a 1D Gaussian filter over a window
containing the past 2 hours of data</p>
      <p>We use the saved timestamps at preprocessing step 1 to generate
the results at the same timestamps as the measured values.</p>
      <p>Linear interpolation is used during the training process to impute
the missing values. This allows to have more data points for the
model to be trained on. However, we should note that linear
interpolation is not ideal for big gaps of missing values. The interpolation
is not used at test time as it could lead to a data peek. Meaning the
predictions would be contaminated by future values.</p>
      <p>The CRNN model target values are based on the following
equation:
yt+L = bgt+L
bgt; for L = 1; 2; : : : ; 12
(1)
where bgt is the blood glucose value at time t, L is the lag value in
timesteps for the horizon, and y the label to predict, that is the
differentiated value of the blood glucose level.</p>
      <p>For instance, if the blood glucose level is 80 mg=dL at the
current time and 60 mg=dL 30 minutes later, the label for a prediction
horizon of 30 minutes at the current time would be 20 mg=dL.</p>
      <p>Respectively, as the model does not predict directly the blood
glucose level but only the difference from the last known value. The
predicted blood glucose level is obtained with the following
equation:
bbgt+L = bgt + y^t+L; for L = 1; 2; : : : ; 12
(2)
where bgt is the blood glucose value at time t, bbgt+L is the
predicted blood glucose level at time t + L, y^t+L is the predicted
blood glucose level difference at time t with lag L, L is the lag
value in timesteps for the horizon, and y the label to predict.
It is important to note that the CRNN only outputs the values y^t+L.</p>
      <p>The model is capable of giving a prediction for each 5 minutes
prediction horizon up to 60 minutes that is 5, 10, ..., 60 minutes. This
feature may give valuable information to a user and thereby improve
their blood glucose level control. An example of such a prediction is
given in Fig. 5.</p>
      <p>
        The overall architecture of the CRNN is based on [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ] and
described in Fig. 1. The input signals time series are fed into a CNN
for extracting relevant features. The purpose of the pooling layers
is to gradually reduce the spatial dimension while keeping only the
highest values included in the pooling window. Then, these features
are fed into an RNN layer to model the relationships over time.
Finally, a dense neural network is used as a last layer for regressing the
desired target.
      </p>
      <p>
        The training of a model is done on a contributor-basis, that is one
model is trained per contributor. The reason is that each glucose
response is individual, and a one-population model does not seem
reasonable for CGM.
Our results reported in this work are based on the OhioT1DM dataset
[
        <xref ref-type="bibr" rid="ref5">5</xref>
        ]. For each contributor a train set as well as test set are provided.
One model only is pretrained on the data from the 6 contributors of
2018. Then for each 6 data contributor of 2020 transfer learning is
applied, resulting in one trained model per contributor.
      </p>
      <p>The reported results are based on the following signals: glucose
level, basal insulin, bolus insulin, and meal for 6 data contributors
(540, 544, 552, 567, 584, and 596). While more signals were
available, we decided to use only these signals. Indeed, we performed
several tests with the complete dataset and the preliminary results
indicated better results with a limited set of features.</p>
      <p>
        The use of a sliding window consisting of the last 2 hour data,
resulting in 24 data points is based on [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ]. Cross- and/or
autocorrelation may provide a good starting point to find a reasonable
sliding window size. Of course, the computing complexity must be
taken into consideration depending on the targeted deployment
hardware.
4.2.2
      </p>
      <sec id="sec-4-1">
        <title>Architecture and learning process</title>
        <p>The detailed architecture of the CRNN is presented in Table1.</p>
        <p>Layer description
Convolution 1D
Max pooling 1D
Convolution 1D
Max pooling 1D
Convolution 1D
Max pooling 1D
LSTM
Dense
Dense
Dense</p>
        <p>Output dimension
(Batch size, 24, 8)
(Batch size, 12, 8)
(Batch size, 12, 16)
(Batch size, 6, 16)
(Batch size, 6, 32)
(Batch size, 3, 32)
(Batch size, 64)
(Batch size, 256)
(Batch size, 32)
(Batch size, 12)</p>
        <p>The model is pretrained on batches of size 1024 over 1000 epochs,
with an RMSProp optimizer. The learning rate is initially set to 0.001
and is reduced with a factor of 0.1 when the model does not progress
after 3 epochs. Early stopping is used similarly with a patience of
50 epochs in order to regularize the model. The last model’s weights
with the lowest validation loss are then restored.</p>
        <p>For each data contributor of 2020 the pretrained model is loaded
and trained similarly as the pretraining stage. With the only
difference that the learning rate is reduced with a patience of 15 epochs
and that one model is saved for each contributor.
4.2.3</p>
      </sec>
      <sec id="sec-4-2">
        <title>Results</title>
        <p>The RMSE and the MAE are calculated for the six contributors using
the following equations.</p>
        <p>v</p>
        <p>n
RM SE = tuu n1 X(y^i
i=1
yi)2
(3)
where y^i is the predicted value, yi the truth value and n the number
of observation.</p>
        <p>n
M AE = 1 X
n
i=1
jy^i
yij
(4)</p>
        <p>The first observation is the errors systematically increase for each
contributor over time. It is not surprising that the larger the prediction
window, the larger the error in general grown up.</p>
        <p>A comparison between contributors was also performed (Fig. 2
and Fig. 3). As we can see, for example with the contributor 596,
the prediction curve for 30 minutes and 60 minutes follows the real
curve with an RMSE = 13.34 and MAE = 9.08 [mg/dL], and RMSE
= 27.74 and MAE = 19.13 [mg/dL]. These specific curves are also
detailed in Fig. 4.</p>
        <p>The evaluation of the prediction from the contributor-side can be
performed by a multi-step prediction (as illustrated in Fig. 5).
Prediction is made through one forward pass of a horizon of the last 2 hours
data and outputs the horizon for the next hour represented by the
orange curve. In the given example, the model seems to have predicted
well the tendencies.</p>
        <p>
          A comparison of our approach with other algorithms is
summarized in Table 2. We notice that the RMSE of our work at horizon 30
is smallest and at 60 minutes similar to [
          <xref ref-type="bibr" rid="ref3">3</xref>
          ]. Let us highlight that in
(1) the database is different. The persistent algorithm is the baseline
model. It forecasts the blood glucose level by using the last know
value.
        </p>
        <p>y^t+L = bgt 1; for L = 1; 2; : : : ; 12
(5)
Prediction horizon
30
60</p>
        <p>Metrics
(mg/dL)
MAE
RMSE
MAE
RMSE
(1) Li’s CRNN</p>
        <p>NA
21:0:7 2:35</p>
        <p>NA
33:27 4:79
(2) BASELINE
Overall
18:13 0:00
25:76 0:00
30:70 0:00
42:00 0:00
(3) CRNN</p>
        <p>With the hypothesis of a hypo-glycemia starting below 70 mg=dL
and a hyper-glycemia starting above 150 mg=dL, we believe that our
model delivers relevant and actionable results for real patients. In our
opinion, a RMSE of 17:45 mg=dL for a 30-minute horizon indicates
that data-driven decisions could be made in regard to avoiding hypo
or hyper-glycemic related events.
5</p>
      </sec>
    </sec>
    <sec id="sec-5">
      <title>CONCLUSION</title>
      <p>
        In this paper we described a model for predicting future blood sugar
levels of people with type 1 diabetes. A CRNN approach was
proposed with the advantages of using only 4 different signals and very
little signal processing. The evaluation was performed using RMSE
and MAE metrics, with different horizons and on multiple
contributors. The results were compared with different algorithms.The results
report low error rates given the problematic of glucose prediction,
and in our opinion could be considered for real-world
implementation. Yet, several research tracks remain to be explored. For instance,
testing additional features that can influence blood sugar levels such
as stress or illness. We can also think of extracting manual features
from the given signals with signal processing methods, and defining
domain-specific imputation methods, such as for the absorption of
carbohydrates over time. It would be also interesting to further
personalize predictions as suggested in [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ]. Another direction could be
to use reinforcement learning approaches for the insulin
recommendation, such as in [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ].Those self-learning approaches are adaptable
and personalize the daily insulin values to ensure glucose control,
despite inter and intra-patient variability.
      </p>
    </sec>
    <sec id="sec-6">
      <title>ERRATUM</title>
      <p>During the making of the camera ready version, we found an error in
the preprocessing stage thanks to the great reviews. The missing
values were treated using a linear interpolation during the testing of the
model. Thereby the predictions were contaminated by future values.
This error was corrected by removing the interpolation and dealing
with missing values as explained in this paper version.</p>
    </sec>
    <sec id="sec-7">
      <title>Code source</title>
      <p>It is available at https://github.com/JonasFreibur/BLGP-HES-SO</p>
    </sec>
    <sec id="sec-8">
      <title>ACKNOWLEDGEMENTS</title>
      <p>The authors would like to thank the HES-SO for funding this
research.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1] Iva´n Contreras, Silvia Oviedo, Martina Vettoretti, Roberto Visentin, and Josep Veh´ı, '
          <article-title>Personalized blood glucose prediction: A hybrid approach using grammatical evolution and physiological models</article-title>
          .',
          <source>PloS one 12.11</source>
          , (
          <year>2017</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>Weixi</given-names>
            <surname>Gu</surname>
          </string-name>
          , Yuxun Zhou, Zimu Zhou, Xi Liu, Han Zou, Pei Zhang, Costas J Spanos, and Lin Zhang, 'Sugarmate:
          <article-title>Non-intrusive blood glucose monitoring with smartphones</article-title>
          .
          <source>', Proc. ACM Interact. Mob. Wearable Ubiquitous Technol</source>
          , (
          <year>2017</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>Kezhi</given-names>
            <surname>Li</surname>
          </string-name>
          , John Daniels, Chengyuan Liu,
          <article-title>Pau Herrero-Vinas, and Panteli Georgiou, 'Convolutional recurrent neural networks for glucose prediction</article-title>
          .',
          <source>EEE journal of biomedical and health informatics</source>
          , (
          <year>2019</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>Chengyuan</given-names>
            <surname>Liu</surname>
          </string-name>
          , Josep Vehi, Nick Oliver, Pantelis Georgiou, and Pau Herrero, '
          <article-title>Enhancing blood glucose prediction with meal absorption and physical exercise information</article-title>
          .', arXiv preprint arXiv:
          <year>1901</year>
          .
          <volume>07467</volume>
          , (
          <year>2018</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <surname>Razvan</surname>
            <given-names>C. MARLING</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Cindy et</surname>
            <given-names>BUNESCU</given-names>
          </string-name>
          , '
          <article-title>The ohiot1dm dataset for blood glucose level prediction</article-title>
          .', KHD@ IJCAI, (update
          <year>2020</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>Kevin</given-names>
            <surname>Plis</surname>
          </string-name>
          , Razvan Bunescu, Cindy Marling, Jay Shubrook, and Frank Schwartz,
          <string-name>
            <surname>'</surname>
          </string-name>
          <article-title>A machine learning approach to predicting blood glucose levels for diabetes management</article-title>
          .
          <source>in proceedings of aaai workshop on modern artificial intelligence for health analytics.'</source>
          , AAAI Press,
          <fpage>35</fpage>
          -
          <lpage>39</lpage>
          , (
          <year>2014</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>Qingnan</given-names>
            <surname>Sun</surname>
          </string-name>
          , Marko V Jankovic, Joa˜o Budzinski,
          <string-name>
            <surname>Brett Moore</surname>
            ,
            <given-names>Peter</given-names>
          </string-name>
          <string-name>
            <surname>Diem</surname>
          </string-name>
          , Christoph Stettler, and Stavroula G Mougiakakou,
          <article-title>'A dual mode adaptive basal-bolus advisor based on reinforcement learning</article-title>
          .',
          <source>IEEE journal of biomedical and health informatics</source>
          ,
          <volume>23</volume>
          (
          <issue>6</issue>
          ),
          <fpage>2633</fpage>
          -
          <lpage>2641</lpage>
          , (
          <year>2018</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>Qingnan</given-names>
            <surname>Sun</surname>
          </string-name>
          , Marko V Jankovic, and Stavroula G Mougiakakou,
          <article-title>'Reinforcement learning-based adaptive insulin advisor for individuals with type 1 diabetes patients under multiple daily injections therapy'</article-title>
          ,
          <source>in 2019 41st Annual International Conference of the IEEE Engineering in Medicine and Biology Society (EMBC)</source>
          , pp.
          <fpage>3609</fpage>
          -
          <lpage>3612</lpage>
          . IEEE, (
          <year>2019</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>Chunhui</given-names>
            <surname>Zhao</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Eyal</given-names>
            <surname>Dassau</surname>
          </string-name>
          ,
          <string-name>
            <surname>Lois</surname>
            <given-names>Jovanovicˇ</given-names>
          </string-name>
          , Howard C Zisser,
          <string-name>
            <surname>Francis J Doyle</surname>
            <given-names>III</given-names>
          </string-name>
          , and Dale E Seborg, '
          <article-title>Predicting subcutaneous glucose concentration using a latent-variable-based statistical method for type 1 diabetes mellitus'</article-title>
          ,
          <source>Journal of diabetes science and technology</source>
          ,
          <volume>6</volume>
          (
          <issue>3</issue>
          ),
          <fpage>617</fpage>
          -
          <lpage>633</lpage>
          , (
          <year>2012</year>
          ).
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>