Training method, device and equipment of nssi prediction model based on micro-state sequence

By constructing a training network to extract microstate templates and segment EEG data, and optimizing the feature extraction and classification process, the problem of inaccurate NSSI behavior prediction in existing technologies is solved, and higher accuracy and robustness of NSSI prediction are achieved.

CN121416054BActive Publication Date: 2026-04-07SHENZHEN UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-12-29
Publication Date
2026-04-07

AI Technical Summary

Technical Problem

Existing technologies cannot effectively extract stable neurobiomarkers related to non-suicidal self-harm behaviors from EEG signals, resulting in inaccurate prediction of NSSI behavior, and the models are prone to overfitting, have low training efficiency, and are difficult to identify subtle neurodynamic differences.

Method used

By constructing a training network, including a feature extraction module, a classification module, a domain discriminator, and a consistency learning module, microstate templates are extracted and block-based processing is performed on EEG data samples. The feature extraction and classification processes are optimized by combining a gradient inversion layer and a contrastive learning loss.

Benefits of technology

It improves the prediction accuracy and robustness of the NSSI prediction model, enabling it to more effectively identify non-suicidal self-harm behaviors and reducing the model's sensitivity to noise and individual baseline differences.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121416054B_ABST
    Figure CN121416054B_ABST
Patent Text Reader

Abstract

This invention relates to the field of software technology and provides a training method, apparatus, and device for an NSSI prediction model. The method includes: extracting microstate templates and performing inverse fitting on EEG data samples to obtain an initial microstate sequence; dividing the initial microstate sequence into blocks to obtain a first block sequence; weakly and strongly shuffling the first block sequence to obtain second and third block sequences, respectively; extracting features from the first, second, and third block sequences to obtain first, second, and third feature vectors; classifying the first feature vector for a disease and calculating the classification loss; classifying the first feature vector for a domain and calculating the domain classification loss; calculating the consistency loss based on the predicted category labels of the first and third feature vectors; combining the first and second feature vectors; combining the first and third feature vectors; calculating the contrastive learning loss based on the combined feature vectors; and updating the model parameters based on the calculated losses.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application belongs to the technical field of software, and particularly relates to a training method and device of a NSSI prediction model based on micro-state sequences and equipment. BACKGROUND

[0002] Depression is a common mental disorder characterized by persistent low mood, decreased interest, and impaired cognitive function, and has become one of the important reasons for disability and disease burden. Early and objective identification and intervention of non-suicidal self-injury (NSSI) behavior in adolescent depression patients is crucial. Existing research shows that individuals with non-suicidal self-injury behavior have abnormalities in physiological pain perception and social pain processing. For example, they often show increased thresholds and tolerance to physiological pain, and have stronger emotional responses and abnormal activation of specific brain regions (such as the medial prefrontal cortex and ventrolateral prefrontal cortex) to negative social emotional stimuli such as social exclusion. This suggests that there is a specific neurophysiological basis behind non-suicidal self-injury behavior.

[0003] Electroencephalography (EEG) is widely used in the study of neural mechanisms and auxiliary diagnosis of mental disorders due to its high temporal resolution and non-invasive nature. EEG microstate is considered to be a stable state that characterizes the dynamic activity of large-scale functional networks in the brain on a millisecond time scale. The dynamics of its time series (such as duration, probability of occurrence, transition patterns, etc.) can reflect the information processing process of the brain. Previous studies have reported abnormal patterns of EEG microstate in mental disorders such as depression and non-suicidal self-injury behavior.

[0004] In existing technologies, researchers have attempted to use EEG signals combined with machine learning methods to identify non-suicidal self-injury behavior. For example, some studies have used support vector machines, random forests, or convolutional neural networks to classify based on the time-frequency features, functional connectivity, or statistical parameters of microstate of EEG. However, these existing technical solutions have obvious limitations: first, directly processing raw multi-channel EEG signal data has high dimensionality and high noise interference, making the model prone to overfitting and low training efficiency; second, traditional models (such as standard Transformer) typically calculate based on a single time step when processing discrete functional state sequences such as microstate, without fully considering the discrete dynamic characteristics of microstate sequences composed of relatively stable "state blocks" and "switching points", making it difficult to effectively capture the functional network switching patterns related to pathology; third, the model is easily disturbed by non-specific factors such as individual baseline differences and acquisition noise, and has limited ability to identify subtle neurodynamic differences between non-suicidal self-injury behavior and simple depression, resulting in insufficient classification accuracy and robustness.

[0005] Therefore, there is an urgent need in this field for a technical solution that can more effectively extract stable neurobiomarkers associated with non-suicidal self-harm behavior from EEG signals and achieve high-precision and robust identification. Summary of the Invention

[0006] The purpose of this invention is to provide a training method, apparatus, and device for an NSSI prediction model based on microstate sequences, aiming to solve the problem of inaccurate NSSI behavior prediction caused by the inability of existing technologies to provide an effective NSSI prediction model.

[0007] In a first aspect, the present invention provides a training method for an NSSI prediction model based on micro-state sequences. The NSSI prediction model is trained using a pre-constructed training network, which includes a feature extraction module, a classification module, a domain discriminator, and a consistency learning module. The NSSI prediction model includes the feature extraction module and the classification module. The training method includes the following steps:

