Joint domain adaptation based cross-patient seizure prediction method, system, and media

By employing an unsupervised domain alignment mechanism based on Euclidean alignment and second-order Wasserstein distance, combined with an improved Softmax classification loss, and optimizing neural network parameters, the problems of low accuracy and high deployment cost in cross-patient prediction of epileptic EEG signals are solved, achieving efficient and lightweight epileptic seizure prediction.

CN120678385BActive Publication Date: 2026-04-24TIANJIN UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
TIANJIN UNIV
Filing Date
2025-06-09
Publication Date
2026-04-24

AI Technical Summary

Technical Problem

Existing methods for predicting epilepsy EEG signals across patients have low accuracy, poor model generalization, and high deployment costs under conditions of small sample size, making it difficult to run in real time on resource-constrained embedded devices.

Method used

A joint domain adaptation-based approach is adopted, which optimizes neural network parameters by combining Euclidean alignment and second-order Wasserstein distance unsupervised domain alignment mechanisms with an improved Softmax classification loss, to achieve cross-patient epileptic seizure prediction.

Benefits of technology

It improves the cross-patient adaptability and predictive performance of neural network models, reduces the acquisition and annotation costs of customizing neural network models for new patients, is adapted for lightweight deployment, and is suitable for resource-constrained embedded terminals.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120678385B_ABST
    Figure CN120678385B_ABST
Patent Text Reader

Abstract

The application provides a cross-patient seizure prediction method, system and medium based on joint domain adaptation, wherein the method comprises: preprocessing electroencephalogram signals of a source domain and a target domain; calculating average covariance matrices of the preprocessed electroencephalogram signals of the source domain and the target domain respectively, and performing Euclidean alignment processing on the electroencephalogram signals of the corresponding domains based on the corresponding average covariance matrices; inputting the electroencephalogram signals subjected to the Euclidean alignment processing into a neural network for feature extraction; in a high-dimensional feature space, calculating a second-order Wasserstein distance between the source domain and the target domain, and defining the second-order Wasserstein distance as an unsupervised domain alignment loss L d ; introducing an improved Softmax classification loss L c , and imposing a nonlinear boundary adjustment on original scores of electroencephalogram signal samples on their real categories; taking L as a total loss function, L c + λ·L d , performing back propagation using an AdamW optimizer, and updating parameters of the neural network. The above method can improve the cross-patient adaptability and prediction performance of the neural network model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of epilepsy seizure prediction technology, and in particular to a cross-patient epilepsy seizure prediction method, system, and medium based on joint domain adaptation. Background Technology

[0002] Epilepsy is a neurological disorder caused by abnormal electrical discharges in the brain, leading to transient brain dysfunction. Monitoring and analyzing electroencephalograms (EEGs) are crucial for diagnosing epileptic seizures. Traditional methods for detecting epilepsy EEGs typically train specific models for each patient (patient-specific models). However, these methods show significant performance degradation when applied to new patients and fail to generalize effectively. This is primarily due to the non-stationarity of epileptic EEGs and the high degree of variation in EEG signal patterns among different patients. To improve the universality and clinical applicability of epilepsy EEG prediction models, transfer learning techniques have been introduced into epilepsy EEG analysis. Transfer learning utilizes existing patients' EEG data (source domain) to help analyze the EEG data of new target patients (target domain), effectively addressing the issue of characteristic differences in EEG signals across patients and improving the model's predictive performance on target patients.

[0003] However, current transfer learning techniques still have some problems: existing methods typically require a large amount of data from one or more source domains as training sets. Most cross-patient domain adaptation methods require abundant labeled samples from both the source and target domains. In practical clinical applications, it is often difficult to obtain sufficient labeled epileptic EEG signal samples for new patients. Furthermore, in epilepsy detection tasks, the number of positive samples (EEG signals during seizures) is far lower than the number of negative samples (EEG signals outside of seizures), which can easily lead to majority class bias during alignment or pseudo-labeling, resulting in decreased seizure detection accuracy. Simply aligning the feature distributions of the source and target domains may cause confusion between different class features, lacking clear discriminative constraints on the seizure category, leading to insufficient predictive performance of the model. Simultaneously, deep domain adaptation networks typically have a large number of parameters and high computational complexity, resulting in high deployment costs and difficulty in real-time operation on resource-constrained embedded devices. These problems lead to insufficient model training and decreased classification accuracy under conditions of limited clinical samples, making it difficult to effectively support the need for real-time online epileptic seizure prediction. Summary of the Invention

