Blood glucose prediction method based on LSTM encoder-decoder architecture

By introducing the LSTM encoder-decoder architecture, attention mechanism to learn similar patterns and DTW chain address search algorithm in the blood glucose prediction model, the problem of low personalized parameter recognition and prediction accuracy of existing blood glucose prediction models is solved, and the more Accurate prediction of blood sugar fluctuations and improve accuracy.

CN118942719APending Publication Date: 2024-11-12NANJING UNIV OF POSTS & TELECOMM +1
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410921813.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-10
Publication Date
2024-11-12

AI Technical Summary

Technical Problem

Existing blood glucose prediction models have difficulties in personalized parameter identification and prediction accuracy, especially the dynamic regulation process is easily disturbed, resulting in low prediction accuracy.

Method used

Using a blood glucose prediction method based on the LSTM encoder-decoder architecture, the attention mechanism that learns similar patterns and the DTW-based chain address search algorithm are introduced to enhance neuronal memory and reduce error propagation, and combined with attention characteristics and hidden state vectors. predict.

Benefits of technology

More accurate predictions of blood sugar level fluctuations are achieved, helping doctors and patients determine the optimal insulin injection time and dose, reduce the risk of hyperglycemia and hypoglycemia, and improve the accuracy of predicting blood sugar concentrations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118942719A_ABST
    Figure CN118942719A_ABST
Patent Text Reader

Abstract

A blood glucose prediction method based on an LSTM encoder-decoder architecture comprises the following steps: performing smoothing, noise reduction, window sliding and other processing on acquired blood glucose data of a diabetic patient; a blood glucose prediction model based on an LSTM encoder-decoder architecture is constructed, an encoder is responsible for converting an input sequence into a hidden state vector, and a decoder performs prediction output by using the hidden state vector; in order to enhance neuron memory and reduce accumulation of error propagation, in an encoder-decoder structure, an attention mechanism based on a learning similar mode is introduced, and a DTW-based chain address search algorithm is constructed to find a similar window sequence; the attention feature and the hidden state vector are jointly input into the decoder, and the output of the decoder is mapped to the vector conforming to the output dimension through the projection layer, so that a more accurate blood glucose prediction result is obtained. The method has strong learning ability, and can effectively improve the blood glucose concentration prediction precision through experimental authentication.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of deep learning, and in particular to a blood sugar prediction method based on an LSTM encoder-decoder architecture. Background Art

[0002] Diabetes has become a global public health issue that threatens human life and affects economic development. The analysis and prediction results of blood sugar data can assist physicians in timely treatment of patients and avoid blood sugar risks. Therefore, blood sugar prediction for diabetic patients has always been a hot topic in diabetes risk prediction.

[0003] Blood glucose prediction models are mainly divided into two categories: blood glucose prediction based on physiological models and blood glucose prediction based on data-driven. Physiological models are generally more complex and involve a large number of parameters in their use. However, human blood glucose is a dynamic regulation process and is easily interfered by various factors, which makes it difficult to identify personalized parameters during the modeling process, resulting in low prediction accuracy. With the development of sensor technology, data-driven models use blood glucose and other data indicators obtained by sensors for modeling. Deep learning can use deep structures to mine deep information hidden in data and solve many problems that are difficult to solve with traditional methods, such as difficulty in establishing mathematical models, strong nonlinearity of the system, capturing hidden or incomplete information, data scrambling, etc. It has opened up new ideas for blood glucose prediction and provided new prediction methods and broad prospects. Summary of the invention

[0004] In response to the problems existing in the background technology, the present invention provides a blood sugar prediction method based on the LSTM encoder-decoder architecture, which can effectively prevent complications in diabetic patients by accurately predicting fluctuations in blood sugar levels, and help doctors and patients determine the optimal insulin injection time and dosage, thereby maintaining blood sugar within a normal range and reducing the risks of hyperglycemia and hypoglycemia.

[0005] A blood sugar prediction method based on LSTM encoder-decoder architecture comprises the following steps:

