Interventional electroencephalogram signal classification system based on SHAP interpretable feature selection and Transform

By combining the SHAP algorithm and the spatiotemporal Transformer model, interventional EEG signal features are automatically screened and classified, solving the problems of insufficient automation and interpretability in existing technologies, and achieving high-precision and high-generalization EEG signal classification.

CN120929969APending Publication Date: 2025-11-11NANKAI UNIV
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202511034711.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-25
Publication Date
2025-11-11

AI Technical Summary

Technical Problem

Existing interventional EEG signal classification systems lack automation and interpretability in preprocessing and feature selection, and their spatiotemporal feature mining is insufficient, resulting in limited classification performance.

Method used

The SHAP interpretability algorithm is used to automatically filter key signal features, and combined with the spatiotemporal Transformer model for end-to-end classification to capture the spatial coupling relationship and temporal dependence information of multi-channel signals.

Benefits of technology

It improves the classification accuracy and generalization ability of interventional EEG signals, while providing an intuitive interpretation of signal-task associations and reducing feature engineering costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120929969A_ABST
    Figure CN120929969A_ABST
Patent Text Reader

Abstract

The invention provides an intrusive electroencephalogram signal classification system based on SHAP interpretable feature selection and Transform, and relates to the technical field of brain-computer interfaces and intelligent neural information processing. The system comprises a candidate feature extraction module, an SHAP feature optimization module, a space-time Transform classification model and an interpretability and visualization module. The candidate feature extraction module is used for extracting time domain, frequency domain and nonlinear candidate features from the preprocessed interventional electroencephalogram signals; the SHAP feature optimization module performs importance scoring and recursive screening on the candidate features based on a random forest and a Shapley value method to generate an optimal feature subset; according to the space-time Transform classification model, a space-time feature matrix is constructed through feature embedding and a time position coding mechanism, and high-precision classification is achieved through a multi-head self-attention structure; and the interpretability and visualization module is combined with the SHAP heat map and the attention weight map to provide physiological interpretation of a model discrimination basis. The system is suitable for various interventional brain-computer interface scenes such as neural rehabilitation and motion intention recognition.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the interdisciplinary field of artificial intelligence and neural engineering, and in particular to an interventional EEG signal classification system based on SHAP interpretable feature selection and Transformer, which falls under the categories of brain-computer interface systems, medical signal processing, and intelligent neurodiagnosis and treatment assistance technologies. Background Technology

[0002] Brain-computer interface (BCI) technology, as a cutting-edge human-computer interaction method, has attracted much attention due to its ability to directly utilize brain electrical activity for information transmission, showing broad application prospects in fields such as medical rehabilitation, neural reconstruction, intelligent prosthetic control, and assisted communication. Interventional BCI, through the implantation of electrode arrays in the cerebral cortex or subcutaneous tissue, can acquire high signal-to-noise ratio EEG signals at a spatial scale closer to neurons, demonstrating stronger signal stability and decoding accuracy in applications such as clinical neurorehabilitation, motor threat recognition, and epileptic seizure detection. Furthermore, interventional EEG signals also have significant value in pathological monitoring, neural circuit research, and neuromodulation. Therefore, how to design effective signal preprocessing, feature extraction, and classification algorithms tailored to the characteristics of interventional EEG signals has become a key issue urgently needing to be addressed in current BCI technology research.