[0004] This invention aims to address the problems of low prediction accuracy, poor model generalization, and high deployment cost in existing cross-patient prediction of epilepsy EEG signals under limited sample conditions. It provides a cross-patient epilepsy seizure prediction method, system, and medium based on joint domain adaptation, which achieves effective transfer between the source and target domains under limited EEG signal sample conditions, thereby improving the cross-patient adaptability and prediction performance of neural network models.

[0005] To achieve the above objectives, the present invention proposes the following technical solution:

[0006] One aspect of this application proposes a cross-patient seizure prediction method based on joint domain adaptation, comprising the following steps:

[0007] Step 1: Preprocess the EEG signals from the source and target domains;

[0008] Step 2: Calculate the mean covariance matrix of the source domain and target domain EEG signals after processing in Step 1, and perform Euclidean alignment on the source domain EEG signals based on the mean covariance matrix of the source domain, and perform Euclidean alignment on the target domain EEG signals based on the mean covariance matrix of the target domain, and normalize the mean covariance matrices of the source domain and target domain EEG signals to identity matrices.

[0009] Step 3: Input the EEG signal after Euclidean alignment into the neural network for feature extraction to obtain a high-dimensional feature representation for subsequent analysis;

[0010] Step 4: In the high-dimensional feature space, calculate the second-order Wasserstein distance between the source and target domains to measure the distributional difference between them, and define the second-order Wasserstein distance as the unsupervised domain alignment loss L. d Unsupervised alignment of high-dimensional features is achieved by minimizing the domain alignment loss;

[0011] Step 5: Introduce the improved Softmax classification loss L c By applying a nonlinear boundary adjustment to the original scores of EEG signal samples on their true categories, a strict classification discrimination boundary is achieved.

[0012] Step 6: Use L as the overall loss function, L = L c +λ·L d λ is the classification loss L used to balance the classification loss. c Domain alignment loss L d The hyperparameters are determined, and backpropagation is performed using the AdamW optimizer to update the parameters of the neural network.

[0013] In some embodiments, in step 1, the preprocessing includes bandpass filtering, power frequency notch filtering, normalization, and category balancing; the category balancing refers to undersampling the EEG signals during the interictal period to achieve a quantitative balance with the EEG signals during the preictal period.

[0014] In some embodiments, in step 2, the average covariance matrix of the source domain and target domain EEG signals is calculated using formula (1):

[0015]

[0016] Among them, X i Let i be the matrix of the i-th EEG signal sample. For X i The transpose of the matrix, where N is the total number of EEG signal samples;

[0017] Source domain EEG signal sample matrix X s Applying Euclidean alignment, we obtain X′ s :

[0018] X′ s =R s -1 / 2 X s (2)

[0019] For the target domain EEG signal sample matrix X t Applying Euclidean alignment, we obtain X′ t :

[0020] X′ t =R t -1 / 2 X t (3)

[0021] Among them, the source domain EEG signal sample matrix X s and the target domain EEG signal sample matrix X t All are known quantities, R s R represents the mean covariance matrix of the source domain EEG signals. t R represents the mean covariance matrix of the EEG signals in the target domain. s -1 / 2 and R t -1 / 2 It is the square root inverse of the corresponding matrix.

[0022] In some embodiments, in step 3, EEGNet or ConvNet is selected as the neural network model for feature extraction.

[0023] In some embodiments, in step 4, the second-order Wassstein distance domain alignment loss L d The formula is as follows:

[0024]

[0025] Where, μ s μ t Let |μ| be the mean of the features in the source domain and the target domain, respectively. s -μ t || 2 ∑ represents the squared Euclidean distance between the mean features of the source and target domains. s ,∑ tLet be the covariance matrices of the source and target domain features, respectively, and Tr(·) denote the trace operation of the matrix. 1 / 2 It represents the principal square root of a symmetric positive definite matrix.

[0026] In some embodiments, in step 5, the nonlinear boundary adjustment includes: when the original score is positive, scaling the original score and subtracting the boundary parameter; when the original score is non-positive, weighting and amplifying the original score and then subtracting the boundary parameter.

[0027] In some embodiments, F is defined i (c)* F represents the score of the i-th EEG signal sample after applying boundary adjustments to its true class c. i (c)* for:

