Unbalance classification method for electroencephalogram data in epilepsy detection

By generating synthetic samples using covariance-guided transformation and Mahalanobis distance constraints, the imbalanced classification problem of EEG data in epilepsy detection is solved, improving the classification accuracy and robustness of the model, overcoming the limitations of existing technologies, and achieving better epilepsy seizure detection results.

CN121845606APending Publication Date: 2026-04-14NINGBO INST OF TECH ZHEJIANG UNIV ZHEJIANG
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-01-23
Publication Date
2026-04-14

AI Technical Summary

Technical Problem

Existing imbalanced classification methods for EEG data in epilepsy detection suffer from dataset imbalance, making it difficult for traditional classification methods to effectively identify rare epileptic seizure patterns, affecting the sensitivity and robustness of the model. Furthermore, existing oversampling techniques have limitations, such as local information dependence, insufficient diversity of generated samples, and intra-class imbalance.

Method used

By employing covariance-guided transformation and Mahalanobis distance constraints, synthetic samples are generated through matrix factorization, constructing a generation mechanism oriented towards minority class samples, optimizing the diversity and boundary consistency of synthetic samples, and using Mahalanobis distance ranking for sample pairing. The generated synthetic samples can better reflect the global distribution of the data and the class decision boundary.

Benefits of technology

While preserving the global distribution characteristics of the data, the generated synthetic samples can improve the classification accuracy and robustness of epileptic seizure detection, outperforming the overall performance of existing technologies and enhancing the sensitivity of the classifier and the clarity of the decision boundary.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121845606A_ABST
    Figure CN121845606A_ABST
Patent Text Reader

Abstract

The invention discloses an unbalanced classification method for electroencephalogram data in epilepsy detection, and relates to the technical field of data optimization and big data processing. According to the method, firstly, covariance matrixes of majority class samples and minority class samples are calculated, linear transformation is achieved through matrix decomposition, and the minority class samples inherit global distribution characteristics of the majority class samples; and then, in the transformed feature space, sorting samples based on mahalanobis distance and performing partition pairing, selecting sample pairs with large difference to generate convex combination synthesis samples, and ensuring sample diversity and boundary consistency. Experimental results show that on a CHB-MIT electroencephalogram data set, the method effectively solves the problems that a traditional oversampling technology is prone to expanding minority class decision boundaries and generated samples are lack of diversity, and the reliability of epileptic seizure detection is remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the fields of data optimization and big data processing technology, and in particular to an imbalance classification method for EEG data in epilepsy detection. Background Technology

[0002] In machine learning classification tasks, data imbalance is one of the key challenges affecting model performance. Ideally, classifiers need sufficient and class-balanced data for training to achieve reliable generalization. However, in practical applications, especially in fields such as medical diagnosis and anomaly detection, minority class samples are often extremely scarce, resulting in a severely imbalanced distribution of the dataset. Taking epilepsy EEG detection as an example, seizure events account for a low percentage in long-term monitoring, with the vast majority of records showing normal EEG activity. This extreme imbalance makes it difficult for traditional classification methods to effectively identify rare epileptic seizure patterns, thus limiting the model's sensitivity and robustness.

[0003] To alleviate class imbalance, traditional classification methods often perform poorly on imbalanced data. Many imbalanced datasets exist in practical applications, particularly in epilepsy detection, where data on normal brain activity far exceeds data related to seizures, leading to severe data imbalance that significantly hinders the performance of traditional classification methods. Current mainstream oversampling techniques include resampling, random downsampling (RUS), and synthetic minority class oversampling (SMOTE). SMOTE generates synthetic samples by linear interpolation between nearest neighbors of minority class samples, expanding the minority class to some extent, but it still has significant limitations: first, it relies solely on the local structure of nearest neighbors, easily ignoring the global distribution of the data; second, the generated samples lack diversity and representativeness, potentially leading to overfitting; and third, blindly generating samples in overlapping class boundaries may incorrectly introduce synthetic points into the majority class region, thus disrupting the classification boundary and reducing classification accuracy. To address the shortcomings of SMOTE, researchers have proposed various improvement methods. These include minimizing class overlap and mapping samples to a more linearly separable space to ensure the synthesized samples are far from the decision boundary; or introducing genetic algorithms to fuse features from different parent samples to enhance sample diversity. While these methods have improved resampling performance to some extent, they still generally suffer from two core problems: first, over-reliance on local neighborhood information, failing to fully consider the global distribution and structural features of the dataset, resulting in generated samples that cannot truly reflect the overall shape of the minority class; and second, when intra-class distribution is uneven (i.e., there is sub-cluster imbalance within the minority class), traditional nearest-neighbor-based methods may further exacerbate intra-class imbalance, causing large sub-clusters to obtain more synthesized samples while small sub-clusters are ignored.