[0003] In signal preprocessing and classification, traditional time-domain and frequency-domain feature extraction methods have developed into relatively mature analytical frameworks over a long period. Researchers often calculate EEG signal features using bandpass filtering, artifact removal, time-domain statistics (such as mean, variance, and sample entropy) and frequency-domain indices (such as power spectral density and bandpass power), and combine these with classic machine learning algorithms such as support vector machines (SVM) and random forests for classification. However, these methods rely on manually defined features in multi-channel, high-dimensional EEG data, making it difficult to fully exploit complex spatiotemporal coupling features. Furthermore, their performance is easily limited in the high-noise, nonlinear, and non-stationary environments encountered by interventional EEG signals. In recent years, deep learning technology has been widely applied in the field of EEG signal analysis. Models such as convolutional neural networks (CNN) and recurrent neural networks (RNN) can automatically extract temporal features in an end-to-end manner, achieving performance superior to traditional methods in tasks such as motor imagery, emotion recognition, and epileptic seizure detection. However, due to the vanishing / exploding gradient problem of RNNs, CNNs are limited in capturing long-range dependencies, making them less than ideal for processing the long-term temporal dependencies and cross-brain region coupling patterns of interventional EEG signals. In recent years, Transformer models have achieved breakthroughs in natural language processing and vision due to their self-attention mechanism and are gradually being introduced into time-series signal analysis. Several preliminary studies have attempted to apply Transformers to non-invasive EEG classification tasks, demonstrating excellent long-range feature capture capabilities; however, these works mostly remain at the level of shallow model validation and have not yet systematically designed and optimized for the high-frequency, multi-channel characteristics of interventional EEG signals. Furthermore, the SHAP (SHapley Additive exPlanations) method in Explainable AI can quantify the contribution of each feature to the model output, providing interpretability for black-box models. Studies in ECG and EEG analysis have also used SHAP to evaluate the feature importance of deep learning models, but currently, no research has combined SHAP with Transformers for feature selection and classification of interventional EEG signals.

[0004] Current interventional EEG signal classification systems largely rely on deep neural network frameworks, often employing empirical strategies for data preprocessing and feature selection, lacking automation and interpretability. On one hand, existing methods mostly use fixed time window segmentation, filtering, and conventional time-domain, frequency-domain, or time-frequency-domain feature extraction methods, manually selecting feature dimensions and failing to adaptively select the most discriminative spatiotemporal features. On the other hand, existing Transformer models often directly feed the raw time-series vectors into the encoder, ignoring the multi-channel spatial topology and coupling information between different frequency bands of interventional EEG signals, leaving room for improvement in classification performance under complex tasks. Furthermore, the lack of visualization and interpretation of the model's discriminative criteria makes it difficult to obtain a direct mapping relationship between signals and cognitive or pathological states in clinical applications. Summary of the Invention

[0005] To address the aforementioned shortcomings, this invention proposes an interventional EEG signal classification system based on interpretable feature optimization and spatiotemporal Transformer. The system aims to automatically filter key signal features using the SHAP method and perform end-to-end classification of multi-channel signals by combining the spatiotemporal Transformer structure. This approach enhances the interpretability and generalization ability of the model while ensuring high accuracy, providing reliable technical support for the clinical application and neuroscience research of interventional brain-computer interface systems.

[0006] This invention addresses the problems of non-automated preprocessing and feature selection, insufficient model interpretability, and inadequate spatiotemporal feature mining in existing interventional EEG signal classification systems. It proposes an interventional EEG signal classification system based on interpretable feature optimization and a spatiotemporal Transformer. This invention acquires interventional EEG signals and performs adaptive filtering, artifact removal, and normalization preprocessing. Then, it introduces the SHAP interpretability algorithm to score the importance of candidate time-domain, frequency-domain, and nonlinear features, automatically selecting key signal features highly relevant to the classification task. Subsequently, the selected features are reorganized according to spatial channel and time-series structures and input into a designed spatiotemporal Transformer model. A multi-head self-attention mechanism is used to simultaneously capture the spatial coupling relationships between electrode channels and long-range dependency information at different time points, achieving high-precision classification of EEG signals. This invention significantly reduces feature engineering costs, improves the accuracy and generalization ability of interventional EEG signal decoding, and provides clinicians and researchers with an intuitive interpretation of signal-task associations based on the feature importance map generated by SHAP, demonstrating strong practicality and promotional value.

[0007] To achieve the above objectives, the present invention provides the following technical solution:

[0008] An interventional EEG signal classification system based on SHAP interpretable feature selection and Transformer is presented. This system includes a candidate feature extraction module, a SHAP feature optimization module, a spatiotemporal Transformer classification model, and an interpretability and visualization module. The candidate feature extraction module extracts all candidate features from the raw data to obtain candidate feature data. The SHAP feature optimization module filters key signal features from the candidate feature data to obtain filtered key signal feature data. The spatiotemporal Transformer classification model classifies the key signal feature data. The interpretability and visualization module displays the contribution of each feature to the results, providing physiological analysis for the classification task.

[0009] In a further optimization of this technical solution, the candidate feature extraction module is used to extract time-domain, frequency-domain, and nonlinear features from the preprocessed interventional EEG signal data to obtain candidate feature data.