[0028]

[0029] The improved Softmax classification loss function L c for:

[0030]

[0031] Among them, F i (c) and Let m and k represent the original scores of the i-th EEG signal sample in its true class c and other classes j, respectively. m≥1 and k≥0 are boundary control hyperparameters, and N is the total number of EEG signal samples.

[0032] In some embodiments, in step 6, during the parameter optimization process, the AdamW optimizer is used to perform backpropagation updates on the neural network parameters θ. The model parameters updated by backpropagation are:

[0033]

[0034] Where α represents the learning rate, G θ L(G) represents a neural network with parameter θ. θ ) represents the overall loss of the neural network with parameter θ. The gradient operator represents the gradient vector obtained by taking the partial derivatives with respect to all components of the parameter θ, and using the resulting gradient vector for backpropagation and updating of the parameter.

[0035] Another aspect of this application proposes a cross-patient epileptic seizure prediction system based on joint domain adaptation constructed using the above method, comprising:

[0036] The preprocessing module is used to preprocess the EEG signals in the source and target domains. The preprocessing includes bandpass filtering, power frequency notch filtering, normalization, and category balance processing. The category balance processing refers to undersampling the EEG signals during the interictal period to achieve a quantitative balance with the EEG signals during the preictal period.

[0037] The Euclidean alignment module is used to calculate the average covariance matrix of the source domain and target domain EEG signals after processing by the preprocessing module, and to perform Euclidean alignment processing on the source domain EEG signals based on the average covariance matrix of the source domain, and to perform Euclidean alignment processing on the target domain EEG signals based on the average covariance matrix of the target domain, thereby normalizing the average covariance matrices of the source domain and target domain EEG signals into identity matrices.

[0038] The EEG feature extraction module is used to input the EEG signal processed by the Euclidean alignment module into the neural network for feature extraction, so as to obtain a high-dimensional feature representation for subsequent analysis.

[0039] The feature alignment module is used to calculate the second-order Wassstein distance between the source and target domains in a high-dimensional feature space to measure the distributional difference between the two domains. The second-order Wassstein distance is defined as the unsupervised domain alignment loss L. d By minimizing the domain alignment loss L d Achieve unsupervised alignment of high-dimensional features;

[0040] The discriminative learning module is used to introduce the improved Softmax classification loss L. c By applying a nonlinear boundary adjustment to the original scores of EEG signal samples on their true categories, a strict classification discrimination boundary is achieved.

[0041] The overall loss optimization and update module is used to optimize and update the overall loss function, where L = L. c +λ·L d λ is the classification loss L used to balance the classification loss. c Domain alignment loss L d The hyperparameters are determined, and backpropagation is performed using the AdamW optimizer to update the parameters of the neural network.

[0042] This application also proposes a computer-readable storage medium storing computer program instructions that, when executed by a processor, perform the steps of the above-described cross-patient seizure prediction method based on joint domain adaptation.

[0043] The cross-patient seizure prediction method, system, and medium based on joint domain adaptation involved in this application can achieve the following:

[0044] Beneficial effects:

[0045] (1) Improve cross-patient prediction capability: This application constructs a cross-patient epileptic seizure prediction framework based on joint domain adaptation with universality and scalability. It combines the unsupervised domain alignment mechanism of Euclidean alignment and second-order Wasserstein distance to effectively alleviate the feature distribution difference between the source domain and the target domain. In addition, it enhances the inter-class discriminativeness and intra-class clustering of features with the improved Softmax classification loss. Even when the source domain and the target domain contain only a small number of labeled EEG signal samples, it can still achieve efficient prediction of epileptic EEG signals, significantly improving the generalization ability and robustness of the neural network model.

[0046] (2) Reduce the cost of data collection and labeling for custom neural network models for new patients: By using the joint optimization strategy of domain alignment loss and Softmax classification loss proposed in this application, only a small number of labeled EEG signal samples from the source and target domains are needed to complete the training of the neural network model. This fully meets the real dilemma of the difficulty in obtaining a large number of labeled EEG signals in the medical environment, significantly reduces the burden of patient data collection and manual labeling, reduces the manpower and time costs required for personalized customization of neural network models, and enhances the operability of the above methods in clinical applications.