[0008] Microstate templates are extracted and inverse fitting is performed on the EEG data samples in the EEG data sample group to obtain the initial microstate time series of the EEG data samples.

[0009] The initial microstate time series is divided into blocks to obtain the first block time series. The first block time series is then weakly and strongly shuffled to obtain the second block time series and the third block time series, respectively.

[0010] The first, second, and third time series blocks are input into the feature extraction module, and the feature extraction module performs feature extraction on the first, second, and third time series blocks to obtain the corresponding first, second, and third feature vectors.

[0011] The first feature vector is input into the classification module, and the classification module performs disease classification on the first feature vector to obtain the disease classification result. Based on the disease classification result and disease label of the labeled sample, the disease classification loss of the labeled sample is calculated.

[0012] The first feature vector is input into the domain discriminator through a gradient inversion layer. The domain discriminator performs domain classification on the first feature vector to obtain the domain classification result. Based on the domain classification result and the domain label, the domain classification loss is calculated.

[0013] The first and third feature vectors are input into the consistency learning module, and the consistency learning module performs binary classification on the first and third feature vectors to obtain the predicted class labels of the first and third feature vectors. Based on the predicted class labels and the true class labels, the consistency loss of the labeled samples is calculated.

[0014] The first and second feature vectors are combined to obtain a fourth feature vector, and a positive sample label is set for the fourth feature vector. The first and third feature vectors are combined to obtain a fifth feature vector, and a negative sample label is set for the fifth feature vector. The contrastive learning loss of the EEG data sample is calculated based on the fourth and fifth feature vectors.

[0015] Based on the calculated disease classification loss, domain classification loss, consistency loss, and contrastive learning loss, the parameters of the training network are updated, and the NSSI prediction model is trained again until the pre-training is completed to obtain the trained NSSI prediction model.

[0016] In some embodiments, the step of extracting microstate templates and performing inverse fitting processing on the EEG data samples in the EEG data sample group to obtain the initial microstate time series of the EEG data samples includes:

[0017] Calculate the global field power of all EEG data samples in the EEG data sample group at each time point, and select the EEG topology map corresponding to the peak value of the global field power.

[0018] The EEG topology is clustered once to obtain multiple initial microstate templates. Multiple optimal microstate templates are selected from the multiple initial microstate templates. The selected multiple optimal microstate templates are clustered a second time to obtain multiple final microstate templates.

[0019] The multiple final microstate templates are backfitted back to the EEG data samples to obtain the initial microstate time series of the EEG data samples.

[0020] In some embodiments, the step of backfitting the plurality of final microstate templates back to the EEG data samples to obtain the initial microstate time series of the EEG data samples includes:

[0021] For the EEG data samples, multi-channel scalp potential topology vectors are extracted at each time point, and the spatial correlation of polarity is calculated based on the scalp potential topology at each time point and multiple pre-obtained final microstate templates.

[0022] Based on the spatial correlation, a corresponding microstate category label is assigned to each time point to obtain the initial microstate label sequence corresponding to the EEG data sample. The initial microstate label sequence is then temporally smoothed to obtain the initial microstate time series.

[0023] In some embodiments, the step of inputting the first, second, and third time-series blocks into the feature extraction module, and extracting features from the first, second, and third time-series blocks through the feature extraction module to obtain corresponding first, second, and third feature vectors includes:

[0024] The first, second, and third time series blocks are embedded and mapped to obtain the sequence feature representations of the first, second, and third time series blocks;

[0025] A classification marker is added to the head of the sequence feature representation, and positional encoding is applied twice before and after each block of the sequence feature representation to obtain the corresponding positionally encoded block sequence.

[0026] The position-encoded block sequence is input into the Transformer encoder to obtain the corresponding first, second, and third feature vectors.

[0027] In some embodiments, the disease classification loss for labeled samples is calculated using the following formula:

[0028]

[0029] Where N represents the number of labeled samples, For the disease label of the i-th sample, The disease classification result for the i-th sample; and / or

[0030] The domain classification loss is calculated using the following formula:

[0031]

[0032] Where F(x) represents the output of the feature extraction module, x represents the block time series, and D represents the domain discriminator. This refers to the gradient inversion layer.

[0033] In some embodiments, the consistency loss of labeled samples is calculated using the following formula:

[0034]

[0035] in, N This indicates the number of labeled samples. This represents the actual category label. To represent the predicted category label.

[0036] In some embodiments, the contrastive learning loss of the EEG data samples is calculated using the following formula:

[0037]

[0038] Where D represents the number of channels, τ represents the temperature parameter, and sim() represents the calculation of cosine similarity. Represents the first eigenvector. Represents the third eigenvector. This represents the second eigenvector.

[0039] Secondly, the present invention provides an NSSI prediction method based on microstate sequences, the method comprising:

[0040] Microstate template extraction and inverse fitting are performed on the EEG data to obtain the initial microstate time series of the EEG data;

[0041] The initial microstate time series is divided into blocks to obtain block time series. The block time series is then input into a trained NSSI prediction model to obtain disease classification results. The NSSI prediction model is trained using any of the training methods described above.

