A resting state multi-channel electroencephalogram signal recognition method based on a graph attention network and sparse coding

By constructing a brain functional network through frequency band division, using differential entropy and phase lock value features, and combining graph attention networks and sparse coding techniques, the problem of low accuracy in EEG signal classification in traditional methods is solved, and efficient resting-state multi-channel EEG signal recognition is achieved.

CN116211319BActive Publication Date: 2026-04-07BEIJING UNIV OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-22
Publication Date
2026-04-07

AI Technical Summary

Technical Problem

Traditional machine learning methods have low classification accuracy in resting-state multichannel EEG signal recognition, limited by the expressive power of high-dimensional features, and the calculation of brain functional connectivity features is greatly affected by the distance between electrodes, resulting in significant errors.

Method used

We construct a brain functional network using frequency bands, and use differential entropy and phase lock value as brain functional nodes and connection features. We restore the real brain functional connections through graph attention network, and combine sparse coding dimensionality reduction and feature enhancement to fuse multi-frequency band node features for classification.

Benefits of technology

It improved the classification accuracy of resting-state multichannel EEG signals, reaching 98.42%, and significantly enhanced the classification performance of brain functional connectivity features.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116211319B_ABST
    Figure CN116211319B_ABST
Patent Text Reader

Abstract

The present application relates to a kind of multi-channel EEG signal recognition method based on graph attention network and sparse coding.First, the multi-channel electroencephalogram is preprocessed, obtains several multi-channel electroencephalogram data samples.Next, each data sample is processed in sub-band, is divided into five sub-bands, and five brain function networks are constructed using the above two feature extraction methods.Next, the five brain function networks are fused, and the brain function node features are spliced as the fused brain function node features;The average value of five brain function connection features is then processed to remove invalid connections by threshold processing, as the fused brain function connection feature.The fused brain function network is restored to the real brain function connection feature by graph attention network model, and the brain function connection sparse feature is reduced by using autoencoder Dimension and feature enhancement, feature reduction is carried out, and finally the two features are fused and classified.The present application has the highest classification accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the interdisciplinary field of deep learning and electroencephalography (EEG) signal processing technology, and relates to a method for recognizing resting-state multichannel EEG signals by incorporating graph attention networks and sparse coding. Background Technology

[0002] Traditional machine learning methods are widely used in resting-state multichannel EEG signal recognition. By statistically analyzing the acquired resting-state multichannel EEG signals and extracting linear or nonlinear features, machine learning methods can be used for classification, achieving good results. Commonly used EEG signal features can be divided into two categories: linear features and nonlinear features. Linear features include mean, standard deviation, first-order difference mean, and second-order difference mean. Nonlinear features include detrended fluctuation analysis, Higuchi fractals, correlation dimension, and Lyapunov exponents. With the development of graph-based complex networks, it has become possible to construct brain functional networks using physiological data such as magnetic resonance imaging (MRI), magnetoencephalography (MEG), and EEG. As research into the core topology of brain functional networks (BFNs) deepens, increasing evidence suggests that abnormal changes in BFN topology can distinguish between resting-state multichannel EEG signals acquired from subjects in two different states. Traditional classification methods that extract linear or nonlinear features from EEG signals are limited by machine learning's ability to represent high-dimensional features, resulting in low classification accuracy. Constructing brain functional networks to identify EEG signals is feasible, and there are two ways to construct these networks: simple and complex. A simple brain functional network is constructed using brain functional connectivity features, while a complex network is constructed using both connectivity and node features. The accuracy of classification using brain functional connectivity features directly is higher than that of classification using small-world attribute features. This indicates that secondary feature extraction results in the loss of more useful information, and also suggests that brain functional connectivity features can be directly used as the final classification features. According to EEG signal acquisition technology, the calculation of brain functional connectivity features is greatly affected by the distance between electrodes, resulting in significant errors. This may be the main reason limiting the classification performance of brain functional connectivity features. Existing research indicates that brain functional connectivity features should be a sparse matrix, suggesting the presence of many invalid connections. With the increasing application of graph neural networks, graph pooling techniques for embedding brain functional node features have shown some effectiveness in depression identification. However, the difference in performance between graph pooling and brain functional connectivity feature classification has not been thoroughly discussed. Therefore, this study first considers how to remove ineffective brain functional connections, then explores how to restore true brain functional connectivity features, analyzes how to enhance sparse brain functional connectivity features, and finally discusses the classification performance of connectivity features and brain functional node features.

