Blood Glucose Prediction Model Based on Prophet and Temporal Convolutional Networks
2022-08-28RongXiaoJingChenLeiWangWeiLiu
Rong Xiao, Jing Chen, Lei Wang, Wei Liu
Abstract: Diabetes, as a chronic disease, is caused by the increase of blood glucose concentration due to pancreatic insulin production failure or insulin resistance in the body. Predicting the change trend of blood glucose level in advance brings convenience for prompt treatment, so as to maintain blood glucose level within the recommended levels. Based on the flash glucose monitoring data, we propose a method that combines prophet with temporal convolutional networks (TCN) to achieve good experimental results in predicting patient blood glucose. The proposed model achieves high accuracy in the long-term and short-term prediction of blood glucose, and outperforms other models on the adaptability to non-stationary and detection capability of periodic changes.
Keywords: blood glucose; temporal convolutional networks(TCN); seasonal decomposition
1 Introduction
Diabetes is a chronic illness characterized by the absence of glucose homeostasis. According to statistics, there are nearly 34.7 million diabetics in the world [1]. Recently, advances in sensor technologies have allowed patients to measure the glucose concentration with the help of continuous glucose monitoring (CGM) devices [2].With the help of prediction models, it is possible to forecast future blood glucose and generate alerts if hypoglycemia or hyperglycemia is in danger of occurring. Furthermore, the artificial pancreas can effectively control and stabilize the blood glucose level of patients, and blood glucose prediction is the key to its improved control performance [3].
Blood glucose prediction is mainly divided into two categories: model-driven prediction and data-driven prediction. The best available theoretical compartment models often require identification of model parameters which could be patient dependent. The time-varying, non-linear and non-stationary of patient blood glucose model greatly affect the accuracy of blood glucose prediction [4]. Data-driven models for the prediction of blood glucose levels thus have attracted much interest. Such models utilize information hidden in the input–output data (i.e.from CGM, insulin, meal intake, physical activity, etc.), without a priori knowledge about the relationship between them [5].
Sequential regression is a classical method of physiological data modeling. Lu et al. proposed autoregression and made improvements [2], but the prediction horizon (10 min) was short. Li [4]made use of a similar method and reached the prediction horizon to 30 min. Turksoy et al.introduced linear ARMAX models [6], which were composed of autoregressive (AR), moving average (MA) and external inputs (X). In the study carried out by Yu et al, efficient adaptive kernel filtering algorithms were developed to reduce the computational complexity causing problems in real-time applications [7]. The network topology could be generally categorized as feed-forward networks and feedback networks.Both of these network topologies have been successfully employed in modeling and for the prediction of blood glucose level in diabetes patients.Von et al. and others proposed time-lagged feedforward neural networks trained through a backpropagation gradient descent algorithm [8], which was capable of storing previous values of data within the network. Mhaskar et al. proposed a semi-supervised deep learning neural network with a judge predictor based on the function approximation on data-defined manifolds [3] by using diffusion polynomials. Recurrent or feedback networks have been utilized in blood glucose prediction, such as autoregressive neural networks and self-organizing maps [9]. Daskalaki et al. developed an online adaptive ANN-based model using a fully connected [10], multilayered ANN with two feedback loops trained through a teacher-forced, real-time, recurrent algorithm.Quan et al. developed an autoregressive version of a neural network called neural network autoregressive external input (NNARX) [11], which was trained through an extended Kalman filter(EKF) algorithm.
Recent studies have shown that CNN also has excellent performance on sequence modeling.The most representative one is the temporal convolutional network (TCN) proposed by Bai [12].The structure of the TCN is simple, and has a sufficiently large and flexible receptive field to obtain more distant information in the time series data. Like the traditional CNN, the TCN has the characteristics of parallel computing and convolution kernel sharing, and has the advantages of smaller amount of calculation, faster calculation speed and less memory usage.
In this study, we propose a hybrid approach that integrates the prophet and temporal convolutional networks (TCN) models to forecast blood glucose. The proposed method is termed prophet-TCN. It consists of three major processes: (1) decomposing the blood glucose via Prophet decomposition and obtaining the uncorrelated components, including the trend term,periodic term and residual term. The periodic items are extracted from the whole monitoring data of the subjects, and the trend items and residual items are from the input segments of the prediction model; (2) forecasting trend term and residual term by TCN individually; (3) reconstructing the blood glucose predicted values by integrating the forecasting results and periodic term in the time stamp.
The remainder of this paper is organized as follows: In Section 2, detailed information about the Prophet and neural networks models used in this paper is given. In Section 3, the dataset used in this paper, tables and figures related to the hyper-parameters and evaluation metrics and grids are presented. In the conclusion part, the interpretation of the test results obtained with the proposed method and the comparison with other studies in the literature are given.
2 Methodology
In this section, the basic principles and calculation process of the proposed prophet-TCN model are introduced. Prophet model is a curve fitting algorithm specially designed for predicting univariate time series data. It has excellent adaptability to regular change points, especially strong robustness to missing values, slight fluctuations and a large number of abnormal values. In this method, we use Prophet to extract the characteristics of individual fixed behavior, such as periodic fluctuations of blood glucose concentration.However, Prophet model has no ability to deeply mine features, and its idea is still confined to the traditional time series analysis modeling. At the same time, autocorrelation residuals are not considered by the model, which will lead to under fitting in model training and ignore the stability and adaptability. Therefore, Prophet is not suitable for predicting the long-term and overall change trend of human blood glucose level and the change points with certain randomness. In order to make up for the shortcomings of Prophet model, we utilize TCN to predict the trend and residual components of sequence due to its higher accuracy and stability, as well as the sensitivity to capture the differences within and between individuals. In addition, TCN, as a timedomain convolution network, can achieve better performance than recursive neural network and avoid the common defects of recursive model,such as gradient explosion and disappearance problem or lack of memory retention. Finally, we input the trend term extracted by Prophet into TCN model, and recombine its output with the periodic term extracted by Prophet to obtain the predicted blood glucose level. The structure of model is presented in Fig. 1.
Fig. 1 The procedure of blood glucose prediction based on Prophet-TCN
2.1 Prophet Model
Prophet is a time series prediction algorithm based on time series decomposition and machine learning fitting. It can not only deal with some abnormal values and missing values, but also predict the future trend of time series almost automatically. The input is the known time series with time stamp and the length of the time series to be predicted. The output is the trend of future time series. Prophet decomposes the time series into trend items, periodic items and residual items. For allt≥0, the decomposition of the sequence can be expressed as
The trend term has two important functions,one is based on logistic regression function (nonlinear growth), and the other is based on piecewise linear function (linear growth). The expression of logistic regression function (nonlinear
2.2 Temporal Convolutional Networks
input and output in thel-th layer of the 1D FCN, which can be defined as
Fig. 2 The structure of causal convolution
Fig. 3 The structure of dilated convolution
In general, a generic residual module is employed for feature extraction at each layer in the TCN, the residual block consists of two layers of dilated causal convolution and nonlinearity, where the rectified linear unit (ReLU) is taken as the activation function. In each layer,batch normalization is adopted to the convolutional filters and a spatial dropout is added subsequent to each dilated convolution for regularization. The input data are fed to a 1×1 convolution layer to ensure the output-input width is consistent.
3 Experimental Results and Analysis
3.1 Data Collection and Preprocessing
In this study, our dataset is sourced from Peking University People’s Hospital. All patients were over 13 years old and were undergoing medical nutritional treatment through diet control. In the selection of volunteers, patients with renal failure or liver failure and other serious diseases, or patients without flash glucose monitoring (FGM)for continuous blood glucose monitoring were excluded. The dataset contains real medical data recorded by FGM from 137 diabetes patients.FGM system (freestyle libreh, Abbott, USA)consists of a subcutaneous electrochemical sensor based on glucose oxidase, which can receive, store and wirelessly transmit blood glucose data every 15 min within 7 to 30 consecutive days. All participants underwent physical examination, and their height, weight, blood pressure and a series of blood glucose related indicators were collected for conclusion consistency test. The unit of glucose level is mmol/L. This real-time data improves diabetes management by helping patients to better self-manage their condition.The collected blood glucose data can be used to train a prediction model.
Due to poor device contact or other interruptions, missing values and outliers are inevitable in the clinical data of real diabetes patients.In this study, we used interpolation method to deal with the missing values, and deleted the outliers (Sampling points that are out of the normal range of glucose values) in the FGM data.
Time stamp data is very important for the implementation of Prophet algorithm, but in the actual monitoring, the blood glucose sampling duration of each subject is different and the time stamp data occasionally deviates from normal value. Therefore, we checked the interval of adjacent time stamps in the data preprocessing stage and corrected each sampling interval to 15 min by fine tuning the time stamp data. In addition,in order to ensure that the length of the output sequence is the same as that of the input sequence, we need to resample the original sequence.The training set consists of pairs of subsequences(input sequence and target sequence) with the same length ( leni). The target sequence is a sequence that moves forward a certain length( leno) relative to its respective input sequence.That is, the target sequence with length lenicontains the (leni- leno)-th value of its respective input sequence as the first value, and the ( leno)-th value after the last value of the input sequence as the last value, as shown in Fig. 4.
Fig. 4 The time relationship between input and output
3.2 Performance Evaluation Index
In order to quantify the prediction performance,we used the root mean square error (RMSE) and the sum of squares of the glucose prediction errors (SSGPE) for comparison. These measures were commonly-used in the literature for the prediction of blood glucose levels.
SSGPE is a powerful statistical metric that highlights the discrepancy between the actual data compared to predicted data (original data and an estimation model). In statistics, a small SSGPE indicates a tight fit of the model to the data. It is used generally as an optimal criterion in parameter selection and model selection.Mathematically, the expression of SSGPE is defined as follows
3.3 Parameter Determination
During the experiment, we make the size of the acceptance field of TCN equal to leni, the size of the filterkis 3. We want to ensure that the value of a certain time point of the output sequence completely contains the convolution result of all values before that time point in the input sequence, that is “complete coverage ”.When the size of acceptance field and kernel sizekare fixed, the number of layers required by the traditional extended convolution network increases linearly withkand leni. If leniis large, it needs many layers to achieve “complete coverage”, which will lead to a long time to train a large number of parameters of the model. In addition, too many layers have been shown to lead to degradation problems related to loss function gradients. In order to reduce the number of layers, while maintaining a large receptive field,we use variable dilation coefficient.
The value of dilation coefficientdincreasesexponentially with the increase of layers, we set dilation basebto 2, and the dilation coefficient ofl-th layer isd=bl. In order to achieve full coverage of historical data, the following inequality needs to be satisfied
Fig. 5 The structure of TCN with 6 layers
3.4 Results
Since the clinical dataset of 137 patients is relatively large, the obtained results based on these samples are credible and persuasive due to the diversity and richness of data. Through observation, it is found that when the model acts on the sample with the overall blood glucose within the normal level, the model can still maintain accurate prediction effect even if there are blood glucose fluctuations. However, the model has some delay or difference in predicting the blood glucose level with violent fluctuation. The different distribution characteristics of blood glucose level from different patients affect the accuracy of prediction, but bring better robustness to predict the glucose levels for a population of diabetes patients. On the other hand, a consistent trend can be learnt from a long-term monitoring of the same patient, thus the prediction accuracy of our proposed model can be refined for a specific person with a long-term data.
The comparison of predicted and true values is shown in Fig. 6. Fig. 6(a)-6 (c) are the comparisons of predicted and true blood glucose values for 0.75 day, 1 day and 2 days by Prophet-TCN and LSTM prediction model. It can be seen from Fig. 6 that prediction effect of the Prophet-TCN prediction model is significantly more accurate than LSTM method. Since most of the samples in the model have the characteristics of relatively stable data at night, for the samples that are relatively stable at night,they can basically follow the data trend without error. In addition, it can be seen that the best results can be obtained by using the data of the day before the predicted segment for model training. When there is no nighttime blood sugar in the training data, the predicted blood sugar level is generally about 0.3–1.0 Mmol/L higher than the actual value.
In this experiment, we randomly selected 70% of the data as the training set and the remaining 30% as the test set. To evaluate the predictive performance of our proposed model,TCN model, Prophet model and the LSTM model are also applied for comparison. The prediction performance of the training set and the test set data is shown in Tab. 1 and Tab. 2, it shows that the model has a good effect in the training set, and generally shows a certain robustness, though the performance decreases in the test set, which indicates that the model has high adaptability to the data of different patients.
Tab. 1 Performance comparison of 4 prediction models of the training set
Tab. 2 Performance comparison of 4 prediction models of the test set
Fig. 6 Prophet-TCN predictions at different forecasting horizons: (a) 0.75 day horizon; (b) 1 day horizon; (c) 2 days horizon
4 Conclusion
In this paper, the Prophet method combined with TCN is used to process the time series data of glucose, so as to solve the prediction problem.The FGM data from a total of 137 diabetes patients were used to train and test the model.By analyzing the overall experimental results, we conclude that the Prophet-TCN can achieve better prediction accuracy, especially for a long-time prediction, compared with the other method, and the Prophet-TCN method can catch the sharp changes in the trend of the real glucose values.The model is robust to the different distribution characteristics of blood glucose level from different patients.
However, there are still some deficiencies in this method. The implementation of Prophet model has high requirements for timestamp data,the TCN model built in the experiment has large dilated coefficient and the network structure is not concise enough, which makes the model training time longer.
Therefore, how to build a lightweight model and adapt to the unprocessed data is a difficult problem to be solved in our future work. For future work, we plan to gather more true blood glucose of diabetes mellitus data and train a more accurate prediction model.
杂志排行
Journal of Beijing Institute of Technology的其它文章
- Decision-Making Models Based on Meta-Reinforcement Learning for Intelligent Vehicles at Urban Intersections
- Remaining Useful Life Estimation of Lithium-Ion Battery Based on Gaussian Mixture Ensemble Kalman Filter
- A Novel Tuning Method for Predictive Control of VAV Air Conditioning System Based on Machine Learning and Improved PSO
- Prediction of Commuter Vehicle Demand Torque Based on Historical Speed Information
- A Causal Fusion Inference Method for Industrial Alarm Root Cause Analysis Based on Process Topology and Alarm Event Data
- Event-Triggered Moving Horizon Pose Estimation for Spacecraft Systems