[0042] Thirdly, the present invention provides a training device for an NSSI prediction model based on micro-state sequences. The NSSI prediction model is trained using a pre-constructed training network, which includes a feature extraction module, a classification module, a domain discriminator, and a consistency learning module. The NSSI prediction model includes the feature extraction module and the classification module. The device includes:

[0043] The sequence acquisition unit is used to extract microstate templates and perform inverse fitting on the EEG data samples in the EEG data sample group to obtain the initial microstate time series of the EEG data samples.

[0044] The sequence segmentation unit is used to segment the initial microstate time series into blocks to obtain a first segmented time series, and to perform weak and strong shuffling on the first segmented time series to obtain a second segmented time series and a third segmented time series respectively.

[0045] The feature extraction unit is used to input the first, second, and third block time series into the feature extraction module, and to extract features from the first, second, and third block time series through the feature extraction module to obtain the corresponding first, second, and third feature vectors.

[0046] The first loss calculation unit is used to input the first feature vector into the classification module, classify the first feature vector into diseases through the classification module, obtain the disease classification result, and calculate the disease classification loss of the labeled samples based on the disease classification result and the disease label.

[0047] The second loss calculation unit is used to input the first feature vector into the domain discriminator through the gradient reversal layer, classify the first feature vector into a domain through the domain discriminator, obtain the domain classification result, and calculate the domain classification loss based on the domain classification result and the domain label.

[0048] The third loss calculation unit is used to input the first and third feature vectors into the consistency learning module, perform binary classification on the first and third feature vectors through the consistency learning module to obtain the predicted category labels of the first and third feature vectors, and calculate the consistency loss of the labeled samples based on the predicted category labels and the true category labels.

[0049] The fourth loss calculation unit is used to combine the first and second feature vectors to obtain a fourth feature vector, set a positive sample label for the fourth feature vector, combine the first and third feature vectors to obtain a fifth feature vector, set a negative sample label for the fifth feature vector, and calculate the contrastive learning loss of the EEG data sample based on the fourth and fifth feature vectors.

[0050] The parameter update unit is used to update the parameters of the training network based on the calculated disease classification loss, domain classification loss, consistency loss, and contrastive learning loss, and continue to train the NSSI prediction model until the pre-training is completed to obtain the trained NSSI prediction model.

[0051] Fourthly, the present invention also provides a computing device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the method described above.

[0052] In this embodiment of the invention, when training the NSSI prediction model, the initial microstate time series of the EEG data samples is divided into blocks to obtain the first block time series. The first block time series is then weakly and strongly shuffled to obtain the corresponding second and third block time series. A feature extraction module extracts features from the first, second, and third block time series to obtain the corresponding first, second, and third feature vectors. A classification module performs disease classification on the first feature vector to obtain the disease classification result, calculates the disease classification loss for labeled samples, and performs domain classification on the first feature vector using a domain discriminator to obtain the domain classification result. The domain classification loss is then calculated. The consistency learning module performs binary classification on the first and third feature vectors to obtain the predicted class labels of the first and third feature vectors. The consistency loss of the labeled samples is calculated. The first and second feature vectors are combined to obtain the fourth feature vector, and a positive sample label is set for the fourth feature vector. The first and third feature vectors are combined to obtain the fifth feature vector, and a negative sample label is set for the fifth feature vector. Based on the fourth and fifth feature vectors, the contrastive learning loss of the EEG data samples is calculated. Based on the calculated loss, the parameters of the training network are updated, and finally the trained NSSI prediction model is obtained, which improves the prediction accuracy of the trained NSSI prediction model. Attached Figure Description

[0053] Figure 1 This is a flowchart illustrating a training method for an NSSI prediction model based on microstate sequences provided in an embodiment of the present invention.

[0054] Figure 2 This is a flowchart illustrating step S101 in the training method of the NSSI prediction model based on microstate sequences provided in an embodiment of the present invention.

[0055] Figure 3 This is a flowchart illustrating step S103 in the training method of the NSSI prediction model based on microstate sequences provided in an embodiment of the present invention.

[0056] Figure 4 This is a flowchart illustrating an embodiment of the NSSI prediction method based on microstate sequences provided by the present invention.

[0057] Figure 5 This is a schematic diagram of the structure of a training device for an NSSI prediction model based on microstate sequences provided in an embodiment of the present invention.

[0058] Figure 6 This is a schematic diagram of the structure of a computing device provided in an embodiment of the present invention. Detailed Implementation

[0059] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.

[0060] It should be understood that, when used in this specification and the appended claims, the term "comprising" indicates the presence of the described feature, integral, step, operation, element, and / or component, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components, and / or collections thereof. Furthermore, the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the invention. As used in this specification and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms unless the context clearly indicates otherwise. The terms "first," "second," and similar words do not indicate any order, quantity, or importance, but are merely used to distinguish different components. Words such as "connected" or "linked" are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. "Above," "below," "left," "right," etc., are used only to indicate relative positional relationships, which may change accordingly when the absolute position of the described object changes.