[0004] In summary, the imbalance of data severely restricts the application of classification models in real-world scenarios, especially in the field of healthcare. Although current mainstream oversampling methods have made some progress, there is still significant room for improvement in areas such as global distribution modeling, sample diversity generation, and intra-class balance maintenance. Summary of the Invention

[0005] Therefore, it is necessary to provide a method for classifying imbalances in EEG data during epilepsy detection, addressing the aforementioned technical problems.

[0006] The following technical solution is adopted in this specification: Obtain the original EEG dataset; separate the original EEG dataset into a majority sample matrix containing normal EEG samples and a minority sample matrix containing EEG samples from epileptic seizures; Based on the majority sample matrix and the minority sample matrix, the transformed sample matrix is ​​obtained through linear transformation of matrix decomposition and covariance-guided transformation; The EEG data samples in the transformed sample matrix are divided into two partitions according to the Mahalanobis distance between the row vectors of the EEG data samples in descending order; and the sample vectors in the two partitions are paired one by one according to the Mahalanobis distance in descending order. Based on the mean of the paired sample vectors, minority class samples are synthesized; the synthesized minority class samples are added to the original EEG dataset to obtain a balanced EEG data sample set.

[0007] Furthermore, the process of constructing the transformed sample matrix specifically includes: Based on a majority sample matrix containing normal EEG samples and a minority class sample matrix containing EEG samples from epileptic seizures The majority sample matrix is ​​obtained through calculation. covariance matrix and minority class sample matrix covariance matrix ; By analyzing the covariance matrix and Perform matrix decomposition to obtain the corresponding decomposed matrix. L and L' ; Based on the decomposition matrix L and L' For the minority class sample matrix S' Perform a covariance-guided linear transformation to obtain the transformed sample matrix. ; The transformed sample matrix The calculation formula is: ; ; ; Among them, matrix and It is done through Cholesky decomposition and SVD decomposition, respectively. and It is obtained by decomposition.

[0008] Furthermore, the Mahalanobis distance metric between the row vectors of each sample in the transformed sample matrix is ​​calculated using the following formula: ; ; in, A majority sample matrix containing normal EEG samples The sample vector; The sample vectors are the transformed sample matrix; A minority class sample matrix containing EEG samples from epileptic seizures. The covariance matrix; This is the covariance matrix of the transformed sample matrix; For minority class sample matrix Mahalanobis distance; This represents the Mahalanobis distance of the transformed sample matrix.

[0009] Furthermore, the step of dividing the EEG data sample row vectors into two partitions in descending order of Mahalanobis distance metric is specifically as follows: Based on the transformed sample matrix, intermediate instance pairs are obtained by arranging them according to the Mahalanobis distance metric between the row vectors of each sample. The data sample vectors are partitioned based on the intermediate instance; wherein, all data samples of the data with a Mahalanobis distance metric value higher than or equal to that of the intermediate instance are divided into one region; and all data samples of the data with a Mahalanobis distance metric value lower than that of the intermediate instance are divided into another region.

[0010] Furthermore, the process of pairing sample vectors one-to-one in the two partitions specifically includes: Based on the partitioned sample vectors, the samples with the largest Mahalanobis distance metric in each of the two partitions are paired. In the two partitions, the vector samples are paired one by one according to the order of their arrangement from largest to smallest.