[0047] (3) Adaptable to lightweight deployment and has good practicality: This application is designed as a general structure that can flexibly carry a variety of lightweight neural networks (such as EEGNet, ConvNet, etc.), with good modularity and compatibility. It can not only ensure the effectiveness of feature extraction, but also significantly reduce the number of parameters and computational overhead. It is suitable for resource-constrained embedded terminals and real-time epilepsy monitoring equipment, and has excellent engineering adaptability and application prospects. Attached Figure Description

[0048] Figure 1 A flowchart of a cross-patient epileptic seizure prediction method based on joint domain adaptation provided in an embodiment of the present invention.

[0049] Figure 2 This is a comparison chart of classification performance evaluation indicators for various patients under different neural network models, provided in the embodiments of the present invention. Detailed Implementation

[0050] To more clearly illustrate the objectives, technical solutions, and advantages of this invention, the invention will be described in detail below with reference to specific embodiments and accompanying drawings. It should be understood that the specific embodiments described herein are for illustrative purposes only and are not intended to limit the scope of protection of this invention.

[0051] In cross-patient EEG analysis, the distribution of EEG signals (especially the covariance structure) among different subjects often varies greatly, which reduces the generalization ability of general neural network models. Therefore, the cross-patient seizure prediction method based on joint domain adaptation involved in this application is needed to improve the generalization ability of neural network models.

[0052] like Figure 1 As shown, the cross-patient seizure prediction method based on joint domain adaptation involved in this application includes the following steps:

[0053] Step 1: Preprocess the EEG signals from the source and target domains.

[0054] The preprocessing includes bandpass filtering (0.5–70 Hz), power frequency notch filtering, normalization, and category balancing. Category balancing refers to undersampling the interictal EEG signals to achieve quantitative balance with the preictal EEG signals.

[0055] To alleviate the imbalance in the ratio of positive to negative samples in epileptic EEG signal samples, this application undersamples the interictal EEG signal samples to make their number equal to the number of preictal EEG signal samples. Specifically, the number N of preictal EEG signal samples in the target patient's EEG signal data is first counted. preictal Then, an equal number of EEG signal samples N were randomly selected from the interictal EEG signal samples. interictal N interictal =N preictal, This results in a class-balanced dataset.

[0056] Step 2: Calculate the average covariance matrix of the source and target domain EEG signals after processing in Step 1. Perform Euclidean alignment on the source domain EEG signals based on the average covariance matrix of the source domain, and perform Euclidean alignment on the target domain EEG signals based on the average covariance matrix of the target domain. Normalize the average covariance matrices of the source and target domain EEG signals to identity matrices.

[0057] Euclidean alignment was used to process the source and target domain EEG signals to unify the covariance structure of the two domains. Specifically, the average covariance matrix of the source and target domain EEG signals was calculated using formula (1) respectively:

[0058]

[0059] Among them, X i Let i be the matrix of the i-th EEG signal sample. For X i The transpose of , where N is the total number of EEG signal samples.

[0060] Subsequently, the source domain EEG signal sample matrix X was analyzed. s Applying Euclidean alignment (matrix whitening), we obtain X′. s :

[0061] X′ s =R s -1 / 2 X s (2)

[0062] For the target domain EEG signal sample matrix X t Applying Euclidean alignment, we obtain X′ t :

[0063] X′ t =R t -1 / 2 X t (3)

[0064] Among them, the source domain EEG signal sample matrix X s and the target domain EEG signal sample matrix X t All are known quantities, R s R represents the mean covariance matrix of the source domain EEG signals. t R represents the mean covariance matrix of the EEG signals in the target domain. s -1 / 2 and R t -1 / 2 It is the square root inverse of the corresponding matrix.

[0065] Step 3: Input the EEG signal after Euclidean alignment into the neural network G for feature extraction to obtain a high-dimensional feature representation for subsequent analysis.

[0066] Specifically, the EEG signal feature extraction strategy proposed in this application has good versatility and can be flexibly integrated into various neural network structures, including deep convolutional networks. To balance extraction efficiency and model lightweighting, this embodiment selects EEGNet and ConvNet as the neural network models for feature extraction. EEGNet employs a deep separable convolutional design, enabling efficient extraction of temporal and spatial features of EEG signals; ConvNet consists of convolutional layers, pooling layers, and fully connected layers, suitable for hierarchical extraction and classification of multi-level features. The aforementioned neural network models are compact in structure, have few parameters, and are easy to deploy in embedded devices. The EEG signal, after Euclidean alignment processing, is input into the neural network model G to extract high-dimensional features for subsequent classification.