[0061] To keep the following description of the embodiments of the present invention clear and concise, detailed descriptions of some known functions and known components are omitted in this specification.

[0062] The specific implementation of the present invention will be described in detail below with reference to specific embodiments:

[0063] Please see Figure 1 , Figure 1 This paper illustrates the implementation flow of a training method for an NSSI prediction model based on micro-state sequences according to an embodiment of the present invention. This embodiment is applicable to computing devices, such as personal computers and servers, to train the NSSI prediction model on the computing device using a pre-built training network. The training network includes a feature extraction module, a classification module, a domain discriminator, and a consistency learning module. The NSSI prediction model includes a feature extraction module and a classification module. For ease of explanation, only the parts relevant to this embodiment are shown below, detailed as follows:

[0064] In step S101, microstate template extraction and inverse fitting are performed on the EEG data samples in the EEG data sample group to obtain the initial microstate time series of the EEG data samples.

[0065] In this embodiment of the invention, during each training session, the NSSI prediction model is pre-trained using EEG data samples from a batch of EEG data samples. The batch of EEG data samples includes labeled source domain EEG data samples and unlabeled target domain EEG data samples. The unlabeled target domain EEG data samples can train the network's generalization and robustness across datasets. Specifically, the EEG data samples can be electroencephalograms (EEGs). As an example, the labeled source domain EEG data samples and the unlabeled target domain EEG data samples can contain two labels: Depression with NSSI (DN+) and Depression without NSSI (DN-).

[0066] In step S102, the initial microstate time series is divided into blocks to obtain the first block time series. The first block time series is then weakly and strongly shuffled to obtain the second block time series and the third block time series.

[0067] In this embodiment of the invention, the initial microstate time series is patched according to a preset window width and step size to obtain the first patch time series. Specifically, the initial microstate time series can be divided into multiple patches according to a window width of 50 and a step size of 50, thereby perfectly matching the "discrete functional unit" characteristic of the microstate time series, ensuring the information integrity of the same microstate patch, allowing the NSSI prediction model to focus on the "regularity at the functional unit level" and avoid being disturbed by redundant information of a single time step.

[0068] Subsequently, the first block time series is subjected to weak and strong shuffling to obtain the corresponding second and third block time series. Weak shuffling involves shuffling blocks in the first block time series that are fewer than a first preset value (e.g., shuffling 1-3 blocks) to preserve most of the pathological microstate transition patterns in the initial microstate time series. Strong shuffling involves shuffling blocks in the first block time series that are more than a second preset value, effectively disrupting the pathological transition patterns of the initial microstate time series.

[0069] In step S103, the first, second, and third block time series are input into the feature extraction module, and the feature extraction module performs feature extraction on the first, second, and third block time series to obtain the corresponding first, second, and third feature vectors.

[0070] In this embodiment of the invention, the first, second, and third time series blocks are respectively input into the feature extraction module. The feature extraction module extracts features from the first, second, and third time series blocks to obtain the corresponding first, second, and third feature vectors for subsequent training.

[0071] In step S104, the first feature vector is input into the classification module, and the classification module performs disease classification on the first feature vector to obtain the disease classification result. Based on the disease classification result of the labeled sample and the disease label, the disease classification loss of the labeled sample is calculated.

[0072] In step S105, the first feature vector is input into the domain discriminator through the gradient inversion layer. The domain discriminator performs domain classification on the first feature vector to obtain the domain classification result. Based on the domain classification result and the domain label, the domain classification loss is calculated.

[0073] In this invention, the gradient inversion layer does not change the features during forward propagation. Thus, the first feature vector is input into the domain discriminator through the gradient inversion layer (GRL), and the domain discriminator performs domain classification (binary classification) on the first feature vector to obtain the domain classification result, i.e., the source domain or the target domain. When updating the parameters of the feature extraction module later, the gradient of the domain classification loss is inverted, so that the feature extraction module updates in the direction of "domain indistinguishability".

[0074] In step S106, the first and third feature vectors are input into the consistency learning module. The consistency learning module performs binary classification on the first and third feature vectors to obtain the predicted class labels of the first and third feature vectors. Based on the predicted class labels and the true class labels, the consistency loss of the labeled samples is calculated.

[0075] In this embodiment of the invention, the initial microstate time series may contain non-pathological information such as individual baseline differences and EEG acquisition noise (e.g., occasional microstate type labeling errors). This information may still be partially retained after strong scrambling (e.g., the proportion of microstate types corresponding to individual baseline differences may remain unchanged). Consistency loss enables the NSSI prediction model to realize that "the information retained after strong scrambling cannot distinguish the authenticity of the original sequence," thus actively ignoring this redundant information and focusing only on the core pathological features for learning. Specifically, the consistency learning module predicts the category labels of the block time series corresponding to the first and third feature vectors. For example, if 0 represents the original sequence and 1 represents the strongly permuted sequence, then the true category labels of the first and third feature vectors are 0 and 1, respectively.

[0076] In some embodiments, the consistency learning module can be a single-layer, unidirectional LSTM (Long Short-Term Memory) network. Specifically, the consistency loss for labeled samples can be calculated using the following formula:

[0077]

