# Blood Glucose Level Prediction of Diabetic Type 1 Patients Using Nonlinear Autoregressive Neural Networks

Authors: Muhammad Asad; Usman Qamar; Muhammad Abbas
Journal: Journal of Healthcare Engineering
 (2021)

---

## Abstract

Diabetes type 1 is a chronic disease which is increasing at an alarming rate throughout the world. Studies reveal that the complications associated with diabetes can be reduced by proper management of the disease by continuously monitoring and forecasting the blood glucose level of patients.Objective. The prior prediction of blood glucose level is necessary to overcome the lag time for insulin absorption in diabetic type 1 patients. Method. In this research, we use continuous glucose monitoring (CGM) data to predict future blood glucose level using the previous data points. We compare two neural network techniques. We apply the optimal feedforward neural network and then propose optimal nonlinear autoregressive neural networks for blood glucose prediction 15–30 minutes earlier for diabetic type 1 patients. We validate the proposed model with 2 virtual subjects using their 24-hour blood glucose level data. These two case studies have been compiled from AIDA, i.e., the freeware mathematical diabetes simulator. Results. In the prediction horizon (PH) of 15 and 30 minutes, improved results have been shown for minimal inputs for blood glucose level of a particular subject. Root mean square error (RMSE) is used for performance calculation. For the optimal feedforward neural network, the RMSE is 0.9984 and 3.78 ml/dl, and for the optimal nonlinear autoregressive neural network, it reduces the RMSE to 0.60 and 1.12 ml/dl for 15 min and 30 min prediction horizons, respectively, for subject 1. Similarly, for subject 2 for the optimal feedforward neural network, RMSE is 1.43 and 3.51 ml/dl which is improved using the optimal autoregressive neural network to 0.7911 and 1.6756 ml/dl for 15 min and 30 min prediction horizons, respectively. Validation. We further validate our proposed model using UCI machine learning datasets (Abalone and Servo), and it shows improved results on that as well. Conclusion and Future Work. The proposed optimal nonlinear autoregressive neural network model performs better than the feedforward neural network model for these time series data. In the future, we intend to investigate a greater collection of AIDA scenarios and data that are real and influence other factors of BGLs.


---

## Body

## 1. Introduction

T1D is basically a chronic disease which is caused by insulin’s deficiency. The reason for this deficiency is the destruction of pancreaticβ-cells which can further result in affecting the capability of the pancreas to produce sufficient insulin. T1D can be very harmful to the health of a person, and nowadays, it is progressively increasing at the rate of 3% per year [1, 2].It usually takes 60–120 minutes to absorb the insulin to normalize the blood glucose level. Therefore, prior prediction of blood glucose level is necessary to overcome the lag time for insulin absorption in diabetic type 1 patients. In this research, we used continuous glucose monitoring (CGM) data to predict future blood glucose using the previous inputs. First, we analyzed different feedforward neural techniques from the literature used for blood glucose level prediction using univariate and multivariate time series data of diabetic patients and then neural networks used for other applications. We discovered that nonlinear autoregressive (NAR) neural networks are powerful computational models for modeling and forecasting nonlinear time series data [3, 4].We proposed optimal nonlinear autoregressive neural networks for blood glucose prediction in diabetic type 1 patients. We validated the proposed model with 2 virtual subjects for 24-hour blood glucose level data. These two case studies have been compiled from AIDA, i.e., the freeware mathematical diabetes simulator. We compared the proposed technique with the optimal feedforward network [5] for BGL predictions in the prediction horizon (PH) of 15 and 30, minutes, and improved results have been shown for the proposed model with minimal inputs. For the optimal feedforward neural network, the RMSE is 0.9984 and 3.78 ml/dl, and for the optimal nonlinear autoregressive neural network, it reduces the RMSE to 0.60 and 1.12 ml/dl for 15 min and 30 min prediction horizons, respectively, for subject 1. Similarly, for subject 2, for the optimal feedforward neural network, RMSE is 1.43 and 3.51 ml/dl which is improved using the optimal autoregressive neural network to 0.7911and 1.6756 ml/dl for 15 min and 30 min prediction horizons, respectively. We further validated our proposed model using UCI machine learning datasets (Abalone and Servo), and it has shown improved results as well [1, 6, 7].The organization of the paper is as follows: Section2 contains related work, Section 3 describes the system architecture, Section 4 presents the model description and BGL performance prediction, and Section 5 shows results and analysis, whereas in Section 6, there is conclusion presenting the summary of the work done in this research and future work suggested.


## 2. Related Work