[0010] Further optimization of this technical solution involves a SHAP feature optimization module comprising an initial classifier training unit and a SHAP value calculation unit. The initial classifier training unit uses a random forest machine learning algorithm to train candidate feature data. The SHAP value calculation unit, based on Shapley value theory in game theory, calculates the marginal contribution of each feature to the output of the initial classification, automatically selecting key features with SHAP values ​​higher than a set threshold. For a given feature i, its SHAP value φ... i Defined as:

[0011]

[0012] Where N represents the set of all features, S is any subset excluding feature i, f(S) is the predicted value of the model using only the feature subset S, f(S∪{i}) is the predicted value after adding feature i, and φ i The SHAP value of feature i is the weighted average of its marginal contribution to the model prediction, with the weight term... It is the probability of the subset's position across all permutations of the Shapley value.

[0013] This technical solution is further optimized by including a feature recursive update submodule in the SHAP feature optimization module. Based on the initial feature selection, this module continuously updates the feature subset and retrains the classifier model, recursively calculating the SHAP value of each feature. When a new important feature is added or an irrelevant feature is removed, the classifier is retrained and the updated SHAP value is calculated until a stable and optimal feature subset is obtained, ensuring a balance between accuracy and interpretability in the optimization results. Important features are those whose global average SHAP value is higher than a set threshold, indicating a significant contribution to the model's classification output; irrelevant features are those whose SHAP value is consistently lower than the same set threshold, indicating a weak contribution to improving classification performance.

[0014] Further optimization of this technical solution involves a spatiotemporal Transformer classification model that includes a feature embedding and spatiotemporal organization module. This module constructs a two-dimensional spatiotemporal feature matrix from key signal feature data according to time sequence and channel dimension. This module includes a dimension mapping subunit and a time position encoding subunit. The dimension mapping subunit is used to uniformly project the original features onto a fixed-length vector space through linear transformation or neural network embedding, ensuring that different channels and features have the same representation dimension. The time position encoding subunit is used to introduce relative or absolute position encoding information at each time slice to characterize the position information of the feature in the time series, thereby enhancing the model's ability to recognize the temporal structure. The feature matrix processed in the above way can be used as input to a standard Transformer model, facilitating subsequent spatiotemporal dependency modeling and classification prediction.

[0015] This technical solution is further optimized by including a model training and optimization module in the spatiotemporal Transformer classification model. The model training and optimization module is used to divide the training set, validation set and test set in proportion, and uses cross-entropy as the loss function for error backpropagation training.

[0016] This technical solution is further optimized by including a hyperparameter search unit in the spatiotemporal Transformer classification model. The key hyperparameters in the Transformer structure, including the number of network layers, the number of attention heads, the learning rate, and the Dropout ratio, are automatically adjusted through Bayesian optimization to obtain the optimal classification performance on the validation set.

[0017] Further optimization of this technical solution involves a spatiotemporal Transformer classification model comprising multiple attention encoder layers and a feedforward neural network structure. This model utilizes a multi-head self-attention mechanism to model the spatial collaborative relationships between features and the long-range dependencies in the time series in parallel, outputting a classification vector after nonlinear transformation. Finally, multi-class or binary classification prediction is achieved through the Sigmoid function.

[0018]

[0019] Where x is the output value of the model, and σ(x) is the output value of the Sigmoid function, which ranges between (0,1).

[0020] Further optimization of this technical solution involves an interpretability and visualization module that provides physiological interpretation support for the model, including a SHAP visualization unit and an attention heatmap subunit. The SHAP visualization unit outputs feature contribution heatmaps in terms of time period and channel dimensions, intuitively displaying the degree of influence of different features at different times. The attention heatmap subunit displays the response intensity of each attention head to key moments in the time series in image form, assisting in the analysis of activation periods of task-related brain regions.

[0021] Unlike existing technologies, the above technical solution has the following beneficial effects:

[0022] 1. The SHAP feature optimization module automatically calculates and selects candidate features that contribute the most to the classification results, significantly reducing the cost of manual feature engineering. At the same time, it generates feature importance maps, providing intuitive physiological evidence for clinical medicine or neuroscience research.

[0023] 2. The proposed spatiotemporal Transformer classification model can capture the spatial coordination relationship between multi-channel electrodes and the long-range dependency features at different time points in parallel, making full use of interventional high sampling rate and high signal-to-noise ratio EEG data, making the classification results more robust and accurate.