[0067] Step 4: In the high-dimensional feature space, calculate the second-order Wasserstein distance between the source and target domains to measure the distributional difference between them, and define the second-order Wasserstein distance as the unsupervised domain alignment loss L. dBy minimizing the domain alignment loss L d Unsupervised alignment of high-dimensional features is achieved to guide the network in learning domain-invariant features.

[0068] Specifically, this application further utilizes the second-order Wasserstein distance to achieve high-dimensional feature distribution alignment between the source and target domains. This distance metric operates on the intermediate feature representations extracted by a lightweight feature extraction network (neural network), achieving unsupervised cross-domain feature alignment by measuring the differences between the source and target domains in second-order statistics such as mean and covariance. The second-order Wasserstein distance, based on optimal transport theory, has a clear physical interpretation—the energy required to migrate from the source domain feature distribution to the target domain distribution with "minimum cost"—and therefore provides a more complete and refined representation of distribution differences than metrics based solely on mean and variance. This metric method also belongs to the unsupervised feature alignment strategy, does not rely on target domain labels, and can achieve more refined and effective domain alignment in the intermediate feature space. This application minimizes this as the domain alignment loss, guiding the neural network model to learn EEG signal feature representations with domain invariance.

[0069] The formula for the second-order Wasserstein distance domain alignment loss is as follows:

[0070]

[0071] Where, μ s μ t Let |μ| be the mean of the features in the source domain and the target domain, respectively. s -μ t || 2 ∑ represents the squared Euclidean distance between the mean features of the source and target domains. s ,∑ t Let be the covariance matrices of the source and target domain features, respectively, and Tr(·) denote the trace operation of the matrix. 1 / 2 Let L represent the principal square root of a symmetric positive definite matrix. This is achieved by minimizing L... d This enables the network to learn consistent feature representations across patients.

[0072] Step 5: Introduce the improved Softmax classification loss L c By applying nonlinear boundary adjustments to the original scores of EEG signal samples on their true categories, a strict classification boundary is achieved, thereby enhancing the discriminative power between categories and improving the feature aggregation within categories, thus improving the discriminative power of neural network models in cross-domain scenarios.

[0073] Specifically, the adjusted score is transformed using different scaling factors and boundary parameters depending on whether the original score is positive or negative. The nonlinear boundary adjustment includes: when the original score is positive, scaling the original score and subtracting the boundary parameters to further increase the decision boundary distance between different categories; when the original score is negative, weighting and amplifying the original score and then subtracting the boundary parameters again to strengthen the discriminative power of the boundary. This strategy effectively enhances the separability of inter-class features and compresses the distribution of intra-class features, enabling the neural network model to have stronger discriminative performance in cross-domain applications such as transfer learning.

[0074] In multi-class classification tasks, the traditional Softmax loss function represents the predicted scores of each category in a probabilistic manner. However, when faced with similar distributions between classes or large differences between domains, its inter-class discriminative power is insufficient and its intra-class aggregation is weak, easily leading to feature confusion, especially in transfer learning scenarios. To address this, this application introduces an improved Softmax classification loss function with boundary adjustment capabilities. This loss function is an extension of the traditional Softmax, and its optimization objective remains cross-entropy loss. However, by applying a nonlinear boundary adjustment to the original scores of EEG signal samples in their true categories, an adaptive boundary mechanism is introduced, thereby improving feature discriminative power.

[0075] Specifically, let the feature vector output by the neural network be:

[0076] F i =G(X) i ;θ) (5)

[0077] Where G is the neural network, θ is the neural network parameter, and X... i Let F be the matrix of the i-th EEG signal sample. i F represents the feature vector output by the neural network for the i-th EEG signal sample. i (c) and F represents the raw scores of the i-th EEG signal sample in its true class c and other classes j, respectively. These raw scores are the linear outputs used for normalization calculation in the traditional Softmax loss, and have not yet undergone probability normalization or boundary adjustment. i (c)* F represents the score of the i-th EEG signal sample after applying boundary constraints to its true class c. i (c)* for:

[0078]

[0079] Where m≥1 and k≥0 are boundary control hyperparameters, and when m=1 and k=0, it degenerates into the original Softmax function.

