# Application of Improved LightGBM Model in Blood Glucose Prediction
## Materials and Methods  
### LightGBM Model  
LightGBM is an improvement framework based on decision tree algorithm released by Microsoft in 2017. LightGBM and XGBoost both support parallel arithmetic, but LightGBM is more powerful than the previous XGBoost model, with a fast training speed and less memory occupation, which can reduce the communication cost of parallel learning. LightGBM is mainly featured by the decision tree algorithm based on gradient-based one-side sampling (GOSS), exclusive feature bundling (EFB), and a histogram and leaf-wise growth strategy with a depth limit. The basic idea of GOSS (gradient-based one-side sampling) is to keep all of the large gradient samples and to perform random sampling on the small gradient samples according to proportion. The basic idea of the EFB (exclusive feature bundling) algorithm is to divide the features into a smaller number of mutually exclusive bundles, that is, it is impossible to find an accurate solution in polynomial time. Therefore, what it uses is an approximate solution, that is, a small number of sample points that are not mutually exclusive are allowed between features (for example, some corresponding sample points are not non-zero at the same time). Allowing a small part of conflict can obtain a smaller number of feature bundles, which further improves the computational effectiveness [18]. The basic idea of the histogram algorithm is to discretize continuous floating point features into k integers, and to construct a histogram with a width of k at the same time. When the data are traversed, statistics is accumulated in the histogram with the discretized value as index. After the data are traversed once, the histogram accumulates the required volume of statistics, and then the optimal segmentation point can be found through traverse according to the discrete value in the histogram, as shown in Figure 1:  
Most of the learning algorithm tree of decision tree is generated by the level-wise growth method, such as XGBoost, as shown in Figure 2:  
LightGBM uses a leaf-wise growth strategy with a depth limit to find a leaf node with the largest split gain in all of the current leaf nodes, then splits, and so on, as shown in Figure 3:  
Compared with the level-wise growth strategy, leaf-wise tree growth can reduce large errors and achieve a higher accuracy, thereby providing solutions to many problems. For example, [PERSON] used Stacked Denoising Auto Encoder (SDAE) and LightGBM models to recognize human activity [19]; [PERSON] employed a random forest, XGBoost model, and LightGBM model to predict solar energy output [20]; [PERSON] forecasted children's height using a XGBoost model and LightGBM model [21]; [PERSON] et al. adopted a LightGBM model and XGBoost model to predict  
Figure 1: Schematic diagram of the histogram algorithm. Figure 3: Schematic diagram of leaf-wise strategy growth tree. Figure 2: Schematic diagram of level wise strategy growth tree. the default of P2P network loans [22]; [PERSON] et al. used LightGBM and a multi-information fusion model to predict the interaction between proteins [23]; and [PERSON] applied a LightGBM model to stratum lithology classification [24]. The following is the introduction to the theory of the LightGBM model's objective function: \(y_{i}\) is the objective value, \(i\) is the predicted value, \(T\) represents the number of leaf nodes, \(q\) denotes the structure function of the tree, and \(w\) is the leaf weight. The objective function is as follows:  
\[\begin{array}{ll  
When the structure of the q (x) tree is determined, the function \(L_{t}(q)\) is obtained, as follows:  
\[ \begin{array}{rl}L_{t}(q)&=\sum\limits_{j=1}^{T}G_{j}w_{j}+\frac{1}{2}(H_{j}+ \lambda)w_{j}^{2}\\ &=\sum\limits_{j=1}^{T}\big{[}G_{j}(-\frac{G_{j}}{H_{j}+\lambda})+\frac{1}{2}(H _{j}+\lambda)(-\frac{G_{j}}{H_{j}+\lambda})^{2}\big{]}\\ &=\sum\limits_{j=1}^{T}-\frac{G_{j}^{2}}{H_{j}+\lambda}+\frac{1}{2}\frac{G_{j }^{2}}{H_{j}+\lambda}\\ &=-\frac{1}{2}\sum\limits_{j=1}^{T}\frac{G_{j}^{2}}{H_{j}+\lambda}\end{array}