[0011] The above-mentioned technical solutions adopted in this specification can achieve the following beneficial effects: This specification provides a method for imbalanced classification of EEG data in epilepsy detection. By organically integrating covariance-guided linear transformation with a differential pairing generation strategy constrained by Mahalanobis distance, a generation mechanism for minority class samples is constructed. While preserving the global distribution characteristics of the original data, Mahalanobis distance constraint operations are used to optimize the diversity and boundary consistency of the synthesized samples. After sorting by Mahalanobis distance, pairwise pairing generates oversampled samples. This fundamentally solves the key technical problems of traditional oversampling techniques when processing high-dimensional medical signals, such as global distribution distortion, insufficient diversity of synthesized samples, and blurred decision boundaries. It makes the class decision boundary of the generated data closer to the ideal boundary, achieving a comprehensive performance improvement superior to existing technologies in the field of automatic epilepsy seizure detection. Attached Figure Description

[0012] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:

[0013] Figure 1 This is a flowchart illustrating an imbalance classification method for EEG data in epilepsy detection, as provided in this specification. Figure 2 A diagram showing the MCC comparison of different classification algorithms provided in this manual; Figure 3 This diagram illustrates the accuracy comparison of the different classification algorithms provided in this manual. Figure 4 This is a diagram showing the comparison of MCC under different expansion ratios in the KNN classification provided in this specification; Figure 5 This diagram illustrates the accuracy comparison of different expansion ratios in the KNN classification provided in this manual. Detailed Implementation

[0014] To make the objectives, technical solutions, and advantages of this specification clearer, the technical solutions of this application will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments in this specification without creative effort are within the scope of protection of this application.

[0015] Mahalanobis distance, a statistical distance measure proposed by Indian statistician Mahalanobis, considers the correlation between variables by incorporating the covariance matrix of the dataset. This method helps eliminate the influence of different dimensions and corrects for correlations between variables, thus making the distance measurement more robust. A significant characteristic of Mahalanobis distance is that it is unaffected by sample correlations, but rather depends on the attribute weights in the population.

[0016] The technical solutions provided by the various embodiments of this application are described in detail below with reference to the accompanying drawings.

[0017] Figure 1 This is a flowchart illustrating a method for classifying imbalances in electroencephalogram (EEG) data used in epilepsy detection, as described in this specification. The method includes the following steps: S101: Obtain an imbalanced dataset, and generate a sample matrix based on the minority class samples in the imbalanced dataset through covariance-guided transformation. .

[0018] The imbalanced dataset is separated to obtain the original data matrix. and minority class sample matrix And calculate the sample matrix respectively. and its sampled subsample matrix covariance matrix and The calculation formula is: ; ; in, and These are the sample matrices and The number of samples; and These are the sample matrices and The mean vector.

[0019] To ensure that minority class samples retain the original sample matrix Complete data distribution information and the interactions between dimensions, through and For minority class sample matrix Perform a linear transformation to obtain the transformed sample matrix. Sample matrix The formula for calculating is:

[0020] Among them, matrix and Based on the solved covariance matrix and Whether it is positive definite, and then using Cholesky decomposition and SVD decomposition respectively. and The results were obtained separately.

[0021] Sample matrix after linear transformation of covariance matrix covariance matrix With the original data matrix covariance matrix They are consistent.

[0022] S102: Calculate the Mahalanobis distance metric for each sample row vector in the matrix and arrange them in descending order.

[0023] matrix sum matrix The Mahalanobis distance is calculated as shown in the following formula: (4) (5) in, Original data matrix The sample vector; Sample matrix The sample vector; Original data matrix The covariance matrix; Sample matrix The covariance matrix.

[0024] The matrix obtained by using the above covariance-guided linear transformation Mahalanobis distance and matrix The Mahalanobis distances are consistent. This ensures that the transformed matrix... The geometric relationships between data points were preserved, maintaining the integrity of the distance metric.

[0025] S103: Divide all sample vectors into two partitions according to their Mahalanobis distance values ​​and pair them one by one.

