A method for predicting and analyzing epileptic seizures based on BI-LSTM network
By performing EEG data preprocessing and feature extraction in the BI-LSTM network, combined with wavelet transform and PLV analysis, the Bi-LSTM model is optimized to improve the classification accuracy of epileptic seizure prediction, solving the problem of poor classification effect in the existing technology, and achieving for more efficient epilepsy prediction.
Patent Information
- Application Number
- CN202211167114.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-23
- Publication Date
- 2024-10-25
- Estimated Expiration
- 2042-09-23
AI Technical Summary
Existing epilepsy seizure prediction methods have problems with poor classification results, low classification performance and low classification efficiency, and hyperparameter optimization and the number of neurons have little impact on performance, resulting in poor prediction results.
A method based on the BI-LSTM network is used to preprocess and feature extract the EEG data. Wavelet transform is used to reduce noise and build a brain function network based on PLV. It is combined with graph theory analysis to extract feature vectors and uses forgetting gates, input gates and output gates. Optimize the Bi-LSTM model and select the appropriate optimization algorithm and initial learning rate to improve classification accuracy.
It improves the classification accuracy of epilepsy EEG feature sets, reduces resource overhead and time consumption, provides more effective epilepsy prediction results, and provides a new perspective for treatment and prediction.
Smart Images