[0003] This paper adopts a frequency band-based approach to constructing brain functional networks. The acquired resting-state multi-channel EEG signals are filtered through a 0-50Hz bandpass filter and decomposed into five commonly used frequency bands: alpha, beta, gamma, theta, and delta. Five brain functional networks are constructed for each band, and these are initially fused to reduce the complexity of model training. The brain functional network constructed in this paper is a complex brain functional network. The brain functional network G = (V, A, X) consists of nodes and edges between them, where V is the set of nodes, A is the set of edges, and X is the set of node features. The electrodes corresponding to the EEG signals are defined as nodes, the dependencies between nodes are defined as edges, and synchronicity is used as the carrier of these dependencies. Phase Locking Value (PLV) is a representative method for calculating synchronicity, which can quantify the degree of synchronization of two neural signals entering a phase-locked state in a specific frequency band and time domain. Some researchers believe that two neurons entering a phase-locked state can exchange information in real time because their information windows open or close simultaneously, allowing signals to communicate and serving as an important indicator of abnormal brain region signals. Considering the complex nonlinear characteristics of EEG signals, the emergence of nonlinear dynamics analysis methods has provided a new approach to EEG signal analysis. Information entropy, as a standard for the determinism of random events, is one of the most widely used methods. Differential entropy (DE), as an improved algorithm for power spectral density, possesses both the simplicity of power spectral density and the sensitivity of information entropy, enabling more accurate extraction of features contained in EEG signals. Therefore, differential entropy is used to represent brain functional node features. A practical method for removing invalid brain functional connections is to set appropriate thresholds for brain functional connection features to filter out invalid connections. Graph attention networks can learn new edge information based on brain functional node features during training, assigning different weights to edges to calculate more accurate brain functional connection features. Therefore, this paper uses graph attention networks to reconstruct realistic brain functional connections. The brain functional connectivity features after thresholding are a sparse matrix, containing too many zero values, resulting in significant redundancy. Therefore, this paper employs an autoencoder to reduce the dimensionality of the brain functional connectivity features and enhance their effectiveness. To fully utilize node features, a bandgap attention mechanism is used to aggregate multi-band node features. Finally, the brain functional node features and brain functional connectivity features are fused and classified. Summary of the Invention

[0004] To address the aforementioned background, this invention proposes a method for identifying resting-state multichannel EEG signals based on graph attention networks and sparse coding to distinguish between normal and abnormal EEG signals. In constructing the brain functional networks, this invention adopts a strategy of first building five brain functional networks by dividing the EEG signals into frequency bands, and then fusing these networks. Differential entropy (DE) features are used as brain functional node features, and phase-locked value (PLV) is used as brain functional connectivity features. Invalid brain functional connections are filtered out using a threshold, graph attention networks are used to reconstruct true brain functional connections, encoder technology is used to reduce the dimensionality and enhance the features of the sparse matrix of brain functional connections, and a frequency band attention mechanism is used to aggregate multi-frequency band node features. Finally, the two types of features are fused and classified.

[0005] To achieve the above objectives, the present invention adopts the following technical solution:

[0006] A method for recognizing resting-state multichannel EEG signals based on graph attention networks and sparse coding includes:

[0007] Step (1) Preprocessing of EEG signals

[0008] The multi-channel EEG signals used in this paper are from the MODMA dataset publicly available from Lanzhou University. This dataset contains 128 channels of EEG signal data and is a binary classification task dataset. First, the EEG signals are bandpass filtered and divided into 5 sub-bands.

[0009] Step (2) Brain Network Construction

[0010] First, brain functional networks under five frequency bands are constructed. These networks consist of two parts: brain functional node features and brain functional connectivity features. Short-Time Fourier Transform (STFT) is used to extract differential entropy (DE) as brain functional node features, and Hilbert Transform (Hilbert) is used to extract phase lock value (PLV) features as brain functional connectivity features. Then, the five frequency band brain functional networks are merged into a single brain functional network.

[0011] a. Brain functional node feature extraction

[0012] The differential entropy characteristics of the preprocessed EEG subband signal are calculated using STFT.

[0013] Differential entropy features were extracted using STFT.

[0014] 1) Calculate the Discrete Fourier Transform (DFT) of the signal using the Fast Fourier Transform (FFT) algorithm.

[0015] 2) Then, calculate the power spectral density (PSD).

[0016] 3) Calculate the differential entropy value by taking the base-2 logarithm of the power spectral density.

[0017] b. Brain functional connectivity feature extraction

[0018] Synchronization features were extracted from the preprocessed EEG subband signal using Hilbert transform.

[0019] 1) Calculate the phase angle of the signal using the Hilbert transform.

[0020] 2) Then, calculate the phase difference between the phase angles.

[0021] 3) Calculate the exponent with the natural constant as the base based on the phase difference of all points, sum and average the absolute values ​​of the exponents to obtain the value of PLV.

[0022] c. Brain functional network fusion

[0023] 1) The average value of the brain functional connectivity features of the five sub-band brain networks is taken as the fused brain functional connectivity features. Then, the fused brain functional connectivity features are thresholded to retain effective brain functional connectivity.

[0024] 2) The brain function node features of the five sub-band brain function networks are spliced ​​together, so that the feature dimension of each node is increased from 1 dimension to 5 dimensions, and this is used as the fused brain function node features.

[0025] Step (3) Global Feature Extraction

[0026] The proposed model consists of four parts: a global feature extraction module composed of multiple graph attention network layers, a connection feature sparse coding module composed of an autoencoder, a node feature fusion module, and a classifier. The global feature extraction module modifies its own node features by aggregating the features of neighboring nodes and recalculates the correlation between nodes.

[0027] Step (4) Sparse coding and node feature fusion

[0028] The sparse coding module encodes the updated connection features, reducing feature dimensionality and enhancing the features. The node feature fusion module assigns different weights to each sub-band, fusing the node features of the five sub-bands into one, further reducing feature dimensionality.

[0029] Step (5) Classifier