[0026] Data samples are distinguished based on their Mahalanobis distance values, indicating their distance from the center data instance. The data is then partitioned using the intermediate instance found during sorting. All data samples with a Mahalanobis distance greater than or equal to this intermediate instance are grouped into one partition, and the remaining data samples are grouped into another. Samples within each partition are labeled sequentially; and then, based on their Mahalanobis distance values ​​in descending order, other vector samples within each partition are paired one-to-one.

[0027] This ensures that there are no overlapping samples and that the subsequent samples to be generated are within the minority decision boundary, filling the space between the two clusters formed by the partitioning process.

[0028] S104: Generate a synthetic sample by aggregating the mean between two paired instances in each partition, and add the synthetic sample to the original data to obtain a data-balanced data sample set.

[0029] By considering two potentially disjoint instances (non-neighbors) and sequentially merging them, the resulting instances will be clearly unique but related to the two parent partitioning nodes. The generated synthetic samples are uniformly distributed to exhaustively represent all possible minority samples within the two clusters, thus providing more information to the classifier.

[0030] Furthermore, the synthetic samples are convex combinations of well-separated parents that are distinct in terms of Mahalanobis distance metric, ensuring that no duplicate data instances are generated.

[0031] Furthermore, in one embodiment of this specification, the following steps are included: Obtain the original EEG dataset; separate the original EEG dataset into a majority sample matrix containing normal EEG samples and a minority sample matrix containing EEG samples from epileptic seizures; Based on the majority sample matrix and the minority sample matrix, a linear transformation guided by covariance is used to obtain the transformed sample matrix. Based on the magnitude of the Mahalanobis distance between the row vectors of each sample in the transformed sample matrix, all sample vectors are divided into two partitions, and the sample vectors in the two partitions are paired according to the magnitude of the Mahalanobis distance. Based on the mean of the two paired sample vectors in each partition, minority class samples are synthesized. The synthesized minority class samples are added to the original EEG dataset to obtain a balanced EEG data sample set. An epilepsy detection classifier is trained based on the balanced set of EEG data samples to classify the EEG data.

[0032] Furthermore, in the embodiments of this specification, the dataset used in this study was derived from the CHB-MIT scalp EEG database, containing EEG recordings of pediatric patients with evoked seizures. The data used for the experiment came from patients chb01, chb02, chb19, chb21, and chb22. 80% of the dataset was randomly selected as the training set, and 20% as the test set. Taking patient chb01 as an example, the data contained 278,093 normal samples and 11,707 seizure samples. The imbalance rate was 23.8%.

[0033] To compare the performance of the OCT algorithm, a comparative experiment was conducted using the No Oversampling (NONE) and MAHAKIL methods. In addition, four commonly used classification algorithms were selected as classifiers, and the accuracy (ACC) and Matthews correlation coefficient (MCC) were used as evaluation criteria based on the classification results.

[0034] The classification algorithms selected for this experiment were: K-Nearest Neighbors (KNN), Support Vector Machine (SVM), Decision Tree (DT), and Gradient Boosting (GB). The chb01 patient dataset was used. The number of synthesized minority class samples in this experiment was twice that of the original minority class samples. The experimental results are as follows: Figure 2 and Figure 3 As shown, compared to the Mahakil method, the OCT method significantly improves the classification results in terms of MCC value while having a smaller impact on the overall accuracy. For example, in the SVM classification experiment, the OCT method improved the MCC value from 0.078 to 0.6016, while the Mahakil method improved it to 0.2604. The overall accuracy improved from 0.95 of the baseline method to 0.9523, while the Mahakil method showed a slight decrease to 0.9277.

[0035] In addition to comparing different classification algorithms, this paper uses the chb01 patient dataset to design comparative experiments with different expansion ratios for different numbers of synthesized minority class samples, selecting KNN as the classification algorithm. The experimental results are as follows: Figure 4 and Figure 5 As shown, with the increase in the number of synthesized minority class samples, the MAHAKIL method improved the MCC value from 0.1583 to 0.496, while the OCT method improved it from 0.1583 to 0.8534, showing a more significant improvement. Meanwhile, the accuracy of the MAHAKIL method decreased from 0.9335 to 0.7484. The OCT method had a smaller impact on the overall accuracy, consistently remaining above 0.91.

