Classification model training method and device for brain function signal hidden variable dynamic representation
By preprocessing EEG signals and learning latent variable dynamic representations, the classification model parameters are optimized, solving the problem of low accuracy in emotion recognition of EEG signals in existing technologies. This enables efficient recognition and improved interpretability of emotions related to mental disorders such as depression.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- LANZHOU UNIV
- Filing Date
- 2025-02-06
- Publication Date
- 2026-07-24
AI Technical Summary
Existing technologies struggle to effectively mine the temporal features of EEG signals through static modeling, resulting in low accuracy in emotion recognition, particularly in identifying emotions related to mental disorders such as depression, where accuracy and interpretability are lacking.
EEG signals of subjects in a resting state were collected, preprocessed, and mapped to a standard brain template space. Through latent variable dynamic representation learning, long short-term memory network was used to decode and calculate training loss, and the network parameters of the classification model were optimized to improve the accuracy and interpretability of emotion recognition.
By mining the dynamic representation of unobservable latent variables in EEG signals, the accuracy of emotion recognition has been improved and better interpretability has been provided, especially with a significant improvement in recognizing emotions related to mental disorders such as depression.
Smart Images

Figure CN119949849B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of brain functional signal classification technology, and in particular to a classification model training method and apparatus for dynamic representation of latent variables of brain functional signals. Background Technology
[0002] Electroencephalogram (EEG) signals essentially reflect the spontaneous firing behavior of neuronal populations. Driven by brain activity and not easily controlled by conscious thought, EEG signals can serve as an objective basis for emotion classification. Some medical devices can collect EEG signals from subjects and analyze them based on static modeling to obtain the emotions represented by the EEG signals. However, this static modeling method struggles to uncover the temporal characteristics of EEG signals, resulting in low accuracy in emotion recognition.
[0003] In some studies, the subject's brain can be viewed as a dynamic system, and the neural activity generated by the brain can be driven by unobservable latent variables. This allows for modeling dynamic functional changes in the brain through the dynamic evolution of these latent variables. For example, the short-term dependency assumption (the change in state at the current moment depends only on the state at the previous moment) and the state exclusivity assumption (only a single latent state is active at each moment) from resting-state dynamics can be used to model and analyze the emotions corresponding to EEG signals.
[0004] However, emotions associated with mental disorders, such as depression, arise from a disruption of the brain's dynamic homeostasis, which can become further imbalanced over time. Therefore, heuristic data analysis methods, such as short-term dependency hypotheses and state-exclusive hypotheses, lack modeling of the data generation process and thus struggle to improve the accuracy of identifying emotions related to mental disorders like depression, and also lack interpretability for these emotions. Summary of the Invention
[0005] Some embodiments of this application provide a classification model training method and apparatus for dynamic representation of latent variables of brain functional signals, in order to solve the problems of weak accuracy and interpretability in identifying mental disorders such as depression based on electroencephalogram (EEG) signals.
[0006] In a first aspect, some embodiments of this application provide a method for training a classification model for dynamic representation of latent variables of brain functional signals, the method comprising:
[0007] Collect the first EEG signal; the first EEG signal is the EEG signal generated by the subject's EEG signal source in a resting state;
[0008] The first EEG signal is preprocessed to obtain a second EEG signal; the second EEG signal is a signal obtained by mapping the EEG signal source corresponding to the first EEG signal to a standard brain template space.
[0009] Latent variable dynamic representation learning is performed on the second EEG signal to obtain the latent variable dynamic representation of the second EEG signal;
[0010] The classification result of the EEG signal is determined based on the dynamic representation of the latent variables; and the first restored EEG signal is obtained by decoding the dynamic representation of the latent variables.
[0011] The training loss is calculated based at least on the first restored EEG signal, the EEG signal classification result, and the latent variable dynamic representation. The network parameters of the latent variable dynamic representation network are then optimized based on the training loss until the training loss is no greater than a preset loss value, thereby obtaining the optimal latent variable dynamic representation network.
[0012] In some feasible embodiments, the step of preprocessing the first EEG signal to obtain the second EEG signal includes:
[0013] The first EEG signal is subjected to notch filtering to obtain the first EEG signal located in the target frequency band;
[0014] Remove artifact signals from the first EEG signal located in the target frequency band;
[0015] Based on the resting-state experimental paradigm, triggers and delays were used to extract the eye-closed trial as a data segment from the first EEG signal after removing artifact signals, and the primary preprocessed EEG signal was determined based on the extracted eye-closed trial data segment.
[0016] The primary preprocessed EEG signal is mapped to a standard brain template space to obtain a second EEG signal.
[0017] In some feasible embodiments, the step of mapping the primary preprocessed EEG signal to a standard brain template space to obtain a second EEG signal includes:
[0018] Based on a pre-defined head model structure, a head model is constructed using anatomical images of the subject.
[0019] Based on the sensor coordinate file of the EEG cap, the sensor positions are calibrated and registered to the surface of the head model to achieve spatial mapping of the EEG signal recording positions;
[0020] The inverse problem is solved based on the forward model to obtain the localization result of the EEG signal source;
[0021] The localization results of the EEG signal source are mapped to a standard brain template space to generate the spatial distribution of the EEG signal source of the primary preprocessed EEG signal, so as to obtain the second EEG signal.
[0022] In some feasible embodiments, the step of performing latent variable dynamic representation learning on the second EEG signal to obtain the latent variable dynamic representation of the second EEG signal includes:
[0023] The number of brain regions and time points of the second EEG signal were obtained;
[0024] The second-order tensor of the second EEG signal is constructed based on the number of brain regions and the number of time points.
[0025] A third-order tensor of the second EEG signal is constructed based on the second-order tensor of the second EEG signal, the EEG signal classification result, and the number of subjects corresponding to the EEG signal classification result.
[0026] In some feasible embodiments, the step of performing latent variable dynamic representation learning on the second EEG signal to obtain the latent variable dynamic representation of the second EEG signal further includes:
[0027] The variational posterior mean vector and variational posterior covariance are calculated based on the multivariate Gaussian distribution of the third-order tensor of the second EEG signal.
[0028] Reparameterized sampling is performed on the variational posterior mean vector and variational posterior covariance to obtain the dynamic representation of the latent variables corresponding to the second EEG signal.
[0029] In some feasible embodiments, the step of decoding the latent variable dynamic representation to obtain the first restored EEG signal includes:
[0030] The dynamic representation of the latent variables is input into a long short-term memory network to decode the spatial model distribution parameters of the latent variables based on the long short-term memory network; the spatial model distribution parameters of the latent variables include the restored mean vector and the restored covariance based on a multivariate Gaussian distribution;
[0031] The mixing coefficients are calculated based on the mixing coefficient calculation expression and the dynamic representation of the latent variables; the mixing coefficient calculation expression is:
[0032]
[0033] Where, α jt ∈[0,1] and Let τ represent the softmax function, where τ is the mixing degree hyperparameter. The magnitude of τ determines the activity level of each dimension of the latent variables at time t.
[0034] The first reconstructed EEG signal is obtained by performing a linear summation on the distribution parameters of the latent variable spatial model and the mixing coefficients.
[0035] In some feasible embodiments, the step of calculating the loss function based at least on the first reconstructed EEG signal, the EEG signal classification result, and the latent variable dynamic representation includes:
[0036] The training loss is calculated based on the classification loss corresponding to the EEG signal classification result, the reconstruction error corresponding to the latent variable dynamic representation, and the Monte Carlo estimation result corresponding to the latent variable spatial model distribution parameters; the classification loss is calculated based on the true label value and the predicted label value of the EEG signal; the reconstruction error is obtained based on the predicted time point and the true time point corresponding to the latent variable dynamic representation during the decoding process; and the Monte Carlo estimation result is calculated based on the preset class center parameters.
[0037] In some feasible embodiments, the step of determining the EEG signal classification result based on the latent variable dynamic representation includes:
[0038] The latent variable dynamic representation is input into the classification network in the latent variable dynamic representation network to obtain the EEG signal classification result output by the classification network based on the latent variable dynamic representation; the classification network includes a first convolutional layer, a dropout layer, a second convolutional layer, an average pooling layer, a fully connected layer, and an output layer connected in sequence; the first convolutional layer has 32 convolutional kernels and the kernel size is 3; the second convolutional layer has 16 convolutional kernels and the kernel size is 3; the fully connected layer includes a Dense layer containing 64 neurons; the output layer includes a Dense layer containing 1 neuron.
[0039] In some feasible embodiments, the step of acquiring the first EEG signal includes:
[0040] The appropriate size EEG cap is selected based on the subject's head circumference; the EEG cap is equipped with sensors for collecting EEG signals;
[0041] Set the sampling frequency of the sensor;
[0042] The sensor collects the first electroencephalogram (EEG) signals generated by the subject during the alternation of opening and closing their eyes.
[0043] Secondly, this application provides a classification model training device for dynamic representation of latent variables of brain functional signals, comprising: a controller and an EEG cap containing sensors; the EEG cap is communicatively connected to the controller;
[0044] The EEG cap is configured as follows:
[0045] Collect the first EEG signal; the first EEG signal is the EEG signal generated by the subject's EEG signal source in a resting state;
[0046] The controller is configured to:
[0047] The first EEG signal is preprocessed to obtain a second EEG signal; the second EEG signal is a signal obtained by mapping the EEG signal source corresponding to the first EEG signal to a standard brain template space.
[0048] Latent variable dynamic representation learning is performed on the second EEG signal to obtain the latent variable dynamic representation of the second EEG signal;
[0049] The classification result of the EEG signal is determined based on the dynamic representation of the latent variables; and the first restored EEG signal is obtained by decoding the dynamic representation of the latent variables.
[0050] The training loss is calculated based at least on the first restored EEG signal, the EEG signal classification result, and the latent variable dynamic representation. The network parameters of the latent variable dynamic representation network are then optimized based on the training loss until the training loss is no greater than a preset loss value, thereby obtaining the optimal latent variable dynamic representation network.
[0051] As described above, this application provides a method and apparatus for training a classification model based on the dynamic representation of latent variables in brain function signals. The method preprocesses a first EEG signal to obtain a second EEG signal, and then performs latent variable dynamic representation learning on the second EEG signal to obtain the corresponding latent variable dynamic representation. A first reconstructed EEG signal is obtained by decoding the latent variable dynamic representation, and the EEG signal classification result is determined based on the latent variable dynamic representation. The loss can then be calculated based at least on the first reconstructed EEG signal, the EEG signal classification result, and the latent variable dynamic representation, and the parameters of the classification model can be trained based on the training loss. The model trained in this way can directly output the EEG signal classification result based solely on the acquired EEG signal, achieving EEG signal classification by mining the unobservable latent variable dynamic representation in the EEG signal, thereby improving the accuracy of emotion recognition. Attached Figure Description
[0052] To more clearly illustrate the technical solution of this application, the drawings used in the embodiments will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0053] Figure 1 Flowcharts of classification model training provided for some embodiments of this application;
[0054] Figure 2 This is a schematic diagram illustrating the composition of a classification model provided in some embodiments of this application;
[0055] Figure 3 A schematic diagram illustrating the electroencephalogram (EEG) signal generation process provided in some embodiments of this application. Detailed Implementation
[0056] The embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described below do not represent all embodiments consistent with this application. They are merely examples of systems and methods consistent with some aspects of this application as detailed in the claims.
[0057] In some emotion recognition scenarios, the brain can be viewed as a dynamic system, and the neural activity generated within it can be considered as being driven by unobservable latent variables. This allows for the modeling of complex dynamic functional changes in the brain based on the dynamic evolution of these latent variables. In some embodiments, modeling can be based on the short-time dependency assumption (the state change at the current moment depends only on the state at the previous moment) and the state mutual exclusion assumption (only a single latent state is active at each moment). However, brain functional signals exhibit temporal and nonlinear characteristics, and their generation mechanism is a stochastic process with high uncertainty. These two assumptions only allow modeling with a set of observational model parameters at a given moment, which is not suitable for the characteristics of brain functional signals. Therefore, a more flexible modeling method that incorporates multiple states is needed to model brain dynamics and address the low accuracy and interpretability of identifying subject emotions based on EEG signals.
[0058] like Figure 1 As shown, to address the above problems, some embodiments provide a classification model training method for dynamic representation of latent variables of brain functional signals, the steps of which include:
[0059] S100: Acquire the first EEG signal.
[0060] In some embodiments, it is necessary to collect electroencephalogram (EEG) signals as training data. The first EEG signal can be the EEG signal generated by the subject's EEG signal source in a resting state. Here, the resting state can refer to the process in which the subject alternates between opening and closing their eyes. During this process, EEG signals can be collected using an EEG cap (sensors within the EEG cap) placed at a predetermined location on the subject.
[0061] In some embodiments, the step of acquiring the first EEG signal includes:
[0062] A corresponding EEG cap is selected based on the head circumference of the EEG signal provider; the EEG cap is equipped with sensors for collecting EEG signals.
[0063] Set the sampling frequency of the sensor.
[0064] The sensor acquires the first EEG signal generated by the EEG signal provider during the alternation of opening and closing the eyes.
[0065] Understandably, the selection of an EEG cap needs to be based on the subject's head circumference to ensure a closer fit between the sensors inside the cap and the EEG signal source, thereby improving data acquisition accuracy and the modeling accuracy of the head. Furthermore, the EEG signal acquisition system associated with the EEG cap can include 128 leads (the number of leads can be selected according to actual needs). The reference electrode can be placed at a fixed point on the top of the head. Before acquisition, the impedance of each electrode needs to be checked to ensure good contact. For example, an electrode impedance below 40kΩ is acceptable.
[0066] During test preparation, it is also necessary to pre-set the sensor's sampling frequency to control the sensor to collect the EEG signals generated by the subject according to the sampling frequency. For example, the sensor's sampling frequency can be set to 500Hz.
[0067] In some embodiments, after placing an EEG cap on the subject's head, the EEG signals generated by the subject during the alternation of opening and closing their eyes can be continuously collected for 30 minutes, i.e., the first EEG signal. The first EEG signal can be understood as the EEG signal generated by the subject in a resting state.
[0068] S200: Perform preprocessing on the first EEG signal to obtain the second EEG signal.
[0069] Understandably, before inputting the acquired EEG signals into the classification model, preprocessing is necessary to facilitate the extraction of latent variable dynamics from the EEG signals. Preprocessing methods for the first EEG signal can include filtering, artifact removal, trial extraction, and source localization. This preprocessing can remove some excessively noisy or clearly defined EEG signal data, improving data quality during training or inference.
[0070] In some embodiments, the step of performing preprocessing on the first EEG signal to obtain the second EEG signal includes:
[0071] The first EEG signal is subjected to notch filtering to obtain the first EEG signal located in the target frequency band.
[0072] Remove artifact signals from the first EEG signal located in the target frequency band.
[0073] Based on the resting-state experimental paradigm, triggers and delays are used to extract eye-closed trials as data segments from the first EEG signal after removing artifact signals, and primary preprocessed EEG signals are determined based on the extracted eye-closed trial data segments.
[0074] The primary preprocessed EEG signal is mapped to a standard brain template space to obtain a second EEG signal.
[0075] In some embodiments, the first EEG signal can be first imported into a system with preprocessing capabilities, such as MATLAB. The specific preprocessing system used is not limited here; the aim is to improve the data quality of the first EEG signal through multiple preprocessing methods.
[0076] It should be noted that during preprocessing, data for training or inference in the first EEG signal can be filtered based on pre-set triggers and delays. Here, a trigger refers to a specific signal corresponding to a specific node in the EEG signal, such as the moment of stimulus presentation. Triggers can be used to synchronize experimental events and EEG signals. The delay refers to the time difference between when the trigger is activated and when a potential change related to that event is observed in the EEG signal. Using triggers and delays, the desired data can be extracted from the first EEG signal.
[0077] It is understandable that triggers can be used to mark events. For example, triggers can be used to mark events such as closed eyes or open eyes. In this way, time series data corresponding to closed eyes events can be extracted as needed through triggers and delays.
[0078] Furthermore, the first EEG signal can be filtered by setting a filtering range and a filtering threshold to obtain a first EEG signal located in the target frequency band. For example, bandpass filtering of 0.1-70Hz and notch filtering of 50Hz can be performed on the first EEG signal. This can improve the data accuracy of the first EEG signal, reduce redundant data, and help improve the accuracy and efficiency of model training.
[0079] After obtaining the first EEG signal located in the target frequency band, artifact removal can be performed on it. For example, a multiple artifact removal algorithm can be used to remove artifacts from the first EEG signal, resulting in a valid first EEG signal. Furthermore, based on a pre-set trigger and delay of a resting-state experimental paradigm, closed-eye trials can be extracted as primary preprocessed EEG signals.
[0080] It should be noted that when subjects close their eyes, the alpha waves in their EEG signals increase, while the amplitude of high-frequency signals such as beta waves decreases. Therefore, the spectral characteristics of the EEG signals shift towards lower frequencies, making it easier to learn and identify the patterns of brain activity and facilitating the extraction of latent variable dynamic representations corresponding to the EEG signals. Furthermore, extracting the closed-eye trials as a primary preprocessing step can filter out unwanted data, thus aiding in model training and inference.
[0081] Furthermore, the triggers and delays in the resting-state experimental paradigm here serve the same function as those in the above embodiments. Based on the triggers and delays corresponding to the closed-eye state, the EEG signal corresponding to the subject's rhinitis state can be extracted from the effective first EEG signal, i.e., the primary preprocessed EEG signal. For example, the closed-eye EEG signal of 5 trials can be extracted from the first EEG signal collected from the subject, and the EEG signals of the 5 trials can be averaged to obtain a stable primary preprocessed EEG signal.
[0082] In this way, the primary preprocessed EEG signals can be further mapped to the standard brain template space to obtain the spatial distribution of the EEG signal source, thereby tracing the source of the primary preprocessed EEG signals and obtaining the traced second EEG signal.
[0083] In some embodiments, the step of mapping the primary preprocessed EEG signal to a standard brain template space to obtain a second EEG signal includes:
[0084] A head model was constructed using images of the subject's head anatomy.
[0085] Based on the sensor coordinate file of the EEG cap, the sensor positions are calibrated and registered to the surface of the head model to achieve spatial mapping of the EEG signal recording positions.
[0086] The inverse problem is solved based on the forward model to obtain the localization result of the EEG signal source.
[0087] The localization results of the EEG signal source are mapped to a standard brain template space to generate the spatial distribution of the EEG signal source of the primary preprocessed EEG signal, so as to obtain the second EEG signal.
[0088] Understandably, head models will differ depending on the individual participant. Therefore, a head model corresponding to the participant can be constructed based on the participant's head anatomical images. Furthermore, based on the sensor location information within the EEG cap, sensor positions can be calibrated and registered on the head model's surface, thereby achieving spatial mapping of EEG signal recording locations. This improves the accuracy of data acquisition and facilitates the identification of EEG signal sources corresponding to specific emotions during subsequent EEG signal analysis. For example, spatial mapping can help trace the source of EEG signals associated with depressive moods.
[0089] After determining the spatial mapping of the EEG signal recording location, the inverse problem can be solved using the forward model to obtain the localization result of the EEG signal source. It should be noted that the forward model can be used to describe the mathematical model of the relationship between the EEG signal source and the EEG signal recorded on the subject's scalp. The forward model takes into account factors such as the distribution of current sources within the brain, the geometry of the head, and the conductivity characteristics of different tissues, and can then predict the potential distribution at each electrode location on the scalp through computation or simulation methods. Furthermore, based on the potential distribution, the inverse problem can be solved, that is, the location and intensity of the EEG signal source within the brain can be deduced from the potential distribution results.
[0090] The algorithm for solving the inverse problem can employ the sLORETA (low-resolution EEG tomography) algorithm. By utilizing the potential distribution provided by the forward model in conjunction with EEG or MEG signals, the distribution of the searched EEG signal source is optimized, thereby reducing the error between the simulated potential distribution and the actual measurement data.
[0091] After locating the EEG signal sources of different subjects, these sources can be mapped to a standard brain template space. This ensures that the EEG data generated by different subjects have a unified standard and comparability during the training or inference process of the classification model, eliminating the influence of individual differences on the research results and improving the reliability and reproducibility of the study. Thus, after mapping the EEG signal sources to the standard brain template space, a traced second EEG signal can be obtained. When the model is trained or infers based on this second EEG signal, it can fully integrate the correspondence between the classification results and the EEG signal sources.
[0092] S300: Perform latent variable dynamic representation learning on the second EEG signal to obtain the latent variable dynamic representation of the second EEG signal.
[0093] In some embodiments, after obtaining the second EEG signal, it can be input into a classification model for the dynamic representation of latent variables of brain function signals. For example... Figure 2 As shown, the classification model includes an inference model network, a generative model network, and a classification network. The inference model network generates a dynamic representation of latent variables based on the second EEG signal. The generative model network reconstructs the reconstructed EEG signal from the dynamic latent variable representation output by the inference model network, calculates the training loss based on the reconstructed EEG signal, and then optimizes the classification model using the training loss. The classification network generates the EEG signal classification result based on the dynamic latent variable representation.
[0094] It is understandable that after obtaining the second EEG signal, it can be input into the inference model network, and the inference model network outputs the dynamic representation of the latent variables.
[0095] The inference model network can be a bidirectional recurrent neural network, such as a long short-term memory network. The inference model network can be constructed from normalization layers, activation layers, dropout layers, and regularization layers. Based on recursive connections and time-dependent characteristics, it can dynamically update the latent variable states associated with the time series, thereby fully mining the mean vector and covariance matrix of the multivariate Gaussian distribution of the EEG signal source during the dynamic representation learning process. The mean vector and covariance matrix can then be used to generate the dynamic representation of the latent variables corresponding to the EEG signals.
[0096] It should be noted that the data input to the inference model network is actually a third-order tensor of the second EEG signal. That is, the steps to perform latent variable dynamic representation learning on the second EEG signal to obtain its latent variable dynamic representation include:
[0097] The number of brain regions and time points of the second EEG signal are obtained.
[0098] The second-order tensor of the second EEG signal is constructed based on the number of brain regions and the number of time points.
[0099] A third-order tensor of the second EEG signal is constructed based on the second-order tensor of the second EEG signal, the EEG signal classification result, and the number of subjects corresponding to the EEG signal classification result.
[0100] In some embodiments, the second-order tensor of the second EEG signal can be determined first by acquiring the number of brain regions and time points corresponding to the second EEG signal. The second-order tensor can be represented as follows: Taking a subject with 100 brain regions and a time series length of 20,000 as an example, the second-order tensor of the second EEG signal can be represented as follows: Here, the second-order tensor is equivalent to a two-dimensional matrix composed of the number of time points and the number of brain regions in the subject's EEG signal. Specifically, the second EEG signal at each time t can be viewed as a vector m with a time-varying mean. t The covariance matrix C t It is generated by the multivariate Gaussian distribution process, i.e., X t =N(m) t C t ).
[0101] Furthermore, to achieve the training objective, a third-order tensor can be obtained by adding dimensions corresponding to the number of subjects and the number of classification result categories to the second-order tensor. Where N k K is the number of subjects in that category, and K is the number of categories corresponding to the classification result. This represents the preprocessed EEG signal time series of subjects in category k1. Where K represents the number of emotion / emotion disorder categories if the classification result corresponds to a mental illness / emotion disorder detection result. This allows for the addition of labels during training, facilitating the inference model network's learning from the output results.
[0102] In this way, the third-order tensor of the second EEG signal can be input into the inference model network, and the inference model network can output the dynamic representation of the latent variables of the second EEG signal.
[0103] Understandably, the process of the inference model network determining the dynamic representation of latent variables is essentially the process of mining the mean vector and covariance matrix of the multivariate Gaussian distribution corresponding to the second EEG signal at each time step. That is, the steps of performing latent variable dynamic representation learning on the second EEG signal to obtain the latent variable dynamic representation of the second EEG signal also include:
[0104] The variational posterior mean vector and variational posterior covariance are calculated based on the multivariate Gaussian distribution of the third-order tensor of the second EEG signal.
[0105] Reparameterized sampling is performed on the variational posterior mean vector and variational posterior covariance to obtain the dynamic representation of the latent variables corresponding to the second EEG signal.
[0106] In some embodiments, the dynamic representation of latent variables can be denoted as: Where J represents a multivariate Gaussian distribution, and different latent variable dynamic representations can correspond to different emotion recognition results / emotion-related disorder recognition results. That is, subjects with different emotion-related disorders have different latent variable dynamic representations of brain neural activity. Based on the representation method of latent variable dynamic representation, in the case of multiple subjects, the latent variable dynamic representation can be denoted as... and then, It is the representation of the j-th hidden state of the k1 category subjects at time t, while This represents the latent variable representation of subject k1 at time t. Specifically, it represents the neural activity interaction pattern of the subject's brain in a resting state with eyes closed at time t, representing the latent state representation of any category. The calculation process can be expressed as: in and These are the variational posterior mean and covariance of the multivariate Gaussian distribution, respectively, where the variational posterior covariance is a diagonal matrix. Given an EEG signal, the inference model network outputs the parameters of the variational posterior distribution, namely the variational posterior mean and covariance of the multivariate Gaussian distribution, using the following expression:
[0107]
[0108] Furthermore, reparameterization techniques can be used for sampling in variational posterior distribution inference; specifically, sampling can be performed from a standard normal distribution. Its calculation expression is:
[0109]
[0110] Where I is the identity matrix, ε s This indicates that the sample is taken from the normal distribution N(0,I) for the s-th time. It is a collection The square root of the diagonal element.
[0111] It should be noted that in the above calculation process, because it is necessary to process z, which has time-dependent characteristics... t Perform Bayesian inference, thus making z t The estimates will have significant uncertainties, and these uncertainties will propagate to z over time. t In the reasoning. However, the mean μ of the latent variables. j Covariance D j These are global parameters, and their inference includes dynamic evolution information at all time points. Therefore, μ is learned using a trainable static scaling factor through point estimation methods. j and D j .
[0112] The static scaling factor can be 1 / batch size × number of batches. Introducing a static scaling factor improves the determinism of the dynamic representation of latent variables, thereby increasing the accuracy of classification results and the training effect of the model. The batch size and number of batches can be set according to requirements. In some embodiments, the batch size can be 64, and the number of batches in each batch period can be 100, resulting in a static scaling factor of 1 / 6400. This ensures that the gradients calculated from different batches have a consistent scale when updating model parameters, preventing model training instability caused by excessive differences in gradient scale.
[0113] S400: Determine the classification result of the EEG signal based on the latent variable dynamic representation; and decode the latent variable dynamic representation to obtain the first restored EEG signal.
[0114] Understandably, the inference model network can input a dynamic representation network into a classification network, which then outputs an emotion recognition result based on the latent variable dynamic representation. The steps for determining the EEG signal classification result based on the latent variable dynamic representation include:
[0115] The latent variable dynamic representation is input into the classification network in the latent variable dynamic representation network to obtain the EEG signal classification result output by the classification network based on the latent variable dynamic representation; the classification network includes a first convolutional layer, a dropout layer, a second convolutional layer, an average pooling layer, a fully connected layer, and an output layer connected in sequence; the first convolutional layer has 32 convolutional kernels and the kernel size is 3; the second convolutional layer has 16 convolutional kernels and the kernel size is 3; the fully connected layer includes a Dense layer containing 64 neurons; the output layer includes a Dense layer containing 1 neuron.
[0116] In some embodiments, the classification network is designed based on a temporal convolutional network, which aims to extract local and high-level features from time-series data through a multi-layer network and ultimately complete a binary classification task. Taking the training process of the classification model as an example, when the dynamic representation of latent variables is input into the classification network, the network can extract local features from the time dimension through the first convolutional layer, introduce non-linear changes through the ReLU activation function, and reduce the risk of overfitting by applying L2 regularization to limit the model weight values. Furthermore, by connecting a Dropout layer after the first convolutional layer, 30% of the neurons are randomly dropped during training to improve the generalization ability of the classification network. Then, a second convolutional layer is used to further extract higher-level time-series features, in conjunction with the ReLU activation function and L2 regularization.
[0117] Through two convolutional layers, the classification network can progressively capture the complex patterns and feature relationships in the time series corresponding to the dynamic representations of latent variables. Then, a global average pooling layer is introduced to average the time dimension of each feature channel, compressing the time dimension information into a fixed-size vector. After further non-linear learning of the extracted feature relationships through a fully connected layer, the classification result is output based on the output layer. The activation function used in the output layer can be sigmoid.
[0118] In this way, the classification network can fully extract key features from the time series corresponding to the dynamic representations of latent variables, and then perform the task of emotion classification based on the dynamic representations of latent variables. It can be understood that, taking the identification process of mental illness as an example, the classification task performed by the classification network during the retraining process is actually a binary classification task (the dynamic representations of latent variables can correspond to patients with mental illnesses / healthy control group subjects).
[0119] Furthermore, to train a complete classification model, in some embodiments, a first reconstructed EEG signal is obtained by decoding the latent variable dynamic representation through a generative model network, and this first reconstructed EEG signal is used as an important component in calculating the training loss. The generative model network can be a long short-term memory network, i.e., a recurrent neural network, and can be configured as a unidirectional recurrent network. The step of decoding the latent variable dynamic representation to obtain the first reconstructed EEG signal includes:
[0120] The latent variable dynamic representation is input into a long short-term memory network to decode the latent variable spatial model distribution parameters based on the long short-term memory network; the latent variable spatial model distribution parameters include the restored mean vector and restored covariance based on a multivariate Gaussian distribution.
[0121] The mixing coefficients are calculated based on the mixing coefficient calculation expression and the dynamic representation of the latent variables; the mixing coefficient calculation expression is:
[0122]
[0123] Where, α jt ∈[0,1] and Let τ represent the softmax function, where τ is the mixing degree hyperparameter. The magnitude of τ determines the activity level of each dimension of the latent variable at time t.
[0124] The first reconstructed EEG signal is obtained by performing a linear summation on the distribution parameters of the latent variable spatial model and the mixing coefficients.
[0125] like Figure 3 As shown, a schematic diagram of the EEG signal generation process is provided. Taking the classification results of a classification network for identifying mental disorders in subjects as an example, this includes EEG signals reflecting changes in brain functional activity. Dynamic representation of latent variables in brain neural activity Category K of mental disorders.
[0126] It is understandable that there is a causal dependency between latent variable dynamic representations and mental disorders, with different mental disorders corresponding to different latent variable dynamic representations. Furthermore, latent variable dynamic representations influence the generation process of electroencephalogram (EEG) signals. This application aims to train a classification model by mining the features of latent variable dynamic representations of EEG signals, enabling the model to learn the correspondence between latent variable dynamic representations and mental disorders. Therefore, latent variable dynamic representations can be considered a major factor in determining whether a subject has a mental disorder.
[0127] It should be noted that the latent variable spatial model corresponding to the dynamic representation of latent variables corresponds to the static spatial distribution of functional connectivity in brain neural activity, while the functional connectivity of specific latent variables can be captured by the correlation between brain regions in the covariance. However, the distribution of the latent variable spatial model is static. Therefore, in the process of decoding the dynamic representation of latent variables, the generative network also needs to introduce a mixing coefficient to represent the dynamic changes of EEG signals. This mixing coefficient can be denoted as α. t Mixing coefficient α t It also provides a low-dimensional and interpretable dynamic representation of time-series data such as EEG signals.
[0128] It is evident that, during the decoding process of the generative model network, the dynamic representation of latent variables can be considered as composed of mixing coefficients and the latent variable spatial model distribution parameters. The latent variable spatial model distribution parameters are the mean μ. j Covariance D j .
[0129] Thus, the expression for the EEG signal generation process based on the dynamic representation of latent variables can be determined as follows:
[0130] P(X,Z,K)=P(X|Z,K)P(Z,K)=P(X|Z)P(Z|K)p(K)
[0131] Wherein, the class k of each sample follows a categorical distribution, i.e. and Each sample has a probability of belonging to one of K classes, which is π. The latent variable representation of any class at each time point... The calculation expression is: in This represents the dynamic representation of latent variables before time point t-1. and These are the mean vector and covariance matrix of a multivariate Gaussian distribution, respectively.
[0132] Thus, based on the above derivation, the generative model network can predict the dynamic representation of latent variables at the next time point, given the dynamic representations of latent variables at past time points. That is, given the dynamic representations of latent variables at past time points... Input to the generative model network:
[0133]
[0134] in and This represents the affine transformation in a recurrent neural network, where ξ() is a parameter used to preserve the standard deviation. The softplus function is a positive number; LSTM stands for Long Short-Term Memory Network.
[0135] In this way, the generative model network can obtain the covariance and mean of the spatial distribution parameters of the latent variables.
[0136] In some embodiments, the mixing coefficient α t Characterized by latent variables The transformation calculation yields the following expression for calculating each state j of the hidden variable at time point t:
[0137]
[0138] Where, α jt ∈[0,1] and Let τ represent the softmax function. τ is a hyperparameter called the degree of mixing, and the magnitude of τ determines the activity level of each dimension of the latent variables at the current time.
[0139] Thus, the second EEG signal X, which follows a multivariate Gaussian distribution, t The parameter, i.e., the instantaneous mean m t Covariance C t Through the aforementioned α t And the parameters of the spatial static distribution of observable EEG signals (mean μ) j Covariance D j Linear summation yields the result. The expression for its linear summation is:
[0140]
[0141] It is understood that, in some embodiments of this application, the generative model network module 140 can first sample the latent vector time series from the latent variable dynamic representation learned from the inference model network, use the latent variable dynamic representation based on past time points in a one-way recurrent neural network to predict the latent variable dynamic representation at the next time point, perform a nonlinear transformation on the latent variable dynamic representation at a time point to obtain the mixing coefficients, and linearly sum the mean vector and covariance matrix of the spatial static distribution of EEG signals with the dynamic mixing coefficients of different categories of latent variable time series to fit a more interpretable descriptive form of the latent variable dynamic representation of EEG signals, which can be used to calculate training loss and improve the generalization ability of the neural network model.
[0142] S500: Calculate the training loss based at least on the first restored EEG signal, the EEG signal classification result, and the latent variable dynamic representation, and optimize the network parameters of the latent variable dynamic representation network based on the training loss until the training loss is not greater than a preset loss value, thereby obtaining the optimal latent variable dynamic representation network.
[0143] It is understandable that the parameters of the classification model are random in the initial state, therefore, it is necessary to optimize the various parameters of the model through training to obtain the optimal classification model. That is, the step of calculating the loss function based at least on the first reconstructed EEG signal, the EEG signal classification result, and the dynamic representation of the latent variables includes:
[0144] The training loss is calculated based on the classification loss corresponding to the EEG signal classification result, the reconstruction error corresponding to the latent variable dynamic representation, and the Monte Carlo estimation result corresponding to the latent variable spatial model distribution parameters; the classification loss is calculated based on the true label value and the predicted label value of the EEG signal; the reconstruction error is obtained based on the predicted time point and the true time point corresponding to the latent variable dynamic representation during the decoding process; and the Monte Carlo estimation result is calculated based on the preset class center parameters.
[0145] In some embodiments, the classification network can not only output classification results based on the dynamic representation of latent variables output by the inference model network, but also calculate training loss by combining key data such as classification results, first EEG reconstruction signal, and dynamic representation of latent variables, and then optimize various parameters of the classification model in reverse through the training loss.
[0146] In classification networks, the distribution of latent variables needs to be constrained when calculating training loss to obtain the maximized variational boundary, i.e., minimizing the variational free energy F. That is, minimizing the variational free energy F can be used as the objective loss. To distinguish the distributions of latent variables of different classes, label information can be introduced. The formula for minimizing the variational free energy F is:
[0147]
[0148] Where q(z,k|x) and p(z,k,x) can represent the probability distributions of the inference model and the generative model with respect to the data x, the category k, and the latent variable z, respectively.
[0149] Based on the data x generation process, we can obtain: p(x,z,k)=p(x|z,k)p(k,z)=p(x|z)p(z|k)p(k) and q(z,k|x)=q(z|x)q(k|x).
[0150] Therefore, the variational free energy is converted to F = -E. q(z,k|x) log[p(x|z)p(z|k)p(k)]+E q(z,k|x) logq(z,k|x).
[0151] In some embodiments, taking the classification network's objective of distinguishing between subjects with mental disorders and healthy subjects as an example, assuming the data only includes two groups: subjects with mental disorders (depression) and healthy subjects, the number of states J in the multivariate Gaussian distribution of the latent variables can be 8. The number of states J can be selected according to the actual situation, for example, within the range of 6 to 12. Thus, assuming labels are introduced during the classification model training process, the classification network can calculate the following classification loss:
[0152]
[0153] Where k k and These are the actual label value and the label value predicted by the model, respectively, and k is the category index.
[0154] The final loss function is shown below:
[0155]
[0156] In the formula It is the reconstruction error between the predicted time points and the actual values in the generative model, where... This indicates that when using Monte Carlo estimation, only one sample is used, k is the one-hot encoding of class k, and μ jt and σ jt These are the mean vector and covariance matrix of the latent variable time series learned by the inference model network, respectively, μ kj,t These are the class centers of the time series mean values of latent variables in different brain categories. They are set as trainable parameters with an initial value of 0 in the model and are updated as the neural network model is optimized and iterated.
[0157] In this way, the classification network can calculate the training loss during the training process based on key data such as the dynamic representation of latent variables output by the inference model network, the first reconstructed EEG signal generated by the generative model network, and the second EEG signal corresponding to the first reconstructed EEG signal, and further optimize various parameters in the classification model through the training loss.
[0158] In some embodiments, the training loss is the loss function constructed based on minimizing the variational free energy. The training loss not exceeding a preset loss value can mean that the loss function constructed based on minimizing the variational free energy converges during training, i.e., the difference between the previously calculated loss function and the currently calculated loss function is less than or equal to a preset range of differences.
[0159] It should be noted that after the optimal classification model is trained, during its use, the subject's EEG signals are input into the optimal classification model. The optimal classification model then outputs a dynamic representation of latent variables from the inference model network based on the EEG signals, which is then fed into the classification network for classification. During this process, the classification network does not need to calculate the training loss, and the generative model network does not need to decode the dynamic representation of latent variables output by the inference model network.
[0160] In some embodiments, after optimizing the parameters of the classification model, the performance of the classification model can also be evaluated. For example, the five-fold cross-validation method with leave-out cross-validation can be used to evaluate the classification model. Alternatively, the five-fold cross-validation method with leave-out cross-validation can also be used to evaluate the classification model during the parameter optimization process. The implementation process is as follows: the dataset to be tested is divided into 5 parts, and 4 parts are used as training data and 1 part is used as test data in turn for experimentation.
[0161] In some embodiments, all samples from 50 depressed subjects and 50 healthy subjects can be divided into 5 groups based on the subjects themselves. That is, all samples from 50 depressed subjects and 50 healthy subjects can be divided into 5 groups based on the individuals, with each group containing as many depressed subjects as possible from the healthy subjects. During each training and testing cycle, one group of data is reserved for performance evaluation, while the remaining four groups are used to train the neural network model. This process is repeated a total of 5 times, depending on the reserved data. During training, the Adam optimizer can be used to update the parameters in the neural network model.
[0162] For example, the initial learning rate is 0.0002, the batch size is set to 64, the reconstruction loss and KL loss are balanced by the KL (Kullback-Leibler Divergence) annealing strategy, and the early stopping method is used to save the optimal model parameters. After testing each data set, four indicators are calculated: accuracy, sensitivity, specificity, and F1 score. The average of the five results is then used as the final performance evaluation of the neural network model.
[0163] In some embodiments, a classification model training device for dynamic representation of latent variables of brain functional signals is also provided. The classification model training device includes a controller and an EEG cap containing sensors. The EEG cap is communicatively connected to the controller. The EEG cap is configured to: acquire a first EEG signal; the first EEG signal is an EEG signal generated by the subject's EEG signal source in a resting state.
[0164] The controller is configured as follows:
[0165] The first EEG signal is preprocessed to obtain a second EEG signal. The second EEG signal is obtained by mapping the EEG signal source corresponding to the first EEG signal to a standard brain template space.
[0166] Latent variable dynamic representation learning is performed on the second EEG signal to obtain the latent variable dynamic representation of the second EEG signal.
[0167] The classification result of the EEG signal is determined based on the dynamic representation of the latent variables; and the first restored EEG signal is obtained by decoding the dynamic representation of the latent variables.
[0168] The training loss is calculated based at least on the first restored EEG signal, the EEG signal classification result, and the latent variable dynamic representation. The network parameters of the latent variable dynamic representation network are then optimized based on the training loss until the training loss is no greater than a preset loss value, thereby obtaining the optimal latent variable dynamic representation network.
[0169] In some embodiments, after training, the brain function signal latent variable dynamic representation classification model training device can be used as a mature inference model in medical devices for emotion recognition and mental disorder recognition.
[0170] This application provides a method and apparatus for training a classification model based on the dynamic representation of latent variables in brain function signals. The method preprocesses a first acquired EEG signal to obtain a second EEG signal, and then performs latent variable dynamic representation learning on the second EEG signal to obtain the corresponding latent variable dynamic representation. A first reconstructed EEG signal is then obtained by decoding the latent variable dynamic representation, and the EEG signal classification result is determined based on the latent variable dynamic representation. Furthermore, a loss can be calculated based at least on the first reconstructed EEG signal, the EEG signal classification result, and the latent variable dynamic representation to train the parameters of the classification model based on the training loss. The model trained in this way can directly output the EEG signal classification result based solely on the acquired EEG signal, achieving EEG signal classification by mining the unobservable latent variable dynamic representation in the EEG signal, thereby improving the accuracy of emotion recognition.
[0171] Similar parts between the embodiments provided in this application can be referred to mutually. The specific implementation methods provided above are only a few examples under the overall concept of this application and do not constitute a limitation on the scope of protection of this application. For those skilled in the art, any other implementation methods extended from the solution of this application without creative effort shall fall within the scope of protection of this application.
Claims
1. A method for training a classification model of dynamic representation of latent variables of brain functional signals, characterized in that, include: Acquire the first EEG signal; The first EEG signal is the EEG signal generated by the subject's EEG signal source in a resting state; The first EEG signal is preprocessed to obtain the second EEG signal; The second EEG signal is a signal obtained by mapping the EEG signal source corresponding to the first EEG signal to a standard brain template space; Latent variable dynamic representation learning is performed on the second EEG signal to obtain the latent variable dynamic representation of the second EEG signal; After obtaining the second EEG signal, the second EEG signal is input into a classification model for the dynamic representation of latent variables of brain function signals. The classification model includes an inference model network, a generative model network, and a classification network. The inference model network is used to generate the dynamic representation of latent variables based on the second EEG signal. The generative model network is used to reconstruct the restored EEG signal based on the dynamic representation of latent variables output by the inference model network, calculate the training loss based on the restored EEG signal, and then optimize the classification model through the training loss. The classification network is used to generate EEG signal classification results based on the dynamic representation of latent variables. The classification result of the EEG signal is determined based on the dynamic representation of the latent variables; and the first restored EEG signal is obtained by decoding the dynamic representation of the latent variables. At least based on the first restored EEG signal, the EEG signal classification result and the latent variable dynamic representation, the training loss is calculated, and the network parameters of the classification model are optimized based on the training loss until the training loss is not greater than a preset loss value, thus obtaining the optimal classification model. The step of performing latent variable dynamic representation learning on the second EEG signal to obtain the latent variable dynamic representation of the second EEG signal includes: The number of brain regions and time points of the second EEG signal were obtained; The second-order tensor of the second EEG signal is constructed based on the number of brain regions and the number of time points. A third-order tensor of the second EEG signal is constructed based on the second-order tensor of the second EEG signal, the EEG signal classification result, and the number of subjects corresponding to the EEG signal classification result. The variational posterior mean vector and variational posterior covariance are calculated based on the multivariate Gaussian distribution of the third-order tensor of the second EEG signal. Reparameterized sampling is performed on the variational posterior mean vector and variational posterior covariance to obtain the dynamic representation of the latent variables corresponding to the second EEG signal.
2. The method according to claim 1, characterized in that, The steps of preprocessing the first EEG signal to obtain the second EEG signal include: The first EEG signal is subjected to notch filtering to obtain the first EEG signal located in the target frequency band; Remove artifact signals from the first EEG signal located in the target frequency band; Based on the resting-state experimental paradigm, triggers and delays were used to extract the eye-closed trial as a data segment from the first EEG signal after removing artifact signals, and the primary preprocessed EEG signal was determined based on the extracted eye-closed trial data segment. The primary preprocessed EEG signal is mapped to a standard brain template space to obtain a second EEG signal.
3. The method according to claim 2, characterized in that, The step of mapping the primary preprocessed EEG signal to a standard brain template space to obtain the second EEG signal includes: Based on a pre-defined head model structure, a head model is constructed using anatomical images of the subject. Based on the sensor coordinate file of the EEG cap, the sensor positions are calibrated and registered to the surface of the head model to achieve spatial mapping of the EEG signal recording positions; The inverse problem is solved based on the forward model to obtain the localization result of the EEG signal source; The localization results of the EEG signal source are mapped to a standard brain template space to generate the spatial distribution of the EEG signal source of the primary preprocessed EEG signal, so as to obtain the second EEG signal.
4. The method according to claim 1, characterized in that, The generative model network is a long short-term memory network, and the step of decoding the dynamic representation of the latent variables to obtain the first restored EEG signal includes: The latent variable dynamic representation is input into the long short-term memory network to decode the latent variable spatial model distribution parameters based on the long short-term memory network; the latent variable spatial model distribution parameters include the restored mean vector and restored covariance based on the multivariate Gaussian distribution; The mixing coefficients are calculated based on the mixing coefficient calculation expression and the dynamic representation of the latent variables; the mixing coefficient calculation expression is: ; in, and , This represents the softmax function. For the degree of mixing hyperparameter, The magnitude of N determines the activity level of each dimension of the latent variable at time t; t represents the time point of the EEG signal; k represents the number of categories corresponding to the classification result; N k The number of subjects in each category is represented by J; J represents the state of the multivariate Gaussian distribution. This represents the dynamic representation of latent variables; The first reconstructed EEG signal is obtained by performing a linear summation on the distribution parameters of the latent variable spatial model and the mixing coefficients.
5. The method according to claim 4, characterized in that, The step of calculating the training loss based at least on the first reconstructed EEG signal, the EEG signal classification result, and the latent variable dynamic representation includes: The training loss is calculated based on the classification loss corresponding to the EEG signal classification result, the reconstruction error corresponding to the latent variable dynamic representation, and the Monte Carlo estimation result corresponding to the latent variable spatial model distribution parameters; the classification loss is calculated based on the true label value and the predicted label value of the EEG signal; the reconstruction error is obtained based on the predicted time point and the true time point corresponding to the latent variable dynamic representation during the decoding process; and the Monte Carlo estimation result is calculated based on the preset class center parameters.
6. The method according to claim 1, characterized in that, The step of determining the EEG signal classification result based on the dynamic characterization of the latent variables includes: The latent variable dynamic representation is input into the classification network in the classification model to obtain the EEG signal classification result output by the classification network based on the latent variable dynamic representation; the classification network includes a first convolutional layer, a dropout layer, a second convolutional layer, an average pooling layer, a fully connected layer, and an output layer connected in sequence; the first convolutional layer has 32 convolutional kernels and the kernel size is 3; the second convolutional layer has 16 convolutional kernels and the kernel size is 3; the fully connected layer includes a Dense layer containing 64 neurons; the output layer includes a Dense layer containing 1 neuron.
7. The method according to claim 1, characterized in that, The steps for acquiring the first electroencephalogram (EEG) signal include: The appropriate size EEG cap is selected based on the subject's head circumference; the EEG cap is equipped with sensors for collecting EEG signals; Set the sampling frequency of the sensor; The sensor collects the first electroencephalogram (EEG) signals generated by the subject during the alternation of opening and closing their eyes.
8. A classification model training device for dynamic representation of latent variables of brain functional signals, characterized in that, include: A controller and an EEG cap containing sensors; the EEG cap is communicatively connected to the controller; The EEG cap is configured as follows: Acquire the first EEG signal; The first EEG signal is the EEG signal generated by the subject's EEG signal source in a resting state; The controller is configured to: The first EEG signal is preprocessed to obtain the second EEG signal; The second EEG signal is a signal obtained by mapping the EEG signal source corresponding to the first EEG signal to a standard brain template space; Latent variable dynamic representation learning is performed on the second EEG signal to obtain the latent variable dynamic representation of the second EEG signal; After obtaining the second EEG signal, the second EEG signal is input into a classification model for the dynamic representation of latent variables of brain function signals. The classification model includes an inference model network, a generative model network, and a classification network. The inference model network is used to generate the dynamic representation of latent variables based on the second EEG signal. The generative model network is used to reconstruct the restored EEG signal based on the dynamic representation of latent variables output by the inference model network, calculate the training loss based on the restored EEG signal, and then optimize the classification model through the training loss. The classification network is used to generate EEG signal classification results based on the dynamic representation of latent variables. The classification result of the EEG signal is determined based on the dynamic representation of the latent variables; and the first restored EEG signal is obtained by decoding the dynamic representation of the latent variables. The training loss is calculated based on at least the first restored EEG signal, the EEG signal classification result, and the latent variable dynamic representation. The network parameters of the classification model are optimized based on the training loss until the training loss is not greater than a preset loss value, thus obtaining the optimal classification model. The step of performing latent variable dynamic representation learning on the second EEG signal to obtain the latent variable dynamic representation of the second EEG signal includes: The number of brain regions and time points of the second EEG signal were obtained; The second-order tensor of the second EEG signal is constructed based on the number of brain regions and the number of time points. A third-order tensor of the second EEG signal is constructed based on the second-order tensor of the second EEG signal, the EEG signal classification result, and the number of subjects corresponding to the EEG signal classification result. The variational posterior mean vector and variational posterior covariance are calculated based on the multivariate Gaussian distribution of the third-order tensor of the second EEG signal. Reparameterized sampling is performed on the variational posterior mean vector and variational posterior covariance to obtain the dynamic representation of the latent variables corresponding to the second EEG signal.