[0030] The construction of the brain functional network in this paper consists of two parts: brain functional connectivity features and brain functional node features. These two types of features are learned and enhanced through the aforementioned feature transformations. Finally, the two types of features are concatenated, and the prediction result is output after passing through two fully connected layers and the log_softmax function. Attached Figure Description

[0031] Figure 1 This is a flowchart of the method involved in the present invention;

[0032] Figure 2 This is a general structural diagram of the present invention;

[0033] Figure 3 This is a diagram of the sparse coding module of the present invention;

[0034] Figure 4 This is a visualization of the feature transformation effect of the present invention; Detailed Implementation

[0035] The present invention will now be further described in conjunction with the accompanying drawings and specific implementation details.

[0036] The method involved in this invention includes the following steps:

[0037] Step (1) Preprocessing of EEG signals

[0038] First, the obtained multi-channel EEG data was bandpass filtered from 1 to 50 Hz, and the filtered signal was then divided into frequency bands according to 1-4 Hz, 4-8 Hz, 8-13 Hz, 13-30 Hz, and 30-50 Hz, into five sub-band signals: delta, theta, alpha, beta, and gamma. The EEG signal was then divided into 1-second segments.

[0039] Step (2) Brain Network Construction

[0040] Brain functional networks were constructed from five sub-band EEG signals using the following method, and then the five brain functional networks were merged into one. The brain functional network consists of two parts: one is the brain functional node feature composed of differential entropy values ​​(DE), and the other is the brain functional connectivity feature composed of phase lock values ​​(PLV).

[0041] a. Brain functional node feature extraction

[0042] Nonlinear time-frequency features are extracted using STFT.

[0043] 1) Calculate the DFT of the signal using FFT.

[0044] [Y,f]=F DFT (X in ,n,n op ,n win ,n fft ,fs)

[0045] Among them, F DFT Let X be a function of the Discrete Fourier Transform, and let matrix X be the preprocessed input EEG signal. n represents the number of sampling points for each EEG sample. opn is the length of the overlapping windows. op =0, n win n is the length of the sliding window. win =200, n fft For the sampling points of the Discrete Fourier Transform (DFT), n fft =200, fs is the sampling frequency, fs=200, f is the sampling frequency vector, and Y is the matrix value of the signal after DFT.

[0046] 2) Then, calculate the automatic spectrum of the PSD.

[0047] P xx =F PSD (Y,n fft ,f,n,n op ,n win ,fs)

[0048] Among them, F PSD P is the power spectral density calculation function. xx This is the power density spectral matrix.

[0049] 3) The calculation of DE is P xx Logarithm to base 2.

[0050] DE = log2(P) xx )

[0051] The output dimension of the DE feature is 128×1.

[0052] b. Brain functional connectivity feature extraction

[0053] The phase angle of the EEG signal is calculated using Hilbert transform, and the phase lock value is calculated as a feature of brain functional connectivity.

[0054] 1) Use the eegfilt function for filtering.

[0055] f = F eegfilt (C,srate,locutoff,hicutoff)

[0056] Among them, F eegfilt Let be the filtering function, and matrix C be the preprocessed input EEG signal. srate is the sampling frequency, srate = 200, locutoff is the low-frequency start frequency of the filter, locutoff = [1, 4, 8, 13, 30]. hicutoff is the high-frequency cutoff frequency of the filter, hicutoff = [4, 8, 13, 30, 50].

[0057] 2) After Hilbert transform, the phase angle of the signal is calculated using the angle function.

[0058] P = F angle (F hilbert (f))

[0059] Where F angle This is the phase calculation function. The input signal for calculating the phase angle is the segment signal extracted from the segmentation.

[0060] 3) Calculate the phase difference.

[0061] PLV i-j =sum(P i -P j )

[0062] PLV i-j P represents the correlation between the i-th and j-th channels of the EEG signal, where sum is the summation function. i -P j This represents vector subtraction. Calculating the PLV values ​​of pairwise correlations for all channels yields the brain functional connectivity features (Adjacent) for all EEG signals. The dimensions of these brain functional connectivity features are 128×128.

[0063] c. Brain functional network fusion

[0064] The fusion operation of brain functional networks is divided into two steps, which fuse brain functional node features and brain functional connectivity features respectively.

[0065] 1) Fusion of brain functional node features

[0066] The brain functional node features of the five frequency bands were spliced ​​together to obtain the fused brain functional node features.

[0067] X=concat(DE1|DE2|DE3|DE4|DE5|)

[0068] Where X represents the fused brain functional node features, concat represents the matrix concatenation operation, and DE i This represents the brain functional node features of different sub-band signals. The feature dimension of the brain functional node features of each sub-band is 128×1, and the dimension of the fused brain functional node feature X is 128×5.

[0069] 2) Brain functional connectivity features are fused and thresholded.

[0070] The brain functional connectivity feature matrices of the five frequency bands were summed and averaged.

[0071]

[0072] Adjacent cThis represents the averaged brain functional connectivity feature matrix, Adjacent k This represents the brain functional connectivity matrix for signals in different sub-bands. A suitable threshold λ is selected; brain functional connections greater than λ are retained, while those less than λ are discarded and their values ​​are set to 0.

[0073]

[0074] In this study, after multiple experiments, the threshold λ was finally determined to be 0.85. The brain functional connectivity features have a dimension of 128×128, and after thresholding λ, they are represented by a non-sparse matrix. c It became a sparse matrix A.