[0080] When F i (c) When F > 0, the neural network scales the original score and subtracts the boundary parameters. The neural network needs stronger discriminative power to classify correctly, thus widening the decision boundary between classes and strengthening the separation of different categories; when F i (c) When the value is ≤0, the original score is weighted and amplified, and then the boundary parameter is subtracted to enhance its gradient response, so as to encourage it to move closer to the class center and improve the compactness within the class.

[0081] The improved Softmax classification loss function L c for:

[0082]

[0083] Where N is the total number of EEG signal samples.

[0084] Step 6: Use L as the overall loss function, L = L c +λ·L d λ is the classification loss L used to balance the classification loss. c Domain alignment loss L d The hyperparameters are determined, and backpropagation is performed using the AdamW optimizer to update the parameters θ of the neural network.

[0085] Finally, this application will use the aforementioned second-order Wasserstein distance domain alignment loss L d Compared with the improved Softmax classification loss L c Joint optimization is performed, and the overall loss function is defined as follows:

[0086] L = L c +λ·L d (8)

[0087] Where λ is the classification loss L used to balance the classification loss. c Domain alignment loss L d Hyperparameters.

[0088] During parameter optimization, this application uses the AdamW optimizer to update the neural network model parameters θ through backpropagation. The model parameters updated by backpropagation are:

[0089]

[0090] Where α represents the learning rate, G θ L(G) represents a neural network with 0 as a parameter. θ ) represents the overall loss of the neural network with parameter θ. The gradient operator θ represents the gradient vector obtained by taking the partial derivatives with respect to all components of the parameter θ, and using this gradient vector for backpropagation and parameter updates. Through this method, the parameters of the neural network with θ as the parameter will be continuously optimized during the process of minimizing the overall loss, eventually converging to a parameter state that possesses both good discriminative ability and strong cross-domain generalization ability, making it suitable for epilepsy EEG signal prediction tasks in the target domain.

[0091] To verify the effectiveness of the cross-patient epileptic seizure prediction method based on joint domain adaptation proposed in this application, the embodiment uses the publicly available CHB-MIT epilepsy EEG dataset for cross-patient classification experiments. Specifically, this embodiment selects data from 13 patients (chb01, chb02, chb03, chb05, chb09, chb10, chb13, chb14, chb18, chb19, chb20, chb21, chb23) in the dataset as the target domain, and selects data from one patient (chb11) as the source domain.

[0092] EEG signals within 30 minutes before a seizure are defined as pre-seizure EEG signals, and EEG signals from one hour after the end of a seizure to one hour before the start of the next seizure are defined as interictal EEG signals. All EEG signals are first preprocessed with bandpass filtering (0.5–70 Hz), power line interference removal, and normalization. Then, a sliding window is used to segment the signals into non-overlapping segments of 5 seconds each. A balanced dataset is obtained using the class balancing method proposed in this application, and then 10% of the data samples are randomly downsampled from the balanced dataset.

[0093] During the neural network model training process, the source domain (chb11) was used as the training reference domain, while the target domain used only a small number of labeled EEG signals from the current patient for each iteration, for joint domain adaptation training. Accuracy, sensitivity, and specificity were used as evaluation metrics for the neural network model, and the model was tested on the remaining target domain data. The experiment was repeated five times, and the average was taken. The experimental results of the example are shown in Table 1. Figure 2 A comparison chart of classification performance evaluation indicators for each patient under different neural network models provided in the embodiments of this application.

[0094] See Table 1 and Figure 2As can be seen, the joint domain adaptation strategy introduced in this application significantly improves classification performance on the EEGNet model. Compared with the original EEGNet model, with the same number of parameters (only 4,600), the accuracy is improved by 8.80%, the sensitivity by 13.83%, and the specificity by 3.73%. On the ConvNet model, after introducing joint domain adaptation, the accuracy is improved by 6.44%, the sensitivity by 6.25%, and the specificity by 6.30%, showing the same significant performance gain.

[0095] Table 1 Comparison of classification performance evaluation indicators for each patient under different neural network models

[0096]

[0097] The results in summary show that the joint domain adaptation mechanism proposed in this application exhibits significant performance improvements on different neural network structures, significantly enhances the ability of neural network models to recognize epileptic seizure signals, and balances classification accuracy with model lightweightness, thus demonstrating good prospects for widespread application.