[0006] Step 1: Perform missing value filling, smoothing, noise reduction and sliding window preprocessing on the acquired blood glucose data of diabetic patients to obtain blood glucose data that meets the input and output requirements of the model;

[0007] Step 2: Based on the processed blood glucose data, a blood glucose prediction model based on the LSTM encoder-decoder architecture is constructed, where the encoder is responsible for converting the input sequence into a hidden state vector, and the decoder uses the hidden state vector to predict the output;

[0008] Step 3: In the encoder-decoder structure, an attention mechanism based on learning similar patterns is introduced, and a DTW-based chain address search algorithm is constructed to find similar window sequences to enhance neuron memory and reduce the accumulation of error propagation;

[0009] Step 4: Based on the attention feature and the hidden state vector, they are input into the decoder together, and the output of the decoder is mapped to a vector that meets the output dimension size through the projection layer to obtain the blood glucose prediction result.

[0010] The beneficial effects achieved by the present invention are:

[0011] (1) By accurately predicting fluctuations in blood sugar levels, it can effectively prevent complications in diabetic patients and help doctors and patients determine the optimal time and dosage of insulin injections to maintain blood sugar within the normal range and reduce the risk of hyperglycemia and hypoglycemia.

[0012] (2) In the encoder-decoder structure, an attention mechanism based on learning similar patterns is introduced, and a DTW-based chain address search algorithm is constructed to find similar window sequences, which can enhance neuronal memory and reduce the accumulation of error propagation.

[0013] (3) The attention mechanism based on learning similar patterns allows the network to dynamically focus on relevant information from previous time steps and integrate it into the current RNN unit. In this way, the model is able to retain and utilize key information from previous time steps, which helps to better handle dependencies between long sequences, thereby improving the model's prediction performance.

[0014] (4) This method has strong learning ability and has been experimentally verified to be able to effectively improve the accuracy of blood glucose concentration prediction. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] Figure 1 A flow chart of a blood sugar prediction method based on an LSTM encoder-decoder architecture is provided in an embodiment of the present invention.

[0016] Figure 2 A model architecture diagram of a blood glucose prediction method based on an LSTM encoder-decoder architecture provided in an embodiment of the present invention.

[0017] Figure 3 A diagram illustrating the construction of a sample of a blood glucose prediction method based on an LSTM encoder-decoder architecture provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0018] The technical solution of the present invention is further described in detail below in conjunction with the accompanying drawings.

[0019] Figure 1A flow chart of a blood glucose prediction method based on an LSTM encoder-decoder architecture provided in an embodiment of the present invention is as follows: Figure 1 As shown, the blood glucose prediction method based on the LSTM encoder-decoder architecture includes the following steps:

[0020] The blood glucose data of diabetic patients are processed by missing value filling, smoothing, noise reduction and sliding window to obtain blood glucose sample data that meets the input and output requirements of the model.

[0021] Specifically, blood glucose data preprocessing includes the following steps:

[0022] (1) The spline interpolation method is used to fill the missing values ​​in the blood glucose data.

[0023] (2) The Savitzky-Golay method is used to smooth the data to effectively filter out the influence of noise, thereby improving the quality of the data and the performance of the time series prediction model. The specific formula is as follows:

[0024]

[0025] In the formula, is the signal value at position i after smoothing, which is calculated by polynomial fitting of the data at the current position i and its neighboring points; c j are the coefficients of the fitted polynomial, determined by the least squares method; y i+j is the value of the original signal at position i+j. In order to calculate the smoothed signal value The signal value y of the current position i and the k points before and after it needs to be used i+j .

[0026] (3) In order to improve the prediction accuracy and speed up the calculation of data, the blood glucose data was further normalized. Considering that the fluctuation range of the blood glucose values ​​of patients in the data set is large and there are outliers, the z-score method is used to normalize the blood glucose data. The conversion function is as follows:

[0027]