[0078] in, N This indicates the number of labeled samples. Indicates the true category label, This represents the predicted category label.

[0079] In step S107, the first and second feature vectors are combined to obtain the fourth feature vector, and a positive sample label is set for the fourth feature vector. The first and third feature vectors are combined to obtain the fifth feature vector, and a negative sample label is set for the fifth feature vector. Based on the fourth and fifth feature vectors, the contrastive learning loss of the EEG data samples is calculated.

[0080] In this embodiment of the invention, the first and second feature vectors are combined to obtain a fourth feature vector, and a positive sample label is set for the fourth feature vector. The first and third feature vectors are combined to obtain a fifth feature vector, and a negative sample label is set for the fifth feature vector. By maximizing the mutual information between positive sample pairs and minimizing the similarity between negative sample pairs, the pathological specific features related to NSSI in EEG data samples are learned. This allows the NSSI prediction model to actively focus on the pathological specific features related to NSSI that are preserved in weak scrambling and destroyed in strong scrambling, making the originally ambiguous classification boundaries clear.

[0081] In some embodiments, the contrastive learning loss of EEG data samples is calculated using the following formula:

[0082]

[0083] Where D represents the number of channels, τ represents the temperature parameter, and sim() represents the calculation of cosine similarity. Represents the first eigenvector. Represents the third eigenvector. Let represent the second feature vector. In this way, the parameters of the feature extraction module can be optimized by minimizing the contrastive learning loss.

[0084] In step S108, the parameters of the training network are updated based on the calculated disease classification loss, domain classification loss, consistency loss, and contrastive learning loss. The NSSI prediction model is then trained until the pre-training is completed, resulting in the trained NSSI prediction model.

[0085] In this embodiment of the invention, when training the NSSI prediction model, the initial microstate time series of the EEG data samples is divided into blocks to obtain a first block time series. The first block time series is then weakly and strongly shuffled to obtain corresponding second and third block time series. A feature extraction module extracts features from the first, second, and third block time series to obtain corresponding first, second, and third feature vectors. A classification module performs disease classification on the first feature vector to obtain the disease classification result. The disease classification loss for labeled samples is calculated. A domain discriminator performs domain classification on the first feature vector to obtain the domain classification result, and the domain classification loss is calculated. The consistency learning module performs binary classification on the first and third feature vectors to obtain the predicted class labels of the first and third feature vectors. The consistency loss of the labeled samples is calculated. The first and second feature vectors are combined to obtain the fourth feature vector, and a positive sample label is assigned to the fourth feature vector. The first and third feature vectors are combined to obtain the fifth feature vector, and a negative sample label is assigned to the fifth feature vector. Based on the fourth and fifth feature vectors, the contrastive learning loss of the EEG data samples is calculated. Based on the calculated loss, the parameters of the training network are updated, and finally the trained NSSI prediction model is obtained, which improves the prediction accuracy of the trained NSSI prediction model.

[0086] Please see Figure 2 , Figure 2 The implementation flow of step S101 in the above embodiments of the present invention is shown. For ease of explanation, only the parts related to the embodiments of the present invention are shown, and are described in detail below:

[0087] In step S201, the global field power of all EEG data samples in the EEG data sample group at each time point is calculated, and the EEG topology map corresponding to the peak of the global field power (GFP) is selected.

[0088] In step S202, the EEG topology map is clustered once to obtain multiple initial microstate templates. Multiple optimal microstate templates are selected from the multiple initial microstate templates. The selected multiple optimal microstate templates are clustered a second time to obtain multiple final microstate templates.

[0089] In step S203, multiple final microstate templates are backfitted back to the EEG data samples to obtain the initial microstate time series of the EEG data samples.

[0090] In this embodiment of the invention, when extracting microstate templates and performing inverse fitting on the EEG data samples in the EEG data sample group, the global field power of all EEG data samples in the EEG data sample group at each time point is calculated, the EEG topology map corresponding to the peak of the global field power is selected, and the EEG topology map is clustered once to obtain multiple initial microstate templates. Multiple optimal microstate templates are selected from the multiple initial microstate templates, and the selected multiple optimal microstate templates are clustered a second time to obtain multiple final microstate templates. Finally, the multiple final microstate templates are inversely fitted back to the EEG data samples to obtain the initial microstate time series of the EEG data samples. This compresses the original high-dimensional data of the whole-brain EEG topography map to low-dimensional temporal features. In addition, local noise is automatically filtered out by clustering the global field power peak, so that the NSSI prediction model does not need to process redundant information, thus improving training efficiency.

[0091] As an example, in the first clustering of the EEG topology, the clustering method is K-means clustering, where the number of clustering templates K=2:8, the number of random initializations is 2000, and the number of iterations is 5000, resulting in multiple initial microstate templates. Subsequently, based on high globally explained variance (GEV) and low cross-validation criteria (CV), multiple optimal microstate templates are selected from the multiple initial microstate templates for secondary clustering. The clustering method is the same as the first clustering, resulting in 8 optimal microstate templates.

