Personalized blood glucose prediction method, equipment, medium and product
By constructing and adjusting a blood sugar prediction model based on long and short-term memory networks, the problem of relying on a large amount of data in traditional methods is solved, and personalized blood sugar prediction and improving prediction efficiency is achieved.
Patent Information
- Application Number
- CN202510223353.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-27
- Publication Date
- 2025-06-13
AI Technical Summary
Traditional blood sugar prediction methods rely on a large amount of historical data and are difficult to adapt to personalized needs, especially when facing new patients, which leads to inefficient prediction.
By obtaining the historical blood sugar sequence and current blood sugar data of the user to be tested, an initial blood sugar prediction model is constructed based on the long and short-term memory network, and the model is adjusted by adjusting the sample pair until the output error reaches the set threshold, and the final blood sugar prediction model is obtained.
Personalized blood sugar prediction is achieved, the efficiency of blood sugar prediction is improved, the dependence on a large amount of training data is reduced, and individual differences are adapted to different patients.
Smart Images

Figure CN120148855A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of blood glucose prediction, and particularly to a personalized blood glucose prediction method, device, medium and product. Background Art
[0002] Diabetes management and its impact on patients' quality of life and health status have become key issues in the field of public health, and blood glucose prediction plays a crucial role in this. For patients, accurate prediction of blood glucose data means being able to adjust treatment plans in a timely manner, effectively prevent hypoglycemia and hyperglycemia events, thereby improving the quality of life, maintaining health, and significantly reducing the risk of complications. This personalized blood glucose management is crucial for patients. For doctors, blood glucose prediction data can provide personalized blood glucose control suggestions, helping them optimize clinical decisions and develop more precise treatment plans for patients.
[0003] However, blood glucose prediction, especially personalized blood glucose prediction, faces significant challenges. There are significant individual differences in blood glucose changes among patients with type 1 diabetes (T1D), which makes population models may not be precise and safe enough in prediction and control, and it is difficult to develop effective model predictive control (MPC) strategies. In practical applications, traditional blood glucose prediction models, especially in scenarios requiring personalized prediction, often require a large amount of historical data as support, or use general models, but these models usually need to be retrained when applied to new patients, not only with low prediction efficiency, but also difficult to fully adapt to the individual differences of patients.
[0004] In recent years, deep learning technology has gradually emerged in the field of blood glucose prediction due to its flexibility and high performance. When dealing with time series data such as blood glucose data, deep learning models, especially those based on the Recurrent Neural Network (RNN), such as the Long Short-Term Memory (LSTM) network, have demonstrated excellent capabilities. However, these deep learning technologies often rely on large amounts of data to achieve the best results, which to some extent limits their application in personalized blood glucose prediction. Meta-learning, as a learning method that optimizes at the task level, its core lies in transferring experience from a small number of similar learning tasks. Although meta-learning can theoretically alleviate the problem of data scarcity, its practical application also faces significant limitations. Meta-learning methods often require a large number of similar tasks for meta-training, which is a costly process. In addition, to prevent the model from overfitting to a small amount of training data, each task usually can only use a low-complexity base learner for modeling, such as a shallow neural network (Spiking Neural Network, SNN), and cannot apply deeper and more powerful network architectures. These limitations result in the performance of meta-learning methods being restricted when dealing with complex tasks, especially those that require the use of deep neural networks.
[0005] In summary, traditional blood glucose prediction methods usually rely on a large amount of historical data. However, in practical applications, especially in personalized prediction scenarios, the amount of data often fails to meet the requirements. The blood glucose data of different individuals is limited, making it difficult to build an accurate prediction model; there are significant differences in the physiological states, living habits, and drug responses of different patients, resulting in the difficulty of general models to adapt to personalized needs; traditional models often need to be retrained when facing new patients, leading to low prediction efficiency. Summary of the Invention
[0006] The purpose of this application is to provide a personalized blood glucose prediction method, device, medium, and product that can adapt to personalized needs and improve the efficiency of blood glucose prediction.
[0007] To achieve the above purpose, this application provides the following solutions:
[0008] In the first aspect, this application provides a personalized blood glucose prediction method, including:
[0009] Obtain the historical blood glucose sequence and current blood glucose data of the user to be tested; the historical blood glucose sequence includes historical blood glucose values at multiple sampling times;
[0010] Construct an initial blood glucose prediction model based on the long short-term memory network;
[0011] In the historical blood glucose sequence, using the historical blood glucose value at the previous sampling moment as the input and the historical blood glucose value at the next sampling moment as the output, an adjustment sample pair is formed;
[0012] Using the adjustment sample pair to adjust the initial blood glucose prediction model until the output error of the adjusted initial blood glucose prediction model reaches the set threshold, the adjusted initial blood glucose prediction model is used as the final blood glucose prediction model;
[0013] Inputting the current blood glucose data into the final blood glucose prediction model to obtain the blood glucose prediction result of the user to be measured.
[0014] Optionally, constructing an initial blood glucose prediction model based on a long short-term memory network, including:
[0015] Obtaining a blood glucose training sample sequence pair and performing preprocessing to form a first training sample set and a second training sample set; in the blood glucose training sample sequence pair, using the historical blood glucose value at the previous sampling moment as the input and the historical blood glucose value at the next sampling moment as the output;
[0016] Taking the long short-term memory network as the Encoder layer and the Decoder layer respectively, and setting a fully connected layer to obtain an initial model; the Encoder layer is connected to the Decoder layer, and the Decoder layer is connected to the fully connected layer; the long short-term memory network includes: a forgetting gate, an input gate, an output gate, and a cell state update gate;
[0017] Using a transfer learning algorithm, training the initial model with the first training sample set until the output error of the trained initial model reaches the set threshold to obtain a trained initial model;
[0018] Freezing the weight parameters of the Encoder layer and the Decoder layer in the trained initial model, performing scaling and shifting operations on the forgetting gate, input gate, output gate, and cell state update gate in the trained initial model based on scaling parameters and shifting parameters, and using a meta-learning algorithm to train the trained initial model after the scaling and shifting operations with the second training sample set until the output error of the trained initial model after the scaling and shifting operations reaches the set threshold to obtain a trained blood glucose prediction model;
[0019] Taking the trained blood glucose prediction model as the initial blood glucose prediction model.
[0020] Optionally, obtaining the historical blood glucose sequence and current blood glucose data of the user to be measured, including:
[0021] Obtaining the historical blood glucose data and current initial blood glucose data of the user to be measured;
[0022] Preprocess the historical blood glucose data and the current initial blood glucose data of the user to be measured to obtain the historical blood glucose sequence and the current blood glucose data of the user to be measured; the preprocessing includes: smoothing and noise reduction processing and sliding window processing.
[0023] Optionally, the process of the smoothing and noise reduction processing is expressed as:
[0024]
[0025] where is the blood glucose data after smoothing and noise reduction processing at the sampling time i, y i+j is the blood glucose data at the sampling time i + j, c j is the coefficient of the fitting polynomial, and the coefficient of the fitting polynomial is determined based on the least squares method.
[0026] Optionally, perform scaling and shifting operations on the forget gate, input gate, output gate, and cell state update gate in the trained initial model based on the scaling parameter and the shifting parameter, which is expressed as:
[0027] SS(X; H; W, b; F S{1,2} ) = (W · F S1 )(X, H) + (b + F S2 );
[0028] where X is the current input data, H is the input hidden state, (X, H) is the input vector combination, W is the weight matrix, b is the bias parameter, F S1 is the scaling parameter, F S2 is the shifting parameter, and · is the element-wise multiplication.
[0029] Optionally, the meta-learning algorithm includes an inner loop process and an outer loop process;
[0030] The inner loop process is expressed as:
[0031]
[0032] The outer loop process is expressed as:
[0033]
[0034] where F S{1,2} ' is the updated scaling and offset parameter, θ' is the updated fully connected layer parameter, θ is the weight parameter of the Encoder layer and the weight parameter of the Decoder layer in the frozen trained initial model, α is the learning rate updated by the inner loop, θ is the fully connected layer parameter, F S{1,2} is the scaling and offset parameter, is the gradient of F S{1,2} and θ, ζΤ(tr) is the loss function, T(tr) is the blood glucose data set in the inner loop process, T(te) is the blood glucose data set in the outer loop process, and β is the learning rate updated in the outer loop.
[0035] Optionally, the process of adjusting the initial blood glucose prediction model using the adjustment samples is expressed as:
[0036] (F S{1,2} , θ) = (F S{1,2} , θ) - κ▽ (FS{1,2},θ) ζ Τ(ti) ([θ; θ], F S{1,2} );
[0037] where F S{1,2} is the scaling and offset parameter, θ is the fully connected layer parameter, κ is the learning rate during the adjustment process, is the gradient of F S{1,2} and θ, T(ti) is the historical blood glucose data of the user to be measured, and θ is the weight parameter of the Encoder layer and the weight parameter of the Decoder layer in the frozen and trained initial model.
[0038] In a second aspect, the present application provides a computer device, including: a memory, a processor, and a computer program stored on the memory and executable on the processor, and the processor executes the computer program to implement the steps of the personalized blood glucose prediction method described in any one of the above.
[0039] In a third aspect, the present application provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements the steps of the personalized blood glucose prediction method described in any one of the above.
[0040] In a fourth aspect, the present application provides a computer program product, including a computer program, and when the computer program is executed by a processor, it implements the steps of the personalized blood glucose prediction method described in any one of the above.
[0041] According to the specific embodiments provided by the present application, the present application has the following technical effects:
[0042] The present application provides a personalized blood glucose prediction method, device, medium, and product. By using the historical blood glucose sequence of the user to be measured as the adjustment sample pair to adjust the initial blood glucose prediction model, the final blood glucose prediction model for the user to be measured is obtained, which can meet the personalized needs and further solve the problem that the traditional model requires a large amount of data for training when dealing with new users, resulting in low blood glucose prediction efficiency. Description of the Drawings
[0043] To more clearly illustrate the technical solutions in the embodiments of the present application or the related art, the following will briefly introduce the accompanying drawings required in the embodiments. Obviously, the accompanying drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other accompanying drawings can be obtained based on these drawings.
[0044] Figure 1 It is a schematic flowchart of a personalized blood glucose prediction method in an embodiment of the present application.
[0045] Figure 2 It is a schematic diagram of dividing blood glucose data by the sliding window method provided in an embodiment of the present application.
[0046] Figure 3 It is a schematic diagram of scaling and shifting operations provided in an embodiment of the present application.
[0047] Figure 4 It is a schematic diagram of a prediction result provided in an embodiment of the present application.
[0048] Figure 5 It is a schematic diagram of Clarke error grid analysis provided in an embodiment of the present application.
[0049] Figure 6 It is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. Detailed implementation manners
[0050] The following will clearly and completely describe the technical solutions in the embodiments of the present application with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only some embodiments of the present application, rather than all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present application.
[0051] To make the above objects, features, and advantages of the present application more obvious and understandable, the present application will be further described in detail below with reference to the accompanying drawings and specific implementation manners.
[0052] In an exemplary embodiment, as Figure 1 shown, a personalized blood glucose prediction method is provided. This method is executed by a computer device, and specifically, it can be executed independently by a computer device such as a terminal or a server, or jointly executed by a terminal and a server. In the embodiments of the present application, as Figure 1 shown, it includes the following steps 100 to step 104. Among them:
[0053] Step 100, obtain the historical blood glucose sequence and the current blood glucose data of the user to be tested; the historical blood glucose sequence includes historical blood glucose values at multiple sampling times.
[0054] Step 101: Construct an initial blood glucose prediction model based on a long short-term memory network.
[0055] Step 102: In the historical blood glucose sequence, use the historical blood glucose value at the previous sampling moment as the input and the historical blood glucose value at the next sampling moment as the output to form adjusted sample pairs.
[0056] Step 103: Use the adjusted sample pairs to adjust the initial blood glucose prediction model until the output error of the adjusted initial blood glucose prediction model reaches a set threshold, and then use the adjusted initial blood glucose prediction model as the final blood glucose prediction model.
[0057] Step 104: Input the current blood glucose data into the final blood glucose prediction model to obtain the blood glucose prediction result of the user to be measured.
[0058] Implementing the above Steps 100 to 104 can adapt to personalized needs and improve the efficiency of blood glucose prediction.
[0059] In another exemplary embodiment of the present application, constructing an initial blood glucose prediction model based on a long short-term memory network includes:
[0060] Step 1: Obtain a blood glucose training sample sequence pair and perform preprocessing to form a first training sample set and a second training sample set; in the blood glucose training sample sequence pair, use the historical blood glucose value at the previous sampling moment as the input and the historical blood glucose value at the next sampling moment as the output.
[0061] Step 2: Use the long short-term memory network as the Encoder layer and the Decoder layer respectively, and set a fully connected layer to obtain an initial model; the Encoder layer is connected to the Decoder layer, and the Decoder layer is connected to the fully connected layer; the long short-term memory network includes: a forgetting gate, an input gate, an output gate, and a cell state update gate.
[0062] The initial model constructed in the present application realizes dynamic modeling of blood glucose data and prediction of future values through a hierarchical design, combining the Encoder layer, the Decoder layer, and the fully connected layer. The specific construction method is as follows:
[0063] (1) Construct the Encoder layer: Use the long short-term memory network as the Encoder layer. The input is blood glucose data, such as historical blood glucose data, with a shape of the number of samples, time steps, and the number of features. Here, the number of samples is the total number of samples formed after sliding window processing; the time step is the duration of the historical blood glucose time series data collection, indicating the number of time steps included in each sample. In this application, historical 30-minute blood glucose data is used for input, with blood glucose data collected every 5 minutes, so the time step is 6; the number of features is the number of features included in the historical blood glucose time series data, indicating how many features there are in each time step, such as blood glucose value and insulin dose, etc. In this application, only the blood glucose value is used, and the number of features is 1. Use the LSTM network to encode the input data to capture the long-term dependencies in the input sequence, and use the final hidden state and cell state of the LSTM network as the context vector to be passed to the Decoder layer.
[0064] (2) Construct the Decoder layer: Use the long short-term memory network as the Decoder layer. The input is the context vector generated by the Encoder layer, as well as the prediction result and hidden state of the previous time step. Here, the Encoder layer encodes the input data into a set of fixed-length vectors, and the prediction result and hidden state of the previous time step are the vectors encoded by the Encoder layer. Use the LSTM network to gradually decode, combine the context information and the output of the previous time step to generate the future blood glucose prediction sequence. Among them, the future blood glucose prediction sequence is included in the hidden state as the input to the fully connected layer, and the hidden state of the LSTM network is passed to the fully connected layer.
[0065] (3) Construct the fully connected layer: The input is the hidden state output by the Decoder layer. Use the fully connected layer to map the hidden state to the final prediction result space to generate the prediction result of the blood glucose value. The output is the predicted blood glucose value for future time steps, with a shape of the number of samples and the prediction step length.
[0066] (4) Define the loss function and optimizer: Use the mean squared error as the loss function to measure the difference between the predicted value and the true value. Use the Adam optimizer to optimize the initial model, and set the learning rate, number of training epochs, and batch size.
[0067] (5) Complete the construction of the initial model.
[0068] Step 3: Use the transfer learning algorithm to train the initial model with the first training sample set until the output error of the trained initial model reaches the set threshold, and then obtain the trained initial model. The output error of the trained initial model is the error between the historical blood glucose value at the next sampling moment in the first training sample set and the output value of the initial model.
[0069] Step 4: Freeze the weight parameters of the Encoder layer and the Decoder layer in the trained initial model. Perform scaling and shifting operations on the forget gate, input gate, output gate, and cell state update gate in the trained initial model based on the scaling parameter and the shifting parameter. Then, use the meta-learning algorithm to train the trained initial model after the scaling and shifting operations with the second training sample set until the output error of the trained initial model after the scaling and shifting operations reaches the set threshold, thereby obtaining the trained blood glucose prediction model.
[0070] Step 5: Use the trained blood glucose prediction model as the initial blood glucose prediction model.
[0071] In another exemplary embodiment of the present application, in order to improve the quality and reliability of blood glucose data, it is necessary to preprocess the blood glucose data, which is specifically as follows:
[0072] In practical applications, the Savitzky-Golay method can be used to perform smoothing and noise reduction processing on the blood glucose data to effectively reduce the influence of noise, thereby improving the quality of the blood glucose data and the performance of the final blood glucose prediction model. The smoothing and noise reduction formula in the present application is expressed as:
[0073]
[0074] Where is the blood glucose data after smoothing and noise reduction processing at time point i, y i+j is the blood glucose data at time point i + j, c j is the coefficient of the fitting polynomial, and the coefficient of the fitting polynomial is determined based on the least squares method.
[0075] In the database, the continuous blood glucose data may be separated by too long a time interval, so it is necessary to process the blood glucose data. Generally, the interpolation method is used to fill in the missing values, but the data filled in this way has a large error. In the present application, the blood glucose data is divided into separated continuous blood glucose data segments by determining whether the blood glucose data is continuous. When the time interval of the blood glucose data in a continuous blood glucose data segment is not sufficient to use the sliding window method to construct the training sample and the adjustment sample, this continuous blood glucose data segment will be automatically discarded, and the next continuous blood glucose data segment will be skipped to perform the sliding window method to divide and construct the training sample and the adjustment sample.
[0076] The sliding window method in the present application is as Figure 2 shown, specifically: Represent the blood glucose data after smoothing and noise reduction as Y = {y 1 , y 2 ,..., y N}, where yi (i = 1, ..., N) represents the blood glucose data at the i-th time point, and N is the total number of data points. To generate input-output pairs, first select a fixed time window of size n to represent the number of historical blood glucose data points for prediction. Then, select a prediction step h to represent the time interval for predicting future blood glucose values. Finally, through the sliding window method, generate an input matrix X of size (N - n - h + 1) * n, which is specifically represented as follows:
[0077]
[0078] Generate the corresponding output vector Z, whose size is (N - n - h + 1) * 1, which is specifically represented as follows:
[0079]
[0080] By processing the smoothed and noise-reduced blood glucose data through the sliding window method, continuous blood glucose data can be divided into multiple input-output pairs, providing the data structure required for training and prediction in this application.
[0081] In an exemplary embodiment of this application, in order to further improve the adaptability and flexibility of the final blood glucose prediction model, freeze the weight parameters of the Encoder layer and the Decoder layer in the trained initial model, and perform scaling and shifting operations on the forget gate, input gate, output gate, and cell state update gate in the trained initial model based on the scaling parameter and the shift parameter. Specifically:
[0082] The core structure of the LSTM network includes: a forget gate, an input gate, an output gate, and a cell state update gate. In order to better perform scaling and shifting (SS) operations on the LSTM network, it is necessary to split the weight matrices of the corresponding formulas of the forget gate, input gate, output gate, and cell state update gate. In the traditional LSTM network, the forget gate, input gate, output gate, and cell state update gate concatenate the hidden state H t-1 and the input value X at the current moment t as the input vector. In order to better add scaling and shifting (SS) parameters, this application re-splits the weight matrix of each gate in the traditional LSTM network into the weight matrix of H t-1 and the weight matrix of X t .
[0083] Among them, the calculation formulas of each gate are as follows:
[0084] The forget gate is expressed as:
[0085]
[0086] The input gate is expressed as:
[0087]
[0088] The output gate is represented as:
[0089]
[0090] The cell state update gate is represented as:
[0091]
[0092] where f t is the output of the forget gate, σ is the sigmoid function used to compress the input into the interval [0, 1], generating a value between 0 and 1, b f is the bias parameter of the forget gate, i t is the output of the input gate, b i is the bias parameter of the input gate, O t is the output of the output gate, b o is the bias parameter of the output gate, is the cell state update gate, b C is the bias parameter of the cell state update gate, tanh is the hyperbolic tangent function, W f is the weight matrix of the forget gate, W i is the weight matrix of the input gate, W o is the weight matrix of the output gate, W C is the weight matrix of the cell state update gate, W fh is the weight matrix of the forget gate for processing the hidden state, W ih is the weight matrix of the input gate for processing the hidden state, W oh is the weight matrix of the output gate for processing the hidden state, W Ch is the weight matrix of the cell state update gate for processing the hidden state, W fx is the weight matrix of the forget gate for processing the input value, W ix is the weight matrix of the input gate for processing the input value, W ox is the weight matrix of the output gate for processing the input value, W Cx is the weight matrix of the cell state update gate for processing the input value.
[0093] According to the weight matrices of the hidden state of each gate, the weight matrices of the input value of each gate, and the bias parameter of each gate obtained above, perform scaling and shifting (Scaling Shift, SS) operations as Figure 3 shown. Assume the number of hidden units in the LSTM network is d, then the dimensions of W fh 、W ih 、W oh and W Ch are (d, d), and the dimensions of W fx, W ix , W ox and W Cx have dimensions (d, c), and b f , b i , b o and b C have dimension (d,). The scaling operation in this application is: applying the scaling parameter to the matrices obtained by splitting W f , W i , W o and W C into matrices with dimensions (d, d) and (d, c). The scaling parameter for each matrix is F S1 , initialized to 1, with dimension (1,). The shifting operation in this application is: applying the shifting parameter to the bias parameter of each gate, and each gate's bias parameter corresponds to the corresponding shifting parameter F S2 , initialized to 0, with dimension (d,). Further, for simplicity of representation, the weight matrices are collectively referred to as W, and the bias parameters are collectively referred to as b. The scaling operation is to scale each weight matrix, specifically: multiplying each element of the scaling parameter and the corresponding weight matrix, i.e., W·F S1 . The shifting operation is to shift each bias parameter, specifically: adding the corresponding elements of the shifting parameter and the corresponding bias parameter, i.e., b + F S2 .
[0094] Assume that the current input data is X, the input hidden state is H, and the input vector combination is (X, H). Then the SS operation is expressed as:
[0095] SS(X; H; W, b; F S{1,2} ) = (W·F S1 )(X, H) + (b + F S2 ).
[0096] where W is the weight matrix, b is the bias parameter, F S1 is the scaling parameter, F S2 is the shifting parameter, and · is element - level multiplication.
[0097] In practical applications, the scaling parameter and the shifting parameter can be updated through the loss function and the gradient.
[0098] In an exemplary embodiment of this application, using the meta - learning algorithm, the trained initial model after scaling and shifting operations is trained with a second training sample set until the output error of the trained initial model after scaling and shifting operations reaches the set threshold, and a trained blood glucose prediction model is obtained as follows:
[0099] Divide the blood glucose data of patients in the blood glucose database into multiple tasks to improve the generalization ability of the final blood glucose prediction model and its adaptability to new patients. Define the whole-day blood glucose data of each patient as the time period from the start time to the end time of a day. Specifically, the whole-day blood glucose data AD i x represents the whole-day blood glucose data of the i-th day of patient x, denoted as:
[0100]
[0101] where y x is the blood glucose data of patient x, is the start time of the i-th day of patient x, is the end time of the i-th day of patient x.
[0102] Each task consists of a pair of whole-day blood glucose data of any patient in the blood glucose database, where one whole-day blood glucose data serves as the support set and the other as the target set. Specifically, task Ti is denoted as:
[0103]
[0104] where, is the whole-day blood glucose data of the i-th day of patient x, is the whole-day blood glucose data of the j-th day of patient x.
[0105] In this application, AD x i is used as the blood glucose data in the support set for the inner-loop optimization of the trained initial model after scaling and shifting operations; AD x j is used as the blood glucose data in the target set for the outer-loop optimization of the trained initial model after scaling and shifting operations. To further improve the generalization ability of the final blood glucose prediction model, this application enhances the tasks during the training process of the trained initial model after scaling and shifting operations. Specifically, by randomly shuffling the order of the support set and the target set, the trained initial model after scaling and shifting operations is forced not to rely on the order of specific whole-day blood glucose data pairs, but to extract the blood glucose data of patients from the support set to predict the change in blood glucose values in the target set. This task enhancement strategy enables the final blood glucose prediction model to better capture the dynamic characteristics of patients' blood glucose behavior, thereby improving its adaptability to different patients and different whole-day blood glucose data.
[0106] This application uses the above-defined tasks to perform meta-learning on the scaling parameters, shifting parameters, and fully connected layers in the trained initial model after scaling and shifting operations. Among them, the inner-loop process in meta-learning is denoted as:
[0107]
[0108] Among them, F S{1,2} ' is the updated scaling and offset parameter, θ' is the updated fully connected layer parameter, θ is the weight parameter of the Encoder layer and the weight parameter of the Decoder layer in the frozen and trained initial model, α is the learning rate for the inner loop update, θ is the fully connected layer parameter, and F S{1,2} is the scaling and offset parameter, is the gradient of F S{1,2} and θ, and ζ Τ(tr) is the loss function in the inner loop process, and T(tr) is the blood glucose dataset in the inner loop process, which can also be called the support set.
[0109] The outer loop process in meta-learning is expressed as:
[0110] (F S{1,2} , θ) = (F S{1,2} , θ) - β▽ (FS{1,2},θ) ζ Τ(te) ([θ; θ'], F S{1,2} ').
[0111] Among them, β is the learning rate for the outer loop update, and ζ Τ(te) is the loss function in the outer loop process, and T(te) is the blood glucose dataset in the outer loop process, which can also be called the query set.
[0112] The main role of the inner loop in meta-learning is to quickly adapt to a single task and provide an optimized scaling and offset parameter and fully connected layer parameter for the outer loop. The outer loop in meta-learning applies the optimized scaling and offset parameter and fully connected layer parameter in the inner loop to the query set, calculates the performance of the trained initial model after scaling and shifting operations on the query set, and then updates the parameters of the trained initial model after scaling and shifting operations through the loss function and gradient, so that it can better adapt to new tasks.
[0113] In an exemplary embodiment of the present application, the initial blood glucose prediction model is personalized adjusted using the blood glucose data of the user to be measured, so as to obtain an accurate final blood glucose prediction model.
[0114] Specifically, the initial blood glucose prediction model is fine-tuned. The fine-tuning here is the adjustment in the present application, mainly fine-tuning the scaling parameter, shift parameter and fully connected layer of the initial blood glucose prediction model to generate an accurate and personalized final blood glucose prediction model exclusive to the user to be measured, providing an efficient and accurate tool for diabetes management.
[0115] The adjustment formula is expressed as:
[0116] (F S{1,2} , θ) = (F S{1,2} , θ) - κ▽ (FS{1,2},θ) ζ Τ(ti) ([θ; θ], F S{1,2} ).
[0117] Among them, κ is the learning rate during adjustment, and T(ti) is the blood glucose data of the user to be measured.
[0118] In an exemplary embodiment of the present application, in order to prove the effectiveness of a personalized blood glucose prediction method provided by the present application, the OhioT1DM blood glucose dataset is used for verification.
[0119] The OhioT1DM blood glucose dataset contains eight-week data of 12 type 1 diabetes patients. When the historical window is 30 minutes and the prediction is for the blood glucose value in the next 30 minutes, the personalized blood glucose prediction method uses the blood glucose data of the target patient on different days in the dataset to finally adjust the initial blood glucose prediction model. Experiments are carried out on 12 diabetes patients respectively, and the average value is obtained according to the root mean square error (RMSE) results as Figure 4 shown in the result. Through Figure 4 it can be seen that in the personalized blood glucose prediction method of the present application, only a small amount of blood glucose data of the target patient can achieve an accurate blood glucose prediction effect, which meets the expectation of the present application. Among them, the RMSE formula is expressed as:
[0120]
[0121] Among them, k i is the actual blood glucose value of the i-th patient, is the predicted blood glucose value of the i-th patient, and n is the number of samples.
[0122] Furthermore, the present application also uses the Clarke error grid for clinical verification to evaluate the accuracy of the blood glucose prediction results of the present application. The Clarke Error Grid (CEG) was proposed in 1987, aiming to evaluate the clinical accuracy between the patient's estimate of the current blood glucose level and the actual measurement value, and is used to quantify the clinical accuracy between the estimated value generated by the blood glucose measurement device and the reference value. In the Clarke error grid diagram, the y-axis is the predicted value and the x-axis is the reference value, which is usually regarded as the accurate value; area A is that the difference between the predicted value and the reference value is within 20%, which belongs to the acceptable area; area B is the benign error area, located above or below area A, and the values falling into area A and area B are both considered acceptable values. The Clarke error grid diagram of the present application is as Figure 5As shown, the predicted result in area A accounts for 95.29% and that in area B accounts for 4.4%. In summary, the prediction accuracy of this application meets the requirements of the Clark grid.
[0123] Compared with the prior art, the advantages of a personalized blood glucose prediction method proposed in this application are mainly reflected in the following aspects:
[0124] 1. High-precision prediction: By combining the advantages of transfer learning and meta-learning, this application can provide a high-precision personalized final blood glucose prediction model for each diabetic patient with extremely few samples. Compared with traditional methods, this application not only improves the accuracy of blood glucose prediction but also significantly reduces the need for training data, making personalized blood glucose prediction more feasible in the actual clinical environment. This advantage mainly comes from the meta-transfer learning method adopted in this application. In particular, by transferring the weights of a large-scale deep neural network through training and keeping the weights of the transferred trained neural network unchanged, the general patterns learned in the transferred trained neural network are prevented from being forgotten when adapting to new tasks. This strategy ensures that the neural network can maintain a high generalization ability when facing new tasks. Combining lightweight scaling and shifting operations with meta-learning, it converges quickly and reduces the few-shot overfitting problem while maintaining the transferred training knowledge and avoiding "catastrophic forgetting".
[0125] 2. Fast convergence and efficient training: Through scaling and shifting operations, this application reduces the number of parameters of the final blood glucose prediction model, reduces the risk of overfitting, while maintaining the transferred training knowledge and avoiding "catastrophic forgetting", thus achieving fast convergence. And through scaling and offset operations, meta-transfer learning only adjusts a small number of parameters, thereby reducing the overfitting risk in small-sample tasks.
[0126] 3. Strong personalization adaptability: Through the task division scheme, this application divides the patient's blood glucose data into multiple tasks, each task consisting of two independent all-day blood glucose data of the patient, thereby improving the generalization ability of the final blood glucose prediction model and its adaptability to new patients. This task division scheme enables the final blood glucose prediction model to better capture the dynamic characteristics of the patient's blood glucose behavior, thus improving the adaptability of the final blood glucose prediction model to different patients and different all-day data.
[0127] 4. Low data requirement: By combining transfer learning and meta-learning, this application significantly reduces the dependence of the final blood glucose prediction model on a large amount of labeled data. Traditional personalized blood glucose prediction methods usually require a large amount of historical data for training, while this application reduces the dependence on a large amount of labeled data by leveraging the knowledge of the transferred trained initial model and combining meta-learning methods, thus achieving better performance on the target task. The meta-transfer learning method can achieve comparable performance to existing methods with fewer training tasks.
[0128] 5. Better expression ability: In this application, meta-transfer learning can use a deep neural network by adding scaling and shifting parameters to a trained initial model, without being limited to a shallow network, thereby improving the expression ability of the final blood glucose prediction model.
[0129] 6. High clinical application value: This application not only has significant innovation in technology but also has important clinical application value. By providing a final blood glucose prediction model with high precision, this application can provide a more accurate and efficient blood glucose management plan for diabetic patients, thus bringing practical therapeutic benefits to diabetes management. In particular, it has an innovative application in the time-series task of blood glucose prediction, and for the first time attempts to transplant and use meta-transfer learning in the LSTM network.
[0130] 7. Strong generality: The scaling and offset operations of the meta-transfer method are modular and can be easily inserted into a trained initial model without significantly modifying the overall architecture of the trained initial model. This design of this application makes the meta-transfer method have strong generality and scalability.
[0131] In summary, through the meta-transfer learning technology, this application solves the problem of personalized blood glucose prediction under small sample data, fills the gap in the deployment of blood glucose prediction in existing research, and provides a more accurate and efficient blood glucose management plan for diabetic patients.
[0132] In an exemplary embodiment, a computer device is provided. The computer device can be a server or a terminal, and its internal structure diagram can be as Figure 6 shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, abbreviated as I / O), and a communication interface. Among them, the processor, the memory, and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store personalized blood glucose prediction data. The input / output interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, it implements a personalized blood glucose prediction method.
[0133] Those skilled in the art can understand, Figure 6The structure shown is only a block diagram of some structures related to the solution of this application, and does not constitute a limitation on the computer device to which the solution of this application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements. In an exemplary embodiment, a computer device is provided, including a memory and a processor. A computer program is stored in the memory, and when the processor executes the computer program, the steps in the above method embodiments are implemented.
[0134] In an exemplary embodiment, a computer-readable storage medium is provided, storing a computer program, and when the computer program is executed by a processor, the steps in the above method embodiments are implemented.
[0135] In an exemplary embodiment, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps in the above method embodiments are implemented.
[0136] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use, and processing of relevant data need to comply with relevant regulations.
[0137] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, database, or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memories. Non-volatile memories can include read-only memory (ROM), magnetic tapes, floppy disks, flash memories, optical memories, high-density embedded non-volatile memories, resistive random access memories (ReRAM), magnetoresistive random access memories (MRAM), ferroelectric random access memories (FRAM), phase change memories (PCM), graphene memories, etc. Volatile memories can include random access memory (RAM) or external cache memories, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc.
[0138] The databases involved in the embodiments provided in the present application can include at least one of relational databases and non-relational databases. Non-relational databases can include distributed databases based on blockchain, etc., without limitation. The processors involved in the embodiments provided in the present application can be general-purpose processors, central processors, graphics processors, digital signal processors, programmable logics, data processing logics based on quantum computing, etc., without limitation.
[0139] The technical features of the above embodiments can be combined arbitrarily. For the sake of concise description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered to be within the scope described in this specification.
[0140] Specific examples are used in this article to elaborate on the principles and implementation manners of the present application. The description of the above embodiments is only used to help understand the method and its core idea of the present application; at the same time, for those of ordinary skill in the art, according to the idea of the present application, there will be changes in the specific implementation manners and application scopes. In summary, the content of this specification should not be construed as a limitation to the present application.
Claims
1. A personalized blood sugar prediction method, characterized in that: The personalized blood sugar prediction method comprises: Acquire a historical blood sugar sequence and current blood sugar data of the user to be tested; the historical blood sugar sequence includes historical blood sugar values at multiple sampling moments; Construct an initial blood glucose prediction model based on long short-term memory network; In the historical blood glucose sequence, the historical blood glucose value at the previous sampling moment is input, and the historical blood glucose value at the next sampling moment is output, forming an adjustment sample pair; Using the adjustment sample pair to adjust the initial blood glucose prediction model until the output error of the adjusted initial blood glucose prediction model reaches a set threshold, and using the adjusted initial blood glucose prediction model as the final blood glucose prediction model; The current blood sugar data is input into the final blood sugar prediction model to obtain the blood sugar prediction result of the user to be tested.
2. The personalized blood sugar prediction method according to claim 1, characterized in that: The initial blood glucose prediction model is constructed based on the long short-term memory network, including: Obtain and preprocess a pair of blood glucose training sample sequences to form a first training sample set and a second training sample set; the blood glucose training sample sequence pair has a historical blood glucose value at a previous sampling moment as input and a historical blood glucose value at a next sampling moment as output; The long short-term memory network is used as the encoder layer and the decoder layer respectively, and a fully connected layer is set to obtain an initial model; the encoder layer is connected to the decoder layer, and the decoder layer is connected to the fully connected layer; the long short-term memory network includes: a forget gate, an input gate, an output gate and a cell state update gate; Using the transfer learning algorithm, the initial model is trained using the first training sample set until the output error of the trained initial model reaches a set threshold, thereby obtaining a trained initial model; Freeze the weight parameters of the encoder layer and the decoder layer in the trained initial model, perform scaling and shifting operations on the forget gate, input gate, output gate, and cell state update gate in the trained initial model based on the scaling parameters and the shifting parameters, and use a meta-learning algorithm to train the trained initial model after the scaling and shifting operations using a second training sample set until the output error of the trained initial model after the scaling and shifting operations reaches a set threshold, thereby obtaining a trained blood glucose prediction model; The trained blood sugar prediction model is used as the initial blood sugar prediction model.
3. The personalized blood sugar prediction method according to claim 1, characterized in that: Obtain the historical blood sugar sequence and current blood sugar data of the user to be tested, including: Obtain the historical blood sugar data and current initial blood sugar data of the user to be tested; The historical blood sugar data and the current blood sugar initial data of the user to be tested are preprocessed to obtain the historical blood sugar sequence and the current blood sugar data of the user to be tested; the preprocessing includes: smoothing and noise reduction processing and sliding window processing.
4. The personalized blood sugar prediction method according to claim 3, characterized in that: The process of smoothing and denoising is expressed as follows: in, is the blood glucose data after smoothing and noise reduction at sampling time i, y i+j is the blood sugar data at sampling time i+j, c j To fit the coefficients of the polynomial, the coefficients of the fitting polynomial are determined based on the least squares method.
5. The personalized blood sugar prediction method according to claim 2, characterized in that: The forget gate, input gate, output gate and cell state update gate in the trained initial model are scaled and shifted based on the scaling parameter and the shift parameter, which is expressed as: SS(X;H;W,b;F S{1,2} )=(W·F S1 )(X,H)+(b+F S2 ); Among them, X is the current input data, H is the hidden state of the input, (X,H) is the input vector combination, W is the weight matrix, b is the bias parameter, and F S1 is the scaling parameter, F S2 is the shift parameter and · is the element-wise multiplication.
6. The personalized blood sugar prediction method according to claim 2, characterized in that: The meta-learning algorithm includes an inner loop process and an outer loop process; The inner loop process is expressed as: The outer cycle process is expressed as: Among them, F S{1,2} ' is the updated scaling and offset parameters, θ' is the updated fully connected layer parameters, θ is the weight parameters of the Encoder layer and the Decoder layer in the frozen trained initial model, α is the learning rate of the inner loop update, θ is the fully connected layer parameters, F S{1,2} are the scaling and offset parameters, For F S{1,2} and the gradient of θ, ζ Τ(tr) is the loss function, T(tr) is the blood glucose dataset in the inner loop, T(te) is the blood glucose dataset in the outer loop, and β is the learning rate of the outer loop update.
7. The personalized blood sugar prediction method according to claim 2, characterized in that: The process of adjusting the initial blood glucose prediction model using the adjustment sample pair is expressed as: Among them, F S{1,2} are scaling and offset parameters, θ is the fully connected layer parameter, κ is the learning rate during the adjustment process, For F S{1,2} and the gradient of θ, T(ti) is the historical blood glucose data of the user to be tested, and θ is the weight parameter of the Encoder layer and the weight parameter of the Decoder layer in the frozen trained initial model.
8. A computer device comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the personalized blood glucose prediction method according to any one of claims 1 to 7.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the personalized blood glucose prediction method according to any one of claims 1 to 7 is implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the personalized blood glucose prediction method according to any one of claims 1 to 7 is implemented.