[0028] Where μ is the mean, σ is the standard deviation, and x and z are the data before and after normalization.

[0029] (4) In order to meet the input and output requirements of the prediction model, the sliding window method is used to transform the blood glucose data. Each sample data uses the blood glucose data at time 1-T as the input window and the blood glucose values ​​at the next n moments as the target output. Then, the window is slid to the right by n steps to form sample 2, and continues to slide to the right until all data are processed and all samples are obtained.

[0030] Based on the blood sugar data, a blood sugar prediction model based on the LSTM encoder-decoder architecture is constructed.

[0031] In one embodiment of the present invention, the constructed sample data is input into a prediction model of a preset LSTM encoder-decoder architecture. Specifically, first, the blood glucose prediction model based on the LSTM encoder-decoder architecture includes two sets of independent LSTM recurrent units, based on a preset function

[0032] I t =σ(W i .[h t-1 ,x t ]+b i )

[0033]

[0034] The sample information x t The information is input into the LSTM unit, and the input gate extracts features from the information.

[0035] Among them, h t-1 represents the hidden state of the neural unit at the previous time step, b i 、b c Represent the input gate and candidate state bias values, W i , W c Represent the weight matrices of the input gate and candidate state respectively. t represents the state activation value of the input gate at time step t, It represents the combination of feature information of the output at the previous moment and the input sequence at the current moment. σ(.) and h(.) represent Sigmoid and tanh activation functions respectively.

[0036] Based on preset functions

[0037] F t =σ(W f .[h t-1 ,x t ]+b f )

[0038] Retain the key feature information in the sequence and filter out irrelevant information, and then input the information x t Enter the forget gate.

[0039] Among them, W f 、b f Represent the weight matrix and bias vector of the forget gate respectively, F t Represents the state activation value of the forget gate at time step t.

[0040] Based on preset functions

[0041]

[0042] The filtered matrix features are combined with the features of the input gate to obtain the state features C of the current LSTM unit. t .

[0043] Based on preset functions

[0044] O t =σ(W o [h t-1 ,x t ]+b o )

[0045] The previous hidden state and the current input features are weighted and biased to obtain the output gate matrix O t .

[0046] Among them, W o 、b o They are represented as the weight matrix and bias vector of the output gate respectively.

[0047] Based on preset functions

[0048] h t =O t *tanh(C t )

[0049] Get the output state of the LSTM unit.

[0050] A group of LSTM recurrent units as encoders is responsible for converting the input sequence into a fixed-length vector representation to capture the context of the input blood glucose data information. Another group of LSTM recurrent units as decoders uses the feature vector generated by the encoder to generate the output sequence. The blood glucose multi-step prediction process can be expressed as:

[0051]

[0052] Among them, x1,x2,…,x T The historical blood sugar values ​​at 1-T moments; is the predicted blood sugar value at the T+t moment; m is the prediction step length, f ED It is a prediction model based on the LSTM encoder-decoder architecture.

[0053] In the encoder, the input sequence X t =(x1,x2,...,x T ) is input to the LSTM recurrent network layer, and a hidden state h(t)=f(h(t-1),x t), which is processed step by step by the recurrent neural network, and all states h(t) are summed up and finally converted into a vector C of fixed length.

[0054] Based on the feature vector C generated by the encoder, the decoder starts working. The decoder is expanded in time sequence. After the t-1th LSTM unit decodes the encoded feature vector, it is converted into the required dimension through the fully connected layer to obtain the blood sugar prediction value y at the t-1th moment. t-1 , and then the hidden state s that integrates the prediction sequence information of the previous t-1 moments is t-1 Same as the predicted value y at time t-1 t-1 The two are sent together as input to the next LSTM unit to obtain the blood sugar prediction value at the tth moment. By analogy, the prediction of the entire blood sugar data sequence is finally completed, and the power blood sugar data prediction values ​​at multiple moments in the future are obtained.