[0092] In some embodiments, when backfitting multiple final microstate templates back to EEG data samples, a multi-channel scalp potential topology vector is extracted from the EEG data samples at each time point. The spatial correlation of polarity is calculated based on the scalp potential topology at each time point and the multiple pre-obtained final microstate templates. A corresponding microstate category label is assigned to each time point based on the spatial correlation to obtain the initial microstate label sequence corresponding to the EEG data sample. The initial microstate label sequence is then temporally smoothed to finally obtain the initial microstate time series.

[0093] Please see Figure 3 , Figure 3 The implementation flow of step S103 in the above embodiments of the present invention is shown. For ease of explanation, only the parts related to the embodiments of the present invention are shown, and are described in detail below:

[0094] In step S303, the first, second, and third block time series are embedded and mapped to obtain the sequence feature representations of the first, second, and third block time series;

[0095] In step S302, a classification marker is added to the head of the sequence feature representation, and positional encoding is applied twice before and after each block of the sequence feature representation to obtain the corresponding positionally encoded block sequence.

[0096] In step S303, the position-encoded block sequence is input into the Transformer encoder to obtain the corresponding first, second, and third feature vectors.

[0097] In this embodiment of the invention, the feature extraction module can be a patch-based Transformer backbone network. After receiving the first, second, and third patch time series, the feature extraction module embeds and maps the first, second, and third patch time series to obtain the sequence feature representations of the first, second, and third patch time series. A classification label is added to the head of the sequence feature representation to learn global and local features related to the micro-state time series. The module performs position encoding twice before and after each patch of the sequence feature representation to obtain the corresponding position-encoded patch sequence, thereby fully preserving the temporal regularity of each patch in the micro-state time series. Finally, the position-encoded patch sequence is input into the Transformer encoder to obtain the corresponding first, second, and third feature vectors.

[0098] In some embodiments, after obtaining the first feature vector, the first feature vector is input into the classification module, which performs disease classification on the first feature vector to obtain the disease classification result. The classification module can be a two-layer multilayer perceptron (MLP) network. When calculating the disease classification loss of labeled samples based on the disease classification result and disease label, the following formula is used:

[0099]

[0100] Where N represents the number of labeled samples, Let i be the disease label for the i-th sample. This represents the disease classification result for the i-th sample.

[0101] In some embodiments, after obtaining the first feature vector, the first feature vector is input into the domain discriminator through a gradient inversion layer. The domain discriminator performs domain classification on the first feature vector to obtain the domain classification result. Based on the domain classification result and the domain label, the domain classification loss is calculated, thereby reducing the distribution difference between the source domain and the target domain through domain adversarial loss. Specifically, the domain classification loss can be calculated using the following formula:

[0102]

[0103] Where F(x) represents the output of the feature extraction module, x represents the block time series, and D represents the domain discriminator. This indicates a gradient inversion layer.

[0104] See Figure 4 , Figure 4 The implementation flow of the NSSI prediction method based on microstate sequences provided by an embodiment of the present invention is illustrated. For ease of explanation, only the parts related to the embodiment of the present invention are shown, and are described in detail below:

[0105] In step S401, microstate template extraction and inverse fitting are performed on the EEG data to obtain the initial microstate time series of the EEG data;

[0106] In step S402, the initial microstate time series is divided into blocks to obtain block time series. The block time series is then input into the trained NSSI prediction model to obtain disease classification results.

[0107] In this embodiment of the invention, the NSSI prediction model is a model trained by any of the training methods described above, and the NSSI prediction model can accurately predict NSSI behavior.

[0108] See Figure 5 , Figure 5 The structure of a training device for an NSSI prediction model based on microstate sequences provided in an embodiment of the present invention is shown. For ease of explanation, only the parts related to the embodiment of the present invention are shown.

[0109] In this embodiment of the invention, the NSSI prediction model is trained using a pre-constructed training network, which includes a feature extraction module, a classification module, a domain discriminator, and a consistency learning module. The NSSI prediction model includes a feature extraction module and a classification module. The training device includes:

[0110] The sequence acquisition unit 51 is used to extract microstate templates and perform inverse fitting on the EEG data samples in the EEG data sample group to obtain the initial microstate time series of the EEG data samples.

[0111] The sequence segmentation unit 52 is used to segment the initial microstate time series into blocks to obtain the first block time series. The first block time series is weakly shuffled and strongly shuffled to obtain the second block time series and the third block time series respectively.

[0112] The feature extraction unit 53 is used to input the first, second, and third block time series into the feature extraction module, and to extract features from the first, second, and third block time series through the feature extraction module to obtain the corresponding first, second, and third feature vectors.

[0113] The first loss calculation unit 54 is used to input the first feature vector into the classification module, classify the first feature vector into diseases through the classification module, obtain the disease classification result, and calculate the disease classification loss of the labeled samples based on the disease classification result and the disease label.

[0114] The second loss calculation unit 55 is used to input the first feature vector into the domain discriminator through the gradient reversal layer, classify the first feature vector into the domain through the domain discriminator, obtain the domain classification result, and calculate the domain classification loss based on the domain classification result and the domain label.

[0115] The third loss calculation unit 56 is used to input the first and third feature vectors into the consistency learning module, perform binary classification on the first and third feature vectors through the consistency learning module to obtain the predicted class labels of the first and third feature vectors, and calculate the consistency loss of the labeled samples based on the predicted class labels and the true class labels.