[0075] Step (3) Global Feature Extraction Module

[0076] The brain functional network is constructed from two types of features—brain functional node features X and brain functional connectivity features A. These two features are used as input to a graph attention network for global feature extraction. The global feature extraction module consists of two identical graph attention network layers. Each graph attention network contains a multi-head attention layer and an aggregation layer. The multi-head attention layer has 8 heads, and the aggregation layer consists of a single graph attention layer.

[0077] Multi-head graph attention layer

[0078] In the multi-head attention layer, each head is a separate graph attention layer. Each brain functional node in the graph attention layer updates its own information by aggregating information from all its neighbors, thus achieving global information extraction. All nodes in the attention layer share a node attention mechanism 'a' to perform self-attention calculations on the node, updating its own information by assigning different weights to different neighbor nodes to obtain global features. Attention mechanism 'a' is a single-layer feedforward neural network, and the attention value represents the correlation strength between nodes. To further differentiate the contribution of different frequency band brain functional node features to classification performance, a frequency band attention mechanism 'W' is designed to assign different weights to different frequency band node features, allowing it to pay more attention to frequency band node features with higher weights during global information extraction. In this invention, both attention mechanisms 'a' and 'W' are implemented using linear transformations, with the formula: y = wx + b, where y represents the transformed output, x represents the input, w is the weight coefficient, and b is the bias term. In this invention, the bias term of the attention mechanism is always 0. The attention value between nodes is calculated as follows:

[0079] e ij =a(WX i WX j )

[0080] eij This indicates that node X j For node X i The correlation. This mechanism injects graph structure into the computation by performing masked attention—only node X is computed. j ∈N i e ij , where N i It is node X in the graph i The neighborhood is queried based on the brain functional connectivity feature matrix A. To facilitate comparison of coefficients across different nodes, the softmax function is used on X. j Normalize all correlations:

[0081]

[0082] α ij This represents the normalized correlation coefficient. The LeakyReLU nonlinear activation function is then applied. The above formula can be expanded as follows:

[0083]

[0084] Where ∑ represents the summation function, T represents the transpose, || represents the concatenation operation, and exp represents the exponential function.

[0085] The normalized attention coefficients among all nodes are obtained using the above formula. Then, the linear combination of the corresponding node features is calculated using the normalized coefficients as the final output feature of each node.

[0086]

[0087] σ represents the activation function elu(). This represents the brain functional node features after aggregating neighbor node information.

[0088] To make the attention learning process more stable, a multi-head attention mechanism is used. Specifically, eight independent attention mechanisms perform the above transformation, and then their features are concatenated to obtain the following output feature representation:

[0089]

[0090] Where || denotes matrix concatenation operation. This represents the characteristics of node i after incorporating the multi-head attention mechanism. W is the correlation coefficient between nodes i and j calculated under the k-th attention mechanism. k This refers to the attention coefficient of the corresponding frequency band attention mechanism. After updating the node information for all brain functional nodes using the above calculation method, the output X of the multi-head graph attention layer is obtained. cTo prevent the global feature extraction module from overfitting, a dropout layer is used to mask brain functional connectivity features.

[0091] Polymer layer

[0092] The aggregation layer's role is to aggregate the features of multiple brain functional nodes learned by the multi-head attention layer and use them to update the connection features between nodes, thus creating new brain functional connection features. The aggregation layer consists of a single graph attention layer, but its output has two parts: one part is the updated brain functional node feature X. merge The other part consists of the correlation coefficients between all nodes. Brain functional connectivity features A merge .

[0093]

[0094]

[0095] Where a merge For the attention coefficients of the attention mechanism between nodes in the aggregation layer, W represents the correlation coefficient between aggregation layer nodes i and j. merge This is the weight matrix for the frequency band attention mechanism of the aggregation layer.

[0096] Step (4) Sparse coding and node feature fusion

[0097] The construction of a brain network consists of a brain functional connectivity matrix representing the relationships between brain regions and node features representing the attributes of brain region nodes. However, after thresholding λ, the brain functional connectivity matrix becomes a sparse matrix. Figure 4 As can be seen from the .b diagram, the classification performance of the original sparse matrix of brain functional connectivity is poor. Therefore, we designed a sparse encoding module for brain functional connectivity features. This module borrows the idea of ​​an autoencoder to reduce the dimensionality of brain functional connectivity features, making the differences between the brain functional connectivity features of depressed individuals and normal individuals more apparent. The autoencoder consists of two parts: an encoder and a decoder. Here, we use the linear transformation function built into PyTorch for feature transformation. The formula for the linear transformation function is: y = kx + b, where y represents the transformed output, x represents the input, k is the weight coefficient, and b is the bias term.

[0098] A out =Linear (1) (flatten(triu(A merge )))

[0099] Among them, Linear (1)The output dimension is Adjacent c The effective number of brain functional connections retained after thresholding the brain functional connectivity matrix by a threshold λ is the number of non-zero elements in the sparse matrix A. Since the brain functional connectivity matrix is ​​a symmetric matrix, the effective number of connections is half the total number of non-zero elements in the matrix after thresholding by λ. In this experiment, the effective number of connections was 600 when the threshold λ was set to 0.85. The `triu()` function extracts the elements of the upper triangular region of the matrix, `flatten()` expands the matrix into one dimension, and `Linear()`... (1) Let represent an independent linear transformation function, and h be the brain functional connectivity features after the linear transformation. From Figure 4 As can be seen from the data in .d, the classification performance of brain functional connectivity features is greatly improved after feature encoding.