[0055] The constructed Seq2Seq prediction model is mainly divided into three steps: (1) splicing input: concatenating the feature vector c, the predicted value y at the previous moment t-1 and the hidden state s at the previous moment t-1 Concatenate into a single input vector. (2) Through the LSTM unit: pass the concatenated input vector to the LSTM unit at the current moment, and update the hidden state and cell state of the LSTM. (3) Fully connected layer: pass the hidden state output by the LSTM unit to a fully connected layer and convert it to the required output dimension, that is, the blood glucose prediction value at the current moment The specific calculation process is expressed as:

[0056]

[0057] Among them, f(.) represents the constructed Seq2Seq prediction model, c is the input sequence encoding vector, y t-1 is the output of the previous step, s t-1 is the hidden state of the previous step.

[0058] In the encoder-decoder structure, an attention mechanism based on learning similar patterns is introduced, and a DTW-based chain address search algorithm is constructed to find similar window sequences.

[0059] The embodiment of the present invention introduces a hard attention mechanism for learning similar patterns on the basis of the original model. In the task of time series prediction, a key issue is to ensure that the model has sufficient "memory" ability, that is, it can effectively review the characteristics of historical similar patterns in the sequence, so as to better capture long-term dependencies. The attention mechanism based on learning similar patterns allows the network to dynamically pay attention to the relevant information of the previous time step and integrate it into the current RNN unit. In this way, the model is able to retain and utilize key information from previous time steps, which helps to better handle dependencies between long sequences, thereby improving the prediction performance of the model.

[0060] Specifically, first, in the tth time step, only the information aligned with the t'th time step in the attention sequence is selected as the input of the decoder. At this time, the corresponding selection probability α t',t is 1, and 0 at other times, and the attention feature information at this time is used as an additional input to the decoder.