Numerous studies have already aimed to predict BGL by making use of different physiological, data-driven, and mathematical models. However, most of the models may not have delivered accurate representations because of oversimpliﬁcations and assumptions not suitable for making life-dependent predictions [8–10]. Therefore, in this study, we aim to deliver solutions that are data-driven with minimal inputs. Ali et al. [5] proposed a novel artificial neural network for continuous blood glucose level prediction of type 1 diabetes mellitus patients. The data were collected from 13 patients for training and testing. Four different prediction horizons were considered: 15, 30, 45, and 60 minutes. This research work presented better results than any previous work done till now. In [11], virtual data from the free online diabetic simulator, AIDA, were used to predict future glucose level using artificial neural intelligence. In the study [1], the artificial neural network (ANN) is used for accurate blood glucose level prediction of type 1 diabetes (T1D). For validation, 12 real patients’ data were used. Similarly, neural network models are created with variable predictive windows of 50–180 min. The neural network model was trained with 17 patients to validate the system [12]. On the other hand, nonlinear autoregressive (NAR) neural networks are powerful computational models for modeling and forecasting nonlinear time series [3, 4, 13, 14]. In the paper [15], prediction models are developed using NAR and BP neural networks. The NAR neural network is used to predict the dynamic change of wheel diameter and therefore to predict the wheel wear high-speed trains. In this [16] study, the wind speed prediction model is created. Using the one-minute time series, the prediction of the next wind speed is performed with the NAR neural network model. Similarly, NAR networks were used for prediction of water level. In [17], NAR predicts a clearness index that is used to forecast global solar radiations. The NAR model is based on the feedforward multilayer perceptron model with two inputs and one output [18].In this research, we compared two neural network techniques. We applied optimal feedforward neural network, and then we proposed optimal nonlinear autoregressive (NAR) neural networks for blood glucose prediction in diabetic type 1 patients. We used AIDA, diabetes simulator data, and UCI machine learning repository data for validation.


## 3. System Architecture

We used automatic insulin delivery advisor (AIDA), a free mathematical online simulator for diabetic patients for generating the required data. We used those data to train our proposed model. The network is trained on PHs, i.e., 15 and 30 minutes. The prediction BGL can be delivered to artificial pancreas (AP) for predicting and injecting the amount of required insulin dose to the diabetic type 1 patient shown in Figure1 [3, 10, 12].Figure 1
System architecture of blood glucose level prediction.


## 4. Blood Glucose Prediction

### 4.1. Dataset

In this paper, AIDA is used for the generation of diabetic subjects data. Nonlinear autoregressive neural networks (NARNNs) and optimal autoregressive artificial neural networks (OANNs) are trained on the basis of AIDA’s BGL data. During the prediction period, the step of current time increments is 15 minutes. This helps OANNs and ONARNN in making BGL predictions by considering each time-step in the prediction period. For further illustration, consider a window having current time-step in its center, then this time-step has been preceded gradually through values of the input vector, with that, targeted BGL is also mentioned at the defined future interval [19, 20].


### 4.2. Justification for Using AIDA

There are various reasons for adopting AIDA for the generation of patient’s data: (i) it is hard to collect data of real patients as there are privacy and ethical concerns. (ii) Experimentation on real subjects is a time-consuming and really expensive task. (iii) The simulator has an ability to generate comparatively large datasets. Lastly, (iv) there is much more flexibility in simulation as compare to real subject experimentations. The British Diabetic Association (BDA) conducted an independent assessment based on the feedback from healthcare personnel and internal evaluators. When an accurate rating has been received from healthcare personnel, then the simulator has been listed in the healthcare brochure of BDA [19, 20].


### 4.3. Optimized Nonlinear Autoregressive Neural Network (ONARNN)

We propose a model which creates optimal feedback delay (Optimal_feedD) and optimal hidden neuron (Optimal_Nhid) to give an optimal solution to the problem. As evident from Figure2, first, we normalize the data. We initialize the variable, min_RMSE to 10^-3 and Max_feedD and Max_Nhid to 10. The RMSE indicates root mean square error. The algorithm increments feedback delay and optimal neuron. Training is performed for each iteration, RMSE is calculated, and the optimal feedback delay and optimal neuron are assigned for each subject. The algorithm terminates on two conditions: first, if minimum RMSE is achieved, and second, if maximum iteration is completed. If maximum iterations are completed, then the minimum RMSE iteration is assigned as the optimal solution [5, 7].Figure 2
Proposed model (optimized NAR neural network).


### 4.4. Prediction Model