[0100] The brain functional node features from multiple frequency bands are fused into a unique value that represents the attribute of that brain functional node. The node feature output by the global feature extraction module is X. merge The feature dimension is N×F, where N=128 represents the number of brain functional nodes and F=5 represents the number of sub-bands. In the node feature aggregation module, we assign different weights to different frequency bands, and then fuse the five frequency band features into one. Here, we still use the linear transformation function Linear, and the output dimension of Linear is set to 1.

[0101] X out =Linrar (2) (X merge )

[0102] Where X out X represents the brain functional node features after linear transformation. out The feature dimension is N×1, where N=128 represents the number of brain functional nodes. (2) It is also an independent linear transformation function. Figure 4 .a and Figure 4 The .c graph shows that the classification performance of brain functional node features is improved before and after training. (Comparison) Figure 4 .c and Figure 4 As can be seen from the data, the classification performance of brain functional connectivity features is higher than that of brain functional node features in this paper.

[0103] Step (5) Classifier

[0104] The brain functional node features are expanded and concatenated with the brain functional connectivity features. Then, the result is passed through two linear transformation layers and finally through the log_softmax function to output the prediction result, as shown in the following formula:

[0105] out = log_softmax(Linear) (4)(Linear (3) (concat(X out A out ))))

[0106] Where concat() represents matrix concatenation operation, Linear (3) Linear (4) Let represent two independent linear transformation functions, and let _out_ represent the probability distribution of the final predicted output. The loss is calculated using the cross-entropy function, as shown in the following formula:

[0107]

[0108] Where loss(out,label) represents the loss during training, out(x) represents the probability distribution of the predicted class x, and label(x) represents the probability distribution of the true class x.

[0109] The proposed model consists of four parts: a global feature extraction module composed of multiple graph attention network layers, a connection feature sparse coding module composed of an autoencoder, a node feature fusion module, and a classifier. Specific model parameters are shown in Table 3. In this model, graph attention networks and linear transformations are used for feature extraction in multiple places; their definitions and parameters are shown in Tables 2 and 1, respectively.

[0110] Network model parameters

[0111] Table 1. Definition and parameters of the linear transformation function (Linear).

[0112] Linear Parameters (in_feature, out_feature, bias)

[0113] Table 2 Definition and parameters of GraphAttentionLayer

[0114] GraphAttentionLayer Parameters (in_feature,out_feature,dropout,alpha) Attention mechanism W nn.Linear(in_feature,out_feature) Attention mechanism a nn.Linear(2*out_feature,1) Activation function LeakyReLU LeakyReLU(alpha) Normalized Softmax Softmax(dim=1) Dropout layer Dropout(0.5)

[0115] Table 3 Network framework parameter settings of the method of the present invention

[0116]

[0117]

[0118] The batch size is not considered in the above network model parameter table. Here, X represents brain functional node features, and A represents brain functional connectivity features. The network framework of this invention consists of three parts.

[0119] Training parameter settings

[0120] In this experiment, the batch size was set to 256, and the number of training epochs was set to 70. The learning rate of the Adam optimizer was set to 1e-3, and the weight decay was set to 1e-8.

[0121] Classification result evaluation

[0122] This paper employs a 5-fold cross-validation data partitioning scheme. For each fold of the experiment, a test set is assigned, and the remaining data is divided into five training and validation partitions to tune model hyperparameters. This process is repeated five times. The best-performing model among the five candidate models (on the validation set) is then selected to evaluate its performance on the unseen test set. Classification performance is evaluated using the following metrics: classification accuracy (Acc), sensitivity (Sen), and specificity (Spe).

[0123] The corresponding indicators are defined as follows:

[0124]

[0125]

[0126]

[0127] Where TP is the true positive rate, representing the number of samples that are actually positive and are also predicted to be positive; TN is the true negative rate, representing the number of samples that are actually negative and are also predicted to be negative; FP is the false positive rate, representing the number of samples that are actually negative and are predicted to be positive; and FN is the false negative rate, representing the number of samples that are actually positive and are predicted to be negative.

[0128] Comparative analysis

[0129] Table 4. Comparison of classification results between this invention and other algorithms

[0130]

[0131] In the table, NM represents network features, PLI represents phase delay exponent, L represents linear features, NL represents nonlinear features, PLV represents phase lock value features, and DE represents differential entropy features. None indicates no frequency band division, and All indicates frequency band division and use of full-band EEG signals.