[0024] 3. By dynamically adjusting the SHAP screening threshold and Transformer structural parameters through feature recursive updates and hyperparameter Bayesian optimization, adaptive training for different tasks and subject datasets is achieved, improving the model's generalization ability in new scenarios.

[0025] 4. From raw signal preprocessing, extraction of 100 candidate features, SHAP optimization, to spatiotemporal Transformer classification, Sigmoid output, and interpretability visualization, a closed-loop processing system is formed, which simplifies the deployment process of interventional brain-computer interfaces and improves experimental efficiency and system practicality.

[0026] 5. The interpretability and visualization module not only outputs the final classification results, but also displays the contribution of each feature at different time periods and attention heatmaps, intuitively linking model decisions with brain region physiological activities. This provides strong support for clinicians to conduct neurological function assessments, postoperative rehabilitation guidance, and researchers to explore new brain-computer interaction patterns. Attached Figure Description

[0027] Figure 1This is a schematic diagram of the system.

[0028] Figure 2 This is a schematic diagram of an interventional brain-computer interface application.

[0029] Figure 3 For 100 feature detail images;

[0030] Figure 4 Here is a diagram of the Transformer network structure;

[0031] Figure 5 This is a schematic diagram of physiological information analysis. Detailed Implementation

[0032] To explain in detail the technical content, structural features, objectives, and effects of the technical solution, the following description is provided in conjunction with specific embodiments and accompanying drawings.

[0033] This invention proposes an interventional EEG signal classification system that combines interpretable feature optimization with a spatiotemporal Transformer. Through adaptive signal preprocessing and the first-ever introduction of SHAP feature filtering technology, it effectively mines high-discriminative time-domain, frequency-domain, and nonlinear features inherent in interventional EEG signals. The spatiotemporal Transformer model, constructed using a multi-head self-attention mechanism, can simultaneously capture the spatial coupling relationships between different electrode channels and long-range dependencies in the time series, achieving accurate end-to-end classification of multi-channel, high-sampling-rate interventional EEG data. Simultaneously, while ensuring classification performance, this invention provides clinicians and researchers with an intuitive interpretation of signal-task associations through feature importance maps generated by SHAP, significantly improving the model's interpretability and generalization ability, reducing the workload of manual feature engineering, and enhancing the overall efficiency and application value of interventional brain-computer interface systems.

[0034] An interventional EEG signal classification system based on interpretable feature optimization and spatiotemporal Transformer is presented. The system includes a candidate feature extraction module, a SHAP feature optimization module, a spatiotemporal Transformer classification model, and an interpretability and visualization module. The candidate feature extraction module extracts all candidate features from the raw data, obtaining candidate feature data. The SHAP feature optimization module filters key signal features from the candidate feature data, obtaining filtered key signal feature data. The spatiotemporal Transformer classification model classifies the key signal feature data. The interpretability and visualization module displays the contribution of each feature to the results, providing physiological analysis for the classification task.

[0035] The candidate feature extraction module is used to extract time-domain, frequency-domain, and nonlinear features from the preprocessed interventional EEG signal data to obtain candidate feature data. This module extracts a total of 100 features to form a candidate feature set containing rich physiological information.

[0036] The SHAP feature optimization module includes an initial classifier training unit and a SHAP value calculation unit. The initial classifier training unit uses a random forest machine learning algorithm to train the candidate feature data. The SHAP value calculation unit, based on Shapley value theory in game theory, calculates the marginal contribution of each feature to the output of the initial classification, automatically selecting key features with SHAP values ​​higher than a set threshold. For a given feature i, its SHAP value φ... i Defined as:

[0037]

[0038] Where N represents the set of all features, S is any subset excluding feature i, f(S) is the predicted value of the model using only the feature subset S, f(S∪{i}) is the predicted value after adding feature i, and φ i The SHAP value of feature i is the weighted average of its marginal contribution to the model prediction, with the weight term... It is the probability of the subset's position across all permutations of the Shapley value.

[0039] The SHAP feature optimization module also includes a feature recursive update submodule. This module recursively optimizes the training model and feature set based on the initial feature selection. When new important features are added or irrelevant features are removed, the classifier is retrained and the updated SHAP value is calculated until a stable and optimal feature subset is obtained, ensuring a balance between accuracy and interpretability in the optimization results.

