Electroencephalogram feature representation method and system based on deep clustering
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHANDONG UNIV
- Filing Date
- 2026-03-17
- Publication Date
- 2026-07-14
AI Technical Summary
Existing traditional microstate analysis methods are sensitive to the selection of initial cluster centers, are prone to getting trapped in local optima, ignore the continuity in the time dimension, and lead to non-physiological fragmentation of microstate sequences and distortion of statistical indicators, making it difficult to meet the high accuracy and robustness requirements of clinical auxiliary diagnosis.
We adopt a deep clustering-based approach, introducing Transformer encoder and decoder reconstruction regularization, Student-t soft assignment and target distribution sharpening, combined with temporal consistency regularization, and initialized cluster centers through EEGPT representation and Max-Min Spread to build an end-to-end framework and optimize the encoder and cluster centers.
It significantly improves the stability and clustering quality of EEG microstate templates, and the generated microstate sequences are highly reproducible and interpretable, improving the sensitivity to subtle pathological changes and diagnostic accuracy, and enhancing the interpretability and clinical application potential of the model.
Smart Images

Figure CN122376128A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of electroencephalogram (EEG) signal processing technology, and specifically to an EEG feature representation method and system based on deep clustering. Background Technology
[0002] The statements in this section are merely background information related to the present invention and do not necessarily constitute prior art.
[0003] Electroencephalogram (EEG) microstate analysis is a crucial technique for studying the dynamic spatiotemporal characteristics of large-scale neural networks in the brain. Its core lies in abstracting continuously changing scalp electrical potential topography into a series of quasi-stable spatial patterns. These microstates typically remain relatively stable for tens to hundreds of milliseconds before rapidly transitioning to another configuration, and are considered to correspond to the basic functional units of brain information processing. In resting-state studies, specific microstate categories have been shown to have significant neurophysiological correspondences with macroscopic functional networks such as auditory, visual, salience, and dorsal attention. By quantifying statistical indicators such as microstate occupancy, average dwell time, transition probability, and switching rate, researchers can capture the dynamic reorganization process of brain networks at the millisecond scale. Currently, this method has shown great potential in cognitive neuroscience and the exploration of the pathological mechanisms of various mental disorders, and is considered an effective means of assessing brain functional status and screening potential biomarkers. It is widely used in the auxiliary diagnosis and research of diseases such as depression and schizophrenia.
[0004] However, existing traditional microstate analysis methods mainly rely on pure spatial clustering algorithms such as K-means, typically selecting only the topographic map at the peak of the global field power for clustering, which has significant technical limitations. First, these methods are highly sensitive to the selection of initial cluster centers, easily getting trapped in local optima, resulting in a lack of stability and reproducibility of the extracted microstate templates across different runs. Second, traditional methods ignore the prior continuity of microstates in the time dimension and do not consider the constraints of smooth transitions between states at adjacent time points, causing non-physiological, high-frequency fragmented switching in the generated microstate sequences, resulting in distortion of statistical indicators such as dwell time. In addition, existing schemes lack constraints on the reconstruction of original topographic details, and the learned latent representations are often disconnected from the actual scalp potential distribution, reducing the interpretability of features and failing to meet the urgent need for high-precision and robust feature extraction in clinical auxiliary diagnosis. Summary of the Invention
[0005] To address the shortcomings of existing technologies, this invention provides a method and system for representing EEG features based on deep clustering. Within an end-to-end framework of encoding-clustering-reconstruction-temporal consistency, it introduces a Transformer encoder (long-range dependency), decoder reconstruction regularization (terrain fidelity), Student-t soft assignment and target distribution sharpening (clustering convergence), and temporal consistency regularization (suppressing non-physiological high-frequency switching). Furthermore, it employs EEGPT representation + Max–Min Spread for robust cluster center initialization, significantly improving template stability and clustering quality.
[0006] To achieve the above objectives, the present invention adopts the following technical solution: In a first aspect, the present invention provides a method for representing EEG features based on deep clustering.
[0007] A method for representing EEG features based on deep clustering includes the following process: Multi-channel EEG signals are acquired, and the multi-channel EEG signals are preprocessed and segmented to obtain a token sequence containing multiple short time slices; The token sequence is input into the Transformer encoder for encoding to obtain the time-by-time latent vector and the global classification label representation. The decoder is used to reconstruct the potential vectors at each time step, and the reconstruction loss is calculated to constrain the terrain and temporal fidelity of the potential space. The soft assignment matrix of potential vectors and cluster centers at each time step is calculated based on the Student-t kernel. The target distribution is generated based on the soft assignment matrix. The divergence between the target distribution and the soft assignment matrix is used as the clustering loss. The encoder parameters and cluster centers are updated together until convergence is obtained to obtain the optimized encoder and optimized cluster centers. The optimized encoder is used to encode the EEG signal to be tested to obtain the time-by-time potential vector, and the time-by-time potential vector is clustered and assigned based on the optimized cluster centers to obtain the EEG microstate label sequence.
[0008] In one implementation of the first aspect of the present invention, multi-channel EEG signals are preprocessed and segmented to obtain a token sequence comprising multiple short time slices, including: The multi-channel EEG signals were filtered, bad path interpolated, artifact removed and standardized to obtain standardized EEG signals. The standardized EEG signal is divided into time windows according to a preset window length and step size, and each time window is further divided into short time slices of a preset length. The short time slice is linearly projected into an embedding vector of a preset dimension, and positional encoding and learnable tags are added to form a token sequence.
[0009] In one implementation of the first aspect of the present invention, the token sequence is input into a Transformer encoder for encoding to obtain a time-by-time latent vector and a global classification label representation, including: Input the token sequence into a Transformer encoder that includes a multi-head self-attention sublayer and a feedforward network sublayer; Long-range dependencies across time and channels are captured by multi-head self-attention sublayers, and time-by-time latent vectors and global classification labels are output through residual connections and layer normalization.
[0010] In one implementation of the first aspect of the present invention, a decoder is used to reconstruct the time-by-time latent vectors, and a reconstruction loss is calculated to constrain the terrain and temporal fidelity of the latent space, including: The time-by-time potential vectors are reconstructed into a reconstructed time window through upsampling and deconvolution operations; Calculate the mean square error between reconstruction time windows as the reconstruction loss.
[0011] In one implementation of the first aspect of the present invention, the soft assignment matrix of the latent vectors and cluster centers at each time step is calculated based on the Student-t kernel, and the target distribution is generated according to the soft assignment matrix, including: The soft assignment matrix is obtained by calculating the probability of the latent vector belonging to each cluster center at each time step using the Student-t kernel with one degree of freedom parameter; The soft assignment matrix is weighted and normalized to obtain the target distribution, which makes the intra-class compact and the inter-class separated.
[0012] In one implementation of the first aspect of the present invention, the cluster centers are obtained by iterative optimization of the initial cluster centers selected using a maximum-minimum distance strategy based on the representations extracted from a pre-trained EEG model, including: Global representations were extracted from short time slices using a pre-trained EEG model. Randomly select a global representation as the first initial center, and iteratively select the global representation with the largest distance to the nearest center in the current set of selected centers as the next initial center, until a preset number of initial cluster centers are selected; During the joint update process, the initial cluster centers are optimized based on the clustering loss to obtain the final cluster centers.
[0013] In one implementation of the first aspect of the present invention, an optimized encoder is used to encode the EEG signal to be tested to obtain a time-by-time latent vector, and the time-by-time latent vector to be tested is clustered and assigned based on optimized cluster centers to obtain an EEG microstate label sequence, including: Calculate the Euclidean distance between the potential vector to be tested at each time step and each optimized cluster center; The index of the optimized cluster center with the smallest distance is used as the EEG microstate label for the time point corresponding to the potential vector of the test time step, and the EEG microstate label sequence is obtained by arranging them in chronological order.
[0014] Secondly, the present invention provides an EEG feature representation system based on deep clustering.
[0015] A deep clustering-based EEG feature representation system, comprising: The signal processing unit is configured to: acquire multi-channel EEG signals, preprocess and segment the multi-channel EEG signals to obtain a token sequence containing multiple short time slices; The encoding mapping unit is configured to input the token sequence into the Transformer encoder for encoding to obtain a time-by-time latent vector and a global classification label representation; The reconstruction constraint unit is configured to: use the decoder to reconstruct the potential vectors at each time step, and calculate the reconstruction loss to constrain the terrain and temporal fidelity of the potential space; The clustering optimization unit is configured to: calculate the soft assignment matrix of the latent vector and cluster centers at each time step based on the Student-t kernel, generate the target distribution based on the soft assignment matrix, use the divergence between the target distribution and the soft assignment matrix as the clustering loss, jointly update the encoder parameters and cluster centers, until convergence is obtained to obtain the optimized encoder and optimized cluster centers; The microstate generation unit is configured to: use an optimized encoder to encode the EEG signal to be tested to obtain the time-by-time potential vector to be tested, and cluster and assign the time-by-time potential vector to be tested based on the optimized cluster centers to obtain the EEG microstate label sequence.
[0016] Thirdly, the present invention provides a computer device, comprising: a processor and a computer-readable storage medium; A processor, adapted to execute computer programs; A computer-readable storage medium storing a computer program, which, when executed by a processor, implements the deep clustering-based EEG feature representation method of the first aspect of the present invention.
[0017] Fourthly, the present invention provides a computer-readable storage medium storing a computer program adapted to be loaded by a processor and executed by the deep clustering-based EEG feature representation method of the first aspect of the present invention.
[0018] Compared with the prior art, the beneficial effects of the present invention are: This invention significantly improves the stability of EEG microstate templates and the discriminative power of feature representations by constructing an end-to-end joint optimization framework of encoding, clustering, and reconstruction. Traditional methods often separate feature extraction and clustering into independent stages, resulting in the latent space failing to optimize for clustering tasks. This scheme utilizes the Student-t kernel to calculate the soft assignment matrix and construct the target distribution, using the divergence between the two as the clustering loss for direct backpropagation to update encoder parameters and cluster centers. This mechanism forces the time-series latent vectors learned by the encoder to naturally form a compact intra-class and segregated inter-class distribution structure in the feature space, effectively overcoming the local optimum trap caused by random initialization. Simultaneously, the decoder reconstruction loss is introduced to constrain the topography and temporal fidelity of the latent space, ensuring that the abstract feature representation does not lose key topological information of the original EEG signal. The resulting optimized encoder and cluster centers can robustly assign microstate labels to the test signal, and the generated microstate sequences are highly reproducible, providing a solid and reliable data foundation for subsequent clinical biomarker mining and solving the core pain point of template consistency in existing technologies.
[0019] This invention employs a Transformer architecture as the core encoder, effectively capturing the complex long-range dependencies across time and channels in multi-channel EEG signals, overcoming the limitations of traditional methods that only focus on local spatial similarity. EEG signals are non-stationary, and the formation of their microstates often depends on the coordinated oscillations of multiple brain regions across the entire brain at millisecond-level time scales. Traditional convolutional or fully connected structures struggle to model this global dynamic interaction. This approach, through a multi-head self-attention mechanism, adaptively weights the association strength between different time steps and different electrode channels, accurately capturing and fusing these dependencies into a time-sequential latent vector regardless of their temporal distance. This global receptive field ensures that the generated feature representation not only includes local topographic information but also contains the contextual semantics of the overall dynamic evolution of the brain network. Combining positional encoding and learnable labels, the model accurately perceives the temporal order of signals, achieving a deep representation of the spatiotemporal characteristics of EEG during the encoding stage, significantly improving the accuracy of microstate classification and sensitivity to subtle pathological changes.
[0020] This invention innovatively introduces a terrain reconstruction constraint mechanism. By using a decoder to restore latent vectors to the original time window signals and calculate the mean square error, it effectively ensures topological consistency between the latent feature space and the actual scalp potential terrain. In existing deep clustering research, there is often an overemphasis on optimizing clustering metrics while neglecting the reversibility of the generation process. This results in learned latent variables, while beneficial for clustering, potentially losing crucial physical meaning from the original signal or introducing unexplainable noise. This scheme mandates that the latent representation must contain sufficient information to reconstruct high-fidelity EEG waveforms. This self-supervised reconstruction task acts as a powerful regularization term, preventing feature collapse or overfitting. It ensures that the center vector corresponding to each microstate category, when mapped back to the sensor space, presents a clear scalp terrain map consistent with neurophysiological laws. This explicit fidelity constraint greatly enhances the model's interpretability, making the final extracted microstate template not only statistically significant but also physically reliable, facilitating doctors' intuitive understanding of abnormal patterns in brain functional networks.
[0021] This invention fundamentally solves the problems of microstate sequence fragmentation and statistical indicator distortion by initializing cluster centers using a maximum-minimum distance strategy combined with pre-trained representations and incorporating temporal consistency constraints. Traditional K-means algorithms randomly select initial centers, which are prone to convergence to suboptimal solutions due to noise interference, and the generated state sequences often exhibit meaningless and frequent jumps, rendering key clinical indicators such as average dwell time and transition probability unreliable. This scheme first uses a pre-trained model to extract high-quality global representations, then iteratively selects the farthest sample as the initial center, ensuring maximum coverage and representativeness of the initial cluster centers in the feature space, providing an excellent starting point for subsequent optimization. Furthermore, the joint optimization process implicitly learns temporal smoothness, suppressing non-physiological high-frequency switching, resulting in a more coherent and natural microstate label sequence. The calculated occupancy rate, dwell time, and switching rate, among other statistical features, accurately reflect the dynamic reorganization patterns of the brain network, significantly improving the biomarker value and clinical application potential of this method in the auxiliary diagnosis of mental disorders such as depression and schizophrenia.
[0022] Advantages of additional aspects of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description
[0023] The accompanying drawings, which form part of this invention, are used to provide a further understanding of the invention. The illustrative embodiments of the invention and their descriptions are used to explain the invention and do not constitute an improper limitation of the invention.
[0024] Figure 1A flowchart illustrating an exemplary embodiment of the present invention for representing EEG features based on deep clustering; Figure 2 A schematic diagram illustrating the principle of an EEG feature representation system based on deep clustering, provided as an exemplary embodiment of the present invention; Figure 3 A schematic diagram of a computer device provided for an exemplary embodiment of the present invention. Detailed Implementation
[0025] The present invention will be further described below with reference to the accompanying drawings and embodiments.
[0026] It should be noted that the following detailed descriptions are exemplary and intended to provide further illustration of the invention. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains.
[0027] This implementation proposes a method for representing EEG features based on deep clustering, such as... Figure 1 As shown, the process includes the following: Step 1: Preprocessing and standardization.
[0028] In practice, EEG signal datasets can be obtained from publicly available EEG databases or self-collected patient EEG data can be used to create datasets. This embodiment adopts a unified preprocessing workflow, which mainly includes: a. Filtering: Zero-phase FIR bandpass filter (0.5–45Hz, Hamming window) is used; and a 50Hz notch filter is applied to remove power frequency interference; b. Bad channel interpolation: Channels with poor correlation to spatially adjacent electrodes (r < 0.8) are repaired using spherical spline interpolation; the data are then rereferenced to the common average reference (CAR). c. Artifact removal: Independent component analysis (ICA) is performed; artifact components such as eye movement (EOG), electromyography (EMG), and electrocardiography (ECG) are identified and removed based on spatial / temporal characteristics; d. Standardization: Perform Z-score standardization on a channel-by-channel basis; After the above preprocessing, standardized EEG data can be obtained. Then, these EEG data are segmented with a length of 4s and a step size of 2s. Further, each segmented EEG data is divided into a 500ms patch, which is linearly projected into a d-dimensional token, with positional encoding added, and a learnable [CLS] marker at the beginning of the sequence is used as the input of subsequent modules.
[0029] Step 2: Encoder encoding.
[0030] After preprocessing, the patch sequence is fed into a Transformer for encoding, yielding a latent representation at each time step and a global [CLS] representation; this structure is used to capture long-range dependencies and channel-time interactions. For each token sequence, multiple heads are concatenated and then linearly transformed to obtain MHSA(H).
[0031] Let the input EEG token sequence be: (1); Where N is the sequence length and d is the embedding dimension. Represents the Transformer encoder's... The input feature matrix of the layer, It represents the real number field.
[0032] For the first in the Transformer encoder Each attention head, the query matrix, key matrix, and value matrix are obtained from the input sequence through linear mapping: (2); (3); (4); in, For the Transformer encoder Layer A query matrix with attention heads; For the Transformer encoder Layer The query matrix of each attention head is linearly mapped to weights; Let be the key matrix of the m-th attention head in the l-th layer of the Transformer encoder; The key matrix of the m-th attention head in the l-th layer of the Transformer encoder is linearly mapped to the weights. This is the value matrix of the m-th attention head in the l-th layer of the Transformer encoder; The weights are linearly mapped to the value matrix of the m-th attention head in the l-th layer of the Transformer encoder.
[0033] No. The attention weight matrix for each attention head is defined as follows: (5); in, Let be the attention weight matrix of the m-th attention head in the l-th layer of the Transformer encoder; The soft-maximization activation function normalizes the vector into a probability distribution; This represents the square root of the attention head dimension, used to prevent attention weight values from becoming too large.
[0034] Based on this, the forward propagation of the Transformer encoder can be expressed as: (6); (7); in, Representation layer normalization, Indicates a feedforward network. This is the output of the multi-head self-attention module; This represents the output feature matrix of the l-th multi-head self-attention sublayer of the Transformer encoder.
[0035] Step 3: The decoder reconstructs the input signal and calculates the reconstruction loss.
[0036] To ensure the latent space retains scalp topographic details and local temporal structure, a decoder is used to reconstruct the latent sequence into the original window shape. The reconstruction process mainly involves upsampling and deconvolution of the latent feature sequence output by the encoder to obtain the reconstructed EEG, where the upsampling factor is set to 4x and the deconvolution kernel size is 3x3. By minimizing the mean square error constraint on the reconstruction loss, the reconstructed EEG contains as much information as possible from the original signal, avoiding sacrificing topographic details for clustering alone, and improving the consistency and interpretability of the template with the real topography.
[0037] Let the potential sequence be After upsampling and deconvolution, the reconstructed window is obtained: (8); in, For the reconstructed EEG signal matrix of the nth time window; The mapping operation of the decoder restores the latent vectors to EEG signals; To reconstruct the dimensional space of the signal matrix, C represents the number of EEG channels, and T represents the number of time points.
[0038] For all The reconstruction loss is defined as follows: (Each time window is specified in the original text.) (9).
[0039] in, Overall reconstruction loss value; The total number of time windows after segmentation of the EEG signal; is the reconstruction loss value for the nth time window; C is the number of EEG channels; T is the number of time points within a single time window; This represents the signal matrix of the nth original EEG time window; This is the signal matrix for the nth reconstructed EEG time window; This is the square of the Frobenius norm of the matrix, used to calculate the error between matrices.
[0040] Step 4: Cluster center initialization (EEGPT+Max–Min Spread).
[0041] This step corresponds to the EEGPT module. It mainly uses the pre-trained EEG large model EEGPT and the Max-Min Spread algorithm to initialize the cluster centers. The pre-trained information is used to enhance the stability of the cluster center initialization, thereby enhancing the stability of the micro-state template.
[0042] The patch sequence is input into EEGPT to obtain the embedding representation [CLS]. This is then normalized, and the first centroid is randomly selected. The samples with the maximum and minimum distances are then iteratively added to the current set until K=4 centroids are obtained. This reduces the sensitivity to random initialization and improves the stability of the template.
[0043] Let the feature set extracted by EEGPT be: (10); in, The set of global EEG representations extracted for the EEG pre-trained model; Let i be the i-th global EEG representation vector in the set; Let d be the dimension space of the global representation vector, where d is the embedding dimension.
[0044] Randomly select a sample as the first center: (11); in, This is the first initial cluster center vector; Let be the r-th representation vector randomly selected from the global representation set.
[0045] Let the current set of selected centers be: (12); in, For the selected m A set consisting of one initial cluster centers; For the 1st to the mth One initial cluster center vector.
[0046] For any unselected sample, the nearest center distance to the current center set is defined as: (13); Wherein, from the i-th unselected sample to the current Cm 1. The nearest center distance of a set of centers; here Let be the i-th unselected global EEG representation vector; For the cluster center set C m Any cluster center vector in 1.
[0047] The m-th center is taken as: (14); Where is the m-th initial cluster center vector; here It belongs to the global representation set G and does not belong to the selected center set C. m A sample of 1; Represents the i-th unselected sample to the current C. m 1. The nearest center distance of a set of centers.
[0048] When satisfied The iteration terminates at time 1, and the initial center set is output. : (15).
[0049] Step 5: Soft clustering and target distribution sharpening based on Student-t.
[0050] This step performs soft clustering on each time step in the latent space and improves intra-cluster compactness and inter-cluster separation through the target distribution.
[0051] Specifically, firstly, the soft assignment Q uses the Student-t kernel to calculate the probability q of the latent vector z belonging to each cluster center. For the target distribution P, it is obtained by power-wise sharpening and reweighting Q. The clustering loss is represented as the KL divergence between P and Q, and the encoder parameters and centers are updated synchronously by minimizing the KL divergence, so that the representation and clustering mutually promote each other.
[0052] The degree of freedom parameter α is selected as 1 to obtain better soft allocation effect and clustering stability.
[0053] Cluster centers are represented as: (16); in, Let k be the cluster center vector; Let be the dimension space of the cluster center vectors, and d be the embedding dimension; K is the index of the cluster center, and K is the total number of cluster centers.
[0054] The probability of belonging is: (17); in, Let be the probability that the potential vector at time step t belongs to the kth cluster center; Let be the latent feature vector of the EEG at time step t; Let k be the cluster center vector; The degree of freedom parameters of the Student-t kernel; This represents the total number of cluster centers. The traversal index for the cluster centers; Let be the vector of the j-th cluster center.
[0055] The target distribution is as follows: (18); in, Let be the probability that the potential vector at time step t in the target distribution belongs to the kth cluster center; This represents the square of the corresponding probability in the soft assignment matrix, used for weight sharpening; Assign frequencies to samples at the k-th cluster center; Let be the probability that the t-th time step in the soft assignment matrix belongs to the j-th cluster center; Assign frequencies to samples at the j-th cluster center.
[0056] Step 6: Reverse labeling and micro-state statistics.
[0057] The purpose of this step is to obtain an interpretable discrete microstate sequence and calculate standard statistics for quantification and visualization. Through steps 1-5, four microstate templates can be obtained. In this step, by comparing the distance between the EEG topography at each time point and the four templates, a microstate template is assigned to each time point, thus obtaining the microstate sequence. This sequence provides information such as temporal coverage, average duration, and transition matrix, which can be used in subsequent classification tasks.
[0058] The occupancy rate feature has four dimensions, corresponding to the time proportion of each type of microstate in the entire time series; The average dwell time feature has four dimensions, corresponding to the average length of the continuous dwell time segment for each type of microstate. The transition probability feature has 4×4 dimensions, corresponding to the first-order transition probability between any two microstates.
[0059] Step 7: Classification of mental disorders.
[0060] The micro-state sequence is input into the Transformer for feature extraction, and the output is concatenated with statistical information and then input into a fully connected layer to obtain the class probability, label, and evaluation metrics (ACC / F1 / AUC).
[0061] Transformer output feature dimensions The concatenated vector The dimension is 152.
[0062] Fully connected mapping is: (19); in, ; , The number of categories is 2 here; This is the output vector of the fully connected layer; This is the weight matrix of the fully connected layer; The fused feature vector is the concatenation of Transformer features and microstate statistical features. The bias vector of the fully connected layer.
[0063] The prediction probability is then defined as: (20); in, Predict the probability that a sample belongs to class c for the model; This refers to the element of class c in the output vector of the fully connected layer; The total number of categories for the classification task; This refers to the element corresponding to the j-th class in the output vector of the fully connected layer.
[0064] For the classification results, the cross-entropy loss function is used for training. The classification loss is defined as: (twenty one); in, The cross-entropy loss value for the classification task; The true label (0 or 1) for the sample belonging to class c.
[0065] Furthermore, to verify the effectiveness of the method of the present invention, the following experimental results are provided: The dataset used in the experiment was collected from a mental health center, employing resting-state EEG signals from 59 patients (all with patient consent), including 34 patients with MDD and 25 patients with BD. The resting-state EEG signal length was approximately 240 seconds, using 63 leads and a sampling rate of 1000 Hz. Table 1 below presents detailed experimental results of the method of this invention and the comparative method on various tasks. The data in the table are all average values obtained under five-fold cross-validation conditions.
[0066] Table 1: Results of the comparative experiment.
[0067] method ACC F1-Score AUC K-means 57.80% 0.56 0.60 DNN 58.13% 0.56 0.61 Self-encoder 56.44% 0.54 0.57 Variational autoencoder 59.52% 0.58 0.61 Method of the present invention 68.15% 0.67 0.70 As can be seen, Table 1 presents the results of the comparative experiment, which aims to verify whether the method of the present invention can bring about a significant performance improvement under the same backbone configuration.
[0068] Figure 2 A deep clustering-based EEG feature representation system is shown, comprising: The signal processing unit 201 is configured to: acquire multi-channel EEG signals, preprocess and segment the multi-channel EEG signals to obtain a token sequence containing multiple short time slices; The encoding mapping unit 202 is configured to input the token sequence into the Transformer encoder for encoding processing to obtain the time-by-time latent vector and the global classification label representation; The reconstruction constraint unit 203 is configured to: use the decoder to reconstruct the potential vectors at each time step, and calculate the reconstruction loss to constrain the terrain and temporal fidelity of the potential space; The clustering optimization unit 204 is configured to: calculate the soft assignment matrix of the latent vector and cluster center at each time step based on the Student-t kernel, generate the target distribution according to the soft assignment matrix, use the divergence between the target distribution and the soft assignment matrix as the clustering loss, jointly update the encoder parameters and cluster centers, until convergence is obtained to obtain the optimized encoder and optimized cluster centers; The microstate generation unit 205 is configured to: use the optimized encoder to encode the EEG signal to be tested to obtain the time-by-time potential vector to be tested, and cluster and assign the time-by-time potential vector to be tested based on the optimized cluster center to obtain the EEG microstate label sequence.
[0069] It is understood that the aforementioned units can be individually or entirely merged into one or more other units, or some of the units can be further divided into multiple functionally smaller units. This achieves the same operation without affecting the technical effects of the embodiments of the present invention. The aforementioned units are based on logical functional division. In practical applications, the function of one unit can be implemented by multiple units, or the function of multiple units can be implemented by one unit. In other embodiments of the present invention, the system may also include other units. In practical applications, these functions can also be implemented with the assistance of other units, and can be implemented collaboratively by multiple units.
[0070] According to another embodiment of the present invention, the system of this embodiment can be constructed by running a computer program (including program code) capable of performing the steps involved in the corresponding method of the present invention on a general-purpose computing device, such as a computer, which includes processing elements and storage elements such as a central processing unit (CPU), random access memory (RAM), and read-only memory (ROM). The computer program can be recorded on, for example, a computer-readable recording medium, loaded into the aforementioned computing device through the computer-readable recording medium, and run therein.
[0071] Figure 3 A computer device is shown, which includes a processor 301, a communication interface 302, and a computer-readable storage medium 303. The processor 301, communication interface 302, and computer-readable storage medium 303 can be connected via a bus or other means.
[0072] The communication interface 302 is used to receive and send data. The computer-readable storage medium 303 can be stored in the memory of the electronic device. The computer-readable storage medium 303 is used to store computer programs, which include program instructions. The processor 301 is used to execute the program instructions stored in the computer-readable storage medium 303.
[0073] The processor 301 is the computing and control core of the electronic device. It is suitable for implementing one or more instructions, specifically for loading and executing one or more instructions to achieve the corresponding method flow or corresponding function.
[0074] Processor 301 is configured to perform the following procedure: Multi-channel EEG signals are acquired, and the multi-channel EEG signals are preprocessed and segmented to obtain a token sequence containing multiple short time slices; The token sequence is input into the Transformer encoder for encoding to obtain the time-by-time latent vector and the global classification label representation. The decoder is used to reconstruct the potential vectors at each time step, and the reconstruction loss is calculated to constrain the terrain and temporal fidelity of the potential space. The soft assignment matrix of potential vectors and cluster centers at each time step is calculated based on the Student-t kernel. The target distribution is generated based on the soft assignment matrix. The divergence between the target distribution and the soft assignment matrix is used as the clustering loss. The encoder parameters and cluster centers are updated together until convergence is obtained to obtain the optimized encoder and optimized cluster centers. The optimized encoder is used to encode the EEG signal to be tested to obtain the time-by-time potential vector, and the time-by-time potential vector is clustered and assigned based on the optimized cluster centers to obtain the EEG microstate label sequence.
[0075] This invention also provides a computer-readable storage medium, which is a memory device in an electronic device for storing programs and data. It is understood that the computer-readable storage medium here may include both built-in storage media in the electronic device and extended storage media supported by the electronic device. The computer-readable storage medium provides storage space for storing the processing system of the electronic device.
[0076] Furthermore, this storage space also contains one or more instructions suitable for loading and execution by the processor. These instructions can be one or more computer programs (including program code). It should be noted that the computer-readable storage medium here can be a high-speed RAM memory; alternatively, it can also be at least one computer-readable storage medium located remotely from the aforementioned processor.
[0077] In one embodiment, the computer-readable storage medium stores one or more instructions; the processor loads and executes the one or more instructions stored in the computer-readable storage medium to perform the following process: Multi-channel EEG signals are acquired, and the multi-channel EEG signals are preprocessed and segmented to obtain a token sequence containing multiple short time slices; The token sequence is input into the Transformer encoder for encoding to obtain the time-by-time latent vector and the global classification label representation. The decoder is used to reconstruct the potential vectors at each time step, and the reconstruction loss is calculated to constrain the terrain and temporal fidelity of the potential space. The soft assignment matrix of potential vectors and cluster centers at each time step is calculated based on the Student-t kernel. The target distribution is generated based on the soft assignment matrix. The divergence between the target distribution and the soft assignment matrix is used as the clustering loss. The encoder parameters and cluster centers are updated together until convergence is obtained to obtain the optimized encoder and optimized cluster centers. The optimized encoder is used to encode the EEG signal to be tested to obtain the time-by-time potential vector, and the time-by-time potential vector is clustered and assigned based on the optimized cluster centers to obtain the EEG microstate label sequence.
[0078] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed in this invention can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can implement the described functions using different methods for each specific application, but such implementations should not be considered beyond the scope of this invention.
[0079] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. A computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the flow or function according to the embodiments of the present invention is generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in or transmitted through a computer-readable storage medium. The computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic cable, digital cable) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that a computer can access or a data processing device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state drive), etc.
[0080] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for representing EEG features based on deep clustering, characterized in that, The process includes the following: Acquire multi-channel EEG signals, preprocess and segment the multi-channel EEG signals to obtain a token sequence containing multiple short time slices; The token sequence is input into the Transformer encoder for encoding to obtain the time-by-time latent vector and the global classification label representation. The time-by-time latent vectors are reconstructed using a decoder, and the reconstruction loss is calculated to constrain the terrain and temporal fidelity of the latent space. The soft assignment matrix of the potential vector and cluster center is calculated based on the Student-t kernel, and the target distribution is generated according to the soft assignment matrix. The divergence between the target distribution and the soft assignment matrix is used as the clustering loss. The encoder parameters and the cluster center are jointly updated until the optimized encoder and optimized cluster center are obtained. The optimized encoder is used to encode the EEG signal to be tested to obtain the time-by-time potential vector, and the time-by-time potential vector is clustered and assigned based on the optimized cluster centers to obtain the EEG microstate label sequence.
2. The EEG feature representation method based on deep clustering as described in claim 1, characterized in that, The multi-channel EEG signal is preprocessed and segmented to obtain a token sequence containing multiple short time slices, including: The multi-channel EEG signals are filtered, bad path interpolated, artifact removed, and standardized to obtain standardized EEG signals. The standardized EEG signal is divided into time windows according to a preset window length and step size, and each time window is further divided into short time slices of a preset length. The short time slice is linearly projected into an embedding vector of a preset dimension, and positional encoding and learnable tags are added to form the token sequence.
3. The EEG feature representation method based on deep clustering as described in claim 1, characterized in that, The token sequence is input into the Transformer encoder for encoding to obtain a time-by-time latent vector and a global classification label representation, including: The token sequence is input into a Transformer encoder that includes a multi-head self-attention sublayer and a feedforward network sublayer. The multi-head self-attention sublayer captures long-range dependencies across time and channels, and outputs the time-by-time latent vector and the global classification label representation through residual connections and layer normalization.
4. The EEG feature representation method based on deep clustering as described in claim 1, characterized in that, The time-by-time latent vectors are reconstructed using a decoder, and the reconstruction loss is calculated to constrain the terrain and temporal fidelity of the latent space, including: The time-by-time potential vector is reconstructed into a reconstructed time window through upsampling and deconvolution operations; The mean square error between the reconstruction time windows is calculated and used as the reconstruction loss.
5. The EEG feature representation method based on deep clustering as described in claim 1, characterized in that, The soft assignment matrix between the time-by-time latent vectors and cluster centers is calculated based on the Student-t kernel, and the target distribution is generated based on the soft assignment matrix, including: The soft assignment matrix is obtained by calculating the probability of the latent vector at each time step belonging to each cluster center using the Student-t kernel with a degree of freedom parameter of one. The soft allocation matrix is subjected to weight sharpening and normalization to obtain the target distribution, so that the intra-class distribution is compact and the inter-class distribution is separated.
6. The EEG feature representation method based on deep clustering as described in claim 1, characterized in that, The cluster centers are obtained through iterative optimization of the initial cluster centers selected using a maximum-minimum distance strategy, based on representations extracted from a pre-trained EEG model. These cluster centers include: Global representations were extracted from the short time slices using a pre-trained EEG model. Randomly select one of the global representations as the first initial center, and iteratively select the global representation with the largest distance to the nearest center in the current set of selected centers as the next initial center, until a preset number of initial cluster centers are selected; During the joint update process, the initial cluster centers are optimized based on the clustering loss to obtain the final cluster centers.
7. The EEG feature representation method based on deep clustering as described in claim 1, characterized in that, The optimized encoder is used to encode the EEG signal to be tested to obtain a time-by-time latent vector, and the time-by-time latent vector is clustered and assigned based on the optimized cluster centers to obtain an EEG microstate label sequence, including: Calculate the Euclidean distance between the potential vector to be tested at each time step and each of the optimized cluster centers; The index of the optimized cluster center with the smallest distance is used as the EEG microstate label for the time point corresponding to the potential vector to be tested at each time step, and the EEG microstate label sequence is obtained by arranging them in chronological order.
8. A brainwave feature representation system based on deep clustering, characterized in that, include: The signal processing unit is configured to: acquire multi-channel EEG signals, preprocess and segment the multi-channel EEG signals to obtain a token sequence containing multiple short time slices; The encoding mapping unit is configured to input the token sequence into the Transformer encoder for encoding processing to obtain a time-by-time latent vector and a global classification label representation; The reconstruction constraint unit is configured to: use the decoder to reconstruct the time-by-time potential vectors and calculate the reconstruction loss to constrain the terrain and temporal fidelity of the potential space; The clustering optimization unit is configured to: calculate the soft assignment matrix of the potential vector and cluster centers at each time step based on the Student-t kernel, generate a target distribution based on the soft assignment matrix, use the divergence between the target distribution and the soft assignment matrix as the clustering loss, jointly update the encoder parameters and the cluster centers, until convergence is obtained to obtain the optimized encoder and the optimized cluster centers; The microstate generation unit is configured to: use the optimized encoder to encode the EEG signal to be tested to obtain the time-by-time potential vector to be tested, and cluster and assign the time-by-time potential vector to be tested based on the optimized cluster center to obtain the EEG microstate label sequence.
9. A computer device, characterized in that, include: Processor and computer-readable storage media; A processor, adapted to execute computer programs; A computer-readable storage medium storing a computer program that, when executed by the processor, implements the deep clustering-based EEG feature representation method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program adapted to be loaded by a processor and executed as described in any one of claims 1 to 7, which is a deep clustering-based EEG feature representation method.