[0132] The MODMA dataset from Lanzhou University was used in the experiment to verify the performance of the feature extraction and classification algorithms. The experimental results are shown in Table 1. The first four references are from Sun Shuting et al., who first extracted various brain network features from Beta band EEG signals based on the weighted PLI functional connectivity matrix, including Shortest Path Length (SPL), EBC, NBC, CC, transitivity, assortativity, modularity, and strength. Local network features (SPL, EBC, NBC, CC, and strength) provided 90 features, reflecting the 90 brain functional nodes used in this study; global features (transitivity, assortativity, and modularity) provided one feature. The brain network feature vector dimension was 453, and classification using an LR classifier achieved a classification accuracy of 82.59%. Next, functional connectivity features (PLI) of the alpha band EEG signals were extracted. The upper triangular elements of the PLI matrix were expanded to one dimension, resulting in a 4005-dimensional vector of functional connectivity features. A BFDT classifier was used for classification, achieving a classification accuracy of 84.18%. Then, eight linear features were extracted from the Theta and Delta band EEG signals: variance, mean amplitude between peaks, mean square, activity, mobility, and complexity calculated based on the Hjorth parameter, and maximum road pattern density and total power calculated based on an adaptive regression model. This yielded a 720-dimensional vector of linear features, which were classified using C4.5 and LR classifiers, achieving recognition accuracies of 77.88% and 74.29%, respectively. Zhang Lu et al. extracted four linear features from EEG signals of depression: mean, standard deviation, first-order difference mean, and second-order difference mean, as well as seven nonlinear features: Higuchi fractal dimension, C0 complexity, LZC complexity, approximate entropy, spectral entropy, SVDen single-valued decomposition entropy, and Shannon entropy. The resulting vector dimension of the nonlinear features was 54 dimensions. A soft voting ensemble learning strategy was used for classification, achieving a maximum recognition accuracy of 82.61%. Zhang Bingtao, based on 64-channel EEG theta-band signals, constructed a BFN using the phase delay index. Based on the complementary information of weighted and binarized BFNs, he selected BFN indicators closely related to "small-world" characteristics and specific brain regions with minimum spanning trees, employing a progressive analysis strategy to find potential indicators for depression identification. Finally, the shortest path length and clustering coefficient features of the weighted BFN were extracted, and a KNN classifier was used for classification, achieving a maximum recognition rate of 94.11%. Chen Tao proposed an EEG-based MDD detection model, namely Soft-Label Self-Attention Graph Pool (SGP-SL). He explored the local and global connections between EEG channels and pre-constructed an EEG-based graph.By utilizing multiple self-attention graph pooling modules, the constructed graph is progressively refined, and then graph pooling is performed to aggregate information from less important nodes to more important nodes, achieving a recognition rate of up to 84.91%. As shown in Table 4, our invented resting-state multichannel EEG signal classification method based on graph attention networks and sparse coding adopts a novel brain functional network construction approach. It uses graph attention networks for global information extraction to reconstruct the true brain functional connections, employs encoder technology to enhance the sparse brain functional connection matrix, analyzes the correlation of brain functional node features in different frequency bands through attention mechanisms, and finally fuses the two features to achieve a maximum classification accuracy of 98.42%, as well as a sensitivity of 98.93% and a specificity of 98.01%.

Claims

1. A method for recognizing resting-state multichannel EEG signals based on graph attention networks and sparse coding, characterized in that... Includes the following steps: Step (1) Preprocessing of EEG signals First, the EEG signal was bandpass filtered and divided into 5 sub-band signals; Step (2) Brain Network Construction First, a brain functional network under five frequency band signals is constructed. The brain functional network consists of two parts: brain functional node features and brain functional connectivity features. The differential entropy (DE) is extracted using the short-time Fourier transform (STFT) as the brain functional node features, and the phase lock value (PLV) is extracted using the Hilbert transform as the brain functional connectivity features. Then, the five sub-band brain functional networks are merged into one brain functional network; a. Brain functional node feature extraction The differential entropy characteristics of the preprocessed EEG sub-band signal are calculated using STFT. Extracting differential entropy features using STFT; 1) Calculate the Discrete Fourier Transform (DFT) of the signal using the Fast Fourier Transform (FFT) algorithm; 2) Then, calculate the power spectral density (PSD); 3) Calculate the differential entropy value by taking the base-2 logarithm of the power spectral density; b. Brain functional connectivity feature extraction Synchronization features were extracted from the preprocessed EEG sub-band signals using Hilbert transform. 1) Calculate the phase angle of the signal using the Hilbert transform; 2) Then, calculate the phase difference between the phase angles; 3) Calculate the exponent with the natural constant as the base based on the phase difference of all points, sum and average the absolute values ​​of the exponents to obtain the value of PLV; c. Brain functional network fusion 1) The average value of the brain functional connectivity features of the five sub-band brain networks is taken as the fused brain functional connectivity features. Then, the fused brain functional connectivity features are thresholded to retain effective brain functional connectivity. 2) The brain function node features of the five sub-band brain function networks are spliced ​​together, so that the feature dimension of each node is increased from 1 dimension to 5 dimensions, and this is used as the fused brain function node features. Step (3) Global Feature Extraction The proposed model consists of four parts: a global feature extraction module composed of multiple graph attention network layers, a connection feature sparse coding module composed of an autoencoder, a node feature fusion module, and a classifier. The global feature extraction module modifies its own node features by aggregating the features of neighboring nodes and recalculates the correlation between nodes. Step (4) Sparse coding and node feature fusion The sparse coding module encodes the updated connection features, reducing feature dimensionality and enhancing the features; the node feature fusion module assigns different weights to each sub-band, fusing the node features of the five sub-bands into one, reducing feature dimensionality. Step (5) Classifier The construction of the brain functional network consists of two parts: brain functional connectivity features and brain functional node features. The two types of features are learned and enhanced through the above feature transformations. Finally, the two types of features are concatenated and the prediction results are output through two fully connected layers and the log_softmax function.