[0040] The spatiotemporal Transformer classification model includes a feature embedding and spatiotemporal organization module. This module constructs a two-dimensional spatiotemporal feature matrix based on the key features mentioned above, according to temporal order and channel dimension. This module comprises a dimension mapping subunit and a temporal position encoding subunit. The dimension mapping subunit maps the original channel feature vectors into a high-dimensional vector representation of uniform length through linear projection or neural network embedding, thus satisfying the Transformer's requirement for consistent input vector dimension. The temporal position encoding subunit introduces relative or absolute positional information into each time slice, enabling the model to model sequence order even in the absence of a recurring structure. These two subunits work together to generate high-dimensional feature inputs with both spatial structure and temporal order information, used for subsequent parallel modeling of the multi-head self-attention mechanism.

[0041] The spatiotemporal Transformer classification model comprises multiple attention encoder layers and a feedforward neural network structure. This model utilizes a multi-head self-attention mechanism to model spatial collaborative relationships between features and long-range dependencies in time series in parallel, outputting a non-linearly transformed classification vector. Finally, a sigmoid function is used to achieve multi-class or binary classification prediction.

[0042]

[0043] Where x is the output value of the model, and σ(x) is the output value of the Sigmoid function, which ranges between (0,1).

[0044] This application provides a model training and optimization module. This module is a functional component in the spatiotemporal Transformer classification model of this invention, used for model training and performance optimization. This component supports the proportional partitioning of the training set, validation set, and test set, and uses cross-entropy as the loss function for error backpropagation training. Simultaneously, the spatiotemporal Transformer classification model includes a hyperparameter search unit, which can automatically adjust key hyperparameters in the Transformer structure, including the number of network layers, the number of attention heads, the learning rate, and the Dropout ratio, through Bayesian optimization methods to obtain optimal classification performance on the validation set. The above training and optimization process, as an important component of the spatiotemporal Transformer classification model, provides support for improving model performance and enhancing generalization ability.

[0045] The interpretability and visualization module provides physiological interpretation support for the model, including the SHAP visualization unit and the attention heatmap subunit. The SHAP visualization unit outputs feature contribution heatmaps in terms of time period and channel dimensions, intuitively showing the degree of influence of different features at different times; the attention heatmap subunit displays the response intensity of each attention head to key moments in the time series in image form, assisting in the analysis of activation periods of task-related brain regions.

[0046] The interpretability and visualization module also supports dynamic visualization, which can generate individualized interpretation maps based on different input samples, providing doctors or researchers with targeted interpretation criteria. This helps to establish an intuitive connection between interventional brain signals and neurocognitive behavior, and improves clinical usability and scientific interpretation value.

[0047] The interpretability and visualization module supports outputting summary information of the model's decision path. By combining SHAP value changes and attention focus segments, it can generate the physiological signal logic behind classification decisions, which is convenient for rapid citation and interpretation in diagnostic, scientific research reports, or medical teaching scenarios.

[0048] The technical solution proposed in this invention is used to classify the motor state of interventional EEG signals. (See also...) Figure 1 The diagram shown is a system schematic. (See attached image.) Figure 2 The diagram shows an application of an interventional brain-computer interface. The task is to use the interventional EEG signal classification system based on interpretable feature optimization and spatiotemporal Transformer described in this invention to collect and classify the interventional EEG signals of the subject in different motor imagery states, so as to accurately determine whether the subject is in a "static", "right-hand motor imagery" or "left-hand motor imagery" state based on EEG activity.

[0049] Step 1: Data Acquisition and Preprocessing

[0050] In neurosurgery, a microelectrode array is implanted into the motor cortex of the subject to obtain interventional EEG signals with a high signal-to-noise ratio. The system records the subject's EEG waveforms in real time at a sampling rate of 500Hz in three different states: rest, right-hand motor imagery, and left-hand motor imagery, each lasting 300 seconds, for a total of 900 seconds of raw time-domain signal. During the acquisition process, the operator simultaneously records the timestamps of the subject's task switching for subsequent data segmentation. The acquired raw signal is first subjected to a 10Hz–200Hz bandpass filter to remove low-frequency drift and high-frequency interference, and then a 50Hz power frequency notch filter algorithm is applied to suppress power supply noise. Next, a time-domain anomaly detection method is used to remove spike artifacts caused by breathing, heartbeat, or minor electrode movements. The remaining data is then normalized to zero mean and unit variance for each channel to ensure consistent feature scales across channels and different time periods, laying the foundation for subsequent feature extraction.

