Electroencephalogram signal classification method, device and equipment fusing cnn and kan, and storage medium
By integrating CNN and KAN methods for EEG signal classification, a feature extraction encoder and a nonlinear classification decoder are constructed. Combined with transfer learning and dynamic grid update strategies, the problems of individual differences and small sample size in EEG signal classification are solved, achieving high accuracy and stable classification results.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- 湖南工商大学
- Filing Date
- 2026-03-13
- Publication Date
- 2026-05-12
AI Technical Summary
Existing technologies struggle to achieve high-precision and stable classification of EEG signals due to high noise, significant individual differences, and small sample sizes. In particular, the model's generalization performance is poor due to individual differences and covariate bias.
We employ a brainwave signal classification method that integrates convolutional neural networks (CNN) and Kolmogorov-Arnold networks (KAN). By constructing a feature extraction encoder and a nonlinear classification decoder, and combining two-stage transfer learning, regularized ridge regression, and hybrid dynamic grid update strategies, we optimize the model's performance under small sample conditions.
High-precision and stable EEG signal classification was achieved under conditions of high noise and significant individual differences, improving the model's generalization ability and robustness.
Smart Images

Figure CN121859164B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the fields of artificial intelligence and neural network technology, and in particular to a method, apparatus, device and storage medium for classifying electroencephalogram (EEG) signals that integrates CNN and KAN. Background Technology
[0002] Electroencephalogram (EEG) signals, as important bioelectrical signals reflecting brain neural activity, are widely used in fields such as brain-computer interfaces (BCI), neurorehabilitation, epilepsy detection, and cognitive state monitoring. Among these, EEG signal classification based on motor imagery (MI) is one of the core tasks of BCI systems, and its performance directly determines the efficiency and reliability of human-computer interaction. However, EEG signals are characterized by high dimensionality, non-stationarity, and low signal-to-noise ratio, and are significantly affected by individual physiological differences, environmental interference, and acquisition equipment, placing extremely high demands on the robustness and generalization ability of classification algorithms.
[0003] Currently, existing approaches typically employ convolutional neural networks (such as EEGNet and DeepConvNet) for feature extraction. While these networks are effective at extracting spatiotemporal features, they usually use standard fully connected layers (MLP / Dense Layer) at the end of the network to map features to the class space. MLP (Multilayer Perceptron) is essentially a linearly weighted combination of features (with fixed activation functions such as ReLU), which limits its function approximation ability, making it difficult to fully explore the complex nonlinear relationships in deep features, and it also lacks interpretability.
[0004] Due to time constraints in BCI system calibration, it is often difficult to obtain large amounts of labeled training data from a single target user. Training deep learning models directly on small sample data from the target user is highly prone to overfitting. Although historical data from other users can be used for auxiliary training, due to "covariate shift," the data distributions of the source domain (other users) and the target domain (current user) are inconsistent. Models trained by directly mixing these data often exhibit poor generalization performance on the target user, and may even show negative transfer. Therefore, achieving high-accuracy and stable EEG signal classification under conditions of high noise, significant individual differences, and small sample sizes has become an urgent problem to be solved. Summary of the Invention
[0005] The purpose of this application is to provide a method, device, equipment and storage medium for classifying EEG signals that integrates CNN and KAN, aiming to solve the technical problem of how to achieve high-precision and stable EEG signal classification under the conditions of high noise, significant individual differences and small sample size.
[0006] To achieve the above objectives, this application proposes a brainwave signal classification method that integrates CNN and KAN, the method comprising:
[0007] A feature extraction encoder is constructed based on the first convolutional block, the second convolutional block, and the distribution adaptation layer;
[0008] A nonlinear classification decoder is constructed based on the KAN layer, wherein the KAN layer contains multiple learnable activation function paths based on B-splines;
[0009] An initial EEG classification model is constructed based on the feature extraction encoder and the nonlinear classification decoder.
[0010] A hybrid dataset containing source domain data and target domain data is constructed, and the initial EEG classification model is iteratively trained based on the hybrid dataset, a two-stage transfer learning strategy, a spline coefficient update strategy based on regularized ridge regression, and a hybrid dynamic grid update strategy to obtain the target EEG classification model.
[0011] Bandpass filtering, channel-level standardization, and temporal segment permutation enhancement were performed on the multi-channel EEG data to be classified to obtain enhanced data;
[0012] The enhanced data is subjected to feature extraction, distribution alignment, and nonlinear mapping using the target EEG classification model to obtain the classification result.
[0013] Furthermore, to achieve the above objectives, this application also proposes a brainwave signal classification device that integrates CNN and KAN, the device comprising:
[0014] The encoder building module is used to build a feature extraction encoder based on the first convolutional block, the second convolutional block, and the distribution adaptation layer;
[0015] A decoder building module is used to build a non-linear classification decoder based on a KAN layer, wherein the KAN layer contains multiple learnable activation function paths based on B-splines;
[0016] The model building module is used to build an initial EEG classification model based on the feature extraction encoder and the nonlinear classification decoder;
[0017] The model training module is used to construct a hybrid dataset containing source domain data and target domain data, and to iteratively train the initial EEG classification model based on the hybrid dataset, a two-stage transfer learning strategy, a spline coefficient update strategy based on regularized ridge regression, and a hybrid dynamic grid update strategy to obtain the target EEG classification model.
[0018] The data augmentation module is used to perform bandpass filtering, channel-level standardization, and temporal segment permutation on the multi-channel EEG data to be classified, so as to obtain augmented data.
[0019] The classification prediction module is used to extract features, align distributions, and perform nonlinear mapping on the enhanced data using the target EEG classification model to obtain classification results.
[0020] Furthermore, to achieve the above objectives, this application also proposes an EEG signal classification device that integrates CNN and KAN, the device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the EEG signal classification method integrating CNN and KAN as described above.
[0021] In addition, to achieve the above objectives, this application also proposes a storage medium, which is a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements the steps of the EEG signal classification method that integrates CNN and KAN as described above.
[0022] In addition, to achieve the above objectives, this application also provides a computer program product, which includes a computer program that, when executed by a processor, implements the steps of the EEG signal classification method that integrates CNN and KAN as described above.
[0023] One or more technical solutions proposed in this application have at least the following technical effects:
[0024] First, a feature extraction encoder is constructed based on the first and second convolutional blocks and the distribution adaptation layer. This encoder effectively mitigates the performance degradation caused by individual differences. Second, a nonlinear classification decoder is constructed based on the KAN layer. This KAN layer contains multiple learnable activation function paths based on B-splines, which can flexibly fit complex nonlinear decision boundaries and improve the model's expressive power. Next, the feature extraction encoder and the nonlinear classification decoder are cascaded to form an initial EEG classification model, providing a complete architecture for subsequent optimization. Then, a hybrid dataset containing source and target domain data is constructed, and the initial model is iteratively trained using a two-stage transfer learning strategy, a spline coefficient update strategy based on regularized ridge regression, and a hybrid dynamic grid update strategy, thereby improving generalization ability under small sample conditions. Subsequently, the multi-channel EEG data to be classified is sequentially subjected to bandpass filtering, channel-level standardization, and temporal segment permutation enhancement to generate more robust enhanced data, effectively suppressing noise and expanding sample diversity. Finally, the enhanced data is input into the trained target EEG classification model, and feature extraction, distribution alignment, and nonlinear mapping are sequentially completed to output the final classification result. This application enables high-precision and stable EEG signal classification even under conditions of high noise levels, significant individual differences, and small sample sizes. Attached Figure Description
[0025] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0026] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0027] Figure 1 This is a flowchart illustrating an embodiment of the EEG signal classification method integrating CNN and KAN provided in this application.
[0028] Figure 2 This is a schematic diagram of the connection structure between the feature extraction encoder and the nonlinear classification decoder provided in Embodiment 1 of the EEG signal classification method integrating CNN and KAN in this application.
[0029] Figure 3 This is a flowchart illustrating Embodiment 2 of the EEG signal classification method integrating CNN and KAN provided in this application;
[0030] Figure 4 This is a schematic diagram of the module structure of the EEG signal classification device that integrates CNN and KAN according to an embodiment of this application;
[0031] Figure 5 This is a schematic diagram of the device structure of the hardware operating environment involved in the EEG signal classification method that integrates CNN and KAN in the embodiments of this application.
[0032] The purpose, features, and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0033] It should be understood that the specific embodiments described herein are merely illustrative of the technical solutions of this application and are not intended to limit this application.
[0034] To better understand the technical solution of this application, a detailed description will be provided below in conjunction with the accompanying drawings and specific implementation methods.
[0035] It should be noted that the executing entity of this application embodiment can be a computing service device with data processing, network communication, and program execution functions, such as a tablet computer, personal computer, or mobile phone, or an electronic device or electroencephalogram (EEG) signal classification system capable of performing the above functions. The following description uses an EEG signal classification system as an example to illustrate this embodiment and the subsequent embodiments.
[0036] The user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data comply with the relevant laws, regulations and standards of the relevant countries and regions.
[0037] Based on this, embodiments of this application provide a brainwave signal classification method that integrates CNN and KAN, referring to... Figure 1 , Figure 1 This is a flowchart illustrating the first embodiment of the EEG signal classification method integrating CNN and KAN in this application.
[0038] In this embodiment, the EEG signal classification method fusing CNN and KAN includes steps S10~S60:
[0039] Step S10: Construct a feature extraction encoder based on the first convolutional block, the second convolutional block, and the distribution adaptation layer;
[0040] It should be noted that the first convolutional block refers to the convolutional neural network module used for the initial extraction of spatiotemporal features of EEG signals. It typically consists of one-dimensional or two-dimensional convolutional layers, batch normalization, and activation functions (e.g., ReLU). Its input is raw or multi-channel preprocessed EEG data, aiming to capture local temporal dynamics and inter-channel spatial correlations. The second convolutional block refers to the convolutional structure that further deepens the feature abstraction capability after the first convolutional block. It usually has deeper filters or larger receptive fields and is used to fuse multi-scale contextual information and enhance discriminative feature representation. Its design goal is to improve the model's ability to model complex EEG patterns. The distribution adaptation layer is a module used to alleviate the feature distribution offset problem between the training set and the test set caused by individual differences or different acquisition conditions. Its core idea is to make features have better consistency and generalization across different subjects or sessions through learnable mapping or normalization mechanisms (e.g., adaptive instance normalization). A feature extraction encoder is an overall network structure consisting of a first convolutional block, a second convolutional block, and a distribution adaptation layer stacked sequentially. Its function is to extract discriminative and robust high-dimensional feature representations from the raw EEG signals layer by layer, providing stable and information-rich input for subsequent classifiers.
[0041] As an example, the step of constructing a feature extraction encoder based on a first convolutional block, a second convolutional block, and a distribution adaptation layer includes: constructing a first convolutional block based on a temporal convolutional layer, a first batch normalization layer, a depthwise separable convolutional layer, a second batch normalization layer, a first nonlinear activation layer, and a first average pooling layer; constructing a second convolutional block based on a separable convolutional layer, a pointwise convolutional layer, a third batch normalization layer, a second nonlinear activation layer, and a second average pooling layer; using a one-dimensional batch normalization layer as a distribution adaptation layer, and constructing a feature extraction encoder based on the first convolutional block, the second convolutional block, and the distribution adaptation layer.
[0042] The temporal convolutional layer is a one-dimensional convolutional layer specifically designed for extracting local features from EEG signals over time. Its kernel slides along the time axis to capture temporal dynamic patterns within electrode channels. The first batch normalization layer, immediately following the temporal convolutional layer, normalizes the output of each channel within a batch, aiming to accelerate training and improve model stability. The depthwise separable convolutional layer is an efficient convolutional structure that decomposes standard convolution into spatial depthwise convolution and channel-by-channel convolution operations. Depthwise convolution performs independent spatial filtering on each input channel to model the spatial relationships between multi-channel EEG signals. The second batch normalization layer, following the depthwise separable convolutional layer, further normalizes the spatial feature representation and reduces internal covariate bias. The first nonlinear activation layer is a nonlinear transformation layer using an Exponential Linear Unit (ELU) as the activation function. It can mitigate the vanishing gradient problem while preserving negative responses, enhancing the model's expressive power.
[0043] The first average pooling layer is an average pooling operation that downsamples the feature map in the time dimension. It reduces temporal resolution, compresses feature dimensions, and enhances robustness to temporal shifts. The separable convolutional layer is a depthwise separable convolutional structure reused in the second convolutional block. Its function is to further decouple spatiotemporal features at a higher level of abstraction, improving parameter efficiency and generalization performance. The pointwise convolutional layer uses a 1×1 convolutional kernel to linearly combine the channels of the depthwise separable convolution output, adjusting the channel dimension and fusing cross-channel information. The third batch normalization layer is a batch normalization layer following the pointwise convolutional layer, used to stabilize the deep feature distribution of the second convolutional block. The second nonlinear activation layer is an ELU activation function applied again after the third batch normalization layer to introduce nonlinearity and maintain negative response characteristics. The second average pooling layer is another round of temporal average pooling applied at the end of the second convolutional block, further reducing the temporal scale of the feature map and providing a compact representation for subsequent processing. A one-dimensional batch normalization layer is a batch normalization layer that performs standardization only on a single dimension (usually the feature channel dimension). It is used as a distribution adaptation layer to reduce the negative impact of differences in data distribution between different subjects or sessions and to improve cross-subject generalization ability.
[0044] The deep learning model described in this embodiment mainly includes a feature extraction network and a classification network. The feature extraction network is configured to extract spatiotemporal features from raw electroencephalogram (EEG) signals, and its specific structure includes a first convolutional block, a second convolutional block, and a distribution adapter layer connected in sequence.
[0045] The first convolutional block is mainly used to extract the time-domain frequency band features and spatial topological features of the signal, and its structure is as follows:
[0046] Temporal Convolution: As the first layer of the model, this layer uses a two-dimensional convolutional layer (Conv2d), and its kernel size is set to... In this embodiment, The preferred setting is the sampling rate. Half of (for example, when) hour, =64), with 1 input channel and 64 output channels. (For example = 16), with a stride of (1,1). Specifically, to preserve the integrity of features in the time dimension, this layer is configured with padding parameters. Physically, this layer is equivalent to a set of learnable bandpass filters used to capture EEG features of different frequency components.
[0047] First batch normalization layer: The kernel size of this layer is... ,in The number of EEG electrode channels is [number], and the number of input channels is [number]. The number of output channels is (For example (i.e., output 32 channels) The number of groups is set to This layer learns the spatial weighting patterns between different electrodes by independently performing spatial filtering on each feature channel, thereby effectively decoding the activation patterns of brain regions (such as the activation of the contralateral motor cortex) in motor imagery tasks.
[0048] The second batch normalization layer and the ELU activation function are used to introduce nonlinear transformations and enhance the model's expressive power. The mathematical expression of the ELU activation function is:
[0049]
[0050] in, The output value of the ELU activation function. For input feature values, These are preset hyperparameters for controlling saturation in the negative range. It is a natural constant.
[0051] The first average pooling layer has a kernel size and stride of (1, 4) and is used to downsample along the time dimension to reduce data redundancy.
[0052] The second convolutional block is used for deep extraction of high-level abstract features and fusion of cross-channel information. Its structure employs a "separable convolution" design, with the separable convolutional layer consisting of depthwise convolutions and pointwise convolutions. Specifically, it includes:
[0053] Separable convolution: The kernel size is (1, 15), and the number of groups is equal to the number of input channels (e.g., 32), used to extract deep features in the time dimension; Batch normalization layer (BatchNorm2d): Normalizes the features after convolution.
[0054] Pointwise convolution: The kernel size is (1, 1), used for feature fusion along the channel dimension. The design of the separable convolution significantly reduces the number of model parameters while ensuring feature extraction capability. Subsequently, a batch normalization layer, an ELU activation function, and a second average pooling layer (kernel size and stride are both (1, 8)) are sequentially applied to output a high-dimensional feature map.
[0055] The distributed adaptation layer is a key component for achieving heterogeneous network fusion (fusion of CNN and KAN).
[0056] The system flattens the feature map output from the second convolutional block into a one-dimensional feature vector. (dimension is) After that, a one-dimensional batch normalization layer (BatchNorm1d) is added. The technical motivation for introducing this layer is that the B-spline basis function used in conventional KANs... The domain is typically defined within the grid nodes. If the features output by the CNN... If the offset is too large, the derivatives of all basis functions will... This causes backpropagation to break down. Subsequent KAN connections use B-splines as activation functions, which are typically only active within a finite interval (e.g., ...). or If a non-zero support set is directly input into the features extracted by the CNN, the feature values may fall into the flat region of the spline function (i.e., the gradient is zero region) because the numerical range of the support set may be too large or too small, causing the gradient vanishing problem and the model to fail to converge.
[0057] Therefore, this application configures a one-dimensional batch normalization layer after the feature flattening operation and before the KAN network input. This layer forces the statistical distribution of the input features to be normalized to a standard normal distribution. The one-dimensional batch normalization layer is represented as follows:
[0058] ,
[0059] in, It refers to the feature vector after standardization. It refers to the output feature vector after affine transformation. For the input feature vector, and These are the mean and variance of the current batch of data, respectively. To prevent the use of tiny constants with a denominator of zero (preferably 1e-5); and These are learnable affine transformation parameters. Beneficial effects: Through this adaptation layer, the system ensures that the vast majority of feature values are mapped to the effective activation interval of the B-spline function, thereby breaking down the numerical barrier between the CNN feature space and the KAN function space, guaranteeing the training stability and convergence speed of the hybrid model.
[0060] Step S20: Construct a nonlinear classification decoder based on the KAN layer, wherein the KAN layer contains multiple learnable activation function paths based on B-splines;
[0061] It's important to note that the KAN layer refers to the core computational unit in the Kolmogorov-Arnold Network. Its structure is based on the Kolmogorov-Arnold representation theorem, achieving high-dimensional nonlinear mapping by decomposing a multivariate function into a superposition of several univariate learnable activation functions. Unlike traditional neural networks that use fixed activation functions (such as ReLU), the activation functions in KAN layers are parameterized and can be trained end-to-end. A nonlinear classification decoder is a neural network module used to map the high-dimensional embedding vector output by the feature extraction encoder to the final class probability. Its core consists of one or more KAN layers, utilizing the powerful nonlinear fitting capabilities of KAN layers to perform fine-grained discrimination of EEG signal features, thereby achieving high-precision classification. A learnable activation function path based on B-spline refers to an independent activation function path corresponding to each input dimension in the KAN layer. This activation function is formed by a linear combination of B-spline basis functions. Its control points (or node weights) are automatically optimized as learnable parameters during training, thereby flexibly approximating arbitrarily complex one-dimensional nonlinear functions and forming a data-driven adaptive activation mechanism.
[0062] As an example, the step of constructing a nonlinear classification decoder based on a KAN layer includes: determining the input dimension and output dimension of the KAN layer, wherein the input dimension corresponds to the output dimension of the feature extraction encoder and the output dimension corresponds to the number of categories in the classification task; defining an activation function between each input node and each output node in the KAN layer; constructing a KAN layer based on the activation function, the base linear transformation term, and the spline nonlinear transformation term; and adding an output bias term after the KAN layer to obtain a nonlinear classification decoder.
[0063] The output bias term refers to a learnable scalar offset added to the final output of the KAN layer (one bias for each output category). It is used to adjust the decision thresholds for each category, compensate for the systematic bias that may exist in the model after nonlinear transformation, and thus improve the overall fitting ability and prediction accuracy of the classification decoder.
[0064] After the feature extraction network outputs a high-dimensional feature vector, this embodiment is equipped with a KAN-based nonlinear classification decoder. Unlike traditional techniques that use linear fully connected layers as classifiers, this embodiment utilizes a combination of learnable univariate nonlinear functions in the KAN network to fit the complex nonlinear mapping relationship between EEG signals and motor intentions.
[0065] In a practical implementation, assume the input dimension of the KAN layer is... The output dimension is (Number of categories corresponding to the classification task). For the i-th component of the input vector x and the j-th component of the output vector y The connection between them is no longer a scalar weight, but a learnable nonlinear function. The activation function is composed of a weighted average of base linear units and spline nonlinear units, and is expressed as follows:
[0066]
[0067] Base Function: For the weights of the base function, The base linear transformation term is defined as follows: The Sigmoid term is a weighted linear unit of the Sigmoid expression.
[0068]
[0069] in, The output of the base linear transformation term, For the input feature vector, It is the Sigmoid activation function. It is a natural constant.
[0070] This section is used to preserve the linear trend and basic nonlinear characteristics in the signal, ensuring that the network has good gradient propagation ability during the initialization phase.
[0071] Spline Function: Scaling weights for learnable splines, The nonlinear transformation term is a linear combination of B-spline functions. In this embodiment, a 3rd-order B-spline (Cubic B-Spline, k=3) is preferably used because it achieves the best balance between smoothness (second-order continuous differentiability) and computational complexity. The nonlinear transformation term is expressed as follows:
[0072]
[0073] in, These are learnable spline control coefficients. The total number of basis functions. For the number of grid intervals (e.g.) =5).
[0074] To clarify The calculation process in this embodiment is based on the Cox-de Boor recursive formula to define the B-spline basis function. First, define the node vector. During the initialization phase, the node vector is within the input range. (usually normalized to) The nodes are uniformly distributed within the area. Specifically, the effective number of grid nodes is... 1, and fill both ends. There are auxiliary nodes, with a total length of [number] nodes. The recursive calculation of the B-spline basis functions is as follows:
[0075] 0th order basis functions ( ): is an interval indicator function.
[0076]
[0077] Higher-order basis functions (k≥1):
[0078]
[0079] When the denominator is zero, the term is conventionally set to 0. This is achieved by... Step by step, we can deduce the following: This allows us to obtain smooth basis functions with local support properties. (Arbitrary input) Only fall into Within the non-zero interval of one basis function, this ensures computational efficiency.
[0080] Forward propagation process and parameter initialization:
[0081] Overall output of the nonlinear classification decoder The calculation formula is:
[0082]
[0083] in, The first of the output vectors of the nonlinear classifier decoder One portion, For the input dimension of the KAN layer, For the input feature vector, the first... One portion, For input node To the output node The base function weights, For the base linear transformation term, For input node To the output node spline scaling weights, This represents the total number of B-spline basis functions. These are the spline control coefficients. For B-spline basis functions, This is the output bias term.
[0084] Parameter initialization strategy: base weights Initialize using a uniform Kaiming distribution to fit the SiLU activation function. Spline weights. Initialize to 1.0 or a small constant (e.g., 0.1); do not dominate the gradient in the initial stage. Spline coefficients. Use minimal noise for initialization to make its initial shape close to a zero function, thus avoiding interference with the training startup of the base network.
[0085] Through the above structure, the model decomposes the problem of fitting multivariate functions into a combination of learnable univariate functions, thereby reducing the number of parameters while improving the interpretability and fitting accuracy of the model.
[0086] Step S30: Construct an initial EEG classification model based on the feature extraction encoder and the nonlinear classification decoder;
[0087] It should be noted that the initial EEG classification model refers to the complete neural network architecture composed of the cascaded feature extraction encoder and the nonlinear classification decoder. Its function is to realize end-to-end mapping from the input end of the raw EEG signal to the output end of the classification result. It has not yet been trained or fine-tuned and is used for subsequent parameter learning and performance optimization through labeled data.
[0088] Please refer to Figure 2 , Figure 2 This diagram illustrates the connection structure between the feature extraction encoder and the nonlinear classification decoder provided in Embodiment 1 of the EEG signal classification method integrating CNN and KAN of this application. The diagram is divided into two main parts: the feature extraction encoder and the nonlinear classification decoder. The input signal x, as the raw multi-channel EEG data, first enters the feature extraction encoder, passing through the first and second convolutional modules sequentially. Each convolutional module contains a separable convolutional layer, a combination of batch normalization (BN) and ELU activation functions, and a pooling layer, used to extract spatiotemporal features and reduce dimensionality layer by layer. After completing the two convolutional layers, the output enters a global pooling layer for further dimensionality reduction, and then passes through a distribution adaptation layer (BatchNorm1d) to standardize the feature distribution to enhance cross-subject generalization ability. The output of the feature extraction encoder serves as the input to the nonlinear classification decoder, entering the KAN linear layer. This layer consists of two parts: Spline(x) and SiLU(x), where Spline(x) represents a learnable activation function path based on B-splines. Combined with a ridge regression coefficient update strategy, parameter optimization is achieved, and the final output is the classification result (logits), i.e., the original predicted score for each category. The entire structure achieves end-to-end mapping from raw EEG signals to classification results.
[0089] Understandably, firstly, the EEG signal classification system sequentially connects the feature extraction encoder and the nonlinear classification decoder, making the output of the former the input of the latter; then, the system fixes the data interface dimension between the two to ensure that the number of channels and the shape of the feature vectors are perfectly matched during transmission; finally, the system encapsulates the entire cascaded structure into an end-to-end trainable network module to form an initial EEG classification model, so that all parameters can be jointly updated through backpropagation and optimization algorithms, thereby achieving unified modeling and efficient learning from raw EEG signals to category labels.
[0090] Step S40: Construct a hybrid dataset containing source domain data and target domain data, and iteratively train the initial EEG classification model according to the hybrid dataset, a two-stage transfer learning strategy, a spline coefficient update strategy based on regularized ridge regression, and a hybrid dynamic grid update strategy to obtain the target EEG classification model.
[0091] It should be noted that source domain data refers to datasets from pre-labeled EEG subjects (or sessions), typically containing sufficient label information to provide prior knowledge and the foundation for initial model training. Target domain data refers to EEG data from new subjects (or new sessions) to be adapted, with limited or even no labels, representing the target object for model generalization in practical applications. A hybrid dataset refers to a joint training set formed by merging the source domain data and the target domain data according to a certain ratio or sampling strategy, used to simultaneously utilize the supervisory signals from the source domain and the data distribution characteristics of the target domain during transfer learning. The two-stage transfer learning strategy refers to a phased optimization method for model training: the first stage involves supervised pre-training of the entire initial EEG classification model on the hybrid dataset, enabling the encoder and decoder to acquire general representation capabilities; the second stage freezes features, extracts some parameters from the encoder, fine-tunes only the KAN layer and the distribution adaptation layer, and introduces self-supervised or consistency constraints from unlabeled data in the target domain to enhance cross-subject adaptability. The spline coefficient update strategy based on regularized ridge regression refers to the explicit analytical update of the control point coefficients of the B-spline activation function in the KAN layer using ridge regression with L2 regularization during training, rather than relying solely on gradient descent. This improves the numerical stability of the spline function and prevents overfitting, making it particularly suitable for small-sample target domain scenarios. The hybrid dynamic grid update strategy involves dynamically adjusting the position and density of spline nodes (i.e., grid points) in the B-spline basis function definition of the KAN layer based on loss changes and feature distribution during training. On the one hand, it retains the original uniform grid to maintain global smoothness; on the other hand, it locally densifies the grid in input regions with concentrated gradients or large errors, forming a hybrid "static + dynamic" grid structure to more finely characterize key nonlinear regions. The target EEG classification model refers to the final model obtained after training on the aforementioned hybrid dataset, two-stage transfer learning, regularized spline coefficient updates, and dynamic grid optimization. It exhibits high accuracy, strong robustness, and good generalization ability on target domain data and can be directly deployed for EEG signal classification tasks of new subjects.
[0092] Understandably, the EEG signal classification system first mixes source and target domain data in batches to form a unified training dataset, allowing simultaneous utilization of source domain label information and target domain data distribution during training. Then, in the first stage, the system uses this mixed dataset to perform end-to-end supervised training on the initial EEG classification model, enabling the model to initially adapt to common features across subjects. In the second stage, the system fixes most parameters of the feature extraction encoder, updating only the distribution adaptation layer and the nonlinear classification decoder. During each parameter update, the system recalculates the coefficients of the B-spline activation function in the KAN layer using a regularized ridge regression method to improve stability with small samples. Simultaneously, it dynamically adjusts the spline grid nodes based on the distribution of the current input activation values, increasing node density in high-error regions to preserve global smoothness while enhancing local fitting ability. Finally, the system repeats the above training and update process until convergence, outputting the target EEG classification model with the best generalization performance on the target domain data, thus effectively mitigating the performance degradation caused by individual differences and scarce labeled data.
[0093] Step S50: Bandpass filtering, channel-level standardization, and temporal segment permutation enhancement are performed on the multi-channel EEG data to be classified to obtain enhanced data;
[0094] It should be noted that the multi-channel EEG data to be classified refers to the raw EEG signals collected simultaneously from multiple electrode channels before model processing. It is typically represented as a time-series matrix, with each row corresponding to one channel and each column corresponding to one sampling time point. Augmented data refers to the preprocessed and enhanced data obtained after sequentially performing bandpass filtering (e.g., preserving the 8–30 Hz frequency band to focus on motor imagery-related rhythms), channel-level normalization (zero-mean, unit-variance normalization for each channel independently), and temporal segment permutation augmentation (dividing the signal into several segments in the time dimension and randomly shuffling their order to expand sample diversity). This data is used to improve the signal-to-noise ratio of the model input, cross-channel comparability, and training robustness.
[0095] As an example, the steps of performing bandpass filtering, channel-level normalization, and temporal segment permutation enhancement on the multi-channel EEG data to be classified to obtain enhanced data include: performing bandpass filtering on the multi-channel EEG data to be classified using a preset filter to obtain filtered data; performing Z-score normalization on each channel of the filtered data to obtain normalized data; uniformly dividing the normalized data into a preset number of sub-segments along the time axis; randomly generating an index permutation sequence and splicing the sub-segments according to the order of the index permutation sequence to obtain temporal segment permutation data; and performing random time shifting and Gaussian noise injection on the temporal segment permutation data to obtain enhanced data.
[0096] The preset filter refers to a pre-designed digital bandpass filter, which is either a Finite Impulse Response (FIR) or Infinite Impulse Response (IIR) filter. It is used to preserve task-relevant frequency bands in the EEG signal (e.g., 8–30 Hz) and suppress interference components in other frequency bands. Standardized data refers to the result obtained by independently performing Z-score standardization on each channel of the filtered data. That is, the time series of each channel is converted into a distribution with a mean of 0 and a standard deviation of 1 to eliminate amplitude scale differences between channels. The preset segment number refers to the number of sub-segments into which the standardized data is evenly divided along the time axis during time segment permutation enhancement. This value is fixed during the model preprocessing stage. The index permutation sequence refers to a permutation generated by randomly shuffling integers from 0 to "preset segment number - 1" (e.g., [2, 0, 3, 1]), used to determine the order in which the sub-segments are reassembled. Temporal segment permutation data refers to a new time series formed by sequentially splicing the sub-segments according to the indexed sequence. Its content is recombined from the time segments of the original signal and is used to simulate different temporal dynamic patterns and expand sample diversity.
[0097] First, the computer system acquires multi-channel raw EEG signals from the subject using EEG acquisition equipment. The electrode arrangement follows the 10-20 international standard and is expanded to 22 channels. Let the input signal tensor be... ,in For batch size, This represents the number of electrode channels. The number of sampling points (e.g., if the sampling frequency is 250Hz and 3 seconds of data are extracted, then...) =750).
[0098] During the preprocessing stage, the system first performs a bandpass filter on the raw signal, with the filter frequency band set to 4-38Hz. This frequency band covers areas highly relevant to the motion visualization task. Rhythm (8-13Hz) and The frequency (14-30Hz) is filtered out, while power frequency interference and low-frequency drift are eliminated. Next, the system performs Z-score normalization on the data from each channel, i.e., subtracting the mean and dividing by the standard deviation, to eliminate differences in amplitude dimensions between different channels and accelerate network convergence. Its mathematical expression is:
[0099]
[0100] in, For the standardized first Each channel is in The signal value at time [time] For the first (i.e., after filtering) Each channel is in The signal value at time [time] Indicates the channel index. Indicates a time index. For the first The average value of the signals in each channel. For the first The standard deviation of the channel signal.
[0101] To address the technical issues of overfitting and insufficient generalization ability of models under small sample conditions, this embodiment provides a data augmentation method based on a hybrid strategy. During the training data loading phase, the EEG signal classification system is equipped with a data augmentation module to perform augmentation operations on the input time-series samples, including time segment permutation, random time shift, and Gaussian noise injection.
[0102] Specifically, the time segment permutation operation aims to improve the robustness of feature extraction by reconstructing the temporal structure. The system uses a preset trigger probability. In this embodiment, preferably Perform the following operations on the input samples: For the original time series input samples... Perform the following steps:
[0103] The original time series of length T is uniformly divided along the time axis, and the number of segments is set to be T. Segment (e.g.) =4), resulting in a set of sub-fragments. The length of each sub-segment is ;
[0104] Generate a string containing 0 to -1 random permutation index Also known as an indexed permutation sequence;
[0105] According to the random arrangement of the index vector The sub-segments in the sub-segment set are reassembled in the following order to generate an enhanced sample. .
[0106] in, This is an enhanced sample generated after time segment permutation and splicing. To divide the original time series into a predetermined number of segments evenly, For the generated random permutation index sequence, For the first in this random permutation sequence Index values (i = 1, 2, ...) (, N) For the sub-segment at the corresponding index position in the original sequence, [ This indicates a splicing operation along the time axis for multiple sub-segments.
[0107] Although the aforementioned time segment permutation disrupts the local continuity of the signal along the original time axis, this is precisely the key concept of this application. By breaking short-term dependencies, this method forces the Feature Extraction Network to reduce its reliance on noise-sensitive instantaneous waveform features, instead learning more globally stable frequency domain energy distribution features and spatial topological correlation features. Experiments show that this mechanism significantly improves the model's robustness and generalization performance in complex interference environments.
[0108] Furthermore, to enrich the diversity of the data, the EEG signal classification system is also equipped with a random time shift module. Let the preset maximum shift ratio be... (For example = 0.05), then the maximum number of translation steps is defined as The system is in the interval A random integer number of translation steps is generated inside. The translated sample is generated through a cyclic shift operation. This operation can be represented as:
[0109]
[0110] in, For the translated sample at the time index The value at that location, This represents the value of the original time series sample at the corresponding index. The number of translation steps is a randomly generated integer. For modulo operations (used to implement circular shifts) This represents the total number of sampling points for the time series. For time index .
[0111] In addition, the EEG signal classification system is equipped with a Gaussian noise injection module to simulate background noise in a real environment. The system first calculates the raw signal. average power According to the preset signal-to-noise ratio Calculate noise power Then, a random noise vector following a standard normal distribution is generated. This is then superimposed onto the original signal to obtain a noisy sample. The mathematical expression of this process is as follows:
[0112]
[0113]
[0114] By employing the aforementioned multi-dimensional enhancement strategies, the sample space distribution of training data can be effectively expanded, thereby improving the model's ability to learn time-shift invariance and noise robustness.
[0115] Step S60: The enhanced data is subjected to feature extraction, distribution alignment, and nonlinear mapping using the target EEG classification model to obtain the classification result.
[0116] It should be noted that the classification result refers to the final predicted category output by the target EEG classification model after processing the enhanced data. It is usually represented in the form of a probability distribution (e.g., the probability of each category in the four types of motor imagery tasks), and the one with the highest probability is taken as the discriminant label to indicate the intention or state corresponding to the current EEG signal.
[0117] As an example, the steps of performing feature extraction, distribution alignment, and nonlinear mapping on the augmented data using the target EEG classification model to obtain a classification result include: extracting features from the augmented data using the first convolutional block to obtain spatiotemporal joint features; extracting features from the spatiotemporal joint features using the second convolutional block to obtain high-level abstract features; aligning the high-level abstract features using the distribution adaptation layer to obtain a distribution-aligned feature vector; performing nonlinear mapping on the distribution-aligned feature vector using the nonlinear classification decoder to obtain a class probability distribution; and taking the class with the highest probability in the class probability distribution as the classification result.
[0118] Spatiotemporal joint features refer to the feature representation output by the first convolutional block after processing the enhanced data. These features simultaneously contain dynamic changes in the EEG signal over time and local correlation structures in a multi-channel (spatial) dimension, typically existing as a three-dimensional tensor (number of channels × number of time points × number of feature maps). High-level abstract features refer to the feature representation further extracted by the second convolutional block based on the spatiotemporal joint features, possessing a higher semantic level and stronger discriminative power. They have lower temporal resolution, more complex inter-channel interactions, and can reflect deep neural activity patterns related to the classification task. The category probability distribution refers to the vector output by the nonlinear classification decoder after nonlinearly mapping the distribution-aligned feature vectors. Its dimension is equal to the number of categories in the classification task, with each element taking a value between 0 and 1, and the sum being 1, representing the model's confidence that the input sample belongs to each category.
[0119] First, the system inputs enhanced data into the first convolutional block, sequentially passing it through a temporal convolutional layer, a depthwise separable convolutional layer, a batch normalization layer, an ELU activation function, and an average pooling layer for forward computation, outputting spatiotemporal joint features to capture the coupling information of local temporal dynamics and multi-channel spatial structure in EEG signals. Then, the system feeds these spatiotemporal joint features into the second convolutional block, processing them through a separable convolutional layer, a pointwise convolutional layer, batch normalization, ELU activation, and average pooling to generate high-level abstract features, further compressing redundancy and enhancing discriminative power. Next, the system... The features are standardized through the distribution adaptation layer (i.e., the one-dimensional batch normalization layer) to make the feature distribution closer to the source domain statistical characteristics during training, thereby mitigating the performance degradation caused by individual differences. Subsequently, the system inputs the distribution-aligned feature vectors into the nonlinear classification decoder, where the KAN layer performs high-precision nonlinear mapping based on a learnable B-spline activation function and adds an output bias term to output the predicted probability of each category, forming a category probability distribution. Finally, the system selects the category with the highest probability value in this distribution as the final classification result to achieve accurate discrimination of the current EEG intention.
[0120] The final stage of this embodiment involves in-depth structured analysis and visualization of the trained EEG decoding model, aiming to break down the "black box" barrier of traditional deep learning models in the field of medical rehabilitation and provide clinicians and rehabilitation therapists with physiologically meaningful decision-making basis. Unlike traditional convolutional neural networks or Transformer models, which can only generate fuzzy heatmaps through gradient-weighted class activation mapping (Grad-CAM) to locate "regions of interest," the nonlinear classification decoder in this application is built based on the Kolmogorov-Arnold representation theorem. This special mathematical architecture allows the system not only to know where the model "sees," but also to accurately quantify how the model "thinks" and "transforms" specific features. After the model training converges, the system does not have a fixed weight matrix in the traditional sense, but instead stores a set of B-spline control coefficients defined on a grid. These coefficients are mathematically essentially low-dimensional projections of a high-dimensional functional manifold. In order to transform these abstract mathematical parameters into decision logic that humans can understand, the computer system first starts a dedicated "function reconstruction engine". This engine is responsible for performing the reverse generation process from discrete parameters to continuous functions, that is, reproducing the decision path inside the model "from scratch".
[0121] Specifically, the function reconstruction engine first traverses all connection paths in the last layer of the classifier decoder. For each connection between an input feature dimension and an output class node, the system extracts the corresponding B-spline basis function order, grid node vector, and trained and optimized control point coefficients. Since the B-spline function has local support properties, simply observing the control coefficients does not provide a clear understanding of the function's overall picture. Therefore, the system needs to generate a high-density sampling point sequence within a predefined domain (usually the normalized numerical range of the input features, such as between -1 and +1). The Cox-de Boor Recursion Formula is as follows:
[0122]
[0123] in, for The first B-spline basis functions For input variables, For the index of the basis functions, Let B be the order of the B-spline. They are node vectors The corresponding node value in and They are respectively the corresponding B-order spline basis functions.
[0124] For each sampled input value, the system uses this formula to calculate the activation value of each order B-spline basis function, and then performs a linear weighted summation with the corresponding control coefficients to accurately calculate the nonlinear response output corresponding to that input value. Through continuous scanning and calculation across the entire domain, the system reconstructs the originally discretely stored parameters into continuous, smooth activation function curves with well-defined geometric shapes. This process explicitly transforms the originally implicit, deeply embedded nonlinear mapping relationship within the neural network into a geometric figure in a Cartesian coordinate system, where the horizontal axis represents the intensity or value of the input EEG feature, and the vertical axis represents the contribution (Logits) of that feature to the classification result of a specific movement intention. When hundreds or thousands of such function curves are reconstructed and visualized on the terminal interface, the system can automatically perform semantic parsing of the model's micro-decision mechanism by analyzing the slope, curvature, monotonicity, and zero-point positions of these curves, thereby revealing the following three key neural-like decision-making logics.
[0125] Logical empirical proof of asymmetric noise suppression:
[0126] For any subinterval of the domain If all control coefficients corresponding to this interval If all values approach zero, then the function... Its derivatives and all their orders converge uniformly to zero within this interval. This property mathematically guarantees the independence of the "noise suppression" mechanism. Unlike polynomial fitting or global activation functions (such as Sigmoid), B-splines allow the model to operate within the "noise interval" of its domain (e.g., ...). Control coefficients Optimize to 0, thus achieving Meanwhile, this does not affect the model's performance in the "signal range" (e.g., This involves fitting complex nonlinear curves by adjusting other control coefficients. This domain decoupling capability is the mathematical basis for achieving "asymmetric noise suppression" in this application, proving that the noise suppression behavior does not come at the expense of sensitivity in the signal region.
[0127] After statistical analysis of the function shapes of a large number of decoding channels, the system found that for specific feature dimensions, especially those edge channels sensitive to high-frequency electromyography interference or electrode contact artifacts, the model spontaneously learned function shapes with significant "one-way rectification" characteristics without any artificial hard threshold constraints. Specifically, when the normalized eigenvalues of the input signal after standardization are in the negative range, the reconstructed activation function curve exhibits a remarkably flat state, with its tangent slope almost zero or remaining within a very small fluctuation range throughout the negative half-axis. From a signal processing perspective, this means that when the signal strength of the feature channel is below a certain baseline level or exhibits negative fluctuations, regardless of its numerical value, the output after mapping by the activation function remains constant at zero or close to zero.
[0128] This geometric morphology indicates that the model, during training, is "aware" that the data in this interval contains a large amount of background noise or invalid information, and therefore actively chooses to "silence" it, cutting off its propagation path to subsequent network layers. Once the feature value crosses zero and enters the positive range, the slope of the function curve changes abruptly, exhibiting a significant non-zero response, even showing a steep upward trend. This asymmetric morphology of "left-side inhibition and right-side activation" is mathematically highly isomorphic to the "ignition threshold" characteristic of biological neurons, meaning that neurons only fire impulses when the stimulus intensity exceeds a specific threshold. This analytical result fundamentally proves that the model described in this application does not mechanically fit the data, but possesses an active noise-resistant capability that distinguishes effective neural discharges from background interference. It can automatically filter irrelevant information in noisy EEG environments, and this filtering rule is completely data-driven and self-evolving.
[0129] Secondly, for the core feature dimensions that play a decisive role in the classification results, the system reveals a "non-linear gain control" mechanism based on signal strength by analyzing the second derivative and curvature changes of their activation functions. "Non-linear gain" is geometrically equivalent to the function's convexity or higher-order derivatives being greater than zero. Based on the variational diminishing property of B-splines, the function... The geometry is strictly constrained by its control polygon. If the control coefficient sequence... This forms a convex polygonal sequence (i.e.) The generated activation function It must be strictly convex downwards, that is...
[0130]
[0131] in, For the generated activation function Regarding input features The second derivative, For input feature values, The mathematical expression is used to characterize that the continuous function is strictly convex downward in terms of its geometric shape.
[0132] When the model detects a feature with a high signal-to-noise ratio, the optimization algorithm will drive the control coefficients. It exhibits a superlinear growth trend (e.g., an exponential distribution). According to the above theorem, this necessarily leads to the generation of continuous functions. It possesses a positive second derivative, thus achieving the mathematical effect that the output response (Logits) increases explosively as the input signal strengthens. This proves that the system's sensitivity gain is a necessary mapping of the geometric distribution of the parameter space.
[0133] This nonlinear gain characteristic reveals a sophisticated signal amplification strategy within the model: in regions of weak signal strength and low signal-to-noise ratio, the function curve is relatively gentle, avoiding misjudgments caused by minor noise fluctuations; however, once the signal strength confirms entry into a high-confidence region, the function curve rapidly steepens, giving the signal a very high weight reward. This mechanism enables the model to keenly capture weak but crucial signals of motor intention and exhibits extremely high confidence when the signal is significant, thus achieving discriminative sensitivity far superior to traditional linear weighted classifiers in EEG signal processing with low signal-to-noise ratios.
[0134] Finally, the system reveals the "Feature Disentanglement & Mutual Exclusion" logic by superimposing activation function curves connected to different output category nodes along the same feature dimension in the same coordinate system for comparative analysis. Mathematically, "Multi-task Feature Disentanglement" corresponds to the gradient directions of the same input variable having opposite signs in different mapping spaces. Let the feature... Simultaneously input into two classification nodes and The confidence margin of a discriminant logic can be defined as follows: To maximize the classification boundary, the model needs to maximize the gradient of the margin:
[0135]
[0136] in, To determine the logical confidence level Regarding input features The gradient (or derivative) of. For target category Corresponding activation function Regarding input features The derivative of Non-target category Corresponding activation function Regarding input features The derivative of They are the same input feature variables.
[0137] In order to In the target class The fastest growth occurs in the direction of , and the optimal solution necessarily requires (Positive slope) and (Negative slope). The mathematical framework of this application allows and It possesses a completely independent set of basis function coefficients. Therefore, the model can freely search for this "scissor-shaped" orthogonal solution in the function space, thus mathematically guaranteeing the mutual exclusivity of features. In contrast, traditional neural networks, if they share underlying weights, often struggle to achieve such thorough semantic untangling on a single feature.
[0138] The model in this embodiment successfully deconstructs complex physiological signal logic within a single feature channel, dynamically assigning drastically different semantic interpretations to the same physiological feature based on its numerical range and the objects it connects. This capability allows the model to eliminate ambiguity by leveraging the inherent mutual exclusion between features when facing multi-classification tasks, significantly improving the robustness of decision-making. Through the complete process described above, from parameter reconstruction to curve morphology analysis and then to semantic logic deduction, this application achieves true "white-box" decision-making, making the complex EEG decoding process transparent, interpretable, and consistent with neurophysiological intuition.
[0139] This embodiment provides a method for classifying EEG signals by integrating CNN and KAN. First, a feature extraction encoder is constructed based on the first convolutional block, the second convolutional block, and the distribution adaptation layer. This encoder can effectively mitigate the performance degradation caused by individual differences. Second, a nonlinear classification decoder is constructed based on the KAN layer. This KAN layer contains multiple learnable activation function paths based on B-splines, which can flexibly fit complex nonlinear decision boundaries and improve the model's expressive power. Next, the feature extraction encoder and the nonlinear classification decoder are cascaded to form an initial EEG classification model, providing a complete architecture for subsequent optimization. Then, a hybrid dataset containing source domain data and target domain data is constructed, and the initial model is iteratively trained using a two-stage transfer learning strategy, a spline coefficient update strategy based on regularized ridge regression, and a hybrid dynamic grid update strategy, thereby improving generalization ability under small sample conditions. Subsequently, the multi-channel EEG data to be classified is sequentially subjected to bandpass filtering, channel-level standardization, and temporal segment permutation enhancement to generate more robust enhanced data, effectively suppressing noise and expanding sample diversity. Finally, the enhanced data is input into the trained target EEG classification model, and feature extraction, distribution alignment, and nonlinear mapping are sequentially completed to output the final classification result. This embodiment can achieve high-precision and stable EEG signal classification even under conditions of high EEG signal noise, significant individual differences, and small sample size.
[0140] Based on the first embodiment of this application, in the second embodiment of this application, the content that is the same as or similar to that in Embodiment 1 above can be referred to the above description, and will not be repeated hereafter. Based on this, please refer to... Figure 3 , Figure 3 This is a flowchart illustrating the second embodiment of the EEG signal classification method integrating CNN and KAN in this application. Step S40 of the EEG signal classification method integrating CNN and KAN includes steps S41 to S46:
[0141] Step S41: Obtain EEG data from multiple source domain subjects and target subjects. After preprocessing and enhancement processing, a hybrid dataset is obtained, which includes source domain data and target domain data.
[0142] Step S42: Based on the first preset learning rate, the first preset batch size, and the first preset training rounds, perform full parameter update training on the initial EEG classification model according to the source domain data to obtain a pre-trained model;
[0143] Step S43: Freeze the parameters in the feature extraction encoder except for the distribution adaptation layer, and fine-tune the pre-trained model according to the target domain data, the second preset learning rate, the second preset batch size and the second preset training rounds;
[0144] Step S44: During the fine-tuning training process, the grid nodes of the KAN layer are adjusted at each preset update interval using a hybrid dynamic grid update strategy.
[0145] Step S45: In each training batch, the spline control coefficients of the KAN layer are updated using a spline coefficient update strategy based on regularized ridge regression.
[0146] Step S46: Stop the fine-tuning training using an early stop strategy to obtain the target EEG classification model.
[0147] It should be noted that the EEG data of the source domain subjects refers to the EEG signals collected from multiple subjects with existing annotations that provide prior knowledge, and usually contains sufficient and reliable label information. The EEG data of the target subjects refers to the EEG signals collected from new subjects to be adapted (i.e., the actual application subjects), whose number of labels is limited or partially missing, representing the target scenario for which the model needs to generalize. The first preset learning rate refers to the optimizer learning rate used for full parameter training, which is 0.001 in this embodiment, and is used to control the update step size of the model parameters on the source domain data. The first preset batch size refers to the number of samples used in each training iteration, which is 64 in this embodiment, and affects the stability of gradient estimation and training efficiency. The first preset training epochs refer to the total number of iterations for end-to-end training of the initial EEG classification model using the source domain data, which is 100 in this embodiment.
[0148] The pre-trained model refers to a model that has been fully trained on the source domain data and possesses preliminary feature extraction and classification capabilities. The second preset learning rate refers to a smaller learning rate used in the fine-tuning stage, which is 0.0001 in this embodiment. This rate is used to fine-tune trainable parameters on the target domain data, avoiding the destruction of learned general representations. The second preset batch size refers to the number of samples included in each training batch during the fine-tuning stage, which is 32 in this embodiment, adapting to the smaller amount of data in the target domain. The second preset training epochs refers to the maximum number of iterations for fine-tuning training, which is 200 in this embodiment, providing sufficient optimization space for the model to fully adapt to the target domain. The preset update epochs refer to the time interval for executing the hybrid dynamic grid update strategy, which is every 10 training epochs in this embodiment, used to periodically adjust the spline node layout of the KAN layer. The spline control coefficients refer to the weight parameters of the B-spline activation function in the KAN layer (i.e., the coefficients corresponding to the control points), determining the shape of the spline curve and being a core learnable variable for the model's nonlinear mapping capability.
[0149] As an example, the step of updating the spline control coefficients of the KAN layer in each training batch using a spline coefficient update strategy based on regularized ridge regression includes: in each training batch, obtaining the current feature vector batch input to the KAN layer and the target output matrix corresponding to the training batch; calculating the B-spline basis function activation matrix based on the current feature vector batch and the current grid node position; constructing a least squares objective function containing an L2 regularization term, wherein the least squares objective function includes a fitting error term and a regularization term; solving the normal equation corresponding to the least squares objective function to obtain the updated spline control coefficients, and applying the updated spline control coefficients to the KAN layer.
[0150] It should be noted that the current feature vector batch refers to a set of sample feature vectors input to the KAN layer in the current training iteration, with a shape of (batch size × input dimension), representing the high-level representation after processing by the feature extraction encoder. The target output matrix refers to the matrix composed of the supervision labels corresponding to the current feature vector batch, usually in one-hot encoded form (e.g., batch size × number of classes), used to guide the mapping learning of the KAN layer. The current grid node position refers to the set of segmented node coordinates currently used by the B-spline basis functions in the KAN layer on the input axis. These nodes define the support interval of the spline function and may be adjusted during training through a hybrid dynamic grid update strategy. The B-spline basis function activation matrix is a matrix composed of the response values of each B-spline basis function on each input dimension calculated based on the current feature vector batch and the current grid node position. Each column corresponds to the activation intensity of a basis function on all samples, used for linear combination to generate the final activation output. The L2 regularization term refers to the sum of squares of the spline control coefficients added to the optimization objective multiplied by the regularization coefficient, used to suppress excessively large coefficients, improve the model's generalization ability, and prevent overfitting. The least squares objective function is a loss function that optimizes the sum of the fitting error term and the L2 regularization term. The fitting error term is the sum of the squared errors between the model's predicted output and the target output matrix, measuring how well the current spline parameters approximate the training data. The regularization term, specifically the L2 regularization term, is used to constrain the complexity of the spline control coefficients, preventing ill-conditioned solutions under small sample sizes or noisy data. The normal equations are a system of linear equations obtained by differentiating the least squares objective function with respect to the spline control coefficients and setting the gradient to zero. Their analytical solutions can be directly used to update the spline control coefficients without relying on gradient descent.
[0151] It is understandable that (1) a spline coefficient update algorithm based on ridge regression is constructed:
[0152] During training, the system needs to dynamically update the spline control coefficients. In standard KAN implementations, the least squares method is typically used. However, due to the "volume conduction" effect, EEG signals are highly correlated with those acquired by adjacent electrodes. This leads to a significant difference in the coefficient matrix when solving the least squares problem. (Where A is the activation matrix) is extremely close to a singular matrix, with an extremely large condition number. Direct inversion will produce huge numerical errors, causing the spline coefficients to oscillate and diverge.
[0153] Therefore, this embodiment proposes and implements a coefficient update algorithm based on Ridge Regression in the code. Specifically, when updating the coefficient matrix C in each training step, the system solves the following regularized normal equation:
[0154]
[0155] in, These are the updated spline control coefficients. Let B-spline basis function activation matrix be used. For matrix transpose, Output the target matrix. These are preset ridge regression coefficients (e.g., 1e-4). It is an identity matrix. By adding tiny perturbations to the diagonal, the eigenvalues of the matrix are artificially increased, ensuring the matrix's invertibility and thus obtaining a numerically stable solution. This improvement is crucial for successfully training KAN networks on noisy EEG data.
[0156] Let the input for the current batch be... The original network's output (target value) for this input is The goal is to find a new coefficient vector. This allows the new spline function to fit... .
[0157] Define the Design Matrix , of which elements For the first The new basis function is at the th... Values at each sample point:
[0158] Constructing the loss function for the optimization problem Includes least squares error term and Regularization term (used to prevent overfitting due to excessively large coefficients):
[0159]
[0160] in, is the regularization coefficient.
[0161] Will Norm expansion into matrix multiplication form:
[0162]
[0163] Using matrix calculus Find the gradient : noticed It is a scalar, and its transpose is equal to itself, therefore .
[0164]
[0165] Set the gradient to zero to find the extreme points:
[0166]
[0167]
[0168] Assumption Matrix Reversible (due to) and If the matrix is positive semi-definite (meaning it must be positive definite and invertible), then the closed-form update formula for the coefficients is obtained:
[0169]
[0170] in, This is the spline control coefficient vector obtained from the closed-loop update solution. To design the matrix (i.e., the B-spline basis function activation matrix). For matrix transpose, This is the target value vector (i.e., the output of the original network to the current batch of inputs). These are the preset ridge regression coefficients (regularization perturbation terms). It is an identity matrix.
[0171] By introducing a small regularization perturbation on the diagonal of the autocorrelation matrix This mechanism forcibly guarantees the positive definite invertibility of the matrix, effectively overcoming the huge numerical error caused by direct inversion, thereby suppressing the oscillation and divergence of spline coefficients and significantly improving the convergence stability and robustness of the model during training with noisy EEG data.
[0172] (2) Constructing a hybrid dynamic grid update mechanism:
[0173] Furthermore, this embodiment introduces a hybrid grid adaptation mechanism. In brain-computer interface (BCI) systems, EEG signals exhibit high non-stationarity. During training (especially when migrating from the source domain to the target domain), significant distributional drift occurs in EEG signals between different subjects or at different time points.
[0174] Let the source domain data distribution be... The target domain data distribution is as follows In practical applications, there are often... This refers to the distribution drift. Traditional spline networks use fixed grid nodes. When the data distribution shifts, i.e., the eigenvalues... Remove interval Or they may be clustered in large numbers within a very narrow sub-interval. At this time, the fitting ability of spline functions will decrease sharply due to truncation error or underfitting. If the grid nodes remain fixed, features may move out of the grid coverage area. To solve the above problems, this embodiment introduces a hybrid dynamic grid update mechanism, which dynamically adjusts the support domain of the basis functions through statistical and numerical analysis methods. The core of this embodiment lies in constructing a support domain that varies with data distribution. Dynamically changing function space The operation steps are as follows:
[0175] During specific phases of training (such as each (each epoch), the system first needs to capture the current input features. The statistical properties of the input features are analyzed. The histogram distribution of the input features is statistically analyzed, and the quantiles of the feature values (e.g., the 0.01 quantile and the 0.99 quantile) are calculated to determine the effective range of the features. ;
[0176] To determine the effective range of a feature, we need to estimate its cumulative distribution function (CDF). We define the empirical cumulative distribution function. for:
[0177]
[0178] in, The empirical cumulative distribution function of the current batch of feature data in The value at that location, The batch size (total number of samples) of the feature vector. For sample index, For the first in the batch 1 eigenvalue, Given a reference threshold variable, This is an indicator function (it takes 1 when the condition in parentheses is true, and 0 otherwise).
[0179] To remove the interference of outliers on the mesh boundaries, we employ a quantile truncation method. A minimum probability threshold is set. The lower bound of the effective range and the Upper Realm Defined as The generalized inverse function value:
[0180]
[0181]
[0182] in, and These are the lower and upper bounds of the effective range of the feature determined after quantile truncation, respectively. For empirical quantile functions (i.e. (generalized inverse function). The preset threshold for extremely low probability. This indicates taking the infimum of the set (i.e., the minimum value that satisfies the condition). It is the set of real numbers.
[0183] Through this step, we lock the feature's domain of interest to .
[0184] To capture both high-density regions of the data (Local Focus) and prevent overfitting to the current batch that would reduce generalization ability to future data (Global Coverage), we construct two sets of grids. Let the number of grid nodes be... .
[0185] A uniform grid aims to provide an equiprobable prior coverage of the entire effective space, assuming that the data is uniformly distributed within the interval. The set of nodes in a uniform grid is defined as follows: .
[0186] Define step size :
[0187]
[0188] in, For uniform grid step size, and These are the upper and lower bounds of the effective range of the feature, respectively. This represents the preset total number of grid nodes.
[0189] Then the first The formula for a node (index starts from 1) is:
[0190]
[0191] in, For the first uniform grid set Each node position The lower bound of the effective range of the feature. For node index (value is) arrive ), For grid step size, This represents the total number of grid nodes.
[0192] This grid ensures uniform resolution of the basis functions in space, preventing model collapse.
[0193] Adaptive meshes are designed based on probability density functions Adjust the node density. Ideally, the grid density should be proportional to the data density, i.e. This means that in areas with dense features, the grid points should be even denser. Specifically, This represents the distribution density of grid nodes. It is the symbol for direct proportion in mathematics. Input features The probability density function.
[0194] This is equivalent to the range of CDF. Uniform sampling is performed on the domain, and then the result is mapped back to the original domain using the inverse function of the CDF. Uniform sampling points are defined in the probability space. :
[0195]
[0196] Then the adaptive grid node set The calculation is as follows:
[0197]
[0198] in, For the first in the adaptive mesh set Each node position It is the generalized inverse function of the empirical cumulative distribution function. For uniform sampling points in probability space, This is a preset threshold for extremely low probability.
[0199] Here we will Zoom to Intervals are used to match valid ranges. In discrete data, this can be achieved by sorting the data. This is achieved using linear interpolation indexing. This design allows:
[0200]
[0201] in, and These are the first and second adaptive meshes, respectively. The and the first Each node (i.e., the lower and upper limits of the integral). Input features The probability density function, For integration variables, The representative constant (meaning that the probability of samples contained in each grid interval is approximately equal).
[0202] That is, each grid interval contains approximately the same number of sample points, enabling automatic focusing on high probability density areas.
[0203] Simply relying on adaptive grids may result in a lack of basis function support in sparse data regions (but which may be target regions for future drift); simply relying on uniform grids cannot accurately fit the complex features of EEG. Therefore, this embodiment proposes a linear hybrid strategy.
[0204] Define the mixing factor This represents the system's level of trust in the data distribution. Hybrid grid nodes. The derivation of the calculation formula is as follows:
[0205]
[0206] in, For the calculated first Location of each hybrid grid node This is a preset mixing factor (used to balance the current data distribution prior with the globally uniform prior). For the first Adaptive grid node positions For the first The location of a uniform grid node.
[0207] when When the grid perfectly conforms to the statistical distribution of the current data, it fits high-density areas extremely well, but is extremely sensitive to distribution shifts; when At this time, the mesh degenerates into a fixed uniform mesh, which is robust but has low fitting accuracy. This implementation takes... This means that we mainly rely on the current data distribution, but retain 2% of the uniform component as a "regularization term" to ensure that the grid nodes do not overlap in value or have too small a spacing due to excessive data aggregation (risk of gradient explosion).
[0208] The final set of grid nodes is
[0209]
[0210] The hybrid dynamic grid update mechanism proposed in this embodiment has significant advantages in EEG signal processing:
[0211] Anti-distribution drift capability: Through quantile statistics and adaptive grid, the domain of the activation function can follow the drift of EEG features in real time (such as when migrating from subject A to subject B, the feature mean shifts), avoiding the vanishing gradient caused by features falling outside the domain of the fixed grid.
[0212] High-precision fitting: The adaptive mesh effectively reduces the local error of spline interpolation by densifying nodes in regions with high probability density, thus achieving refined modeling of the main components of EEG.
[0213] Robustness and stability: The introduction of uniform grid components and ridge regression updates avoids numerical instability (Singular Matrix) or overfitting caused by extreme data distributions (such as all data concentrated at one point), ensuring a smooth transition of the model during dynamic updates.
[0214] (3) In view of individual differences in EEG signals, this application designs a two-stage training process:
[0215] ① First stage (Pre-training), source domain pre-training:
[0216] Data preparation: Collect EEG data from multiple source domain subjects (non-target users) to construct a large-scale source domain dataset. Perform the preprocessing and enhancement operations in step 1 on the data.
[0217] Model initialization: Initialize all parameters of the feature extraction encoder and the non-linear classification decoder.
[0218] Training configuration: Set the learning rate. (e.g., 1e-3), batch size is (e.g., 64), training rounds are (e.g., 100), Ridge regression regularization strength of the KAN layer (e.g., 1e-3).
[0219] Loss function: Cross-entropy loss is used as the main loss, with the regularization loss of the KAN layer added. The total loss is:
[0220]
[0221] in, For cross-entropy loss, Output the probability distribution of the classes predicted by the model. For real category labels, The regularization loss of the KAN layer (including L1 regularization and entropy regularization of the activation function). This is the regularization coefficient (e.g., 1e-4).
[0222] Training process: The model is trained with full parameter updates using the source domain dataset. The optimizer is AdamW, and the weight decay is 1e-4. A learning rate scheduler (such as ReduceLROnPlateau) is used during training to reduce the learning rate when the validation loss stops decreasing. The goal of this stage is to enable the backbone to learn general time-frequency feature extraction rules and the KAN layer to learn general nonlinear mapping patterns.
[0223] ② Second stage (Fine-tuning): Target domain fine-tuning:
[0224] Data preparation: Collect a small amount of EEG data from the target subjects (e.g., 50-100 samples per category) to construct the target domain dataset. Perform the same preprocessing operations, but the probability of data augmentation can be appropriately reduced (e.g., p=0.1).
[0225] Model loading: Load the model weights obtained from the first stage of training.
[0226] Parameter Freezing and Configuration: Freeze all parameters in the feature extraction encoder except for the distribution adaptation layer, allowing only parameter updates for the distribution adaptation layer and the KAN layer. Set the learning rate to... (e.g., 1e-4), batch size is (e.g., 32), training rounds are (e.g., 200), Ridge regression regularization strength of the KAN layer (e.g., 1e-4), this value is lower than that of the first stage. This allows the KAN layer to more flexibly fit the specificity of the target domain data.
[0227] Training Process: A hybrid dynamic grid update mechanism is enabled, updating the grid nodes of the KAN layer every 10 epochs. The optimizer still uses AdamW, with weight decay at 1e-4. The learning rate scheduler is set to ReduceLROnPlateau based on validation accuracy, reducing the learning rate when validation accuracy stops improving. The goal of this stage is to allow the distribution adaptation layer to adjust the feature distribution to better match the target domain data, and for the KAN layer to fine-tune the nonlinear mapping to adapt to the specific EEG patterns of the target subjects.
[0228] ③ Early stop strategy:
[0229] Early stopping was employed in both training phases to prevent overfitting. An early stopping patience value (Patience) was set.
[0230] (e.g., Patience=20 in the first stage, Patience=30 in the second stage). When the validation loss (first stage) or validation accuracy (second stage) does not improve after Patience rounds, training is stopped and the current optimal model weights are saved.
[0231] This embodiment first acquires EEG data from multiple source domain subjects and target subjects. After unified preprocessing and enhancement, a hybrid dataset containing source domain data and target domain data is constructed, providing input with both label information and target distribution characteristics for transfer training. Second, using a first preset learning rate, batch size, and training epochs, the initial EEG classification model is trained with all parameters on the source domain data to obtain a pre-trained model with general representation capabilities. Then, all parameters in the feature extraction encoder except for the distribution adaptation layer are frozen, and the model is fine-tuned only based on the target domain data, with a smaller learning rate, smaller batch size, and longer training epochs. The model is fine-tuned to adapt to the target subjects while retaining general features. During fine-tuning, the grid nodes of the KAN layer are adjusted using a hybrid dynamic grid update strategy at preset update intervals, adaptively densifying the grid in key regions to improve local fitting ability. Simultaneously, a spline coefficient update strategy based on regularized ridge regression is used in each training batch to explicitly solve the normal equation with L2 regularization terms, directly updating the spline control coefficients of the KAN layer to improve parameter stability under small sample sizes. Finally, an early stopping strategy is used to terminate training when validation performance no longer improves, avoiding overfitting and obtaining the final target EEG classification model. This embodiment can achieve high-precision and stable EEG signal classification even under conditions of high EEG signal noise, significant individual differences, and small sample sizes.
[0232] It should be noted that the above examples are only for understanding this application and do not constitute a limitation on the EEG signal classification method that integrates CNN and KAN in this application. Any simple modifications based on this technical concept are within the protection scope of this application.
[0233] Experimental verification and result analysis:
[0234] To verify the validity of this application, this embodiment uses the publicly available BCI Competition IV 2a dataset for experimental verification. This dataset contains EEG signals of motor imagery from 9 subjects. Each subject performed 4 motor imagery tasks (left hand, right hand, foot, tongue), with each task containing 288 trials. The signal sampling frequency was 250Hz, the acquisition time was 3 seconds (750 sampling points), and 22 electrode channels were used to record the signals.
[0235] (1) Experimental setup:
[0236] Comparison Models: Traditional EEGNet and EEGNet (EEGNet+MLP) based on MLP classifier were selected as comparison models;
[0237] The model parameters in this application are as follows: the kernel size and pooling size of the feature extraction encoder are set according to Example 1; the number of basis functions in the KAN layer is K=10, the number of grid nodes is M=15, and the mixing factor is α=0.98; the parameters for the two-stage training are set as follows: in the pre-training stage, the learning rate is 1e-3, the batch size is 64, the number of training epochs is 100, and the regularization coefficient is 1e-3; in the fine-tuning stage, the learning rate is 1e-4, the batch size is 32, the number of training epochs is 200, and the regularization coefficient is 1e-4.
[0238] Evaluation metrics: Accuracy, macro average F1 score, Cohen's Kappa coefficient, and macro average AUC were used as evaluation metrics.
[0239] Experimental procedure: For each participant, leave-one-out cross-validation was used, that is, the data of the other 8 participants were used as the source domain data for pre-training, the data of the current participant were used as the target domain data for fine-tuning, and finally the model performance was evaluated on the test set of the current participant.
[0240] (2) Experimental results:
[0241] The average performance metrics of each model on the BCI Competition IV 2a dataset are shown in Table 1:
[0242] Table 1
[0243]
[0244] The experimental results show that this application significantly outperforms the comparative model in all evaluation metrics:
[0245] The accuracy rate is 9.8 percentage points higher than that of the traditional EEGNet and 7.6 percentage points higher than that of EEGNet+MLP;
[0246] The macro-average F1 score, Cohen's Kappa coefficient, and macro-average AUC all showed significant improvements, indicating that this application has stronger classification performance and generalization ability.
[0247] Further analysis of the experimental results reveals that:
[0248] This application significantly improves the nonlinear fitting ability of the model by introducing a KAN layer to replace the traditional MLP, thereby improving the classification accuracy.
[0249] The ridge regression-based spline coefficient update algorithm and hybrid dynamic grid update mechanism effectively solve the numerical instability problem of standard KAN when processing EEG signals, thus greatly improving the performance of standard KAN.
[0250] The two-stage transfer learning strategy and data augmentation techniques effectively utilize the knowledge of the source domain data, alleviate the overfitting problem of small sample target domain data, and improve the generalization ability of the model.
[0251] The introduction of the distribution adaptation layer enables the effective fusion of CNN and KAN, avoids the gradient vanishing problem, and ensures the training effect of the model.
[0252] This application also provides a brainwave signal classification device that integrates CNN and KAN. Please refer to [reference needed]. Figure 4 The EEG signal classification device that integrates CNN and KAN includes:
[0253] Encoder building module 10 is used to build a feature extraction encoder based on the first convolutional block, the second convolutional block, and the distribution adaptation layer;
[0254] Decoder construction module 20 is used to construct a nonlinear classification decoder based on a KAN layer, wherein the KAN layer contains multiple learnable activation function paths based on B-splines;
[0255] Model building module 30 is used to build an initial EEG classification model based on the feature extraction encoder and the nonlinear classification decoder;
[0256] The model training module 40 is used to construct a hybrid dataset containing source domain data and target domain data, and to iteratively train the initial EEG classification model according to the hybrid dataset, a two-stage transfer learning strategy, a spline coefficient update strategy based on regularized ridge regression, and a hybrid dynamic grid update strategy to obtain the target EEG classification model.
[0257] Data augmentation module 50 is used to perform bandpass filtering, channel-level standardization, and temporal segment permutation on the multi-channel EEG data to be classified to obtain augmented data;
[0258] The classification prediction module 60 is used to perform feature extraction, distribution alignment, and nonlinear mapping on the enhanced data through the target EEG classification model to obtain the classification result.
[0259] The EEG signal classification device fusing CNN and KAN provided in this application, employing the EEG signal classification method fusing CNN and KAN in the above embodiments, can solve the technical problem of achieving high-precision and stable EEG signal classification under conditions of high noise, significant individual differences, and small sample size. Compared with the prior art, the beneficial effects of the EEG signal classification device fusing CNN and KAN provided in this application are the same as those of the EEG signal classification method fusing CNN and KAN provided in the above embodiments, and other technical features in the EEG signal classification device fusing CNN and KAN are the same as those disclosed in the methods of the above embodiments, and will not be repeated here.
[0260] This application provides a brain signal classification device that integrates CNN and KAN. The brain signal classification device integrating CNN and KAN includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the brain signal classification method integrating CNN and KAN in the above embodiment 1.
[0261] The following is for reference. Figure 5 This document illustrates a structural schematic diagram of a brain signal classification device that integrates CNN and KAN, suitable for implementing embodiments of this application. The brain signal classification device integrating CNN and KAN in the embodiments of this application may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Description), PMPs (Portable Media Players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 5 The EEG signal classification device fused with CNN and KAN shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.
[0262] like Figure 5As shown, the EEG signal classification device fusing CNN and KAN may include a processing unit 1001 (e.g., a central processing unit, a graphics processing unit, etc.) that can perform various appropriate actions and processes according to a program stored in ROM (Read Only Memory) 1002 or a program loaded from storage device 1003 into RAM (Random Access Memory) 1004. RAM 1004 also stores various programs and data required for the operation of the EEG signal classification device fusing CNN and KAN. The processing unit 1001, ROM 1002, and RAM 1004 are interconnected via bus 1005. Input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to I / O interface 1006: input devices 1007 including, for example, touchscreens, touchpads, keyboards, mice, image sensors, microphones, accelerometers, gyroscopes, etc.; output devices 1008 including, for example, LCDs (Liquid Crystal Displays), speakers, vibrators, etc.; storage devices 1003 including, for example, magnetic tapes, hard disks, etc.; and communication devices 1009. Communication device 1009 allows the EEG signal classification device fusing CNN and KAN to communicate wirelessly or wiredly with other devices to exchange data. Although the figure shows an EEG signal classification device fusing CNN and KAN with various systems, it should be understood that it is not required to implement or possess all the systems shown. More or fewer systems can be implemented alternatively.
[0263] Specifically, according to the embodiments disclosed in this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device, or installed from storage device 1003, or installed from ROM 1002. When the computer program is executed by processing device 1001, it performs the functions defined in the methods of the embodiments disclosed in this application.
[0264] The EEG signal classification device integrating CNN and KAN provided in this application, employing the EEG signal classification method integrating CNN and KAN in the above embodiments, can solve the technical problem of achieving high-precision and stable EEG signal classification under conditions of high noise, significant individual differences, and small sample size. Compared with the prior art, the beneficial effects of the EEG signal classification device integrating CNN and KAN provided in this application are the same as those of the EEG signal classification method integrating CNN and KAN provided in the above embodiments, and other technical features in this EEG signal classification device integrating CNN and KAN are the same as those disclosed in the previous embodiment method, and will not be repeated here.
[0265] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any suitable manner in one or more embodiments or examples.
[0266] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
[0267] This application provides a computer-readable storage medium having computer-readable program instructions (i.e., a computer program) stored thereon, the computer-readable program instructions being used to execute the EEG signal classification method fusing CNN and KAN in the above embodiments.
[0268] The computer-readable storage medium provided in this application may be, for example, a USB flash drive, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, RAM (Random Access Memory), ROM (Read Only Memory), EPROM (Erasable Programmable Read Only Memory or Flash Memory), optical fibers, CD-ROM (CD-Read Only Memory), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, system, or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.
[0269] The aforementioned computer-readable storage medium may be included in an EEG signal classification device that integrates CNN and KAN; or it may exist independently and not be assembled into an EEG signal classification device that integrates CNN and KAN.
[0270] The aforementioned computer-readable storage medium carries one or more programs. When these programs are executed by an EEG signal classification device that integrates CNN and KAN, the device performs the following actions: constructs a feature extraction encoder based on a first convolutional block, a second convolutional block, and a distribution adaptation layer; constructs a nonlinear classification decoder based on a KAN layer, wherein the KAN layer contains multiple learnable activation function paths based on B-splines; constructs an initial EEG classification model based on the feature extraction encoder and the nonlinear classification decoder; constructs a hybrid dataset containing source domain data and target domain data, and iteratively trains the initial EEG classification model using the hybrid dataset, a two-stage transfer learning strategy, a spline coefficient update strategy based on regularized ridge regression, and a hybrid dynamic grid update strategy to obtain a target EEG classification model; performs bandpass filtering, channel-level normalization, and temporal segment permutation enhancement on the multi-channel EEG data to be classified to obtain enhanced data; and performs feature extraction, distribution alignment, and nonlinear mapping on the enhanced data using the target EEG classification model to obtain a classification result.
[0271] Computer program code for performing the operations of this application can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including LAN (Local Area Network) or WAN (Wide Area Network)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0272] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0273] The modules described in the embodiments of this application can be implemented in software or hardware. The names of the modules do not necessarily limit the functionality of the unit itself.
[0274] The readable storage medium provided in this application is a computer-readable storage medium that stores computer-readable program instructions (i.e., a computer program) for executing the above-described EEG signal classification method that integrates CNN and KAN. This solves the technical problem of achieving high-precision and stable EEG signal classification under conditions of high noise, significant individual differences, and small sample sizes. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as those of the EEG signal classification method integrating CNN and KAN provided in the above embodiments, and will not be repeated here.
[0275] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the above-described method for classifying EEG signals by fusing CNN and KAN.
[0276] The computer program product provided in this application can solve the technical problem of achieving high-precision and stable EEG signal classification under conditions of high noise, significant individual differences, and small sample size. Compared with the prior art, the beneficial effects of the computer program product provided in this application are the same as those of the EEG signal classification method fusing CNN and KAN provided in the above embodiments, and will not be repeated here.
[0277] The above description is only a part of the embodiments of this application and does not limit the patent scope of this application. All equivalent structural transformations made under the technical concept of this application and using the contents of the specification and drawings of this application, or direct / indirect applications in other related technical fields, are included in the patent protection scope of this application.
Claims
1. A brainwave signal classification method integrating CNN and KAN, characterized in that, The method includes: A feature extraction encoder is constructed based on the first convolutional block, the second convolutional block, and the distribution adaptation layer; A nonlinear classification decoder is constructed based on the KAN layer, wherein the KAN layer contains multiple learnable activation function paths based on B-splines; An initial EEG classification model is constructed based on the feature extraction encoder and the nonlinear classification decoder. A hybrid dataset containing source domain data and target domain data is constructed, and the initial EEG classification model is iteratively trained based on the hybrid dataset, a two-stage transfer learning strategy, a spline coefficient update strategy based on regularized ridge regression, and a hybrid dynamic grid update strategy to obtain the target EEG classification model. Bandpass filtering, channel-level standardization, and temporal segment permutation enhancement were performed on the multi-channel EEG data to be classified to obtain enhanced data. The enhanced data is subjected to feature extraction, distribution alignment, and nonlinear mapping using the target EEG classification model to obtain the classification result; The steps of constructing a hybrid dataset containing source domain data and target domain data, and iteratively training the initial EEG classification model based on the hybrid dataset, a two-stage transfer learning strategy, a spline coefficient update strategy based on regularized ridge regression, and a hybrid dynamic grid update strategy to obtain the target EEG classification model include: EEG data from multiple source domain subjects and target subjects were acquired. After preprocessing and enhancement processing, a hybrid dataset was obtained, which included source domain data and target domain data. Based on the first preset learning rate, the first preset batch size, and the first preset training rounds, the initial EEG classification model is fully parameter-updated and trained according to the source domain data to obtain a pre-trained model. Freeze the parameters in the feature extraction encoder except for the distribution adaptation layer, and fine-tune the pre-trained model according to the target domain data, the second preset learning rate, the second preset batch size and the second preset training rounds; During the fine-tuning training process, the grid nodes of the KAN layer are adjusted at preset update intervals using a hybrid dynamic grid update strategy. In each training batch, the spline control coefficients of the KAN layer are updated using a spline coefficient update strategy based on regularized ridge regression; The fine-tuning training was stopped by an early stop strategy, and the target EEG classification model was obtained. The step of updating the spline control coefficients of the KAN layer in each training batch using a spline coefficient update strategy based on regularized ridge regression includes: In each training batch, obtain the current feature vector batch input to the KAN layer and the target output matrix corresponding to the training batch; Calculate the B-spline basis function activation matrix based on the current feature vector batch and the current grid node position; Construct a least squares objective function that includes an L2 regularization term, wherein the least squares objective function includes a fitting error term and a regularization term; Solve the normal equation corresponding to the least squares objective function to obtain the updated spline control coefficients, and apply the updated spline control coefficients to the KAN layer; The normal equation is expressed as follows: in, These are the updated spline control coefficients. Let B-spline basis function activation matrix be used. For matrix transpose, Output the target matrix. These are the preset ridge regression coefficients. It is an identity matrix.
2. The method as described in claim 1, characterized in that, The step of constructing a feature extraction encoder based on the first convolutional block, the second convolutional block, and the distribution adaptation layer includes: The first convolutional block is constructed based on the temporal convolutional layer, the first batch normalization layer, the depthwise separable convolutional layer, the second batch normalization layer, the first nonlinear activation layer, and the first average pooling layer. The second convolutional block is constructed based on the separable convolutional layer, the pointwise convolutional layer, the third batch normalization layer, the second nonlinear activation layer, and the second average pooling layer. A one-dimensional batch normalization layer is used as a distribution adaptation layer, and a feature extraction encoder is constructed based on the first convolutional block, the second convolutional block, and the distribution adaptation layer. The one-dimensional batch normalization layer is represented as follows: , in, It refers to the feature vector after standardization. It refers to the output feature vector after affine transformation. For the input feature vector, and These are the mean and variance of the current batch of data, respectively. It is a tiny constant. and These are the learnable affine transformation parameters.
3. The method as described in claim 1, characterized in that, The steps for constructing a non-linear classification decoder based on the KAN layer include: Determine the input and output dimensions of the KAN layer, wherein the input dimension corresponds to the output dimension of the feature extraction encoder, and the output dimension corresponds to the number of categories in the classification task; Define an activation function between each input node and each output node in the KAN layer; The activation function is expressed as follows: in, For the weights of the base function, For the base linear transformation term, Scaling weights for splines This is a spline nonlinear transformation term; The base linear transformation term is represented as follows: in, The output of the base linear transformation term, For the input feature vector, It is the Sigmoid activation function. It is a natural constant; The spline nonlinear transformation term is represented as follows: in, These are the spline control coefficients. The total number of basis functions. The number of grid intervals, For B-spline basis functions; A KAN layer is constructed based on the activation function, the base linear transformation term, and the spline nonlinear transformation term. An output bias term is added after the KAN layer to obtain a nonlinear classification decoder.
4. The method as described in claim 1, characterized in that, The steps of extracting features, aligning distributions, and performing nonlinear mapping on the enhanced data using the target EEG classification model to obtain classification results include: The enhanced data is used to extract features through the first convolutional block to obtain spatiotemporal joint features; The spatiotemporal joint features are extracted using the second convolutional block to obtain high-level abstract features; The distribution adaptation layer is used to align the high-level abstract features to obtain a distribution-aligned feature vector. The nonlinear classification decoder performs a nonlinear mapping on the distribution-aligned feature vectors to obtain the category probability distribution; The category with the highest probability in the category probability distribution is taken as the classification result.
5. The method according to any one of claims 1 to 4, characterized in that, The steps of performing bandpass filtering, channel-level standardization, and temporal segment permutation enhancement on the multi-channel EEG data to be classified to obtain enhanced data include: The multi-channel EEG data to be classified is bandpass filtered by a preset filter to obtain filtered data. Z-Score normalization is performed on each channel of the filtered data to obtain normalized data; The standardized data is uniformly divided into a preset number of sub-segments along the time axis; A random index permutation sequence is generated, and the sub-segments are concatenated according to the order of the index permutation sequence to obtain time segment permutation data; The time segment permutation data is subjected to random time shifting and Gaussian noise injection to obtain enhanced data.
6. A brainwave signal classification device integrating CNN and KAN, characterized in that, The device employs the EEG signal classification method that fuses CNN and KAN as described in any one of claims 1 to 5, and the device comprises: The encoder building module is used to build a feature extraction encoder based on the first convolutional block, the second convolutional block, and the distribution adaptation layer; A decoder construction module is used to construct a non-linear classification decoder based on a KAN layer, wherein the KAN layer contains multiple learnable activation function paths based on B-splines; The model building module is used to build an initial EEG classification model based on the feature extraction encoder and the nonlinear classification decoder; The model training module is used to construct a hybrid dataset containing source domain data and target domain data, and to iteratively train the initial EEG classification model based on the hybrid dataset, a two-stage transfer learning strategy, a spline coefficient update strategy based on regularized ridge regression, and a hybrid dynamic grid update strategy to obtain the target EEG classification model. The data augmentation module is used to perform bandpass filtering, channel-level standardization, and temporal segment permutation on the multi-channel EEG data to be classified, so as to obtain augmented data. The classification prediction module is used to extract features, align distributions, and perform nonlinear mapping on the enhanced data using the target EEG classification model to obtain classification results.
7. A brainwave signal classification device integrating CNN and KAN, characterized in that, The device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the EEG signal classification method fusing CNN and KAN as described in any one of claims 1 to 5.
8. A storage medium, characterized in that, The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, it implements the steps of the EEG signal classification method that integrates CNN and KAN as described in any one of claims 1 to 5.