[0116] The fourth loss calculation unit 57 is used to combine the first and second feature vectors to obtain the fourth feature vector, set a positive sample label for the fourth feature vector, combine the first and third feature vectors to obtain the fifth feature vector, set a negative sample label for the fifth feature vector, and calculate the contrastive learning loss of the EEG data sample based on the fourth and fifth feature vectors.

[0117] The parameter update unit 58 is used to update the parameters of the training network based on the calculated disease classification loss, domain classification loss, consistency loss, and contrastive learning loss, and to continue training the NSSI prediction model until the pre-training is completed, so as to obtain the trained NSSI prediction model.

[0118] In this embodiment of the invention, for the sake of convenience and brevity, only the division of the above-described functional units and modules is used as an example. In practical applications, the above functions can be allocated to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to achieve all or part of the functions described above. Each unit and module of the device can be implemented by corresponding hardware or software units. Each unit and module can be an independent hardware or software unit, or it can be integrated into a single hardware or software unit, which is not intended to limit the invention. In addition, the specific names of each functional unit and module are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the device can be referred to the corresponding description in the foregoing method embodiments, and will not be repeated here.

[0119] See Figure 6 , Figure 6The structure of a computing device provided in an embodiment of the present invention is shown. For ease of explanation, only the parts related to the embodiment of the present invention are shown.

[0120] The computing device 6 of this embodiment includes a processor 60, a memory 61, and a computer program 62 stored in the memory 61 and executable on the processor 60. When the processor 60 executes the computer program 62, it implements the steps described in the various method embodiments above, for example... Figure 1 Steps S101 to S108 are shown. Alternatively, when processor 60 executes computer program 62, it implements the functions of each unit in the above-described device embodiment, for example... Figure 5 The functions of units 51 to 58 are shown.

[0121] The computing device in this embodiment of the invention can be a personal computer or a server. When the processor 60 in the computing device 6 executes the computer program 62 to implement the above method, the steps implemented can be referred to the description of the foregoing method embodiments, and will not be repeated here.

[0122] The above embodiments are merely illustrative of the technical solutions of the present invention and are not intended to limit them. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that the scope of disclosure involved in the above embodiments is not limited to technical solutions formed by specific combinations of the above technical features, but should also cover other technical solutions formed by arbitrary combinations of the above technical features or their equivalent features without departing from the above-disclosed concept. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

[0123] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in sequential order. In certain circumstances, multitasking and parallel processing may be advantageous. Similarly, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of the invention. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.

Claims

1. A training method for an NSSI prediction model based on micro-state sequences, characterized in that, The NSSI prediction model is trained using a pre-built training network, which includes a feature extraction module, a classification module, a domain discriminator, and a consistency learning module. The NSSI prediction model includes the feature extraction module and the classification module. The training method includes the following steps: Microstate templates are extracted and inverse fitting is performed on the EEG data samples in the EEG data sample group to obtain the initial microstate time series of the EEG data samples. The initial microstate time series is divided into blocks to obtain the first block time series. The first block time series is then weakly and strongly shuffled to obtain the second block time series and the third block time series, respectively. The first, second, and third time series blocks are input into the feature extraction module, and the feature extraction module performs feature extraction on the first, second, and third time series blocks to obtain the corresponding first, second, and third feature vectors. The first feature vector is input into the classification module, and the classification module performs disease classification on the first feature vector to obtain the disease classification result. Based on the disease classification result and disease label of the labeled sample, the disease classification loss of the labeled sample is calculated. The first feature vector is input into the domain discriminator through a gradient inversion layer. The domain discriminator performs domain classification on the first feature vector to obtain the domain classification result. Based on the domain classification result and the domain label, the domain classification loss is calculated. The first and third feature vectors are input into the consistency learning module, and the consistency learning module performs binary classification on the first and third feature vectors to obtain the predicted class labels of the first and third feature vectors. Based on the predicted class labels and the true class labels, the consistency loss of the labeled samples is calculated. The first and second feature vectors are combined to obtain a fourth feature vector, and a positive sample label is assigned to the fourth feature vector. The first and third feature vectors are combined to obtain a fifth feature vector, and a negative sample label is assigned to the fifth feature vector. Based on the fourth and fifth feature vectors, a formula is used to... Calculate the contrastive learning loss for the EEG data samples, where D represents the number of channels, τ represents the temperature parameter, and sim() represents the calculation of cosine similarity. Represents the first eigenvector. Represents the third eigenvector. This represents the second eigenvector; Based on the calculated disease classification loss, domain classification loss, consistency loss, and contrastive learning loss, the parameters of the training network are updated, and the NSSI prediction model is trained again until the pre-training is completed to obtain the trained NSSI prediction model.