[0051] Step 2: Candidate Feature Extraction

[0052] After data preprocessing, the 900-second continuous signal was divided into equal-length time windows of 1 second each, generating 900 time window samples, each containing 500 discrete sampling points. For the multi-channel signal of each time window, 30 indicators, including mean, variance, sample entropy, autocorrelation coefficient, kurtosis, root mean square value, and zero crossover rate, were first calculated in the time domain to characterize the signal amplitude distribution and complexity. Then, a Fast Fourier Transform (FFT) was applied to each time window to extract 40 indicators in the frequency domain, including absolute power, relative power ratio, spectral center frequency, bandwidth, and spectral entropy for five typical frequency bands (δ, θ, α, β, γ), reflecting the intensity of different rhythmic activities in brain regions. Finally, nonlinear dynamics methods were used to calculate 30 nonlinear features for each time window, such as fractal dimension, multi-scale entropy, and maximum Lyapunov exponent, to characterize the chaotic nature and complexity of the signal. After the above processing, each time window sample obtained a reference... Figure 3 The 100-dimensional candidate features, totaling a 900×100-dimensional candidate feature matrix, are used as input to the subsequent SHAP feature optimization module.

[0053] Step 3: SHAP Feature Optimization

[0054] The aforementioned 900×100 dimensional candidate feature matrix, along with the corresponding motion state labels (still, right-handed imagination, left-handed imagination), was input into the initial random forest classifier for training. The initial classifier consisted of 200 decision trees with a maximum tree depth of 10, and each tree randomly selected a subset of features for splitting. After training, the accuracy was validated on the validation set (150 samples randomly selected from 900 time windows) to verify the data's validity and separability. Next, the TreeSHAP algorithm was used to calculate the Shapley value of each feature on the full training samples to quantify the contribution of each candidate feature to the classification output. By calculating the mean of the Shapley values ​​across the 900 time windows, the global average Shapley value of 100 candidate features was obtained, and 30 features with an average value higher than 0.02 were selected as key signal features. Based on this, these 30 features were re-input into the random forest model for secondary training, and the accuracy measured on the validation set was found to be no more than 10% different from the initial model, indicating that the selected feature subset could retain classification information. If the deviation is large, further fine-tune the SHAP threshold or expand the size of the random forest until a feature set that can both guarantee model performance and minimize redundancy is selected.

[0055] Step 4: Feature Embedding and Spatiotemporal Organization

[0056] The 30 selected key signal features are mapped back to their corresponding time windows and electrode channels. Within each time window, each feature is labeled with its associated channel and specific type, and embedded into a 64-dimensional vector space through a learnable linear transformation for subsequent processing by the Transformer model. Simultaneously, a relative positional code of length 64 is generated for each time window, increasing sequentially according to temporal order to help the model capture long-range temporal dependencies. Finally, the embedding results of the key signal features from 900 time windows are concatenated with the positional codes to form a 900×30×64 three-dimensional tensor, where the first dimension represents the number of time windows, the second dimension represents the number of channels (corresponding to the electrode channels where the key signal features reside), and the third dimension represents the representation dimension of each feature in the embedding space.

[0057] Step 5: Training the Spatiotemporal Transformer Classification Model

[0058] See Figure 4The diagram shows the Transformer network structure. Using the constructed 900×30×64 tensor and its corresponding motion state labels, a spatiotemporal Transformer model with a 6-layer encoder is designed. Each encoder layer consists of a multi-head self-attention mechanism and a feedforward fully connected network. The multi-head attention mechanism has 8 heads, each with a dimension of 32. The feedforward network includes two linear transformations, with a hidden layer dimension of 256. A GELU activation function and a Dropout operation are inserted between the two layers, with a Dropout ratio of 0.2. The model's input is processed through positional encoding and channel embedding, followed by 6 layers of parallel attention computation to generate a high-dimensional feature representation with spatiotemporal coupling information. Finally, a global average pooling layer is used to converge the temporal dimension, and a linear mapping layer reduces the vector dimension to 3. A Sigmoid function is then used to map the vector to the 0–1 interval to obtain the probability distribution of the three task classes. Training uses the Adam optimizer with an initial learning rate of 1×10⁻⁶. -4 The batch size is 64, and the cross-entropy loss function is used for backpropagation of the model. During training, the model is evaluated on the validation set every 5 epochs. If the validation accuracy does not improve significantly within 10 consecutive epochs, the training is stopped early.