[0061] In the decoder structure, the predicted value y at each step is t =f(c,y t-1 ,s t-1 ,a t '), where c is the input sequence encoding vector, y t-1 is the output of the previous step, s t-1 is the hidden state of the previous step, a t ' is the value of the tth time step of the attention sequence. The calculation formula of the attention mechanism is as follows:

[0062]

[0063] e ti =s t T h i

[0064]

[0065] s′ t =tanh(W c [C t :s t ])

[0066] Among them, e ti is an attention scoring mechanism, indicating h i For t The degree of influence of Con t is the context vector, which is obtained by adding attention weight α ti and the hidden state h of the historical input node i The sum of the products one by one, W cIt is the weight matrix used to process the concatenation result of the context vector and the current hidden state, and T represents the length of the input sequence.

[0067] The attention mechanism is a hard attention mechanism, that is, in the tth time step, only the information aligned with the t'th time step in the attention sequence is selected as the input of the decoder; at this time, the corresponding selection probability α t',t is 1, and 0 at other times, and the attention feature information at this time is used as an additional input to the decoder; in the decoder structure, the predicted value y at each step t =f(c,y t-1 ,s t-1 ,a t '), where c is the input sequence encoding vector, y t-1 is the output of the previous step, s t-1 is the hidden state of the previous step, a t ' is the value of the tth time step of the attention sequence.

[0068] In the encoder-decoder structure, an attention mechanism based on learning similar patterns is introduced, and a DTW-based chain address search algorithm is constructed to find similar window sequences.

[0069] In one embodiment of the present invention, a DTW-based chain address search algorithm is constructed to find similar window sequences to achieve the construction of attention features. According to the characteristics of blood glucose data, cycle repeatability can be combined with forward iterative search when searching for similar windows.

[0070] Specifically, firstly, an allowable loss threshold β, namely the maximum DTW distance, is set to define the acceptable distance between similar windows.

[0071] The blood glucose data of the corresponding time point in the previous N days is used as the starting search point for searching. The DTW algorithm is used to calculate the distance similarity between the retrieval window and the reading window. If its DTW distance is less than the set threshold β, it is selected as a candidate. If the number of candidates is less than N, the window of the candidate link is searched or iterative forward search is performed. In the experiment, considering the search time complexity and training effect, the number of candidates N is set to 3.

[0072] Furthermore, similar sequences are weighted by inverse distance to obtain the focus sequence. The pseudo code of the algorithm is as follows:

[0073]

[0074]

[0075] 4. Combine the attention features and the hidden state vector and input them into the decoder together. The output of the decoder is mapped to a vector of the same size as the output dimension through the projection layer.

[0076] In one embodiment of the present invention, the attention features and the hidden state vector are combined and input into the decoder together, and the output of the decoder is mapped to a vector that meets the output dimension size through the projection layer, so as to obtain a more accurate blood sugar prediction result.

[0077] Figure 2 A blood sugar prediction model architecture diagram based on LSTM encoder-decoder architecture is provided in an embodiment of the present invention. Figure 2 As shown in the figure, first, the blood glucose data is smoothed, denoised, and processed with sliding windows to meet the input and output requirements of the prediction model. Then, a blood glucose prediction model based on the LSTM encoder-decoder architecture is constructed, and the processed blood glucose data is input into the encoder through the reading window, converted into a semantic vector, and then the prediction sequence is output from the decoder. In order to enhance the long-term memory capacity of neurons in the encoder-decoder structure, an attention mechanism that focuses on the trend of similar sequence features is introduced into the model architecture, and a DTW-based similarity sequence search algorithm is constructed to find similar time window data.

[0078] Figure 3 A sample construction diagram of a blood sugar prediction method based on an LSTM encoder-decoder architecture provided in an embodiment of the present invention. Figure 3 As shown, each sample data includes blood glucose data at time points 1-T as the input window, and the blood glucose values ​​of the following n time steps as the target output. Subsequently, the window moves to the right by n steps to form the second sample, and this process continues until all data are processed to obtain a complete sample set.

[0079] The above description is only a preferred embodiment of the present invention, and the protection scope of the present invention is not limited to the above embodiment. Any equivalent modifications or changes made by ordinary technicians in this field based on the contents disclosed by the present invention should be included in the protection scope recorded in the claims.

Claims

1. A blood sugar prediction method based on LSTM encoder-decoder architecture, characterized in that: The method comprises the following steps: Step 1: Perform missing value filling, smoothing, noise reduction and sliding window preprocessing on the acquired blood glucose data of diabetic patients to obtain blood glucose data that meets the input and output requirements of the model; Step 2: Based on the processed blood glucose data, a blood glucose prediction model based on the LSTM encoder-decoder architecture is constructed, where the encoder is responsible for converting the input sequence into a hidden state vector, and the decoder uses the hidden state vector to predict the output; Step 3: In the encoder-decoder structure, an attention mechanism based on learning similar patterns is introduced, and a DTW-based chain address search algorithm is constructed to find similar window sequences to enhance neuron memory and reduce the accumulation of error propagation; Step 4: Based on the attention feature and the hidden state vector, they are input into the decoder together, and the output of the decoder is mapped to a vector that meets the output dimension size through the projection layer to obtain the blood glucose prediction result.

2. A blood sugar prediction method based on LSTM encoder-decoder architecture according to claim 1, characterized in that: In step 1, the acquired blood sugar data of the diabetic patient is preprocessed to obtain the blood sugar data that meets the input and output requirements of the model, specifically including: Fill missing values ​​in the data based on spline interpolation method; Based on preset functions The blood sugar data is smoothed using the Savitzky-Golay method to filter out the influence of noise; wherein, is the signal value at position i after smoothing, which is calculated by polynomial fitting of the data at the current position i and its neighboring points; c j are the coefficients of the fitted polynomial, determined by the least squares method; y i+j is the value of the original signal at position i+j; in order to calculate the smoothed signal value The signal value y of the current position i and the k points before and after it needs to be used i+j ; Based on preset normalization function Normalize the blood glucose data; where μ is the mean, σ is the standard deviation, and x and z are the data before and after normalization; The normalized blood glucose data is sampled and converted based on a sliding time window. Each sample data uses the blood glucose data at time 1-T as the input window and the blood glucose values ​​at the next n times as the target output. Then, the window is slid to the right for n steps to form sample 2, and continues to slide to the right until all data are processed and all samples are obtained.

3. The blood sugar prediction method based on LSTM encoder-decoder architecture according to claim 1, characterized in that: In step 2, based on the blood glucose data that meets the model input and output requirements, a blood glucose prediction model based on the LSTM encoder-decoder architecture is constructed, specifically including: The blood glucose prediction model based on the LSTM encoder-decoder architecture contains two independent LSTM recurrent units; based on the preset function I t =σ(W i .[h t-1 ,x t ]+b i ) The sample information x t Input into the LSTM unit, and the input gate extracts features from the information; where h t-1 represents the hidden state of the neural unit at the previous time step, b i 、b c Represent the input gate and candidate state bias values, W i , W c Represents the weight matrices of the input gate and candidate state respectively; I t represents the state activation value of the input gate at time step t, It represents the combination of feature information of the previous moment output and the current moment input sequence, σ(.) and h(.) represent Sigmoid and tanh activation functions respectively; Based on preset functions F t =σ(W f .[h t-1 ,x t ]+b f ) Retain the key feature information in the sequence and filter out irrelevant information, and then input the information x t Input forget gate; where F t represents the state activation value of the forget gate at time step t; W f 、b f Represent the weight matrix and bias vector of the forget gate respectively; Based on preset functions The filtered matrix features are combined with the features of the input gate to obtain the state features C of the current LSTM unit. t ; Based on preset functions The t =σ(W o [h t-1 ,x t ]+b o ) The previous hidden state and the current input features are weighted and biased to obtain the output gate matrix O t ; Among them, W o 、b o Represented as the weight matrix and bias vector of the output gate respectively; Based on preset functions h t =O t *tanh(C t ) Get the output state h of the LSTM unit t ; Based on the LSTM network, a blood glucose prediction model with an encoder-decoder architecture is constructed. A group of LSTM recurrent units is used as an encoder to convert the input sequence into a vector representation of a fixed length to capture the context of the input blood glucose data information. Another group of LSTM recurrent units is used as a decoder to generate an output sequence using the feature vector generated by the encoder. The blood glucose multi-step prediction process is expressed as: Among them, x1,x2,…,x T The historical blood sugar values ​​at 1-T moments; is the predicted blood sugar value at the T+t moment; m is the prediction step length, f ED It is a prediction model based on LSTM encoder-decoder architecture; Based on the encoder-decoder model architecture, in the encoder, the input sequence X t =(x1,x2,...,x T ) is input to the LSTM layer, and a hidden state h(t)=f(h(t-1),x t ), after being processed step by step by the recurrent neural network, all states h(t) are summed up and finally converted into a vector C of fixed length; Based on the feature vector C generated by the encoder, the decoder starts working. The decoder is expanded in time sequence. After the t-1th LSTM unit decodes the encoded feature vector, it is converted into the required dimension through the fully connected layer to obtain the blood sugar prediction value y at the t-1th moment. t-1 , and then the hidden state s that integrates the prediction sequence information of the previous t-1 moments is t-1 Same as the predicted value y at time t-1 t-1 The two are sent together as input to the next LSTM unit to obtain the blood sugar prediction value at the tth moment. By analogy, the prediction of the entire blood glucose data sequence is finally completed, and the power blood glucose data prediction values ​​at multiple moments in the future are obtained; the specific calculation process is expressed as: Among them, f(.) represents the constructed Seq2Seq prediction model, c is the input sequence encoding vector, y t-1 is the output of the previous step, s t-1 is the hidden state of the previous step.

4. A blood sugar prediction method based on LSTM encoder-decoder architecture according to claim 3, characterized in that: The constructed Seq2Seq prediction model f(.) is divided into three steps: (1) Concatenation of inputs: concatenating the feature vector c and the predicted value y at the previous moment t-1 and the hidden state s at the previous moment t-1 concatenate into a single input vector; (2) pass through the LSTM unit: pass the concatenated input vector to the LSTM unit at the current moment, and update the hidden state and cell state of the LSTM; (3) fully connected layer: pass the hidden state output by the LSTM unit to a fully connected layer to convert it into the required output dimension, that is, the blood glucose prediction value at the current moment 5. The blood sugar prediction method based on LSTM encoder-decoder architecture according to claim 1, characterized in that: In step 3, based on the constructed encoder-decoder structure, a hard attention mechanism based on learning similar patterns is introduced; the calculation formula of the attention mechanism is as follows: e ti =s t T h i S' t =tanh(W c [C t :S t ]) Among them, e ti is an attention scoring mechanism, indicating h i For t The degree of influence of Con t is the context vector, which is obtained by adding attention weight α ti and the hidden state h of the historical input node i The sum of the products one by one, W c It is the weight matrix used to process the concatenation result of the context vector and the current hidden state, and T represents the length of the input sequence; The attention mechanism is a hard attention mechanism, that is, in the tth time step, only the information aligned with the t'th time step in the attention sequence is selected as the input of the decoder; at this time, the corresponding selection probability α t',t is 1, and 0 at other times, and the attention feature information at this time is used as an additional input to the decoder; in the decoder structure, the predicted value y at each step t =f(c,y t-1 ,s t-1 ,a t '), where c is the input sequence encoding vector, y t-1 is the output of the previous step, s t-1 is the hidden state of the previous step, a t ' is the value of the tth time step of the attention sequence.

6. A blood sugar prediction method based on LSTM encoder-decoder architecture according to claim 1, characterized in that: In step 3, based on the attention mechanism of learning similar patterns, a DTW-based chain address search algorithm is constructed to find similar window sequences to achieve the construction of attention features; specifically, it includes: Based on the characteristics of the blood glucose data, when searching for similar windows, the periodic repeatability is combined with the forward iterative search, and the chain address search algorithm based on DTW is proposed. First, a permitted loss threshold β, that is, the maximum DTW distance, is set to define the acceptable distance between similar windows. Then, the blood glucose data at the corresponding time points in the previous N days are used as the starting search points for searching. The DTW algorithm is used to calculate the distance similarity between the retrieval window and the read window. If its DTW distance is less than the set threshold β, it is selected as a candidate. If the number of candidates is less than N, search for the windows of the candidate links or perform iterative forward search. Finally, inverse distance weighting is performed on the similar sequences to obtain the concerned sequence.

7. A blood sugar prediction method based on LSTM encoder-decoder architecture according to claim 6, characterized in that: The specific steps of the chain address search algorithm based on DTW are as follows: (1) Input the number of candidates N, the threshold β, and the current window, and read the position of the window in the period T; (2) Retrieve the windows at the same positions at the corresponding time points in the previous N days as the starting search points; (3) Calculate the DTW distance D between the retrieval window and the read window; if it is less than β, select the candidate object and store an address pointer p pointing to the retrieval window position at the local read window position i , jump to step (4); otherwise, continue searching according to the current step; if the candidate items >= N, jump to step (6); (4) Retrieve whether the pointer is also stored in the p i In the window pointed to by the pointer; if so, read the window pointed to by the pointer and return to step (3); otherwise, continue searching according to the current step; if the candidate item is greater than or equal to N, go to step (6); (5) If steps (2), (3), and (4) are completed and the number of candidates < N, start from the read window, perform iterative forward search to continue looking for similar windows, and return to step (3); (6) Exit the search and output N similar windows.

8. The blood sugar prediction method based on LSTM encoder-decoder architecture according to claim 6, characterized in that: Considering the search time complexity and training effect, the number of candidates N is set to 5.

Citation Information

Cited By

  • Multi-element load prediction method and device, storage medium and program product

    CN120067995A