2. The method as described in claim 1, characterized in that, The steps of extracting microstate templates and performing inverse fitting on the EEG data samples in the EEG data sample group to obtain the initial microstate time series of the EEG data samples include: Calculate the global field power of all EEG data samples in the EEG data sample group at each time point, and select the EEG topology map corresponding to the peak value of the global field power. The EEG topology is clustered once to obtain multiple initial microstate templates. Multiple optimal microstate templates are selected from the multiple initial microstate templates. The selected multiple optimal microstate templates are clustered a second time to obtain multiple final microstate templates. The multiple final microstate templates are backfitted back to the EEG data samples to obtain the initial microstate time series of the EEG data samples.

3. The method as described in claim 2, characterized in that, The step of backfitting the multiple final microstate templates back to the EEG data samples to obtain the initial microstate time series of the EEG data samples includes: For the EEG data samples, multi-channel scalp potential topology vectors are extracted at each time point, and the spatial correlation of polarity is calculated based on the scalp potential topology at each time point and multiple pre-obtained final microstate templates. Based on the spatial correlation, a corresponding microstate category label is assigned to each time point to obtain the initial microstate label sequence corresponding to the EEG data sample. The initial microstate label sequence is then temporally smoothed to obtain the initial microstate time series.

4. The method as described in claim 1, characterized in that, The steps of inputting the first, second, and third time series blocks into the feature extraction module, and extracting features from the first, second, and third time series blocks through the feature extraction module to obtain the corresponding first, second, and third feature vectors include: The first, second, and third time series blocks are embedded and mapped to obtain the sequence feature representations of the first, second, and third time series blocks; A classification marker is added to the head of the sequence feature representation, and positional encoding is applied twice before and after each block of the sequence feature representation to obtain the corresponding positionally encoded block sequence. The position-encoded block sequence is input into the Transformer encoder to obtain the corresponding first, second, and third feature vectors.

5. The method as described in claim 4, characterized in that, The disease classification loss for labeled samples is calculated using the following formula: Where N represents the number of labeled samples, For the disease label of the i-th sample, The disease classification result for the i-th sample; and / or The domain classification loss is calculated using the following formula: Where F(x) represents the output of the feature extraction module, x represents the block time series, and D represents the domain discriminator. This refers to the gradient inversion layer.

6. The method as described in claim 1, characterized in that, The consistency loss of labeled samples is calculated using the following formula: in, N This indicates the number of labeled samples. This represents the actual category label. To represent the predicted category label.

7. A method for predicting NSSI based on microstate sequences, characterized in that, The method includes: Microstate template extraction and inverse fitting are performed on the EEG data to obtain the initial microstate time series of the EEG data; The initial microstate time series is divided into blocks to obtain block time series. The block time series is then input into a trained NSSI prediction model to obtain disease classification results. The NSSI prediction model is trained using the training method described in any one of claims 1 to 6.

8. A training device for an NSSI prediction model based on micro-state sequences, characterized in that, The NSSI prediction model is trained using a pre-constructed training network, which includes a feature extraction module, a classification module, a domain discriminator, and a consistency learning module. The NSSI prediction model includes the feature extraction module and the classification module. The device includes: The sequence acquisition unit is used to extract microstate templates and perform inverse fitting on the EEG data samples in the EEG data sample group to obtain the initial microstate time series of the EEG data samples. The sequence segmentation unit is used to segment the initial microstate time series into blocks to obtain a first segmented time series, and to perform weak and strong shuffling on the first segmented time series to obtain a second segmented time series and a third segmented time series respectively. The feature extraction unit is used to input the first, second, and third block time series into the feature extraction module, and to extract features from the first, second, and third block time series through the feature extraction module to obtain the corresponding first, second, and third feature vectors. The first loss calculation unit is used to input the first feature vector into the classification module, classify the first feature vector into diseases through the classification module, obtain the disease classification result, and calculate the disease classification loss of the labeled samples based on the disease classification result and the disease label. The second loss calculation unit is used to input the first feature vector into the domain discriminator through the gradient reversal layer, perform domain classification on the first feature vector through the domain discriminator, obtain the domain classification result, and calculate the domain classification loss based on the domain classification result and the domain label. The third loss calculation unit is used to input the first and third feature vectors into the consistency learning module, perform binary classification on the first and third feature vectors through the consistency learning module to obtain the predicted category labels of the first and third feature vectors, and calculate the consistency loss of the labeled samples based on the predicted category labels and the true category labels. The fourth loss calculation unit is used to combine the first and second feature vectors to obtain a fourth feature vector, assign a positive sample label to the fourth feature vector, combine the first and third feature vectors to obtain a fifth feature vector, assign a negative sample label to the fifth feature vector, and calculate the loss using the formula based on the fourth and fifth feature vectors. Calculate the contrastive learning loss for the EEG data samples, where D represents the number of channels, τ represents the temperature parameter, and sim() represents the calculation of cosine similarity. Represents the first eigenvector. Represents the third eigenvector. This represents the second eigenvector; The parameter update unit is used to update the parameters of the training network based on the calculated disease classification loss, domain classification loss, consistency loss, and contrastive learning loss, and continue to train the NSSI prediction model until the pre-training is completed to obtain the trained NSSI prediction model.

9. A computing device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Depression detection method based on scalp electroencephalogram signal cross-individual cross-scene difference

    CN118806297A

  • Training method of multi-concept identification network for electroencephalogram signal analysis

    CN119312145A