[0059] Step 6: Hyperparameter Bayesian Optimization

[0060] To further improve model performance, a Bayesian optimization framework was invoked during training to automatically search for the hyperparameters of the Transformer. The number of layers (4–10), the number of attention heads (4–12), the dimension of the feedforward network hidden layers (128–512), and the Dropout ratio (0.1–0.5) were used as variables to be optimized, with the objective function being to maximize the sum of validation set accuracy and F1 score. Bayesian optimization was performed in parallel for 50 iterations on both the training and validation sets, ultimately selecting the optimal combination. The model was retrained using this optimal parameter configuration, achieving improved accuracy and F1 score on the validation set compared to training with the initial default parameters.

[0061] Step 7: Explainability and Visualization

[0062] See Figure 5The diagram illustrates the physiological information analysis. After the final model training is completed, 150 time-window samples from the test set are visualized and interpreted. First, for a specific time-window sample, its 30-dimensional key signal features are re-inputted, and the local SHAP value of each feature is calculated and displayed as a two-dimensional heatmap. The horizontal axis represents the feature number, the vertical axis represents the channel number, and the color intensity indicates the positive or negative contribution of the feature to the final classification probability. Second, the attention distribution of each attention head of each layer of the trained Transformer model across the time windows in the entire test set is extracted, generating a 900×900 attention weight matrix heatmap. This reveals the changes in attention values ​​in the time window corresponding to the transition from "static" to "motor imagery," indicating the key temporal changes that the model focuses on during that time period. Finally, the SHAP heatmaps of several consecutive time windows are integrated with the attention heatmap to generate a dynamic visualization report, intuitively showing the evolution of the subject's EEG characteristics as the motor task switches, facilitating further analysis of brain activity patterns by clinicians or researchers.

[0063] Step 8: Final Classification and Application

[0064] The remaining 150 time windows in the test set are input into the final optimized spatiotemporal Transformer model to obtain the corresponding motion state prediction labels. The classification accuracy and macro-average F1 score of the model on the test set are calculated. This embodiment fully demonstrates the implementation process and technical effects of the system of the present invention in interventional brain-computer interface tasks, providing a complete demonstration for subsequent clinical applications and scientific research promotion.

[0065] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Unless otherwise specified, an element defined by the phrase "comprising..." or "including..." does not exclude the presence of additional elements in the process, method, article, or terminal device that includes said element. Additionally, in this document, "greater than," "less than," "exceeding," etc., are understood to exclude the stated number; "above," "below," "within," etc., are understood to include the stated number.

[0066] Although the above embodiments have been described, those skilled in the art, once they understand the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the above descriptions are merely embodiments of the present invention and do not limit the scope of patent protection of the present invention. Any equivalent structural or procedural transformations made using the content of the present invention's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the scope of patent protection of the present invention.

Claims

1. An interventional EEG signal classification system based on SHAP interpretable feature selection and Transformer, characterized in that, The system includes a candidate feature extraction module, a SHAP feature optimization module, a spatiotemporal Transformer classification model, and an interpretability and visualization module; the candidate feature extraction module is used to extract all candidate features from the original data to obtain candidate feature data; The SHAP feature optimization module is used to filter out key signal features from candidate feature data to obtain filtered key signal feature data. The spatiotemporal Transformer classification model will classify key signal feature data; the interpretability and visualization module will show the contribution of each feature to the results, providing physiological analysis for the classification task.

2. The interventional EEG signal classification system based on SHAP interpretable feature selection and Transformer as described in claim 1, characterized in that, The candidate feature extraction module is used to extract time-domain, frequency-domain, and nonlinear features from the preprocessed interventional EEG signal data to obtain candidate feature data.

