<!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>Data Fusion of Activity and CGM for Predicting Blood Glucose Levels*</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Hoda Nemat</string-name>
          <email>hoda.nemat@sheffield.ac.uk</email>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Heydar Khadem</string-name>
          <email>h.khadem@sheffield.ac.uk</email>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Jackie Elliott</string-name>
          <email>j.elliott@sheffield.ac.uk</email>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Mohammed Benaissa</string-name>
          <email>m.benaissa@sheffiels.ac.uk</email>
        </contrib>
      </contrib-group>
      <abstract>
        <p>2 This work suggests two methods-both relying on stacked regression and data fusion of CGM and activity-to predict the blood glucose level of patients with type 1 diabetes. Method 1 uses histories of CGM data appended with the average of activity data in the same histories to train three base regressions: a multilayer perceptron, a long short- term memory, and a partial least squares regression. In Method 2, histories of CGM and activity data are used separately to train the same base regressions. In both methods, the predictions from the base regressions are used as features to create a combined model. This model is then used to make the final predictions. The results obtained show the effectiveness of both methods. Method 1 provides slightly better results.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>INTRODUCTION</title>
      <p>
        The literature emphasises the importance of the management of type
1 diabetes mellitus (T1DM) in reducing complications associated
with the disease [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ], [2]. The key role in T1DM management is to
control blood glucose level (BGL) to remain in a normal range [3],
[4].
      </p>
      <p>
        The prediction of BGL from current and past information can be
a useful contributor [
        <xref ref-type="bibr" rid="ref7">5</xref>
        ]. BGL prediction could provide early
warnings concerning inadequate glycaemic control to prevent the
occurrence of an adverse glycemic status [6], [7].
      </p>
      <p>
        BGL prediction models could be classified into three main
groups: physiological models, data-driven models, and hybrid
models. Data-driven models explain the relationship between the
present and past information to BGL prediction. In this regard,
machine learning and time series approaches have been widely used
[
        <xref ref-type="bibr" rid="ref7">5</xref>
        ].
      </p>
      <p>Many studies have proposed data-driven BGL prediction
methodologies. Mirshekarian et al. [8], Bertachi et al. [9],
Martinsson et al. [10], Zhu et al. [11] and Xie et al. [12] in separate
studies, developed prediction models to forecast BGL with a
prediction horizon of up to 60 minutes.</p>
      <p>Mirshekarian’s model was based on a recursive neural network
(RNN), which utilised long short- term memory (LSTM) units.
CGM, insulin, meal, and activity information were inputs of their
model. Bertachi used physiological models of insulin, carbohydrate,
and activity on board to train an artificial neural network (ANN).
Martinsson proposed an RNN model trained on historical blood
glucose information to predict BGL in two horizons of 30 and 60
minutes. Zhu generated a dilated deep convolutional neural network
fed by CGM, insulin, and carbohydrate intake as inputs. Xie applied
an autoregression with exogenous inputs approach to predict BGL
by exploiting current and past information of CGM data.</p>
      <p>Physical activity is a critical factor in diabetes management.
Therefore, investigation of the activity data in BGL prediction
models is encouraged [13]. However, developing models with high
accuracy using activity and CGM data is challenging, and limited
studies have been done in this area. Data fusion of activity and CGM
data normally result in models with a performance not comparable
with those using CGM alone.</p>
      <p>This paper proposes two novel CGM and activity data fusion
methods to generate BGL prediction models with performance
comparable with those using CGM data alone.
2</p>
    </sec>
    <sec id="sec-2">
      <title>DATASET</title>
      <p>To develop BGL prediction algorithms, we used the OhioT1DM
dataset [14]. The dataset contains eight weeks’ worth data of 12
people with T1DM. The data of six patients was released in 2018 for
the first BGL prediction challenge [15] and data for additional six
patients (referred by ID 540, 544, 552, 567, 584, and 596) was
released for the second BGL prediction challenge in 2020 [14]. In
this work, we used the data of the latter six patients.</p>
      <p>The dataset includes data of CGM sensor, physical activity band,