The purpose of training an ANN is to learn that how an input variable is related to the output BGL for making predictions. The ANN architecture which is developed in this research is shown in Figure3. Nonlinear autoregressive networks can make predictions about time series with the help of feedback input. Input for ANN is CGM data (G (t), G (t−1),..., G (t−d), where d represents the times tapped delays occur in the input for making future predictions. The NARANN has been designed in such a way that it contains only one hidden layer consisting one ANN output and optimal neurons in the hidden layer. In this ANN model, previous inputs and outputs are considered for making future predictions about output value (G∗t+1,G∗t+2,…). The relationship between input and output has been represented below in equation (1), i.e., Y (∗) with the setup of delays. During the training phase, the NARANN works in the form of an open-loop. Once the training with the T1DM patients’ data is done, NARANN started to work in form of closed-loop in the phase of testing, i.e., prediction phase. The predictions of BGL are being made by ANN with the help of input datasets. Predict series y (t) given d past values of y (t) [15–18, 21]:(1)Yt=Yt−1,…,Yt−d.Figure 3
Nonlinear autoregressive neural network.Equation (1) is the prediction using past values.


### 4.5. Evaluating Performance

The performance of the proposed model has been measured using RMSE. As depicted in Tables1 and 2, the mean square error (MSE) for Case 001 is 0.6060, 1.127 ml/dl for 15 and 30 minutes, respectively. Similarly, for Case 002, the RMSEs are 0.7911 and 1.6756 ml/dl for 15 and 30 minutes, respectively:(2)RMSE=1n∑i=1nXi−X?i2.Table 1
RMSE for Case 001.
Optimal feedback delayOptimal hidden neuronsNAR NN with optimal inputs (RMSE ml/dl)Y(T) = 15 minY(t+1) = 30 min3100.60601.127Table 2
RMSE for Case 002.
Optimal feedback delayOptimal hidden neuronsNAR NN with optimal inputs (RMSE ml/dl)Y(T) = 15 minY(t+1) = 30 min940.79111.6756Equation (2) is the root mean square error.


## 4.1. Dataset

In this paper, AIDA is used for the generation of diabetic subjects data. Nonlinear autoregressive neural networks (NARNNs) and optimal autoregressive artificial neural networks (OANNs) are trained on the basis of AIDA’s BGL data. During the prediction period, the step of current time increments is 15 minutes. This helps OANNs and ONARNN in making BGL predictions by considering each time-step in the prediction period. For further illustration, consider a window having current time-step in its center, then this time-step has been preceded gradually through values of the input vector, with that, targeted BGL is also mentioned at the defined future interval [19, 20].


## 4.2. Justification for Using AIDA

There are various reasons for adopting AIDA for the generation of patient’s data: (i) it is hard to collect data of real patients as there are privacy and ethical concerns. (ii) Experimentation on real subjects is a time-consuming and really expensive task. (iii) The simulator has an ability to generate comparatively large datasets. Lastly, (iv) there is much more flexibility in simulation as compare to real subject experimentations. The British Diabetic Association (BDA) conducted an independent assessment based on the feedback from healthcare personnel and internal evaluators. When an accurate rating has been received from healthcare personnel, then the simulator has been listed in the healthcare brochure of BDA [19, 20].


## 4.3. Optimized Nonlinear Autoregressive Neural Network (ONARNN)

We propose a model which creates optimal feedback delay (Optimal_feedD) and optimal hidden neuron (Optimal_Nhid) to give an optimal solution to the problem. As evident from Figure2, first, we normalize the data. We initialize the variable, min_RMSE to 10^-3 and Max_feedD and Max_Nhid to 10. The RMSE indicates root mean square error. The algorithm increments feedback delay and optimal neuron. Training is performed for each iteration, RMSE is calculated, and the optimal feedback delay and optimal neuron are assigned for each subject. The algorithm terminates on two conditions: first, if minimum RMSE is achieved, and second, if maximum iteration is completed. If maximum iterations are completed, then the minimum RMSE iteration is assigned as the optimal solution [5, 7].Figure 2
Proposed model (optimized NAR neural network).


## 4.4. Prediction Model

The purpose of training an ANN is to learn that how an input variable is related to the output BGL for making predictions. The ANN architecture which is developed in this research is shown in Figure3. Nonlinear autoregressive networks can make predictions about time series with the help of feedback input. Input for ANN is CGM data (G (t), G (t−1),..., G (t−d), where d represents the times tapped delays occur in the input for making future predictions. The NARANN has been designed in such a way that it contains only one hidden layer consisting one ANN output and optimal neurons in the hidden layer. In this ANN model, previous inputs and outputs are considered for making future predictions about output value (G∗t+1,G∗t+2,…). The relationship between input and output has been represented below in equation (1), i.e., Y (∗) with the setup of delays. During the training phase, the NARANN works in the form of an open-loop. Once the training with the T1DM patients’ data is done, NARANN started to work in form of closed-loop in the phase of testing, i.e., prediction phase. The predictions of BGL are being made by ANN with the help of input datasets. Predict series y (t) given d past values of y (t) [15–18, 21]:(1)Yt=Yt−1,…,Yt−d.Figure 3
Nonlinear autoregressive neural network.Equation (1) is the prediction using past values.


## 4.5. Evaluating Performance

The performance of the proposed model has been measured using RMSE. As depicted in Tables1 and 2, the mean square error (MSE) for Case 001 is 0.6060, 1.127 ml/dl for 15 and 30 minutes, respectively. Similarly, for Case 002, the RMSEs are 0.7911 and 1.6756 ml/dl for 15 and 30 minutes, respectively:(2)RMSE=1n∑i=1nXi−X?i2.Table 1
RMSE for Case 001.
Optimal feedback delayOptimal hidden neuronsNAR NN with optimal inputs (RMSE ml/dl)Y(T) = 15 minY(t+1) = 30 min3100.60601.127Table 2
RMSE for Case 002.
Optimal feedback delayOptimal hidden neuronsNAR NN with optimal inputs (RMSE ml/dl)Y(T) = 15 minY(t+1) = 30 min940.79111.6756Equation (2) is the root mean square error.


## 5. Results and Analysis

In this research work, two neural network techniques are compared. Firstly, the optimal feedforward neural network [5] acts as a window model for these time series data, and it optimally selects the input and hidden neuron.Tables1 and 2 show RMSE for optimal autoregressive neural networks for PH (15 and 30 minutes). For Case 001, it is 0.60 and 1.12 ml/dl for 15 and 30 prediction horizons, respectively. Similarly, for Case 002, it is 0.7911 and 1.6756 ml/dl for 15- and 30-minute PHs, respectively. Figures 4 and 5 show the graphs of actual and predicted blood glucose concentration for different PHs (30 minutes) of optimal feedforward neural network and optimal nonlinear autoregressive neural network. Similarly, for Case 002 shown in Figures 6 and 7, it is evident from the results and the graphs that the optimal nonlinear autoregressive neural network is showing more accurate results compared to feedforward neural network. As it shows in Table 3 for the optimal feedforward neural network, RMSE is 0.9984 and 3.78 ml/dl which is improved using the optimal autoregressive neural network to 0.60 and 1.12 ml/dl for 15 min and 30 min prediction horizons, respectively, for patient 1.Figure 4
Case 001 PH = 30 min graph-feedforward.Figure 5
Case 001 PH = 30 min graph-autoregressive.Figure 6
Case 002 PH = 30 min graph-feedforward.Figure 7
Case 002 PH = 30 min graph-autoregressive.Table 3
Comparison of feedforward and nonlinear autoregressive models.
DatasetSourceFeedforward NN (RMSE) ml/dlNAR NN with optimal inputs (RMSE ml/dl)Y(T) = 15 minY(t+1) = 30 minPatient 1AIDA15 min = 0.99840.606030 min = 3.781.127Patient 2AIDA15 min = 1.430.791130 min = 3.511.6756AbaloneUCIY (t) = 3.362.4177132.56211ServoUCIY (t) = 1.810.7817961.493887Similarly, for patient 2 for the optimal feedforward neural network, RMSE is 1.43 and 3.51 ml/dl which is improved using the optimal autoregressive neural network to 0.7911 and 1.6756 ml/dl for 15 min and 30 min predication horizons, respectively. To validate the model, we used two UCI machine learning repository datasets (Abalone and Servo), and results are given in Tables4 and 5. In Table 3, the comparison is presented to validate the improvement of our proposed system.Table 4
RMSE for the Abalone dataset.
Optimal feedback delayOptimal hidden neuronsNAR NN with optimal inputs (RMSE ml/dl)Y(T) = 15 minY(t+1) = 30 min422.4177132.56211Table 5
RMSE for the Servo dataset.
Optimal feedback delayOptimal hidden neuronsNAR NN with optimal inputs (RMSE ml/dl)Y(T) = 15 minY(t+1) = 30 min850.7817961.493887


## 6. Conclusion and Future Work

In this study, we compare two neural network techniques for predicting future blood glucose level using the preceding data. For BGL predictions, improved results have been shown for minimal inputs in the prediction horizon (PH) of 15 and 30 minutes. For optimal feedforward neural network, RMSE is 0.9984 and 3.78 ml/dl which is improved using the optimal autoregressive neural network to 0.60 and 1.12 ml/dl for 15 min and 30 min prediction horizons, respectively, for patient 1. Furthermore, this study targets to make life easier for T1D patients by minimizing human input to the system. We further validate our proposed model using UCI machine learning datasets (Abalone and Servo), and it has shown improved results as well. The proposed optimal autoregressive neural network model performs better than the feedforward window model for time series data. In the future, we intend to investigate a greater collection of AIDA scenarios and multivariate data and using the nonlinear autoregressive neural network with exogenous inputs.



---

*Source: 6611091-2021-02-26.xml*