[0098] The cross-patient seizure prediction system based on joint domain adaptation provided in this application includes:

[0099] The preprocessing module is used to preprocess the EEG signals from the source and target domains. The preprocessing includes bandpass filtering (0.5–70 Hz), power frequency notch filtering, normalization, and category balancing. The category balancing process involves undersampling the interictal EEG signals to achieve a quantitative balance with the preictal EEG signals.

[0100] The Euclidean alignment module is used to calculate the average covariance matrix of the source domain and target domain EEG signals after processing by the preprocessing module, and to perform Euclidean alignment processing on the source domain EEG signals based on the average covariance matrix of the source domain, and to perform Euclidean alignment processing on the target domain EEG signals based on the average covariance matrix of the target domain, thereby normalizing the average covariance matrices of the source domain and target domain EEG signals into identity matrices.

[0101] The EEG feature extraction module is used to input the EEG signal processed by the Euclidean alignment module into the neural network G for feature extraction, so as to obtain a high-dimensional feature representation for subsequent analysis.

[0102] The feature alignment module is used to calculate the second-order Wassstein distance between the source and target domains in a high-dimensional feature space to measure the distributional difference between the two domains. The second-order Wassstein distance is defined as the unsupervised domain alignment loss L. d By minimizing the domain alignment loss L dUnsupervised alignment of high-dimensional features is achieved to guide the network in learning domain-invariant features.

[0103] The discriminative learning module is used to introduce the improved Softmax classification loss L. c By applying nonlinear boundary adjustments to the original scores of EEG signal samples on their true categories, a strict classification boundary is achieved, thereby enhancing the discriminative power between categories and improving the feature aggregation within categories, thus improving the discriminative power of the neural network model.

[0104] The overall loss optimization and update module is used to optimize and update the overall loss function, where L = L. c +λ·L d λ is the classification loss L used to balance the classification loss. c Domain alignment loss L d The hyperparameters are determined, and backpropagation is performed using the AdamW optimizer to update the parameters θ of the neural network, resulting in a more generalized EEG classification neural network model.

[0105] In addition, this application also provides a computer-readable storage medium having stored thereon computer program instructions that, when executed by a processor, perform any or all of the steps in the joint domain adaptation-based cross-patient seizure prediction method as described above.

[0106] The storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random Access Memory (SRAM), Erasable Programmable Read-Only Memory (EPROM), Programmable Red-Only Memory (PROM), Read-Only Memory (ROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), magnetic storage, flash memory, magnetic disk, or optical disk.

[0107] It should be understood that the above specific embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit the scope of protection of the present invention. For those skilled in the art, various equivalent substitutions and modifications can be made to the technical solutions of the present invention without departing from the spirit and substance of the present invention, and all such equivalent forms should fall within the scope of protection of the present invention.

Claims

1. A cross-patient seizure prediction method based on joint domain adaptation, characterized in that: Includes the following steps: Step 1: Preprocess the EEG signals from the source and target domains; Step 2: Calculate the mean covariance matrix of the source domain and target domain EEG signals after processing in Step 1, and perform Euclidean alignment on the source domain EEG signals based on the mean covariance matrix of the source domain, and perform Euclidean alignment on the target domain EEG signals based on the mean covariance matrix of the target domain, and normalize the mean covariance matrices of the source domain and target domain EEG signals to identity matrices. Step 3: Input the EEG signal after Euclidean alignment into the neural network for feature extraction to obtain a high-dimensional feature representation for subsequent analysis; Step 4: In the high-dimensional feature space, calculate the second-order Wasserstein distance between the source and target domains to measure the distributional difference between them, and define the second-order Wasserstein distance as the unsupervised domain alignment loss. Unsupervised alignment of high-dimensional features is achieved by minimizing the domain alignment loss; where the second-order Wasserstein distance domain alignment loss is used. The formula is as follows: (4) in, , These are the mean values ​​of the features in the source and target domains, respectively. This represents the squared Euclidean distance between the mean features of the source and target domains. , Let be the covariance matrices of the features of the source domain and the target domain, respectively. Represents the trace operation of a matrix. Represents the principal square root of a symmetric positive definite matrix; Step 5: Introduce the improved Softmax classification loss. By applying a nonlinear boundary adjustment to the original scores of EEG signal samples on their true categories, a strict classification discrimination boundary is achieved. Step 6, with As the overall loss function, , To balance classification loss Domain alignment loss The hyperparameters are determined, and backpropagation is performed using the AdamW optimizer to update the parameters of the neural network.