3. The interventional EEG signal classification system based on SHAP interpretable feature selection and Transformer as described in claim 1, characterized in that, The SHAP feature optimization module includes an initial classifier training unit and a SHAP value calculation unit. The initial classifier training unit uses the random forest machine learning algorithm to train the candidate feature data. The SHAP value calculation unit is based on the Shapley value theory in game theory. It calculates the marginal contribution of each feature to the output of the initial classification and automatically selects key features with SHAP values ​​higher than a set threshold. For a given feature i, its SHAP value φ i Defined as: Where N represents the set of all features, S is any subset excluding feature i, f(S) is the predicted value of the model using only the feature subset S, f(S∪{i}) is the predicted value after adding feature i, and φ i The SHAP value of feature i is the weighted average of its marginal contribution to the model prediction, with the weight term... It is the probability of the subset's position across all permutations of the Shapley value.

4. The interventional EEG signal classification system based on SHAP interpretable feature selection and Transformer as described in claim 3, characterized in that, The SHAP feature optimization module also includes a feature recursive update submodule. Based on the initial feature selection, this module continuously updates the feature subset and retrains the classifier model, recursively calculating the SHAP value of each feature. When a new important feature is added or an irrelevant feature is removed, the classifier is retrained and the updated SHAP value is calculated until a stable and optimal feature subset is obtained, ensuring a balance between accuracy and interpretability in the optimization results. Important features are those whose global average SHAP value is higher than a set threshold, indicating that the feature has a significant impact on the classification model output. Irrelevant features are those whose SHAP value is lower than the aforementioned set threshold, indicating that the feature contributes little to the classification performance.

5. The interventional EEG signal classification system based on SHAP interpretable feature selection and Transformer as described in claim 1, characterized in that, The spatiotemporal Transformer classification model includes a feature embedding and spatiotemporal organization module. This module constructs a two-dimensional spatiotemporal feature matrix from key signal feature data according to time sequence and channel dimension. This module includes a dimension mapping subunit and a time position encoding subunit. The dimension mapping subunit is used to uniformly project the original features to a fixed-length vector space through linear transformation or neural network embedding, ensuring that different channels and features have the same representation dimension. The time position encoding subunit is used to introduce relative or absolute position encoding information at each time slice to characterize the position information of the feature in the time series, thereby enhancing the model's ability to recognize the temporal structure. The feature matrix after the above processing can be used as input to the standard Transformer model, which is convenient for subsequent spatiotemporal dependency modeling and classification prediction.

6. The interventional EEG signal classification system based on SHAP interpretable feature selection and Transformer as described in claim 5, characterized in that, The spatiotemporal Transformer classification model also includes a model training and optimization module, which is used to divide the training set, validation set and test set in proportion, and uses cross-entropy as the loss function for error backpropagation training.

7. The interventional EEG signal classification system based on SHAP interpretable feature selection and Transformer as described in claim 6, characterized in that, The spatiotemporal Transformer classification model includes a hyperparameter search unit that automatically adjusts key hyperparameters in the Transformer structure, including the number of network layers, the number of attention heads, the learning rate, and the Dropout ratio, through Bayesian optimization methods to obtain optimal classification performance on the validation set.

8. The interventional EEG signal classification system based on SHAP interpretable feature selection and Transformer as described in claim 1, characterized in that, The spatiotemporal Transformer classification model includes multiple attention encoder layers and a feedforward neural network structure. This model utilizes a multi-head self-attention mechanism to model the spatial cooperative relationships between features and the long-range dependencies in the time series in parallel, outputting a classification vector after nonlinear transformation, and finally achieving multi-class or binary classification prediction through the Sigmoid function. Where x is the output value of the model, and σ(x) is the output value of the Sigmoid function, which ranges between (0,1).

9. The interventional EEG signal classification system based on SHAP interpretable feature selection and Transformer as described in claim 1, characterized in that, The interpretability and visualization module is used to provide physiological interpretation support for the model, including the SHAP visualization unit and the attention heatmap subunit; the SHAP visualization unit outputs feature contribution heatmaps in terms of time period and channel dimensions, which intuitively shows the degree of influence of different features at different times; The attention thermal subunit displays the response intensity of each attention head to key moments in the time series in the form of images, which helps to analyze the activation periods of task-related brain regions.

Citation Information

Cited By

  • Transform-based high-precision sea wave intelligent prediction method

    CN121257337A

  • Bcg signal classification method and system based on multi-domain feature fusion and shap analysis

    CN122413113A