A method and system for classifying motor imagery electroencephalogram signals based on convex optimization
By classifying EEG signals using a convex optimization-based method and optimizing with a linear matrix regression model and regularization terms, the high computational complexity of existing technologies is solved, achieving efficient and stable classification of motor imagery EEG signals, which is suitable for real-time applications in low-power devices.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SOUTH CHINA UNIV OF TECH
- Filing Date
- 2025-06-05
- Publication Date
- 2026-07-07
AI Technical Summary
Existing motor imagery EEG signal classification technologies have high computational complexity and consume a lot of computational resources in real-time applications, making it difficult to meet the needs of efficient and real-time control. In addition, deep learning methods have problems such as long training time and high computational cost.
A convex optimization-based approach is adopted. By collecting EEG signals, covariance matrix preprocessing and spatial filtering are performed. A linear matrix regression model is used for classification training, and a regularization term is introduced to prevent overfitting and optimize the model parameters.
It significantly reduces computational complexity and decoding time, improves classification accuracy, enhances system stability and reliability, and is suitable for real-time brain-computer interface applications in low-power devices.
Smart Images

Figure CN120632724B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of electroencephalogram (EEG) signal classification, and in particular to a method and system for classifying motor imagery EEG signals based on convex optimization. Background Technology
[0002] Brain-Computer Interface (BCI) is a technology that allows direct interaction with external devices by decoding brain activity. BCI systems acquire and analyze neural signals such as electroencephalograms (EEGs) and functional magnetic resonance imaging (fMRI), translating brain activity into controllable commands to enable seamless interaction between humans and computers, robots, or other devices. Traditional BCI technology primarily relies on EEG signals, which offer high temporal resolution, low cost, and non-invasive characteristics, thus possessing broad application potential in clinical, rehabilitation, and intelligent control fields.
[0003] In the development of brain-computer interfaces (BCIs), motor imagery (MI) has been widely used in decoding electroencephalogram (EEG) signals, particularly in neurorehabilitation and assistive device control. Motor imagery refers to an individual imagining a movement pattern solely through brain electrical activity without actual movement. BCI systems can control external devices by detecting and analyzing this EEG activity. Although classifying motor imagery EEG signals theoretically holds immense promise, challenges remain to be overcome in current BCI technology. These challenges stem from EEG signal bias interference, individual differences, and the instability of signal characteristics. Improving classification accuracy, reducing computational complexity, and enhancing system robustness are all critical issues that need to be addressed.
[0004] Currently, significant progress has been made in decoding motor imagery EEG signals, particularly in the application of deep learning methods. Many decoding applications based on deep neural networks (DNNs), convolutional neural networks (CNNs), and recurrent neural networks (RNNs) have demonstrated strong advantages in the classification accuracy of motor imagery EEG signals. These applications effectively capture complex EEG signal patterns by automatically extracting features from raw EEG data, thereby improving classification accuracy and robustness.
[0005] However, despite their outstanding accuracy, deep learning methods typically suffer from long training and inference times, as well as significant computational resource consumption. These applications require large amounts of labeled data for training, and also incur high computational power and memory consumption during decoding, particularly in real-time applications and mobile devices, where computational costs and latency issues are especially pronounced. For real-time brain-computer interface applications, these drawbacks can lead to slow system response times, failing to meet the demands for efficient, real-time control.
[0006] Application content
[0007] To improve the overall efficiency of the system, this application provides a method for classifying motor imagery EEG signals based on convex optimization. The method mainly includes the following steps:
[0008] S101. Collect EEG signals, guide the subject to conduct the experiment using visual cues, and extract the subject's motor imagery EEG signals as a dataset. Then, calculate the covariance matrix of the dataset and divide the dataset into a training set and a test set.
[0009] S102. Preprocess the covariance matrix, the preprocessing including normalization, whitening and logarithmic matrix transformation;
[0010] S103. The preprocessed covariance matrix is mapped to the latent space through a spatial filter to generate a latent signal and extract the spectral power feature z of the latent signal. A linear matrix regression model is then used to map the spectral power feature z to a binary classification task for classification training. The linear matrix regression model uses a weight vector (β=[β1,β2,…,β…)). C ] T The specific formula is as follows:
[0011] y i =β T z+b
[0012] Among them, y i Here, b is the corresponding target variable, 1≤i≤C, and C is the number of channels;
[0013] S104. The linear matrix regression model is optimized by minimizing the loss function, and a regularization term is introduced to prevent overfitting, thereby obtaining the optimized linear matrix regression model.
[0014] S105. Use the optimized linear matrix regression model to predict the test samples, obtain the predicted values, and calculate the classification accuracy based on the predicted values.
[0015] Preferably, step S102 includes: performing spatial filtering on the preprocessed covariance matrix using a spatial filter, and converting it into a potential signal s, s = X. T v, where s is the potential signal after spatial filtering, X = [x1, x2, ..., x C ] T X is a sample in the training set, C is the number of channels, and v = [v1, v2, ..., v2]. C ] T For spatial filters;
[0016] The spectral power characteristic z of the potential signal s is calculated using the following formula:
[0017] z = s T s = v T XX T v
[0018] Where z is the spectral power characteristic of the potential signal s;
[0019] The linear matrix regression model is used to map the spectral power feature z to a binary classification task for classification training. The specific formula is as follows:
[0020]
[0021] Among them, y i Let b be the target variable, β be the bias term, and b be the bias term. k Let X be the k-th weight vector. i For the i-th EEG signal in the test set, v k Let be the k-th spatial filter, where 1 ≤ k ≤ C and k is a positive integer.
[0022] Preferably, step S104 includes: reparameterizing the linear matrix regression model and converting it into a linear form, specifically as follows:
[0023]
[0024] Among them, y i ' represents the corresponding target variable after reparameterization. Let covariance matrix be the variance matrix.
[0025] For the reparameterized matrix, β k Let X be the k-th weight vector. i Let be the i-th EEG signal in the test set, and tr() be the trace of the matrix;
[0026] The reparameterized linear matrix regression model is optimized by minimizing the loss function, including: introducing L into the loss function. 21 The norm, as a regularization term, transforms the minimization of the loss function into the following form:
[0027]
[0028] M is the number of samples in the test set, λ1 is the regularization coefficient, the optimized model parameters W′ and b′ are obtained by minimizing the loss function, and the optimized linear matrix regression model is constructed based on the optimized model parameters W′ and b′.
[0029] In this step, firstly, through covariance matrix modeling and structured sparse regularization, the nonlinearity and overfitting problems in EEG signal regression are effectively solved. Specifically, this is manifested in: transforming nonlinear spatial filtering into linear matrix regression, and utilizing L... 21 The norm achieves channel-level sparsity; secondly, by minimizing the loss function, the parameters of the linear matrix regression model are optimized to find the parameter combination that best explains the target variable, thus achieving a trade-off between accuracy and sparsity.
[0030] Preferably, step S105 includes: using an optimized linear matrix regression model to analyze the i-th EEG signal X in the test set. i Make a prediction and obtain the predicted value y. i ",Right now:
[0031] y i " = tr(WR i )+b
[0032] in, It is the i-th EEG signal X i The covariance matrix;
[0033] Based on the predicted value y i Perform binary classification and obtain the predicted category;
[0034] By comparing the predicted category with the actual category for each test sample, the proportion of samples with correct predictions is calculated, and the accuracy is:
[0035]
[0036] Wherein I(y) i "=y i ) is an indicator function, which takes the value 1 when the predicted value is equal to the actual value, and takes the value 0 otherwise. M is the number of samples in the test set.
[0037] Preferably, the step of predicting the value y i "Perform binary classification and obtain the predicted category, including: if y..." i If the value is greater than a preset threshold, the test sample is determined to be a positive class; otherwise, the test sample is determined to be a negative class.
[0038] Secondly, this application provides a motor imagery EEG signal classification system based on convex optimization. The system includes: an EEG signal acquisition module, which guides subjects to conduct experiments using visual cues and extracts the subjects' motor imagery EEG signals as a dataset, calculates the covariance matrix of each subject's dataset, and divides the dataset into a training set and a test set; a preprocessing module, which preprocesses the covariance matrix, including normalization, whitening, and logarithmic matrix transformation; and a model training module, which maps the preprocessed covariance matrix to a latent space using a spatial filter to generate latent signals and extracts the spectral power features z of the latent signals. A linear matrix regression model is then used to map the spectral power features z to a binary classification task for classification training. The linear matrix regression model uses a weight vector (β = [β1, β2, ..., β...]). c ] T The specific formula is as follows:
[0039] y i =β T z+b
[0040] Among them, y i Here, b is the corresponding target variable, 1≤i≤C, and C is the number of channels;
[0041] The model optimization module optimizes the linear matrix regression model by minimizing the loss function, while introducing a regularization term to prevent overfitting, thereby obtaining the optimized linear matrix regression model.
[0042] The classification accuracy calculation module uses the optimized linear matrix regression model to predict the test samples, obtain the predicted values, and calculate the classification accuracy based on the predicted values.
[0043] Thirdly, this application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements the motor imagery EEG signal classification method based on convex optimization as described above.
[0044] Fourthly, this application provides a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the motor imagery EEG signal classification method based on convex optimization as described above.
[0045] The technical solutions provided in this application embodiment may include the following beneficial effects:
[0046] 1) The proposed application is an end-to-end model that can simultaneously optimize filters and classifiers. Compared with traditional common space model (CSP) applications, it not only enables effective signal extraction through filters, but also reduces the dependencies between multiple processing steps and improves the overall efficiency of the system by directly optimizing the classifier.
[0047] 2) Compared to Deep Neural Network (DNN) applications, this application exhibits significantly shorter decoding time. This is due to its convex optimization method, which enables efficient classification with lower computational complexity. Furthermore, the application is more interpretable; each step of the model can be analyzed through linear transformations and sparse constraints, facilitating understanding and verification.
[0048] 3) When compared with existing well-known applications for classifying motor imagery EEG signals, this application demonstrates higher accuracy. This is due to its optimized latent space filtering and sparse constraint design, which effectively improves the stability and reliability of the classification model in practical applications. Attached Figure Description
[0049] Other features, objects, and advantages of this application will become more apparent from the following detailed description of the non-limiting embodiments, taken with reference to the accompanying drawings:
[0050] Figure 1 A hardware structure block diagram of a mobile terminal for a motor imagery EEG signal classification method based on convex optimization is shown in one embodiment.
[0051] Figure 2 A flowchart illustrating the steps of a motor imagery EEG signal classification method based on convex optimization is shown in one embodiment.
[0052] Figure 3 A flowchart of step S105 of one embodiment is shown;
[0053] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0054] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are only for illustration and explanation of the embodiments of this application and are not intended to limit the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.
[0055] It should be noted that if the embodiments of this application involve directional indicators (such as up, down, left, right, front, back, etc.), the directional indicators are only used to explain the relative positional relationship and movement of the components in a certain specific posture (as shown in the figure). If the specific posture changes, the directional indicators will also change accordingly.
[0056] Furthermore, if the embodiments of this application involve descriptions such as "first" or "second," these descriptions are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, features defined with "first" or "second" may explicitly or implicitly include at least one of those features. Additionally, the technical solutions of various embodiments can be combined with each other, but this must be based on the ability of those skilled in the art to implement them. If the combination of technical solutions is contradictory or impossible to implement, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection claimed in this application.
[0057] The methods and embodiments provided in this application can be executed on a mobile terminal, computer terminal, or similar computing device. Taking running on a mobile terminal as an example, Figure 1 This is a hardware structure block diagram of a mobile terminal based on a convex optimization-based method for classifying motor imagery EEG signals, according to an embodiment of this application. Figure 1 As shown, a mobile terminal may include one or more ( Figure 1 Only one is shown in the diagram. A processor 102 (which may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 104 for storing data are also shown. The mobile terminal may further include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the mobile terminal described above. For example, the mobile terminal may also include components that are more... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.
[0058] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to a data information security protection method in this embodiment. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, thus implementing the aforementioned method. The memory 104 may include high-speed random access memory and non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the mobile terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0059] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the mobile terminal's communication provider. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module used for wireless communication with the Internet.
[0060] A flowchart illustrating a motor imagery EEG signal classification method based on convex optimization, as shown in the attached diagram, is provided. Figure 2 As shown in the embodiments of this application, a method for classifying motor imagery EEG signals based on convex optimization is provided. This method includes the following steps:
[0061] S101. Collect EEG signals, guide the subject to conduct the experiment using visual cues, and extract the subject's motor imagery EEG signals as a dataset. Then, calculate the covariance matrix of the dataset and divide the dataset into a training set and a test set.
[0062] In this embodiment, the subject performs motor imagery based on prompts on the screen, while the system records EEG data. The experiment typically includes multiple trials, each consisting of a prompting period, a motor imagery period, and a rest period. The subject's motor imagery EEG signals are extracted as a dataset. Specifically, the motor imagery experiment uses a BCI system with 22 lead electrode channels and a sampling frequency of 250Hz. The specific procedure for the motor imagery experiment is as follows: the subject gazes at the given screen; 0-2 seconds, a symbol appears on the screen, prompting the subject to prepare for the experiment; 2-3.5 seconds, an indicator arrow appears on the screen, pointing up, down, left, or right; 3-6 seconds, the subject performs a motor imagery task based on the instruction, involving either the tongue, feet, left hand, or right hand; 6-7.5 seconds, the indicator arrow disappears, and the subject relaxes. The motor imagery EEG signal from a single motor imagery task is used as a single instance for model learning. The motor imagery EEG signals are classified into four categories, representing the subject's motor imagery of the tongue, feet, left hand, and right hand.
[0063] S102. Preprocess the covariance matrix, the preprocessing including normalization, whitening and logarithmic matrix transformation;
[0064] In this embodiment, 3-6 seconds of motor imagery EEG signal from a single motor imagery task is extracted as input, i.e., 22 channels per instance, with 250 sampling points per channel. A 6th-order low-pass filter (7-30Hz) is applied to each channel of the input signal to extract frequency features suitable for classification. Moving average denoising filtering is then applied to each channel of the input signal. Three data preprocessing operations are performed on the covariance matrix for each trial: normalization, whitening, and logarithmic matrix transformation. The specific steps are as follows: Normalization: Standardizing each element of the covariance matrix ensures that all elements have a uniform scale, avoiding the impact of differences between channels on subsequent analysis. Whitening: Whitening the covariance matrix removes correlation and redundancy from the signal, resulting in a covariance matrix with no correlation between dimensions, making the signal more consistent with the independence assumption. Logarithmic matrix transformation (logm): Applying logarithmic matrix transformation converts the covariance matrix to its logarithmic form to compress the numerical range and enhance the linearity of the data, further improving the performance of the classification model. These three preprocessing methods can effectively improve data quality and enhance the performance of subsequent signal processing and classification tasks.
[0065] S103. The preprocessed covariance matrix is mapped to the latent space through a spatial filter to generate a latent signal and extract the spectral power feature z of the latent signal. A linear matrix regression model is then used to map the spectral power feature z to a binary classification task for classification training. The linear matrix regression model uses a weight vector (β=[β1,β2,…,β…)). C ]T The specific formula is as follows:
[0066] y i =β T z+b
[0067] Among them, y i Here, b is the corresponding target variable, 1≤i≤C, and C is the number of channels;
[0068] In this embodiment, the preprocessed covariance matrix is spatially filtered using a spatial filter and transformed into a latent signal s, s = X. T v, where s is the potential signal after spatial filtering, X = [x1, x2, ..., x C ] T X is a sample in the training set, C is the number of channels, and v =
[0069] [v1,v2,…,v C ] T For spatial filters;
[0070] The spectral power characteristic z of the potential signal s is calculated using the following formula:
[0071] z = s T s = v T XX T v
[0072] Where z is the spectral power characteristic of the potential signal s;
[0073] The linear matrix regression model is used to map the spectral power feature z to a binary classification task for classification training. The specific formula is as follows:
[0074]
[0075] Among them, y i Let b be the target variable, β be the bias term, and b be the bias term. k Let X be the k-th weight vector. i For the i-th EEG signal in the test set, v k Let be the k-th spatial filter, where 1 ≤ k ≤ C and k is a positive integer.
[0076] Specifically, an end-to-end machine learning application was developed to perform binary classification using resting EEG data via linear regression. This application optimizes the latent space model by minimizing the mean squared linear loss while constraining the dimensionality of the latent signals. The application optimizes the spatial filter to transform multi-channel EEG signals into low-dimensional latent representations, and then uses the frequency band power of these latent signals to accurately predict the binary classification results using a linear regression model.
[0077] For a trial in the training dataset, it is represented as: X = [x1, x2, ..., x C ] T Where C is the number of channels. Using v = [v1, v2, ..., v...] C ] T To represent a spatial filter, perform spatial filtering, and convert multi-channel EEG signals into a latent signal: s = X T v, where s = [s1, s2, ..., s N [ ] represents the filtered latent signal. Spectral power features are used to quantify the intensity of EEG activity. These features are crucial in many EEG decoding applications due to their low computational cost, high reliability, and strong neurophysiological basis. The spectral power of the latent signal is calculated using the following formula:
[0078] z = s T s = v T XX T v
[0079] Here, z represents the spectral power features in the latent space, represented by a set of L spatially filtered signals. These spectral power features are then used in a linear matrix regression model to map the features to a binary classification task, thereby transforming EEG data into practical and interpretable results. The model employs a weight vector (β = ...
[0080] [β1,β2,…,β L ] T The specific formula is as follows:
[0081]
[0082] in, Let M be the training set, and X be the number of samples. i For the EEG signal of the i-th test, y i is the corresponding target variable, and b is the bias term.
[0083] S104. The linear matrix regression model is optimized by minimizing the loss function, and a regularization term is introduced to prevent overfitting, thereby obtaining the optimized linear matrix regression model.
[0084] In this implementation, although the regression model is linear, the presence of a quadratic term results in f(X) i In the spatial filter v k The model exhibits nonlinear characteristics. To address this issue, the model is reparameterized, transforming it into a linear form with respect to the unknown parameters:
[0085]
[0086] Among them, y i' represents the corresponding target variable after reparameterization. Let covariance matrix be the variance matrix. To reparameterize the matrix, β k Let X be the k-th weight vector. i Let be the i-th EEG signal in the test set. Assuming the spatial filters are orthogonal, optimizing v and β is equivalent to optimizing W. To prevent overfitting, L is introduced into the loss function. 21 The norm, as a regularization term, leads to the optimization problem in its final form:
[0087]
[0088] Where M is the number of samples in the test set, λ1 is the regularization coefficient, the optimized model parameters W′ and b′ are obtained by minimizing the loss function, and the optimized linear matrix regression model is constructed based on the optimized model parameters W′ and b′.
[0089] This method enhances the robustness of the application and avoids model overfitting. b is the bias, and λ1 is the regularization coefficient, which controls sparsity.
[0090] S105. Use the optimized linear matrix regression model to predict the test samples, obtain the predicted values, and calculate the classification accuracy based on the predicted values;
[0091] In this embodiment, see Figure 3 , Figure 3 A flowchart of step S105 of one embodiment is shown, which uses an optimized linear matrix regression model to analyze the i-th EEG signal X in the test set. i Make a prediction and obtain the predicted value y. i ",Right now:
[0092] y i " = tr(WR i )+b
[0093] in, It is the i-th EEG signal X i The covariance matrix;
[0094] Based on the predicted value y i Perform binary classification and obtain the predicted category;
[0095] By comparing the predicted category with the actual category for each test sample, the proportion of samples with correct predictions is calculated, and the accuracy is:
[0096]
[0097] Wherein I(y) i "=y i) is an indicator function, which takes the value 1 when the predicted value is equal to the actual value, and takes the value 0 otherwise. M is the number of samples in the test set.
[0098] Specifically, the steps for calculating the test set accuracy are as follows: Calculate the predicted values: Using the optimized model parameters W and b, calculate the predicted values for each...
[0099] y i "=tr(W′R i )+b′
[0100] in, It is the i-th EEG signal X i The covariance matrix, W′ is the optimized model matrix, and b′ is the optimized model bias term;
[0101] Calculate the classification result: based on the predicted value y i "With actual goal y" i The relationship between y is used for binary classification. i "If the value is greater than a certain threshold (e.g., 0), it is classified as a positive class; otherwise, it is classified as a negative class."
[0102] Accuracy is calculated by comparing the predicted class with the actual class for each test sample. The proportion of samples with correct predictions is then calculated.
[0103]
[0104] Wherein I(y) i "=y i ) is an indicator function, which takes the value 1 when the predicted value is equal to the actual value, and 0 otherwise. M is the number of samples in the test set. Through the above steps, the accuracy of the model on the test set can be obtained.
[0105] This application proposes an efficient method for classifying motor imagery EEG signals based on convex optimization. EEG signals are acquired using visual cues, and motor imagery EEG signals are extracted as a dataset, with their covariance matrix calculated. The covariance matrix is preprocessed and mapped to the latent space using a spatial filter to generate latent signals, and their spectral power features are extracted. A linear matrix regression model is used to map the spectral power features to a binary classification task for training, with the model parameterized using weight vectors. The model is optimized by minimizing the loss function and introducing a regularization term to prevent overfitting. The optimized model is used to predict test samples, calculate the predicted values, and perform binary classification. Finally, the classification accuracy is calculated by comparing the predicted and actual categories. This method transforms the EEG signal decoding process into an optimization problem by designing an appropriate optimization model and solving it using convex optimization techniques, thereby significantly reducing computational complexity and overhead while maintaining decoding accuracy. Compared with traditional deep learning applications, this method not only improves the real-time performance and stability of the decoding process but also enables efficient EEG signal classification on low-power devices, demonstrating greater practicality and broad application prospects.
[0106] This application also provides a motor imagery EEG signal classification system based on convex optimization, the system comprising:
[0107] The EEG signal acquisition module uses visual cues to guide the subjects in the experiment, extracts the subjects' motor imagery EEG signals as a dataset, calculates the covariance matrix of each subject's dataset, and divides the dataset into a training set and a test set.
[0108] The preprocessing module preprocesses the covariance matrix, including normalization, whitening, and logarithmic matrix transformation.
[0109] In the model training module, the preprocessed covariance matrix is mapped to the latent space through a spatial filter to generate a latent signal and extract the spectral power feature z of the latent signal. A linear matrix regression model is then used to map the spectral power feature z to a binary classification task for classification training. The linear matrix regression model employs a weight vector (β=[β1,β2,…,β…)). c ] T The specific formula is as follows:
[0110] y i =β T z+b
[0111] Among them, y i Here, b is the corresponding target variable, 1≤i≤c, and c is the number of channels;
[0112] The model optimization module optimizes the linear matrix regression model by minimizing the loss function, while introducing a regularization term to prevent overfitting, thereby obtaining the optimized linear matrix regression model.
[0113] The classification accuracy calculation module uses the optimized linear matrix regression model to predict the test samples, obtain the predicted values, and calculate the classification accuracy based on the predicted values.
[0114] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0115] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0116] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0117] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0118] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0119] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0120] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0121] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0122] The above are merely embodiments of this application and are not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.
Claims
1. A method for classifying motor imagery EEG signals based on convex optimization, characterized in that, The method includes the following steps: S101. Collect EEG signals, guide the subject to conduct the experiment using visual cues, and extract the subject's motor imagery EEG signals as a dataset. Then, calculate the covariance matrix of the dataset and divide the dataset into a training set and a test set. S102. Preprocess the covariance matrix, the preprocessing including normalization, whitening and logarithmic matrix transformation; S103. The preprocessed covariance matrix is mapped to the latent space through a spatial filter to generate a latent signal and extract the spectral power feature z of the latent signal. A linear matrix regression model is then used to map the spectral power feature z to a binary classification task for classification training. The linear matrix regression model employs a weight vector... The specific formula is as follows: ; in, For the corresponding target variable, This is the bias term, 1≤i≤C, where C is the number of channels; S104. The linear matrix regression model is optimized by minimizing the loss function, and a regularization term is introduced to prevent overfitting, thereby obtaining the optimized linear matrix regression model. S105. Use the optimized linear matrix regression model to predict the test samples, obtain the predicted values, and calculate the classification accuracy based on the predicted values; Step S104 includes: The linear matrix regression model is reparameterized and transformed into a linear form, as follows: ; in, For the corresponding target variable after reparameterization, Let covariance matrix be the variance matrix. For the reparameterized matrix, For the k-th weight vector, For the test set of the The secondary EEG signal, tr() is the trace of the matrix; The reparameterized linear matrix regression model is optimized by minimizing the loss function to find the parameter combination that best explains the target variable, achieving a trade-off between accuracy and sparsity. This includes introducing parameters into the loss function. The norm, as a regularization term, transforms the minimization of the loss function into the following form: ; in, The number of samples in the test set. L is the regularization coefficient used to control sparsity and achieve the utilization of L 21 The norm achieves channel-level sparsity, and the optimized model parameters are obtained by minimizing the loss function. and And based on the optimized model parameters and This forms the optimized linear matrix regression model.
2. The method according to claim 1, characterized in that, Step S103 includes: The preprocessed covariance matrix is then spatially filtered using a spatial filter and transformed into a potential signal. , ,in, To perform spatial filtering on the underlying signal, , Let C be a sample in the training set, and C be the number of channels. For spatial filters; The potential signal The spectral power characteristic z is calculated using the following formula: ; in, For the potential signal Spectral power characteristics; The linear matrix regression model is used to map the spectral power feature z to a binary classification task for classification training. The specific formula is as follows: ; in, For the corresponding target variable, For bias terms, For the k-th weight vector, For the test set of the Secondary EEG signals, Let be the k-th spatial filter, where 1 ≤ k ≤ C and k is a positive integer.
3. The method according to claim 1, characterized in that, Step S105 includes: Using the optimized linear matrix regression model, the first [model name] in the test set was [model name]. Secondary EEG signals Make a prediction and obtain the predicted value. ,Right now: ; in, It is the first Secondary EEG signals The covariance matrix, The optimized model matrix, This refers to the optimized model bias term; Based on the predicted value Perform binary classification and obtain the predicted category; The accuracy rate is calculated by comparing the predicted class with the actual class for each test sample, thus determining the proportion of samples that were correctly predicted. Specific accuracy The calculation formula is as follows: ; in, It is an indicator function that takes the value 1 when the predicted value is equal to the actual value, and 0 otherwise. The number of samples in the test set.
4. The method according to claim 3, characterized in that, According to the predicted value Perform binary classification and obtain the predicted category, including: if If the value is greater than a preset threshold, the test sample is determined to be a positive class; otherwise, the test sample is determined to be a negative class.
5. A motor imagery EEG signal classification system based on convex optimization, characterized in that, The system includes: The EEG signal acquisition module uses visual cues to guide the subjects in the experiment, extracts the subjects' motor imagery EEG signals as a dataset, calculates the covariance matrix of each subject's dataset, and divides the dataset into a training set and a test set. The preprocessing module preprocesses the covariance matrix, including normalization, whitening, and logarithmic matrix transformation. In the model training module, the preprocessed covariance matrix is mapped to the latent space through a spatial filter to generate a latent signal and extract the spectral power feature z of the latent signal. A linear matrix regression model is then used to map the spectral power feature z to a binary classification task for classification training. The linear matrix regression model employs a weight vector... The specific formula is as follows: ; in, For the corresponding target variable, This is the bias term, 1≤i≤C, where C is the number of channels; The model optimization module optimizes the linear matrix regression model by minimizing the loss function, while introducing a regularization term to prevent overfitting, thereby obtaining the optimized linear matrix regression model. The classification accuracy calculation module uses the optimized linear matrix regression model to predict the test samples, obtain the predicted values, and calculate the classification accuracy based on the predicted values. The model optimization module includes: The linear matrix regression model is reparameterized and transformed into a linear form, as follows: ; in, For the corresponding target variable after reparameterization, Let covariance matrix be the variance matrix. For the reparameterized matrix, For the k-th weight vector, For the test set of the The secondary EEG signal, tr() is the trace of the matrix; The reparameterized linear matrix regression model is optimized by minimizing the loss function, including: introducing the following into the loss function. The norm, as a regularization term, transforms the minimization of the loss function into the following form: ; in, The number of samples in the test set. L is the regularization coefficient used to control sparsity and achieve the utilization of L 21 The norm achieves channel-level sparsity, and the optimized model parameters are obtained by minimizing the loss function. and And based on the optimized model parameters and This forms the optimized linear matrix regression model.
6. An electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the motor imagery EEG signal classification method based on convex optimization as described in any one of claims 1-4.
7. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the motor imagery EEG signal classification method based on convex optimization as described in any one of claims 1-4.