physiological sensor, and self-reported life-event. Among the
different collected data, we explored CGM and activity data which
were collected every 5 and 1 minutes, respectively. Detailed
information about the sensors and devices as well as characteristics
of the patients has been published [14], [15].</p>
      <p>In the dataset, there are three types of activity data consisting of
galvanic skin response, skin temperature, and magnitude of
acceleration. In this work, we only used the data of the magnitude of
acceleration. Hereafter, for simplicity, ‘magnitude of acceleration’
is referred to as ‘activity’.
3</p>
    </sec>
    <sec id="sec-3">
      <title>METHODOLOGY</title>
      <p>This section presents the information about data preprocessing and
the methodologies developed for the prediction of BGL.
hidden layers used ReLU as the activation function. Mean squared
error was the loss function, Adam was the optimiser. The model
trained with 100 epochs with a learning rate of 0.01.</p>
      <sec id="sec-3-1">
        <title>Partial least squares regression (PLSR)</title>
        <p>PLSR carries considerable popularity in different applications, such
as glucose sensing [18]. In this work, PLSR was applied as a
regression tool. Different values were considered for the number of
components—ranging from one to the length of the input window.
Each time, the predicted residual sum of squares (
  ) was
calculated as follows.</p>
        <p>=1
=
∑( −  ̂ )2
(1)
value, and  ̂ is the predicted value.</p>
        <p>Where, N is the size of the evaluation set, and   is the reference
The number of components ( ) resulting in the minimum value
/( −  − 1) is then selected [19].</p>
      </sec>
      <sec id="sec-3-2">
        <title>Stacked regression</title>
        <p>Stacked regression is applied to enhance the performance of BGL
prediction [20]. This technique uses predictions from a number of
models—first-level models—as features to train a new model—
second-level model. In this work, a stacked regression structure was
employed where the three base regressions mentioned in 2.3.1 were
set as its first-level models and a PLSR as the second-level model
(Figure 1).
3.1</p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>Preprocessing</title>
      <p>Missing data in the training set is imputed using linear interpolation.
For the testing set, on the other hand, linear extrapolation is used.
This is to assure that future data is not seen by the model, and that
the model can be used for a real-time application. Thus, we convert
CGM and activity data to regular time series without any missing
data in 5-minute and 1-minute intervals, respectively.</p>
      <p>The next step was to unify the resolution of CGM and activity
data. To do so, we downsampled the activity time series data to
5minute intervals by capturing the nearest activity data to each CGM
data and discarding the rest.</p>
      <p>There were a considerable number of unavailable activity data at
the beginning and/or end of training and/or test set. This was due to
the difference in wear time of CGM and activity sensors. For these
points average of activity data in the training set is used rather than
linear interpolation or extrapolation. Table 1 shows the number of
unavailable activity data for each patient ID.
fully-connected layer with 100 nodes and an output layer. Both
horizon, two histories of 30 and 60 minutes were tried for training
producing six first-level models rather than three.
[14]. To train and evaluation purposes, we used the training and</p>
      <p>,  ̂ , and N have the same meaning as in (1).
4</p>
    </sec>
    <sec id="sec-5">
      <title>RESULTS AND DISCUSSION</title>
      <p>In this section, the results of RMSE and MAE for prediction
testing sets, respectively. Extrapolated data and, the first 60 minutes
models are provided for both prediction horizons of 30 and 60
of the test set was excluded when calculating the evaluation metrics.
minutes.</p>
      <p>Models
with a performance dependent on random
The latter is because the testing set starts immediately after the
initialisation ran five times, and the mean and standard deviation of
training set, and they are chronologically close to each other.
results are reported. We have used the acronym PH for the prediction
Summarised statistics of the testing set for each patient is given in
horizon in the tables.
|  −  ̂ |</p>
      <p>PH: 30 min</p>
      <p>PH: 60 min</p>
      <p>RMSE
21.19 ± 0.07
17.40 ± 0.08
16.25 ± 0.07
20.40 ± 0.07
21.54 ± 0.06
17.17 ± 0.10</p>
    </sec>
    <sec id="sec-6">
      <title>SUMMARY AND CONCLUSION</title>
      <p>This work contributes to the prediction of BGL by proposing two
methodologies for data fusion of CGM and activity using stacked
regression.</p>
      <p>In the first method, the average value of activity data added to a