[0036] Furthermore, different patient datasets were selected for comparative experiments, with the number of synthesized minority class samples being the same as the number of original minority class samples. The experimental results are shown in Table 1. In different datasets, the OCT method significantly improved the MCC value compared to the MAHAKIL method, with the maximum improvement ranging from 0.1164 to 0.6836, and had little impact on accuracy. For datasets such as chb02, chb19, and chb21, it could even improve the overall classification accuracy.

[0037] Table 1. Comparison of MCC values ​​and accuracy results for different datasets. This invention proposes an oversampling algorithm based on Mahalanobis-covariance metric to solve the class imbalance problem in classification tasks. Experimental results show that the algorithm performs well under various types of classifiers, different minority class sample expansion ratios, and different datasets. Compared with the MAHAKIL method, it can significantly improve the MCC value of the classification results with a small sacrifice in overall accuracy, demonstrating the superiority of the algorithm.

[0038] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

Claims

1. A method for classifying imbalanced EEG data in epilepsy detection, characterized in that, include: Obtain the raw EEG dataset; The original EEG dataset is separated into a majority sample matrix containing normal EEG samples and a minority sample matrix containing EEG samples from epileptic seizures. Based on the majority sample matrix and the minority sample matrix, the transformed sample matrix is ​​obtained through linear transformation of matrix decomposition and covariance-guided transformation; The EEG data samples in the transformed sample matrix are divided into two partitions according to the Mahalanobis distance between the row vectors of the EEG data samples in descending order; and the sample vectors in the two partitions are paired one by one according to the Mahalanobis distance in descending order. Based on the mean of the paired sample vectors, minority class samples are synthesized; the synthesized minority class samples are added to the original EEG dataset to obtain a balanced EEG data sample set.

2. The method for classifying imbalanced EEG data in epilepsy detection as described in claim 1, characterized in that, The process of constructing the transformed sample matrix specifically includes: Based on a majority sample matrix containing normal EEG samples and a minority class sample matrix containing EEG samples from epileptic seizures The majority sample matrix is ​​obtained through calculation. covariance matrix and minority class sample matrix covariance matrix ; By analyzing the covariance matrix and Perform matrix decomposition to obtain the corresponding decomposed matrix. L and L' ; Based on the decomposition matrix L and L' For the minority class sample matrix S' Perform a covariance-guided linear transformation to obtain the transformed sample matrix. ; The transformed sample matrix The calculation formula is: ; ; ; Among them, matrix and It is done through Cholesky decomposition and SVD decomposition, respectively. and It is obtained by decomposition.

3. The method for classifying imbalanced EEG data in epilepsy detection as described in claim 1, characterized in that, The Mahalanobis distance metric between the row vectors of each sample in the transformed sample matrix is ​​calculated using the following formula: ; ; in, A majority sample matrix containing normal EEG samples The sample vector; The sample vectors are the transformed sample matrix; A minority class sample matrix containing EEG samples from epileptic seizures. The covariance matrix; This is the covariance matrix of the transformed sample matrix; For minority class sample matrix Mahalanobis distance; This represents the Mahalanobis distance of the transformed sample matrix.

4. The method for classifying imbalanced EEG data in epilepsy detection as described in claim 1, characterized in that, The data samples were divided into two partitions based on the Mahalanobis distance metric between row vectors, in descending order. Specifically, the partitions included: Based on the transformed sample matrix, intermediate instance pairs are obtained by arranging them according to the Mahalanobis distance metric between the row vectors of each sample. The data sample vectors are partitioned based on the intermediate instance; wherein, all data samples of the data with a Mahalanobis distance metric value higher than or equal to that of the intermediate instance are divided into one region; and all data samples of the data with a Mahalanobis distance metric value lower than that of the intermediate instance are divided into another region.

5. The method for classifying imbalanced EEG data in epilepsy detection as described in claim 1, characterized in that, The process of pairing sample vectors in the two partitions one-to-one specifically includes: Based on the partitioned sample vectors, the samples with the largest Mahalanobis distance metric in each of the two partitions are paired. In the two partitions, the vector samples are paired one by one according to the order of their arrangement from largest to smallest.