2. The method according to claim 1, characterized in that: Step (1) Preprocessing of EEG signals First, the obtained multi-channel EEG data is bandpass filtered from 1 to 50 Hz, and the filtered signal is then divided into frequency bands according to 1-4 Hz, 4-8 Hz, 8-13 Hz, 13-30 Hz, and 30-50 Hz, into five sub-frequency bands: delta, theta, alpha, beta, and gamma. The EEG signal is then divided into 1-second segments. Step (2) Brain Network Construction Brain functional networks were constructed from five sub-band EEG signals in the following manner, and then the five brain functional networks were merged into one. The brain functional network consists of two parts: one is the brain functional node feature composed of differential entropy values ​​(DE), and the other is the brain functional connectivity feature composed of phase lock values ​​(PLV). a. Brain functional node feature extraction Nonlinear time-frequency features are extracted using STFT; 1) Calculate the DFT of the signal using FFT; [Y,f]=F DFT (X in ,n,n op ,n win ,n fft ,fs) Among them, F DFT Let X be a function of the Discrete Fourier Transform, and let X be the preprocessed input EEG signal; n is the sampling point of each EEG sample. op n is the length of the overlapping windows. op =0, n win n is the length of the sliding window. win =200, n fft For the sampling points of the Discrete Fourier Transform (DFT), n fft =200, fs is the sampling frequency, fs=200, f is the sampling frequency vector, and Y is the matrix value of the signal after DFT; 2) Then, calculate the automatic spectrum of the PSD; P xx =F PSD (Y,n fft ,f,n,n op ,n win ,fs) Among them, F PSD P is the power spectral density calculation function. xx The power density spectrum matrix; 3) The calculation of DE is P xx Logarithm to base 2; DE=log2(P xx ) The output dimension of the DE feature is 128×1; b. Brain functional connectivity feature extraction The phase angle of the EEG signal was calculated using Hilbert transform, and the phase lock value was calculated as a feature of brain functional connectivity. 1) Use the eegfilt function for filtering; f=F eegfilt (C,srate,locutoff,hicutoff) Among them, F eegfilt Here, is the filtering function; matrix C is the preprocessed input EEG signal; srate is the sampling frequency, srate = 200; locutoff is the low-frequency starting frequency of the filter, locutoff = [1, 4, 8, 13, 30]; and hicutoff is the high-frequency cutoff frequency of the filter, hicutoff = [4, 8, 13, 30, 50]. 2) After Hilbert transform, the phase angle of the signal is calculated using the angle function; P=F angle (F hilbert (f)) Where F angle The phase calculation function takes the input signal of the segmented signal as its input signal when calculating the phase angle. 3) Calculate the phase difference; PLV i-j =sum(P i -P j ) PLV i-j P represents the correlation between the i-th and j-th channels of the EEG signal, where sum is the summation function. i -P j This represents vector subtraction; calculating the PLV values ​​of pairwise correlations for all channels yields the brain functional connectivity features (Adjacent) of all EEG signals. The dimension of the brain functional connectivity features is 128×128. c. Brain functional network fusion The fusion operation of brain functional networks is divided into two steps, which involve fusing brain functional node features and brain functional connectivity features respectively. 1) Fusion of brain functional node features The brain functional node features of the five frequency bands are spliced ​​together to obtain the fused brain functional node features. X=concat(DE1|DE2|DE3|DE4|DE5|) Where X represents the fused brain functional node features, concat represents the matrix concatenation operation, and DE i The brain functional node features are represented as signals from different sub-bands; the feature dimension of the brain functional node features in each sub-band is 128×1, and the dimension of the fused brain functional node feature X is 128×5. 2) Brain functional connectivity features are fused and thresholded. The brain functional connectivity feature matrices of the five frequency bands are summed and averaged. Adjacent c This represents the averaged brain functional connectivity feature matrix, Adjacent k Represents the brain functional connectivity matrix of signals in different sub-bands; select an appropriate threshold λ, retain brain functional connections greater than λ, discard brain functional connections less than λ and set their values ​​to 0; The threshold λ was set to 0.85; the dimension of the brain functional connectivity features was 128×128, and after thresholding λ, it consisted of a non-sparse matrix. c It became a sparse matrix A; Step (3) Global Feature Extraction Module The brain functional network is constructed from two types of features—brain functional node features X and brain functional connectivity features A. These two features are used as inputs to the graph attention network for global feature extraction. The global feature extraction module consists of two identical graph attention network layers. Each graph attention network contains a multi-head attention layer and an aggregation layer. The multi-head attention layer has 8 heads, and the aggregation layer consists of a graph attention layer. Multi-head graph attention layer In the multi-head attention layer, each head is a separate graph attention layer. Each brain functional node in the graph attention layer updates its own information by aggregating information from all its neighbors, thus achieving global information extraction. All nodes in the attention layer share a node attention mechanism 'a' to perform self-attention calculations on the nodes, updating their own information by assigning different weights to different neighbor nodes to obtain global features. Attention mechanism 'a' is a single-layer feedforward neural network, and the attention value represents the correlation strength between nodes. To further differentiate the contribution of different frequency band brain functional node features to classification performance, a frequency band attention mechanism 'W' is designed to assign different weights to different frequency band node features, allowing it to pay more attention to frequency band node features with higher weights during global information extraction. Both attention mechanisms 'a' and 'W' are implemented using linear transformations, with the formula: y = wx + b, where y represents the transformed output, x represents the input, w is the weight coefficient, and b is the bias term. The bias terms of the attention mechanism are all 0. The attention value between nodes is calculated as follows: e ij =a(WX i ,WX j ) e ij This indicates that node X j For node X i The correlation; injecting the graph structure into this mechanism by performing masked attention—only computing node X. j ∈N i e ij , where N i It is node X in the graph i The neighborhood of X is queried based on the brain functional connectivity feature matrix A; to facilitate comparison of coefficients across different nodes, the softmax function is used. j Normalize all correlations: α ij The above formula represents the normalized correlation coefficient, and the LeakyReLU nonlinear activation function is applied. The formula can be expanded as follows: Where ∑ represents the summation function, T represents the transpose, || represents the concatenation operation, and exp represents the exponential function; The normalized attention coefficients between all nodes are obtained through the above formula. Then, the linear combination of the corresponding node features is calculated using the normalized coefficients as the final output feature of each node. σ represents the activation function elu(). This represents the brain functional node features after aggregating neighbor node information. To make the attention learning process more stable, the above transformation is performed using eight independent attention mechanisms, and then their features are concatenated to obtain the following output feature representation: Where || denotes matrix concatenation operation. This represents the characteristics of node i after incorporating the multi-head attention mechanism. W is the correlation coefficient between nodes i and j calculated under the k-th attention mechanism. k This refers to the attention coefficient of the corresponding frequency band attention mechanism; after updating the node information for all brain functional nodes using the above calculation method, the output X of the multi-head graph attention layer is obtained. c To prevent the global feature extraction module from overfitting, a dropout layer is used to mask brain functional connectivity features. Polymer layer The aggregation layer's function is to aggregate the features of multiple brain functional nodes learned by the multi-head attention layer and use them to update the connection features between nodes, thus using these as new brain functional connection features. The aggregation layer consists of a graph attention layer, but its output has two parts: one part is the updated brain functional node feature X. merge The other part consists of the correlation coefficients between all nodes. Brain functional connectivity features A merge ; Where a merge For the attention coefficients of the attention mechanism between nodes in the aggregation layer, W represents the correlation coefficient between aggregation layer nodes i and j. merge This is the weight matrix for the frequency band attention mechanism of the aggregation layer; Step (4) Sparse coding and node feature fusion An autoencoder consists of two parts: an encoder and a decoder. Here, we use the feature transformation function built into PyTorch, which is a linear transformation function. The formula for the linear transformation function is: y = kx + b, where y represents the transformed output, x represents the input, k is the weight coefficient, and b is the bias term. A out =Linear (1) (flatten(triu(A merge ))) Among them, Linear (1) The output dimension is Adjacent c The number of valid brain functional connections retained after thresholding the brain functional connectivity matrix by a threshold λ is the number of non-zero elements in the sparse matrix A. Since the brain functional connectivity matrix is ​​symmetric, the number of valid connections is half the total number of non-zero elements in the matrix after thresholding by λ. When the threshold λ is set to 0.85, the number of valid connections is 600. The `triu()` function extracts the elements of the upper triangular region of the matrix, `flatten()` expands the matrix into one dimension, and `Linear()`... (1) Let h represent an independent linear transformation function, where h is the brain functional connectivity feature after the linear transformation; the classification performance of the brain functional connectivity feature after feature encoding is greatly improved; The brain functional node features from multiple frequency bands are fused into a unique value that can represent the attribute of the brain functional node; the node feature output by the global feature extraction module is X. merge The feature dimension is N×F, where N=128 represents the number of brain functional nodes and F=5 represents the number of sub-bands. In the node feature aggregation module, different weights are assigned to different frequency bands, and then the five frequency band features are merged into one. Here we still use the linear transformation function Linear, and the output dimension of Linear is set to 1. X out =Linear (2) (X merge ) Where X out X represents the brain functional node features after linear transformation. out The feature dimension is N×1, where N=128 represents the number of brain functional nodes. (2) It is also an independent linear transformation function; Step (5) Classifier The brain functional node features are expanded and concatenated with the brain functional connectivity features. Then, the result is passed through two linear transformation layers and finally through the log_softmax function to output the prediction result, as shown in the following formula: out=log_softmax(Linear (4) (Linear (3) (concat(X out ,A out )))) Where concat() represents matrix concatenation operation, Linear (3) Linear (4) Let represent two independent linear transformation functions, and let out represent the probability distribution of the final predicted output. The loss is calculated using the cross-entropy function, as shown in the following formula: Where loss(out,label) represents the loss during training, out(x) represents the probability distribution of the predicted class x, and label(x) represents the probability distribution of the true class x; The proposed model consists of four parts: a global feature extraction module composed of multiple graph attention network layers, a connection feature sparse coding module composed of an autoencoder, a node feature fusion module, and a classifier.