2. The method according to claim 1, characterized in that: In step 1, the preprocessing includes bandpass filtering, power frequency notch filtering, normalization, and category balancing. The category balancing refers to undersampling the EEG signals during the interictal period to achieve a quantitative balance with the EEG signals during the preictal period.

3. The method according to claim 1, characterized in that: In step 2, the average covariance matrix of the source domain and target domain EEG signals is calculated using formula (1): (1) in, For the first A matrix of EEG signal samples, for The transpose of the matrix, The total number of EEG signal samples; Source domain EEG signal sample matrix Applying Euclidean alignment, we obtain : (2) Target domain EEG signal sample matrix Applying Euclidean alignment, we obtain : (3) Among them, the source domain EEG signal sample matrix and the target domain EEG signal sample matrix All are known quantities. This represents the mean covariance matrix of the source domain EEG signals. This represents the mean covariance matrix of the EEG signals in the target domain. and It is the square root inverse of the corresponding matrix.

4. The method according to claim 1, characterized in that: In step 3, EEGNet or ConvNet is selected as the neural network model for feature extraction.

5. The method according to claim 1, characterized in that: In step 5, the nonlinear boundary adjustment includes: when the original score is positive, scaling the original score and subtracting the boundary parameter; when the original score is non-positive, weighting and amplifying the original score and then subtracting the boundary parameter.

6. The method according to claim 5, characterized in that: definition Indicates the first A sample of EEG signal in its true category The score after applying boundary adjustments for: (6) The improved Softmax classification loss function for: (7) in, and They represent the first A sample of EEG signal in its true category Other categories The original score on For boundary control hyperparameters, This represents the total number of EEG signal samples.

7. The method according to claim 1, characterized in that: In step 6, during the parameter optimization process, the AdamW optimizer is used to optimize the neural network parameters. Perform backpropagation to update the model parameters. The model parameters updated via backpropagation are: (9) in, Indicates the learning rate. Indicates Neural networks with parameters For the purposes of the above The overall loss of a neural network with parameters, For gradient operators, it means that with respect to parameters The partial derivatives of all components are taken separately, and the resulting gradient vector is used for backpropagation and parameter update.

8. A cross-patient epileptic seizure prediction system based on joint domain adaptation constructed according to the method of any one of claims 1 to 7, characterized in that: include: The preprocessing module is used to preprocess the EEG signals in the source and target domains. The preprocessing includes bandpass filtering, power frequency notch filtering, normalization, and category balance processing. The category balance processing refers to undersampling the EEG signals during the interictal period to achieve a quantitative balance with the EEG signals during the preictal period. The Euclidean alignment module is used to calculate the average covariance matrix of the source domain and target domain EEG signals after processing by the preprocessing module, and to perform Euclidean alignment processing on the source domain EEG signals based on the average covariance matrix of the source domain, and to perform Euclidean alignment processing on the target domain EEG signals based on the average covariance matrix of the target domain, thereby normalizing the average covariance matrices of the source domain and target domain EEG signals into identity matrices. The EEG feature extraction module is used to input the EEG signal processed by the Euclidean alignment module into the neural network for feature extraction, so as to obtain a high-dimensional feature representation for subsequent analysis. The feature alignment module is used to calculate the second-order Wassstein distance between the source and target domains in a high-dimensional feature space to measure the distributional difference between the two domains, and defines the second-order Wassstein distance as the unsupervised domain alignment loss. By minimizing the domain alignment loss Achieve unsupervised alignment of high-dimensional features; The discriminative learning module is used to introduce an improved Softmax classification loss. By applying a nonlinear boundary adjustment to the original scores of EEG signal samples on their true categories, a strict classification discrimination boundary is achieved. The overall loss optimization and update module is used to optimize and update the overall loss. As the overall loss function, , To balance classification loss Domain alignment loss The hyperparameters are determined, and backpropagation is performed using the AdamW optimizer to update the parameters of the neural network.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer program instructions that, when executed by a processor, perform the steps of the cross-patient seizure prediction method based on joint domain adaptation as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Epileptic seizure prediction device, terminal device and computer readable storage medium

    CN110477910A

  • Time-varying electroencephalogram feature extraction method based on domain self-adaption

    CN112426161A