window of CGM data was used as input to train prediction models.
Initially, three base regression models consist of MLP, LSTM, and
PLSR were trained. Subsequently, predictions from these base
models were used as features to train a new PLSR model which then
made final predictions.</p>
      <p>In the second method, the same base regressions were trained
once using windows of activity data and once using CGM data. The
predictions of all trained base models were then fed as features to a
new PLSR model for its training process. The new PLSR was used
to make refined predictions.</p>
      <p>The results obtained show that Method 1 (average value of
activity data added to the window of CGM data) had a slightly better
performance than Method 2 (first-level models trained twice, once
with a history of CGM data, once using a history of activity data). In
overall, Method 1 using a history of 30 minutes had the best results
by providing a RMSE of 18.99 and 33.39 for the prediction horizon
of 30 minutes and 60 minutes, respectively.
6</p>
    </sec>
    <sec id="sec-7">
      <title>SOFTWARE AND CODE</title>
      <p>To implement the models, we used Python 3.6, TensorFlow 1.15.0
and Keras 2.2.5. Also, Pandas, NumPy and Sklearn packages of
python were used. The codes were run on a commodity laptop. The
codes of our implementation are available at:
https://gitlab.com/Hoda-Nemat/data-fusionstacking.git</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          <source>[1] [2] [3] [4]</source>
          [5]
          <string-name>
            <given-names>G. S.</given-names>
            <surname>Jeha</surname>
          </string-name>
          et al., “
          <article-title>Continuous glucose monitoring and the reality of metabolic control in preschool children with type 1 diabetes,” Diabetes Care</article-title>
          , vol.
          <volume>27</volume>
          , no.
          <issue>12</issue>
          , pp.
          <fpage>2881</fpage>
          -
          <lpage>2886</lpage>
          ,
          <year>2004</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          <string-name>
            <given-names>L. S.</given-names>
            <surname>Schilling</surname>
          </string-name>
          et al.,
          <article-title>“A new self-report measure of selfmanagement of type 1 diabetes for adolescents</article-title>
          ,
          <source>” Nurs. Res.</source>
          , vol.
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          58, no.
          <issue>4</issue>
          , p.
          <fpage>228</fpage>
          ,
          <year>2009</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          <string-name>
            <given-names>E. R.</given-names>
            <surname>Seaquist</surname>
          </string-name>
          et al.,
          <article-title>“Hypoglycemia and diabetes: A report of a workgroup of the american diabetes association and the endocrine society</article-title>
          ,” J.
          <string-name>
            <surname>Clin</surname>
          </string-name>
          . Endocrinol. Metab., vol.
          <volume>98</volume>
          , no.
          <issue>5</issue>
          , pp.
          <fpage>1845</fpage>
          -
          <lpage>1859</lpage>
          ,
          <year>2013</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          <string-name>
            <surname>Technol.</surname>
          </string-name>
          , vol.
          <volume>5</volume>
          , no.
          <issue>6</issue>
          , pp.
          <fpage>1572</fpage>
          -
          <lpage>1583</lpage>
          ,
          <year>2011</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          <string-name>
            <given-names>A. Z.</given-names>
            <surname>Woldaregay</surname>
          </string-name>
          , E. Årsand,
          <string-name>
            <given-names>T.</given-names>
            <surname>Botsis</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Albers</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Mamykina</surname>
          </string-name>
          , and G. Hartvigsen, “
          <article-title>Data-driven blood glucose pattern classification and anomalies detection: machine-learning applications in type 1 diabetes,”</article-title>
          <string-name>
            <given-names>J.</given-names>
            <surname>Med</surname>
          </string-name>
          . Internet Res., vol.
          <volume>21</volume>
          , no.
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          5, p.
          <fpage>e11030</fpage>
          ,
          <year>2019</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          <string-name>
            <given-names>J.</given-names>
            <surname>Vehí</surname>
          </string-name>
          , I. Contreras,
          <string-name>
            <given-names>S.</given-names>
            <surname>Oviedo</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Biagi</surname>
          </string-name>
          ,
          <article-title>and</article-title>
          <string-name>
            <given-names>A.</given-names>
            <surname>Bertachi</surname>
          </string-name>
          , “
          <article-title>Prediction and prevention of hypoglycaemic events in type-1 diabetic patients using machine learning,” Health Informatics J</article-title>
          ., p.
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          <string-name>
            <given-names>C.</given-names>
            <surname>Berra</surname>
          </string-name>
          et al.,
          <article-title>“Hypoglycemia and hyperglycemia are risk factors for falls in the hospital population,” Acta Diabetol</article-title>
          ., vol.
          <volume>56</volume>
          , no.
          <issue>8</issue>
          , pp.
          <fpage>931</fpage>
          -
          <lpage>938</lpage>
          ,
          <year>2019</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          <string-name>
            <given-names>S.</given-names>
            <surname>Mirshekarian</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Bunescu</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Marling</surname>
          </string-name>
          , and
          <string-name>
            <given-names>F.</given-names>
            <surname>Schwartz</surname>
          </string-name>
          , “
          <article-title>Using LSTMs to learn physiological models of blood glucose behavior</article-title>
          ,
          <source>” Proc. Annu. Int. Conf. IEEE Eng. Med. Biol. Soc. EMBS</source>
          , pp.
          <fpage>2887</fpage>
          -
          <lpage>2891</lpage>
          ,
          <year>2017</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          <string-name>
            <given-names>A.</given-names>
            <surname>Bertachi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Biagi</surname>
          </string-name>
          , I. Contreras,
          <string-name>
            <given-names>N.</given-names>
            <surname>Luo</surname>
          </string-name>
          , and
          <string-name>
            <given-names>J.</given-names>
            <surname>Vehí</surname>
          </string-name>
          , “
          <source>Prediction of Blood Glucose Levels And Nocturnal Hypoglycemia Using Physiological Models and Artificial Neural Networks.,” in 3rd International Workshop on Knowledge Discovery in Healthcare Data</source>
          ,
          <year>2018</year>
          , pp.
          <fpage>85</fpage>
          -
          <lpage>90</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          <string-name>
            <given-names>J.</given-names>
            <surname>Martinsson</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Schliep</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Eliasson</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Meijner</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Persson</surname>
          </string-name>
          , and
          <string-name>
            <given-names>O.</given-names>
            <surname>Mogren</surname>
          </string-name>
          , “
          <article-title>Automatic blood glucose prediction with confidence using recurrent neural networks</article-title>
          ,
          <source>” 3rd Int. Work. Knowl. Discov.</source>
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          <string-name>
            <surname>Healthc</surname>
          </string-name>
          . Data, vol.
          <volume>2148</volume>
          , pp.
          <fpage>64</fpage>
          -
          <lpage>68</lpage>
          ,
          <year>2018</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          <string-name>
            <given-names>T.</given-names>
            <surname>Zhu</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K.</given-names>
            <surname>Li</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Herrero</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Chen</surname>
          </string-name>
          , and
          <string-name>
            <given-names>P.</given-names>
            <surname>Georgiou</surname>
          </string-name>
          , “
          <article-title>A Deep Learning Algorithm for Personalized Blood Glucose Prediction</article-title>
          .,
          <source>” in 3rd International Workshop on Knowledge Discovery in Healthcare Data</source>
          ,
          <year>2018</year>
          , pp.
          <fpage>64</fpage>
          -
          <lpage>78</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          <string-name>
            <given-names>J.</given-names>
            <surname>Xie</surname>
          </string-name>
          and
          <string-name>
            <given-names>Q.</given-names>
            <surname>Wang</surname>
          </string-name>
          , “
          <article-title>Benchmark Machine Learning Approaches with Classical Time Series Approaches on the Blood Glucose Level Prediction Challenge</article-title>
          .,
          <source>” in 3rd International Workshop on Knowledge Discovery in Healthcare Data</source>
          ,
          <year>2018</year>
          , pp.
          <fpage>97</fpage>
          -
          <lpage>102</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          <string-name>
            <surname>M. H. Jensen</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          <string-name>
            <surname>Dethlefsen</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          <string-name>
            <surname>Vestergaard</surname>
            , and
            <given-names>O.</given-names>
          </string-name>
          <string-name>
            <surname>Hejlesen</surname>
          </string-name>
          , “
          <article-title>Prediction of Nocturnal Hypoglycemia From Continuous Glucose Monitoring Data in People With Type 1 Diabetes: A Proof-</article-title>
          ofConcept Study,”
          <source>J. Diabetes Sci. Technol</source>
          ., vol.
          <volume>14</volume>
          , no.
          <issue>2</issue>
          , pp.
          <fpage>250</fpage>
          -
          <lpage>256</lpage>
          ,
          <year>2020</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref17">
        <mixed-citation>
          <string-name>
            <given-names>C.</given-names>
            <surname>Marling</surname>
          </string-name>
          and
          <string-name>
            <given-names>R.</given-names>
            <surname>Bunescu</surname>
          </string-name>
          , “
          <source>The OhioT1DM Dataset for Blood Glucose Level Prediction: Update</source>
          <year>2020</year>
          ,” in
          <source>5th International Workshop on Knowledge Discovery in Healthcare Data</source>
          ,
          <year>2020</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref18">
        <mixed-citation>
          <string-name>
            <given-names>C.</given-names>
            <surname>Marling</surname>
          </string-name>
          and
          <string-name>
            <given-names>R. C.</given-names>
            <surname>Bunescu</surname>
          </string-name>
          , “
          <article-title>The OhioT1DM Dataset For Blood Glucose Level Prediction</article-title>
          .,
          <source>” in 3rd International Workshop on Knowledge Discovery in Healthcare Data</source>
          ,
          <year>2018</year>
          , pp.
          <fpage>60</fpage>
          -
          <lpage>63</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref19">
        <mixed-citation>
          <string-name>
            <given-names>F.</given-names>
            <surname>Murtagh</surname>
          </string-name>
          , “
          <article-title>Multilayer perceptrons for classification and regression</article-title>
          ,” Neurocomputing, vol.
          <volume>2</volume>
          , no.
          <issue>5-6</issue>
          , pp.
          <fpage>183</fpage>
          -
          <lpage>197</lpage>
          ,
          <year>1991</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref20">
        <mixed-citation>
          <string-name>
            <given-names>S.</given-names>
            <surname>Hochreiter</surname>
          </string-name>
          and
          <string-name>
            <given-names>J.</given-names>
            <surname>Schmidhuber</surname>
          </string-name>
          ,
          <article-title>“Long short-term memory,” Neural Comput</article-title>
          ., vol.
          <volume>9</volume>
          , no.
          <issue>8</issue>
          , pp.
          <fpage>1735</fpage>
          -
          <lpage>1780</lpage>
          ,
          <year>1997</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref21">
        <mixed-citation>
          <string-name>
            <given-names>H.</given-names>
            <surname>Khadem</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M. R.</given-names>
            <surname>Eissa</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H.</given-names>
            <surname>Nemat</surname>
          </string-name>
          ,
          <string-name>
            <given-names>O.</given-names>
            <surname>Alrezj</surname>
          </string-name>
          , and
          <string-name>
            <given-names>M.</given-names>
            <surname>Benaissa</surname>
          </string-name>
          , “
          <article-title>Classification before regression for improving the accuracy of glucose quantification using absorption spectroscopy</article-title>
          ,
          <source>” Talanta</source>
          , vol.
          <volume>211</volume>
          ,
          <year>2020</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref22">
        <mixed-citation>
          <string-name>
            <given-names>S.</given-names>
            <surname>Wold</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Sjöström</surname>
          </string-name>
          , and L. Eriksson, “
          <article-title>PLS-regression: a basic tool of chemometrics,” Chemom</article-title>
          . Intell. Lab. Syst., vol.
          <volume>58</volume>
          , no.
          <issue>2</issue>
          , pp.
          <fpage>109</fpage>
          -
          <lpage>130</lpage>
          ,
          <year>2001</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref23">
        <mixed-citation>
          <string-name>
            <given-names>L.</given-names>
            <surname>Breiman</surname>
          </string-name>
          , “Stacked regressions,” Mach. Learn., vol.
          <volume>24</volume>
          , no.
          <issue>1</issue>
          , pp.
          <fpage>49</fpage>
          -
          <lpage>64</lpage>
          ,
          <year>1996</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>