Figure CN115500790B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of electroencephalogram (EEG) signal processing, and in particular relates to a method for predicting and analyzing epileptic seizures based on a BI-LSTM network. Background Art
[0002] Epilepsy is a complex neurological disease. Identifying patterns of epileptic activity in the electroencephalogram (EEG) plays a vital role in providing the right treatment for patients. At the same time, the detection of epileptic seizures is very important for patients.
[0003] There are many methods currently used for research in the field of epilepsy prediction, such as frequency domain analysis methods based on brain wave frequency, time series analysis methods for EEG signal data statistics, analysis methods for intelligent system engineering, and nonlinear dynamic model analysis methods.
[0004] In this method, the degree and clustering coefficient of the network are extracted as features and input into Bi-LSTM for deep learning classification. In this method, the bidirectional long short-term memory network (Bi-LSTM) is a recursive neural network (RNN), and the storage unit, number of neurons and learning algorithm of the single-layer dual LSTM structure are optimized. Network hyperparameters are often an important factor affecting network performance. In this study, the effects of two optimization algorithms on the classification success rate and the effects of changing the number of neurons and the initial learning rate on the performance are compared and analyzed. As far as the research is concerned, the existing classification methods have problems such as poor classification effect, low classification performance and classification efficiency. Unlike previous studies, this study not only focuses on the success rate, but also emphasizes the importance of determining hyperparameters (selection of optimization algorithm, initial learning rate, number of hidden neurons) in the Bi-LSTM model. Summary of the invention
[0005] In view of the problems existing in the above-mentioned prior art, the object of the present invention is to provide a method for predicting and analyzing epileptic seizures based on a BI-LSTM network.
[0006] In order to solve the above-mentioned technical problems and achieve the purpose of the invention, the present invention is realized through the following technical solutions:
[0007] A method for predicting and analyzing epileptic seizures based on a BI-LSTM network is applied to the problem of EEG data classification, and uses existing EEG data for feature extraction and classification. The method comprises the following steps:
[0008] Step 1: Preprocessing of epileptic EEG signals; using wavelet transform to reduce noise on epileptic data.
[0009] Due to the high real-time requirements, epilepsy prediction methods cannot be truly synchronized. In order to extract features from preprocessed EEG recording signals, they should be divided into smaller sliding windows. Studies have shown that if the window length is too long, it will increase the difficulty of calculation and consume time costs. In comparison, the method of using a shorter window can achieve the unity of capturing specific patterns and smoothness. But if the time is too short, no useful information can be obtained. Based on the above discussion, an 8-second semi-overlapping window will be adopted in this method. Then it is necessary to extract effective EEG signals from strong noise pollution. Combining existing methods, the present invention uses wavelet transform (WT) for noise reduction. WT has good time-frequency window characteristics. It can automatically adjust the sampling step size according to the characteristics of the signal itself, and can perform multi-scale fitting and refinement on the signal through transformations such as telescoping and translation. It can achieve time subdivision at high frequencies and frequency subdivision at low frequencies. The signal processed by WT can meet the signal processing requirements of this experiment without losing signal detail information.
[0010] Step 2: Feature extraction; feature extraction of brain functional network based on PLV.
[0011] In the feature extraction part, we first build a brain function network based on PLV, and then analyze the brain network based on graph theory. We extract the features in the network for different case data and further build the corresponding feature vector. In this method, degree and clustering coefficient are used as the measurement indicators of brain function network, and the information interaction ability between nodes is detected from the interphase and prephase, respectively.
[0012] This application constructs a complex functional brain network based on phase lock value, analyzes the function and structure, and then achieves the purpose of extracting EEG signal feature data based on the brain network. In network analysis, phase synchronization plays an important role. Phase synchronization analysis can separate the amplitude component and phase component in the motor imagery EEG signal, and then accurately analyze the EEG signal to fully explore the important information hidden in the EEG signal.
[0013] In the process of constructing a functional brain network, the channels in the EEG data are used as network nodes in a complex topological network. ch (n)}ch=1…23, n=1…L, there are 23 channels in total, and the number of sampling points collected by each channel is recorded as L, The time-frequency components obtained by the empirical mode decomposition of each channel, where ch represents the number of channels of the motor imagery EEG data, and m represents the number of component decompositions. Then, in the motor imagery EEG signal, the relationship between node i and node j can be defined as the phase lock value between the mth intrinsic mode function between channel i and channel j in the EEG signal, and its calculation process is shown in formula (7):
[0014]
[0015] In the formula, It represents the instantaneous phase difference between channel i and channel j at time t, and N is the total number of sample points collected during this time period. PLV represents the calculated phase lock value, which ranges from 0 to 1. The larger the PLV value, the higher the synchronization between the two nodes.
[0016] After constructing the brain functional network based on PLV, the brain network is analyzed based on graph theory. The features in the network are extracted for different case data, and the corresponding feature vectors are further constructed. In previous studies, Grupta R et al. used some network features of the amplitude square coherence network to study the classification of EEG signals, but the recognition effect of EEG signals was not ideal. For EEG data, the global differences of brain functional networks of different categories are smaller than the local differences. If we only focus on the topological properties of the global scale, the sub-module features that can reflect the differences within the functional network will be missing, resulting in unclear feature differences between different categories.
[0017] Step 3: Feature classification: Use BI-LSTM network for feature classification.
[0018] In the feature classification stage, the feature data obtained in the feature extraction stage is used for classification using the BI-LSTM network. Bi-LSTM not only overcomes the RNN gradient explosion problem, but also has the advantages of LSTM inference. The first is the forget gate process. After inputting a string of information, not all the information content is important. If the unimportant information can be removed, it will be beneficial to network training. This step is completed by the forget gate. t-1 is the state value of the previous hidden layer, which is equal to the current input value x t The activation function sigmoid is σ, which determines the information to be retained or discarded. Because its value range is 0 to 1, when the information value tends to 0, it is discarded, and when it tends to 1, it is retained. The forget gate formula is as follows:
[0019] f t =σ(w f *[h t-1 , x t ]+b f ) (1)
[0020] In the formula: w——weight; b——weight bias.
[0021] The second is the input gate operation. It is responsible for storing the information. The candidate value k is obtained. t , and then discard the information through the forget gate and input gate to get the current information c t, the specific operation is as follows:
[0022] i t =σ*(wi * [h t-1 ,x t ]+b i ) (2)
[0023] k t =tanh(w c *[h t-1 ,x t ]+b c ) (3)
[0024] c t =f t *c t-1 +i t *k t (4) Where: i t ——Input gate.
[0025] The last step is the output operation. The sigmoid function is used to determine the content of the information to be output, and then the output information is multiplied by tanh to determine the part to be output. The specific operation is as follows:
[0026] k t =tanh(w c *[h t-1 ,x t ]+b c ) (5)
[0027] h t =o t *tanh(c t ) (6)
[0028] By comparing the advantages and disadvantages of the RMSprop optimization algorithm and the Momentum algorithm, we can finally achieve the goal of improving the training results. The RMSprop optimization algorithm is evolved from SGD and is a type of adaptive learning. By comparing it with the Momentum optimization algorithm, we find that RMSprop can better adjust the problem of excessive swing amplitude in the loss function update, and the convergence speed is also accelerated. In summary, it can be concluded that the RMSprop optimization algorithm is more suitable.
[0029] Step 4: Parameter optimization; discuss and analyze different parameters to obtain the best parameter combination.
[0030] In the parameter optimization stage, by comparing the success rates of classification using the Bi-LSTM model at different initial learning rates, it was found that the generalization ability of the model was more successful in the classification with an initial learning rate of 0.01. Under the premise of determining the learning rate, according to the accuracy results of the Bi-LSTM model, when the number of hidden layer neurons is 30, the highest accuracy is 94.45%. The second highest accuracy is 94.15% when the number of hidden layer neurons is 80. It can also be found from the table that the improvement in accuracy is not positively correlated with the increase in the number of hidden neurons. And as the number of neurons increases, it can be found that the required classification time also increases accordingly. It can be concluded that although the classification accuracy is almost the same when the number of hidden neurons is 10 and 80, the time required for classification increases accordingly as the number of hidden neurons increases, resulting in a decrease in model performance. Based on the above, the number of neurons is selected as 30.
[0031] Due to the adoption of the above technical solution, the present invention has the following beneficial effects compared with the prior art:
[0032] By using this method, the classification accuracy of epilepsy EEG feature set can be improved to a certain extent. Compared with the traditional deep neural network, it is found that this method has significantly improved resource overhead and time consumption. The results show that this method has achieved good results in all subjects, and epilepsy prediction provides effective features and provides a new perspective for the treatment and prediction of epilepsy. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 It is a schematic diagram of signal waveform processing;
[0034] Figure 2 It is a node relationship graph;
[0035] Figure 3 This is the Bi-LSTM schematic diagram;
[0036] Figure 4 It is the overall flow chart of the method of the present invention. DETAILED DESCRIPTION
[0037] The present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments:
[0038] The present invention relates to a method for predicting and analyzing epileptic seizures based on a BI-LSTM network, and its overall flow chart is as follows: Figure 4 As shown, the method comprises the following steps:
[0039] Step 1: Preprocessing of epileptic EEG signals: Use wavelet transform (WT) to reduce noise of EEG data during the interictal and preictal periods. Figure 1As shown, WT has good time-frequency window characteristics. It can automatically adjust the sampling step size according to the characteristics of the signal itself, and can perform multi-scale fitting and refinement on the signal through transformations such as scaling and translation. It can achieve time subdivision at high frequencies and frequency subdivision at low frequencies. The signal processed by WT can meet the signal processing requirements of this experiment without losing signal detail information. Based on the considerations of computational difficulty and time cost, in order to achieve the unity of capturing specific patterns and smoothness, we divide the pre-processed EEG recording signal into smaller sliding windows and divide it into eight-second semi-overlapping windows.
[0040] Step 2: Feature extraction: In the feature extraction part, we first build a brain function network based on PLV, and then analyze the brain network based on graph theory. We extract the features in the network for different case data and further build the corresponding feature vector. This method uses degree and clustering coefficient as the measurement indicators of brain function network. Figure 2 The relationship between each node can be seen, and then the information interaction ability between nodes can be detected from the interphase and prephase respectively.
[0041] This application constructs a complex functional brain network based on phase lock value, analyzes the function and structure, and then achieves the purpose of extracting EEG signal feature data based on the brain network. In network analysis, phase synchronization plays an important role. Phase synchronization analysis can separate the amplitude component and phase component in the motor imagery EEG signal, and then accurately analyze the EEG signal to fully explore the important information hidden in the EEG signal.
[0042] In the process of constructing a functional brain network, the channels in the EEG data are used as network nodes in a complex topological network. ch (n)}ch=1…23, n=1…L, there are 23 channels in total, and the number of sampling points collected by each channel is recorded as L, The time-frequency components obtained by the empirical mode decomposition of each channel, where ch represents the number of channels of the motor imagery EEG data, and m represents the number of component decompositions. Then, in the motor imagery EEG signal, the relationship between node i and node j can be defined as the phase lock value between the mth intrinsic mode function between channel i and channel j in the EEG signal, and its calculation process is shown in formula (7):
[0043]
[0044] In the formula, It represents the instantaneous phase difference between channel i and channel j at time t, and N is the total number of sample points collected during this time period. PLV represents the calculated phase lock value, which ranges from 0 to 1. The larger the PLV value, the higher the synchronization between the two nodes.
[0045] After constructing the brain functional network based on PLV, the brain network is analyzed based on graph theory. The features in the network are extracted for different case data, and the corresponding feature vectors are further constructed. In previous studies, GruptaR et al. used some network features of the amplitude square coherence network to study the classification of EEG signals, but the recognition effect of EEG signals was not ideal. For EEG data, the global differences of brain functional networks of different categories are smaller than the local differences. If we only focus on the topological properties of the global scale, the sub-module features that can reflect the differences within the functional network will be missing, resulting in unclear feature differences between different categories.
[0046] Step 3: Feature classification: In the feature classification stage, the BI-LSTM network is used for classification based on the feature data obtained in the feature extraction stage. The Bi-LSTM network not only overcomes the RNN gradient explosion problem, but also has the advantages of LSTM inference. Figure 3 This is the schematic diagram of the Bi-LSTM network.
[0047] The first is the forget gate process. After a string of information is input, not all the information content is important. If the unimportant information can be removed, it will be beneficial to network training. This step is completed by the forget gate. t-1 is the state value of the previous hidden layer, which is equal to the current input value x t The activation function sigmoid is σ, which determines the information to be retained or discarded. Because its value range is 0 to 1, when the information value tends to 0, it is discarded, and when it tends to 1, it is retained. The forget gate formula is as follows:
[0048] f t =σ(w f *[h t-1 , x t ]+b f ) (1)
[0049] In the formula: w——weight; b——weight bias.
[0050] The second is the input gate operation. It is responsible for storing the information. The candidate value k is obtained. t , and then discard the information through the forget gate and input gate to get the current information c t , the specific operation is as follows:
[0051] i t =σ*(w i *[h t-1 ,x t ]+b i ) (2)
[0052] k t =tanh(wc *[h t-1 ,x t ]+b c ) (3)
[0053] c t =f t *c t-1 +i t *k t (4) Where: i t ——Input gate.
[0054] The last step is the output operation. The sigmoid function is used to determine the content of the information to be output, and then the output information is multiplied by tanh to determine the part to be output. The specific operation is as follows:
[0055] k t =tanh(w c *[h t-1 ,x t ]+b c ) (5)
[0056] h t =o t *tanh(c t ) (6)
[0057] In deep learning applications, the absolute minimum of the loss function must be determined. The smaller the loss function, the better the training results. The process of minimizing (or maximizing) any mathematical expression is called optimization. The absolute minimum of the loss function must be determined to make the learning process produce more accurate results. At present, the most widely used optimization algorithm is Gradient Descent (SGD). The RMSprop optimization algorithm evolved from SGD and is a type of adaptive learning. Comparing it with the Momentum optimization algorithm, it is found that RMSprop can better adjust the problem of excessive swing amplitude of loss function update, and the convergence speed is also accelerated.
[0058] Step 4: Parameter optimization; In the parameter optimization stage, the success rates of classification using the Bi-LSTM model at different initial learning rates were compared, and it was found that the generalization ability of the model was more successful in the classification with an initial learning rate of 0.01. Under the premise of determining the learning rate, according to the accuracy results of the Bi-LSTM model, when the number of hidden layer neurons is 30, the highest accuracy is 94.45%. The second highest is when the number of hidden layer neurons is 80, with an accuracy of 94.15%. From the table, it can be seen that the improvement in accuracy is not positively correlated with the increase in the number of hidden neurons. And as the number of neurons increases, it can also be found that the required classification time also increases accordingly. It can be concluded that although the classification accuracy is almost the same when the number of hidden neurons is 10 and 80, the time required for classification increases accordingly as the number of hidden neurons increases, resulting in a decrease in model performance. Based on the above, the number of neurons is selected as 30.
[0059] In the remaining data set, the data of five people are selected to test the classification prediction ability of the BI-LSTM model proposed in this paper using the cross-validation method. Cross-validation refers to separating and shuffling the training data and test data of the model as much as possible, so that the data for each model training and test are as different as possible, thereby testing the prediction ability of the model.
[0060] In this experiment, the 5-fold cross validation method was used. Cross validation is also used to verify two classification tasks, namely, the pre-seizure period and the inter-seizure period. The data sets of the five patients were divided into five parts, namely A, B, C, D, and E. There was no intersection between any two groups of data. If the training data set uses A, B, C, and D, the test data set uses E. Four of the data sets were used for training, and the remaining data set was used for predictive classification testing. The results were basically consistent with expectations.
[0061] The present invention extracts the degree and clustering coefficient of the network as features and inputs them into Bi-LSTM for deep learning classification. In this method, a bidirectional long short-term memory network (Bi-LSTM) is a recursive neural network (RNN), and the storage unit, number of neurons and learning algorithm of a single-layer dual LSTM structure are optimized. Network hyperparameters are often an important factor affecting network performance. In this study, the effects of two optimization algorithms on the classification success rate and the effects of changing the number of neurons and the initial learning rate on performance are compared and analyzed. Unlike previous studies, this study not only focuses on the success rate. In addition, the importance of determining hyperparameters (selection of optimization algorithm, initial learning rate, number of hidden neurons) in the Bi-LSTM model is emphasized. The results show that this method has achieved good results in all subjects, providing effective features for epilepsy prediction and providing a new perspective for the treatment and prediction of epilepsy.
Claims
1. A method for predicting and analyzing epileptic seizures based on a BI-LSTM network, characterized in that: Step 1: Preprocessing of epileptic EEG signals: Use wavelet transform to reduce the noise of epileptic data during the interictal and preictal EEG data, divide the processed data into eight-and-a-half-second overlapping windows, and extract valid EEG signals; Step 2: Feature extraction stage: feature extraction of brain function network based on PLV. First, construct a brain function network based on PLV, then analyze the brain network based on graph theory, extract the features in the network for different case data, and further construct the corresponding feature vector. Use degree and clustering coefficient as the measurement indicators of brain function network, and detect the information interaction ability between nodes from the interphase and prephase respectively. In the process of constructing a functional brain network, the channels in the EEG data are used as network nodes in a complex topological network, and the collected EEG signals There are 23 channels in total, and the number of sampling points collected by each channel is recorded as L. The time-frequency components obtained by the empirical mode decomposition of each channel, where ch represents the number of channels of the motor imagery EEG data, and m represents the number of component decompositions; in the motor imagery EEG signal, the relationship between node i and node j is defined as the phase lock value between the mth intrinsic mode function between channel i and channel j in the EEG signal, and its calculation process is shown in formula (7): In the formula represents the instantaneous phase difference between channel i and channel j at time t, and N is the total number of sample points collected in the time period; PLV represents the calculated phase lock value, which ranges from 0 to 1. The larger the PLV value, the higher the synchronization between the two nodes; Step 3: In the feature classification stage, BI-LSTM network is used for feature classification; First, unimportant information is removed through the forget gate process, h t-1 is the state value of the previous hidden layer, and the current input value x t They enter the hidden layer together, and the activation function sigmoid is σ, which determines the information to be retained or discarded; its value range is 0 to 1. When the information value tends to 0, it is discarded, and when it tends to 1, it is retained. The forget gate formula is as follows: f t =σ(w f *[h t-1 ,x t ]+b f ) (1) In the formula: w——weight; b——weight bias; Secondly, the reserved information is stored through the input gate operation; the candidate value k is obtained t , and then discard the information through the forget gate and input gate to get the current information c t , the specific operation is as follows: i t =σ*(w i *[h t-1 ,x t ]+b i ) (2)k t =tanh(w c *[h t-1 ,x t ]+b c ) (3) c t =f t *c t-1 +i t *k t (4) Where: i t - Input gate, Finally, for the output operation, sigmoid is used to determine the content of the information to be output, and then the output information is multiplied by tanh to determine the part to be output. The specific operations are as follows: k t =tanh(w c *[h t-1 ,x t ]+b c ) (5) h t =o t *tanh(c t ) (6) Step 4: Parameter optimization stage. After discussing and analyzing different hyperparameters, the best parameter combination is obtained to increase the classification efficiency while reducing computing power. The initial learning rate of the Bi-LSTM model is determined to be 0.01 and the number of hidden layer neurons is 30.
