A depression recognition method and system based on differential evolution feature selection
By using an improved differential evolution feature selection method and a Transformer model, the problems of redundancy and low feature selection efficiency in high-dimensional EEG data are solved, achieving more efficient and accurate depression identification.
Patent Information
- Application Number
- CN202511056081.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-30
- Publication Date
- 2026-02-03
- Estimated Expiration
- 2045-07-30
AI Technical Summary
Existing methods for detecting depression rely on high-dimensional, multimodal EEG data, resulting in high computational costs and low recognition efficiency. Traditional differential evolution algorithms suffer from problems such as initial population imbalance, insufficient consideration of feature correlation, and repetitive distribution in feature selection, which affect the diagnostic accuracy and efficiency of the model.
A differential evolution-based feature selection method is adopted. By introducing a feature association weight matrix and a redundancy index, the population initialization strategy is improved. In combination with non-dominated sorting and an adaptive grid mechanism, the feature subset selection is optimized. An adaptive hierarchical fusion network model based on Transformer is constructed for training to extract the optimal feature subset.
It improves the accuracy of depression identification, saves training time, enhances the diversity of feature selection and the ability to explore the global optimal solution, and improves the model's identification efficiency and diagnostic effect.
Smart Images

Figure CN120770812B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of medical data recognition technology, specifically relating to a method and system for identifying depression based on differential evolutionary feature selection. Background Technology
[0002] Depression has become a major and challenging health problem globally. As one of the most common mental health disorders, depression has a profound impact on an individual's quality of life and social functioning. Therefore, the urgent need to address the identification of depression is increasingly evident. Accurate and efficient detection is not only a prerequisite for early intervention but also provides personalized treatment recommendations, reducing the incidence of serious consequences such as suicide. Currently, commonly used medical methods for detecting depression include medical history taking, blood tests, and imaging examinations. However, these existing technologies are still insufficient in identifying objective biomarkers of depression, and diagnostic criteria are complex and easily affected by individual differences, impacting the accuracy and efficiency of diagnosis. Therefore, there is an urgent need to develop more scientific and accurate methods for detecting depression to improve early diagnosis rates and treatment outcomes.
[0003] With the development of artificial intelligence technology, deep learning models have provided new solutions for the diagnosis of depression. Among them, the Transformer model, with its powerful feature extraction and sequence modeling capabilities, has shown unique advantages in the medical field. Transformers can process physiological signals (electroencephalography) and capture the correlations between different data through a self-attention mechanism, making its application to the diagnosis of depression feasible. Existing technologies use Transformer models with pre-built multi-level cross-attention mechanisms to predict a user's level of depression. By acquiring features, the model predicts the user's level of depression, supplementing the potential connections between different modalities, enabling a more comprehensive assessment of the user's depressive symptoms and resulting in more accurate detection results.
[0004] In existing technologies, multi-objective feature selection encompasses numerous methods, primarily including genetic algorithms, firefly algorithms, particle swarm optimization, and differential evolution (DE). Among these algorithms, DE stands out for its simple structure, intuitive parameters, and high search efficiency, demonstrating superior performance in feature selection tasks and becoming a significant research direction in this field. Therefore, this paper employs DE for feature selection. However, this method suffers from several drawbacks: First, the initial population exhibits significant randomness, potentially leading to uneven individual distribution and impacting search efficiency. Second, traditional differential evolution algorithms do not adequately consider the correlation between features during mutation, limiting search performance. Finally, during optimization, the repetition and high-density distribution of feature subsets can decrease population diversity, restricting the exploration capability of the search space and causing premature convergence of the algorithm.
[0005] Based on the above analysis, the existing technologies have the following problems and shortcomings: the detection and research of depression rely on a large amount of clinical, physiological, and behavioral data. This data is typically high-dimensional, complex in features, and encompasses multiple modalities. Furthermore, the datasets are massive, reaching millions of records. The redundancy of high-dimensional data not only increases computational overhead but also affects the classification performance of the model; therefore, feature selection is crucial. Simultaneously, existing classification models have relatively low efficiency in identifying depression. Summary of the Invention
[0006] To overcome the problems in the prior art, this invention proposes a depression identification method and system based on differential evolution feature selection.
[0007] The technical solution of the present invention to solve the above-mentioned technical problems is as follows:
[0008] In a first aspect, the present invention provides a depression identification method based on differential evolutionary feature selection, comprising the following steps:
[0009] Acquire raw EEG data and preprocess the acquired raw EEG data;
[0010] Based on the preprocessed EEG data, the optimal feature subset was selected using a differential evolution-based feature selection method.
[0011] An adaptive hierarchical fusion network model based on Transformer is constructed and trained based on the optimal feature subset to obtain a reference model for depression recognition, and a reference recognition result is obtained.
[0012] Furthermore, the preprocessing includes filtering, reference reconstruction and artifact removal, data segmentation and baseline correction.
[0013] Furthermore, feature selection methods based on differential evolution include:
[0014] A feature association weight matrix and a feature redundancy index are introduced. A population initialization strategy combining the feature association weight matrix and the feature redundancy index is adopted to divide the population into four subpopulations, which are then merged into a total population for evolution.
[0015] The individual mutation is guided by the feature association weight matrix, and the quality of the solution is optimized by combining non-dominated ranking and classification error rate priority criteria.
[0016] Finally, a feature optimization adaptive grid mechanism is introduced into the fitness space to refine the dense grid and repeatedly optimize the solution to select the optimal feature subset.
[0017] Furthermore, the introduction of the feature association weight matrix includes:
[0018] FCM simulates the dynamic evolution of a system by iteratively updating the state values of its features. Its formula is:
[0019] ;
[0020] In the formula, w ij The weights of the edges, i.e., features i The degree of influence on feature j; Indicates the first j The feature in the first l The state value at +1 iteration; It is an activation function;
[0021] The feature association weight matrix is calculated based on the state values during iteration.
[0022] Furthermore, a feature redundancy index is introduced, which includes: for multiple feature vectors, calculating the cosine similarity value between each pair of feature vectors, and integrating multiple cosine similarity values to form a feature redundancy index.
[0023] Furthermore, the four subpopulations include P1, P2, P3, and P4, where P1 represents the set of individuals formed by random combinations of features with a feature association weight greater than the preset threshold after deleting features with a feature association weight less than the preset threshold; P2 represents the set of inferior solutions formed without considering redundant features after deleting features with a feature association weight less than the preset threshold; P3 represents the set of elite individuals formed by features with a feature association weight greater than the preset threshold and redundant features removed; and P4 represents the set of elite individuals formed by features with a feature association weight greater than the preset threshold but without considering redundant features.
[0024] Furthermore, the mutation of individuals is guided by the feature association weight matrix, and the quality of the solution is optimized by combining non-dominated ranking and classification error rate priority criteria, including:
[0025] Calculate the offset weight matrix based on the feature association weight matrix and the mean of the feature association weight matrix;
[0026] Based on the offset weight matrix, the mutation vector is adjusted by weight-guided fusion through Hadamard product;
[0027] Calculate the redundancy value of the features and the median of the redundancy index of each feature;
[0028] Based on the adjusted mutation vector and the median of the feature redundancy index, features are selected by combining non-dominated ranking and classification error rate priority criteria. The selection conditions are: the feature redundancy value is lower than the median of the feature redundancy index, and the corresponding dimension value of the adjusted mutation vector is positive.
[0029] Furthermore, a feature optimization adaptive grid mechanism is introduced into the fitness space to refine the dense grid and repeatedly optimize the solution, selecting the optimal feature subset, including:
[0030] The population is mapped to the fitness space and divided into dynamic grid cells. The number of individuals in each dynamic grid is counted. If the number of individuals in a dynamic grid exceeds the preset threshold for the number of individuals in a grid, it is marked as a dense grid.
[0031] Perform non-dominated sorting on individuals in the dense grid and select non-dominated solutions to enter the next generation of the population; if all individuals in the dense grid are non-dominated solutions, then use the error rate as the priority criterion and retain individuals with an error rate less than a preset error rate threshold.
[0032] The dense grid is further subdivided into smaller subgrids. The number of individuals is counted and detected repeatedly in the subgrids. If the subgrid is still a dense grid, the subdivision continues.
[0033] Individuals with fitness values less than a preset fitness threshold in a dense grid are modified by deleting features with the lowest feature association weight and high redundancy, and adding features with high feature association weight and low redundancy.
[0034] This is used to select the optimal feature subset.
[0035] Furthermore, an adaptive hierarchical fusion network model based on Transformer is constructed, including:
[0036] Standard sine-cosine position encoding is used to inject position information and form encoder input data;
[0037] The input data is processed by a Transformer encoder for feature extraction. The Transformer encoder consists of four layers, each of which includes a multi-head self-attention mechanism, a feedforward network, residual connections, and layer normalization.
[0038] Calculate the weighted sum of different layers, and take the mean of the fused features along the time dimension to obtain the global feature representation;
[0039] The model is mapped to 2D through a fully connected layer, and the probability distribution of the categories is calculated through an activation function to construct a reference model for depression identification.
[0040] Secondly, the present invention also provides a depression recognition system based on differential evolution feature selection, comprising:
[0041] The EEG data preprocessing module is used to acquire raw EEG data and preprocess the acquired raw EEG data.
[0042] The feature selection module based on differential evolution is used to select the optimal feature subset based on preprocessed EEG data using a feature selection method based on differential evolution.
[0043] The depression identification module is used to construct an adaptive hierarchical fusion network model based on Transformer, and train it based on the optimal feature subset to obtain a depression identification reference model and obtain reference identification results.
[0044] Compared with the prior art, the present invention has the following technical effects:
[0045] (1) This invention does not use all EEG data information. Instead, it utilizes the proposed Differential Evolutionary Feature Selection MODE-FS method to first select EEG features that better highlight the symptoms of depression. Then, it forms a new dataset and feeds it into a Transformer-based adaptive hierarchical fusion network model for training. The purpose of feature selection on EEG data is to remove redundant and irrelevant features, thereby obtaining an optimal feature subset. Feeding the selected feature subset into the Transformer-based adaptive hierarchical fusion network model for training not only saves training time but also achieves a higher recognition rate than training with the original data.
[0046] (2) This invention improves the population initialization strategy of the traditional differential evolution algorithm by introducing a feature association weight matrix and a feature redundancy index. By adjusting the feature association weight matrix and combining it with the feature redundancy index, the diversity of solutions and the ability to explore the global optimal solution are improved. This can solve the problem that the initial population distribution of the traditional algorithm is relatively concentrated and enhance the distribution balance of the initial individuals. Furthermore, a method for modifying duplicate solutions in the population is proposed to enhance the uniform distribution of solutions and the coverage of the search space.
[0047] (3) In the process of mutation, this invention proposes an individual update method based on mutation and selection to optimize the feature selection of individuals in the population; and proposes a feature optimization adaptive grid mechanism to realize dynamic detection and adjustment of population distribution, thereby balancing the diversity and performance of solutions. Attached Figure Description
[0048] To more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0049] Figure 1 This is a flowchart of the depression identification method based on differential evolution feature selection provided by the present invention;
[0050] Figure 2 This is the distribution of nondominated solutions obtained by each algorithm provided by this invention on the Hillvalley test set;
[0051] Figure 3 This is the distribution of non-dominated solutions obtained by each algorithm provided by this invention on the Musk1 test set;
[0052] Figure 4 This is the distribution of non-dominated solutions obtained by each algorithm provided by this invention on the Semeion test set;
[0053] Figure 5 This invention relates to the relationship between the number of features and classification accuracy in MODMA (fear).
[0054] Figure 6 This invention relates the number of features and classification accuracy of MODMA(sad).
[0055] Figure 7 This invention relates the number of features and classification accuracy of MODMA (happy). Detailed Implementation
[0056] To further illustrate the technical means and effects adopted by the present invention to achieve its intended purpose, the specific implementation methods, structures, features, and effects of the technical solutions proposed according to the present invention are described in detail below with reference to the accompanying drawings and preferred embodiments. Specific features, structures, or characteristics in one or more embodiments may be combined in any suitable form. Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains.
[0057] In one embodiment of the present invention, a depression identification method based on differential evolution feature selection is provided. This method is applied to the field of depression identification, assisting doctors in diagnosing depression and potentially improving doctors' work efficiency in the future. It also makes the feature selection algorithm more interpretable and traceable in the field of EEG-assisted identification. The method includes the following steps:
[0058] Step 100: Acquire raw EEG data and preprocess the acquired raw EEG data;
[0059] Step 200: Based on the preprocessed EEG data, the optimal feature subset is selected using the differential evolution-based feature selection method MODE-FS.
[0060] Step 300: Construct an adaptive hierarchical fusion network model based on Transformer, and train it based on the optimal feature subset to obtain a reference model for depression recognition and obtain reference recognition results.
[0061] The following is a detailed explanation of each of the above steps:
[0062] Step 100: Acquire raw EEG data and preprocess the acquired raw EEG data. The preprocessing includes filtering, reference reconstruction and artifact removal, data segmentation and baseline correction.
[0063] As an example, this step 100 includes the following sub-steps:
[0064] Step 110: Obtain raw EEG data.
[0065] The event-related potential (ERP) signals from the point probe task in the MODMA public dataset were used. The dataset contained 53 participants (29 healthy participants and 24 participants with depression), with 128 leads of EEG signals collected from each participant at a sampling rate of 250 Hz. The point probe task consisted of three parts (fear-neutral, sadness-neutral, and happiness-neutral), with 160 trials in each part. The final original data was constructed with dimensions (3, 53 × 128 × 160, 200), representing 3 emotion pairs, with 1,085,440 samples per emotion pair, and each sample containing 200 sampling points (corresponding to a duration of 0.8 seconds).
[0066] Step 120: Preprocess the acquired raw EEG data. The preprocessing includes filtering, reference reconstruction and artifact removal, data segmentation and baseline correction.
[0067] Specifically, step 120 includes the following sub-steps:
[0068] Step 121: Perform signal filtering on the raw EEG data.
[0069] The signals were preprocessed using MATLAB and its EEGLAB toolbox. First, a bandpass filter was used to limit the frequency band of the raw EEG data, with the filtering range set to 0.1Hz–30Hz, to remove DC drift and high-frequency noise. Then, a notch filter was applied to remove 50Hz power frequency interference.
[0070] Step 122: Reference reconstruction and artifact removal.
[0071] All channel signals were subjected to averaged rereference processing to reduce spatial bias. Subsequently, independent component analysis (ICA) was used to identify and remove non-brain-derived noise components such as eye movement artifacts, thereby improving signal purity.
[0072] Step 123: Data segmentation and baseline correction.
[0073] Using the time points of facial stimulus presentation as cue markers (event types including hcue, fcue, and scrue), continuous EEG signals were segmented. Each segment was 800 ms long, covering the period from 200 ms before stimulation to 600 ms after stimulation. Baseline correction was then performed, using the average potential value within the first 200 ms as a baseline reference to offset the impact of initial offset on subsequent feature extraction.
[0074] Step 200: Based on the preprocessed EEG data, the optimal feature subset is selected using the differential evolution-based feature selection method MODE-FS.
[0075] As an example, this step 200 includes the following sub-steps:
[0076] Step 210: Introduce fuzzy cognitive graphs and cosine similarity to calculate feature association weight matrix and feature redundancy index respectively. Based on the population initialization strategy of feature association weight matrix and feature redundancy index, divide the population into four sub-populations, and then merge them into a total population to participate in evolution.
[0077] Specifically, step 210 includes the following sub-steps:
[0078] Step 211: Introduce a Fuzzy Cognitive Map (FCM) to calculate the feature association weight matrix Q.
[0079] FCM simulates the dynamic evolution of a system by iteratively updating the state values of features (nodes), and its formula is as follows:
[0080] (1);
[0081] In the formula, w ij The weights of the edges represent the features (nodes). i The degree of influence on feature (node) j; Indicates the first j The feature (node) in the th... l The state value at +1 iteration; It is an activation function, such as a threshold function or a sigmoid function, used to normalize the calculation results to a specified range.
[0082] The final feature association weight matrix Q (i.e., Q=[w ij ] n×n The update formula for (where n is the number of feature nodes) is:
[0083] (2);
[0084] In the formula, Q (l+1) Indicates the first l+ Feature association weight matrix at iteration 1; Q (l) Indicates the first l Feature association weight matrix at the next iteration; Indicates feature y in the first place l The feature state at the next iteration; α =0.001 is the learning rate, which controls the step size for each update; λ =0.01 is the regularization coefficient used to prevent overfitting, and tanh is the hyperbolic tangent activation function that maps the input to the range [-1, 1].
[0085] Step 212: Introduce cosine similarity and calculate feature redundancy index A.
[0086] Cosine similarity measures the directional consistency between two feature vectors. The formula for calculation is:
[0087] (3);
[0088] In the formula, Represents the cosine similarity value. and These represent two eigenvectors, and Let its Euclidean norm be denoted as . The cosine similarity value ranges from [-1, 1]. A cosine similarity value closer to 1 indicates that the two feature vectors are highly similar or redundant, while a cosine similarity value closer to 0 indicates that the two feature vectors are almost unrelated.
[0089] A is The representation of matrix A ij =Cosine Similarity ij Representative characteristics i and characteristics j The degree of similarity.
[0090] Step 213: Using a population initialization strategy that combines feature association weight matrix and feature redundancy index, the population is divided into four subpopulations.
[0091] This invention improves upon the traditional differential evolution initialization strategy to increase the diversity of the initial population.
[0092] This invention divides the population into four subpopulations: P1, P2, P3, and P4. P1 represents the set of individuals formed by randomly combining features with high feature association weights after removing 40% of the features with poor feature association weights. P2 represents the set of inferior solutions formed after removing 40% of the features with poor feature association weights, without considering redundant features. P3 represents the set of elite individuals composed of features with high feature association weights and without redundancy. P4 represents the set of elite individuals composed of features with high feature association weights but without considering redundant features.
[0093] Step 214: Merge all subpopulations into a single population to participate in evolution.
[0094] Step 220: Guide individuals to mutate through the feature association weight matrix, and optimize the quality of the solution by combining non-dominated ranking and classification error rate priority criteria, thereby achieving feature selection optimization of individuals in the population.
[0095] Specifically, step 220 includes the following sub-steps:
[0096] Step 221: Calculate the offset weight matrix Q1 based on the feature association weight matrix.
[0097] The formula for calculating the offset weight matrix Q1 is:
[0098] Q1[j]=Q[j]-mean(Q),∀j∈{1,2,…,N} (4);
[0099] In the above formula, Q1[j] represents the weight matrix Q1 after the shift. j The element represents the nth element. j The offset weight matrix value of the i-th feature; Q[j] represents the i-th feature association weight matrix. j The element represents the nth element. j The original feature association weight matrix values of each feature; mean(Q) represents the mean of the feature association weight matrix; j This represents the feature index, and N represents the total number of features.
[0100] Step 222: Based on the offset weight matrix, adjust the mutation vector by fusing weights through the Hadamard product.
[0101] Adjust the mutation vector based on the offset weight matrix Q1 v The formula is:
[0102] (5);
[0103] In the formula, v ′ represents the adjusted mutation vector; Represents element-wise product; vThe mutation vector is generated through the traditional Differential Evolution (DE) strategy, and its calculation formula is:
[0104] (6);
[0105] in, r 1. r 2 and r 3 represents three distinct individuals; F This represents the scaling factor.
[0106] Step 223: Select features based on the adjusted mutation vector.
[0107] Adjusted mutation vector v The value of ′ may include both positive and negative values, but this embodiment only retains ′. v The features that are greater than 0 are selected to ensure that the selected features are consistent with the orientation of the offset weight matrix Q1.
[0108] Specifically, it includes:
[0109] Step 2231: Based on the characteristics of the current individual Xi j Obtain the corresponding feature redundancy value A [ j ] and the adjusted mutation vector v ′[ j ];
[0110] Step 2232: Calculate the median of the feature redundancy index A and check the features. j Feature redundancy value A[ j Is it below the feature redundancy index? A The median, while checking v′[ j Is it greater than 0?
[0111] If both conditions are met, the feature is added to the new individual Xnew; otherwise, the feature is not added.
[0112] Step 2233: For the features selected in the new individual Xnew, randomly assign values within the interval [0.6,1] to strengthen high-weight features; for the unselected features, assign values within the interval [0,0.6] to suppress redundant or low-weight features.
[0113] Step 2234: Calculate the fitness value of the new individual Xnew.
[0114] Compare Xnew with the current individual Xi in a non-dominated ranking. If Xnew is better than Xi in the non-dominated ranking, then replace Xi with Xnew in the next generation of the population; otherwise, retain Xi.
[0115] The features of the new individual Xnew (features with values between 0 and 0.6 in Xnew are discarded, and only features with values greater than 0.6 are retained) are re-input into the KNN classification model. KNN calculates the fitness value of Xnew based on the input features. The fitness value is calculated as (feature selection ratio, classification error rate), where the feature selection ratio = the number of features input to KNN / the total number of features, and the classification error rate = the classification error rate calculated by KNN based on the input features. The fitness value is a two-dimensional value, for example, (0.15, 0.2), where 0.15 represents the feature selection ratio and 0.2 represents the classification error rate.
[0116] Step 230: Introduce a feature optimization adaptive grid mechanism in the fitness space to dynamically detect and adjust the population distribution and select the optimal feature subset. The feature optimization adaptive grid mechanism includes refining the dense grid and repeatedly optimizing the solution.
[0117] Specifically, step 230 includes the following sub-steps:
[0118] Step 231: Map the population to the fitness space and divide it into dynamic grid cells. Count the number of individuals in each dynamic grid. If the number of individuals in a dynamic grid exceeds a preset threshold, mark it as a dense grid.
[0119] In each generation of evolution, the population is first mapped to the fitness space, and the population is divided into n×n grid cells G{x,y} using a dynamic grid, as shown in formula (7):
[0120] (7);
[0121] In the formula, f i The fitness value representing an individual; f i1 ∈ [x,x +Δ x This indicates that the individual's first fitness value falls within the interval [ ]. x,x +Δ x )Inside; f i2 ∈[ y,y +Δ y ) indicates that the individual's second fitness value falls within the interval [ y,y +Δ y ) inside; Δ x and Δ y These represent the width and height of the grid, respectively.
[0122] (8);
[0123] In the above formula, Δ xCalculate the range of the first fitness value across all individuals and divide it into... n Intervals; Δ y Calculate the range of the second fitness value across all individuals and divide it into... n A range.
[0124] For each dynamic grid cell, count the number of individuals it contains; if the number of individuals in a dynamic grid cell exceeds a preset threshold, then mark the dynamic grid cell as a dense grid.
[0125] Step 232: Perform non-dominated sorting on individuals in the dense grid, select non-dominated solutions to enter the next generation of the population; and further subdivide the dense grid into smaller sub-grids and redistribute individuals.
[0126] Non-dominated sorting is performed on individuals in a dense grid, and non-dominated solutions are selected to enter the next generation of the population. If all individuals in a certain dense grid are non-dominated solutions, then according to the requirements of the feature selection task, individuals with lower error rates are retained based on the error rate priority criterion.
[0127] To adapt to changes in individual distribution, the dense grid is further subdivided into smaller subgrids, individuals are redistributed, and the detection is repeated. If the subgrid is still a dense grid, the subdivision continues. If the preset sparsity condition is reached, the subdivision stops to control computational resource consumption.
[0128] Step 233: For individuals with poor fitness in the dense grid, use the global strategy to integrate the feature association weight matrix Q and the feature redundancy index A, repeat the optimization process, and select the optimal feature subset.
[0129] For individuals with poor fitness in a dense grid, the following indicators are considered comprehensively based on the global optimization strategy: feature association weight matrix Q and feature redundancy index A.
[0130] Perform optimization and modification operations: delete features with low correlation weights and high feature redundancy, and add features with high correlation weights and low feature redundancy. While ensuring the number of individual features remains unchanged, improve the overall fitness and enhance the convergence and diversity of evolutionary directions.
[0131] Step 300: Construct an adaptive hierarchical fusion network model based on Transformer, and train it based on the optimal feature subset to obtain a reference model for depression recognition and obtain reference recognition results.
[0132] The reference recognition results can assist doctors in diagnosing depression, which can improve doctors' work efficiency in the future and make feature selection algorithms more interpretable and traceable in the field of EEG-assisted recognition.
[0133] This embodiment proposes a Transformer-based Network with Adaptive Hierarchical Fusion (TNAHF) model, whose core innovation lies in the multi-level feature fusion mechanism of adaptive weights. By fusing the outputs of multiple Transformer encoders, features at different levels of abstraction are extracted and integrated, thereby significantly improving the model's expressive power and recognition performance. Simultaneously, it helps to more accurately extract features from EEG data, thus enabling the classification of whether a person suffers from depression.
[0134] Step 310: Construct an adaptive hierarchical fusion network model based on Transformer.
[0135] In the example described above, step 310 includes the following sub-steps:
[0136] Step 311: Input Encoding: Standard sine-cosine position encoding is used to inject position information, enabling the Transformer to recognize the temporal dependencies of the input sequence.
[0137] To effectively model the input time-series data, this TNAHF model employs standard sine-cosine position coding to inject positional information, enabling the Transformer to identify the temporal dependencies of the input sequence. Its calculation method is shown in formula (9):
[0138] , (9);
[0139] In the above formula, t Indicates the time step or position index in the input sequence; i It is the feature dimension index; D represents the total dimension of the input features; PE (t,2i) Indicates at time step t Dimension 2 i Location code value; PE (t,2i+1) Indicates at time step t Dimension 2 i +1 is the position code value.
[0140] The encoded input is represented as X POS = X + PE This enables the model to utilize the positional information of elements, enhancing its temporal modeling capabilities, where X represents the input sequence.
[0141] To match the input format of the Transformer (sequence length first), further... X POS Convert to As input data for the encoder.
[0142] Step 312: Feature Extraction: The input data undergoes feature extraction via the Transformer encoder.
[0143] The input data is processed by a 4-layer stacked Transformer encoder for feature extraction. Each layer includes a multi-head self-attention mechanism (MSA), a feedforward network (FNN), residual connections, and layer normalization to enhance feature representation capabilities.
[0144] MSA employs four attention heads to capture different contextual information; FNN sets the hidden layer dimension to 512 and uses the ReLU activation function to enhance nonlinear expressiveness; residual connections and layer normalization help alleviate the gradient vanishing problem and accelerate model convergence.
[0145] The output of each Transformer encoder layer is cached, ultimately forming a feature sequence { E1, E2, E3, E4},in E1 is the output of the first encoder layer, representing the result after preliminary feature extraction; E2 is the output of the second encoder layer, which performs more in-depth feature mining based on E1; and so on, with E4 being the output of the fourth encoder layer, containing the highest level of abstract features. These features at different levels will be used appropriately in the subsequent hierarchical feature fusion process to improve the model's feature representation ability and classification performance.
[0146] Step 313: Hierarchical Feature Fusion: Calculate the weighted sum of different Transformer layers to enable the model to fully utilize information from different levels.
[0147] To effectively integrate temporal features from different levels of abstraction, this invention proposes a hierarchical feature fusion mechanism with adaptive weights. This mechanism calculates a weighted sum across different Transformer layers, enabling the model to fully utilize information from different levels and thus enhance feature representation capabilities. The calculation method is shown in formula (10):
[0148] (10);
[0149] In the formula, X fusion This represents the fused feature representation, which integrates feature information from different Transformer layers; To normalize the weights, ; wi To initialize the weight coefficients; E i Indicates the first i Output characteristics of the layer Transformer encoder.
[0150] The hierarchical feature fusion mechanism with adaptive weights ensures that features from different layers can be reasonably fused, thereby improving the model's feature representation capability. The fused features are averaged along the time dimension to obtain a global feature representation.
[0151] Step 314: Map the data to 2D through a fully connected layer, and calculate the probability distribution of categories (MDD / HC) using the Sigmoid activation function to achieve depression identification.
[0152] Step 320: Train the TNAHF model based on the optimal feature subset to obtain a reference model for depression identification; in the training and optimization process of the TNAHF model, the binary cross-entropy (BCE) loss function is used.
[0153] The loss function is calculated as shown in formula (11):
[0154] (11);
[0155] In the above formula, L Indicates the loss value; B Indicates batch size; y i Indicates the first i The true label of each sample; Indicates the first i The model predicts the probability of a sample.
[0156] For the optimizer, AdamW was chosen with an initial learning rate of 0.0001 and a weight decay coefficient of 0.001. The ReduceLROnPlateau mechanism was used to monitor loss changes and adaptively adjust the learning rate to prevent excessively high learning rates from causing oscillations or excessively low learning rates from affecting convergence speed. Furthermore, to prevent overfitting, Dropout was added between layers with a dropout rate of 0.3 to enhance generalization ability.
[0157] Based on the selected optimal feature subset, it was put into the TNAHF model and used the publicly available multimodal MODMA dataset. The accuracy was 94.93%, 94.87% and 95.99% in fear, sad and happy modalities, respectively, which is better than other classification and recognition models.
[0158] Based on the same inventive concept, this application also provides a depression recognition system based on differential evolutionary feature selection for implementing the depression recognition method based on differential evolutionary feature selection described above. The solution provided by this system is similar to the implementation scheme described in the above method; therefore, the specific limitations in one or more system embodiments provided below can be found in the limitations of the depression recognition method based on differential evolutionary feature selection described above, and will not be repeated here.
[0159] In one embodiment, a depression recognition system based on differential evolution feature selection is provided, including an EEG data preprocessing module, a differential evolution feature selection module, and a depression recognition module.
[0160] The EEG data preprocessing module is used to acquire raw EEG data and preprocess the acquired raw EEG data.
[0161] The feature selection module based on differential evolution is used to select the optimal feature subset based on preprocessed EEG data using a feature selection method based on differential evolution.
[0162] The depression identification module is used to construct an adaptive hierarchical fusion network model based on Transformer, and train it based on the optimal feature subset to obtain a depression identification reference model and obtain reference identification results.
[0163] To further illustrate the effects of the embodiments of the present invention, the following experiments were conducted.
[0164] The experiment of this invention consists of three parts: the first part uses multiple datasets to verify the effectiveness of the MODE-FS algorithm; the second part applies the proposed method to select the optimal feature subset for depression; and the third part uses the selected optimal feature subset and the TNAHF model to identify depression.
[0165] To verify the accuracy and effectiveness of the proposed feature selection method, 11 publicly available datasets were selected as data for the demonstration experiment. Details of the datasets are shown in Table 1.
[0166] Table 1 Dataset
[0167]
[0168] Proof Experiment:
[0169] (1) Experimental objective:
[0170] Test whether the feature selection method is accurate in feature evaluation.
[0171] (2) Classifier training:
[0172] K-Nearest Neighbors (KNN) method, K=5;
[0173] (3) Specific steps of the experiment:
[0174] First, feature selection methods are used to evaluate features in 11 datasets. Each dataset is randomly divided into training and test sets, with a ratio of 60% and 40%, respectively. During training, KNN is used on the training set to evaluate the classification error rate of the selected features, and the test set is used to validate the performance of the final model. This invention compares MODE-FS with five multi-objective algorithms, including: NSGA-II (Non-dominated sorting genetic algorithm II), MOEA / D (decomposition-based multi-objective evolutionary algorithm), MFFS (multi-form optimization feature selection algorithm), MOCDE (differential evolution-based clustering feature selection algorithm), and CMODE (competitive multi-objective differential evolution algorithm). The effectiveness of the proposed method is evaluated using hypervolume (HV) and inverted generational distance (IGD).
[0175] (4) Performance comparison:
[0176] The comparisons of HV and IGD across 11 datasets are shown in Tables 2 and 3, with the best performance indicated by bold black text. To further evaluate the overall performance of the MODE-FS algorithm in multi-target feature selection tasks, Figures 2-4 The distribution of nondominated solutions obtained by MODE-FS and five comparative algorithms on three random datasets is shown. The horizontal axis represents the feature selection ratio, and the vertical axis represents the classification error rate. All solution sets are derived from the Pareto solution sets obtained by each algorithm in 30 independent runs corresponding to the median HV value.
[0177] Table 211 compares HV for each dataset in each algorithm.
[0178]
[0179] Table 311 compares IGD on each algorithm for IGD across IGD datasets.
[0180]
[0181] (5) Experimental conclusions
[0182] Experimental results clearly demonstrate that MODE-FS exhibits a strong overall advantage in multi-objective feature selection tasks. Specifically, MODE-FS achieves excellent performance on most datasets in both the HV and IGD core metrics, showing significant advantages, particularly in solution set distribution balance and overall convergence. Although MFFS and NSGA-II achieve local optima in IGD values on individual datasets, MODE-FS demonstrates greater stability and broader adaptability in the overall trend.
[0183] In terms of the High Value (HV) metric, MODE-FS achieved state-of-the-art results on 9 out of 11 datasets, demonstrating its outstanding performance in constructing balanced and diverse Pareto front solution sets. A higher HV value indicates stronger coverage of the solution set in the target space and a good trade-off between solution diversity and quality. This performance improvement is mainly attributed to the diversity maintenance mechanisms introduced in MODE-FS, including initialization strategies based on feature importance and redundancy, dynamic grid partitioning methods, and subset iterative optimization mechanisms. In contrast, while other comparative algorithms may exhibit some diversity on certain datasets, their overall solution set distribution and balance remain insufficient. Especially on datasets with high-dimensional features or complex structures, MODE-FS maintains stable solution set quality, validating its excellent global exploration capabilities and adaptability.
[0184] In terms of IGD metrics, MODE-FS also achieved excellent results on most datasets, obtaining the best values on 7 datasets, demonstrating strong convergence and the ability to approach the true Pareto front. MFFS showed local advantages on some datasets, achieving the best IGD on 3 datasets, while NSGA-II achieved the best results on 1 dataset. However, MODE-FS maintained stable performance in most scenarios, and combined with its significant lead on HV, its overall performance was more advantageous in multi-objective optimization tasks. This further indicates that MODE-FS can achieve an effective balance between solution distribution and convergence, and the selected feature subset has stronger discriminative power and adaptability.
[0185] Distribution analysis of non-dominated feature subsets: From an overall distribution perspective, MODE-FS demonstrates superior Pareto front construction capabilities on the vast majority of datasets, achieving a good balance between the two optimization objectives of feature selection ratio and classification performance in the generated non-dominated solutions. Particularly in eight datasets—WBCD, Ionosphere, Sonar, Hillvalley, DLBCL, Musk1, Segment, and Semeion—MODE-FS's solution sets exhibit the best performance on the front boundaries, not only outperforming in both error rate and feature subset ratio, but also achieving complete dominance over other algorithms in multiple solutions, fully demonstrating its excellent convergence and dimensionality reduction capabilities. For example, in the WBCD and DLBCL datasets, MODE-FS achieves extremely low classification error rates while maintaining a small feature subset, and constructs continuous, smooth non-dominated Pareto fronts; while in datasets such as Musk1, Segment, and Semeion, its non-dominated solutions are densely distributed with a wide boundary coverage, demonstrating the algorithm's good adaptability and stability to different dimensions and sample sizes.
[0186] In the Arrhythmia, Toxicity, and SRBCT datasets, MODE-FS performed relatively weakly. In Arrhythmia, MODE-FS had a higher final classification error rate than MFFS, but its solution set was more widely distributed in the target space, exhibiting some diversity. In the Toxicity dataset, although MFFS achieved a better overall front, MODE-FS still provided some non-dominated solutions that were superior to other comparative algorithms, demonstrating local advantages. In the SRBCT dataset, MFFS provided only one non-dominated solution point, with limited coverage, while the solution provided by MODE-FS, although dominated in some regions, still possessed some boundary exploration ability. Overall, although in some datasets, the non-dominated solutions of MODE-FS were dominated by other algorithms in local regions, complete dominance was rare. Furthermore, MODE-FS still provided a competitive solution set in terms of feature selection ratio and classification accuracy, demonstrating stable overall performance and making it a robust multi-target feature selection method.
[0187] Part 2 Experiment: The MODE-FS method was applied to select the optimal feature subset for depression, thereby enabling TNAHF for depression identification;
[0188] The MODE-FS feature selection method was used to evaluate the features of EEG data, select the optimal feature subset, and use this feature subset as the input features of the TNAHF model.
[0189] The dataset used in this invention is MODMA, with EEG signal data derived from 24 patients with depression (MDD) and 29 healthy controls (HC), and the impedance of each electrode was maintained below 50kΩ. The dataset contains three emotional modalities: happy, sad, and fear, each containing 200 features and 1,085,440 samples. The task is binary classification, categorizing data as normal or abnormal. To improve the efficiency of feature selection computation, 10 groups were randomly selected from over 1 million data points, each containing 5,000 normal data points and 5,000 abnormal data points. To evaluate model performance, we used the K-Nearest Neighbors (KNN, K=5) algorithm for testing, and the dataset was divided into training and test sets, with the training set accounting for 80% and the test set accounting for 20%.
[0190] Table 4 (using Fear as an example) shows a partial set of non-dominated solutions generated from 10 datasets. These solutions were first sorted by the number of features, and given the same number of features, solutions with lower error rates were prioritized. As can be seen from Table 4, MODE-FS effectively ensures the diversity of the solution set while significantly reducing the number of selected features (the lowest feature ratio is only 0.005), thereby significantly improving model performance.
[0191] Table 4 shows a selection of non-dominated solutions (fear) from all generated solution sets.
[0192]
[0193] This invention tested all non-dominated solutions and input the corresponding individual data (Example Table 4) into the TNAHF model for training. The recognition rates for depression were obtained by evaluating different emotion datasets. Specifically, the highest recognition rate of the trained model was 94.93% on the fear dataset; 94.87% on the sad dataset; and 95.99% on the happy dataset. Figures 5-7 As shown, after processing with the proposed MODE-FS, the recognition rates of these sentiment datasets are significantly higher than those of the original datasets. These results demonstrate that TNAHF exhibits strong adaptability and high recognition accuracy on multiple sentiment datasets, effectively improving the detection performance of depression. Furthermore, the proposed MODE-FS significantly reduces data dimensionality through an efficient feature selection process, while simultaneously improving the model's recognition rate.
[0194] The TNAHF model for detecting depression of this invention is compared with some existing methods for detecting depression. The comparison is shown in Table 5.
[0195] Table 5 Comparison of methods for detecting depression
[0196]
[0197] The experimental results above demonstrate that the proposed feature selection method, MODE-FS, has proven its accuracy and effectiveness using 11 publicly available datasets. Using the MODE-FS feature selection method, this invention evaluated EEG features and selected the optimal features to form a new feature subset. When incorporated into the TNAHF model, the results show a significant improvement in recognition rate.
[0198] The depression identification algorithm based on differential evolution feature selection selects the optimal features, reduces the number of features, assists doctors in quickly, efficiently and accurately diagnosing patients, and improves the recognition rate of depression.
[0199] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.
Claims
1. A depression identification system based on differential evolutionary feature selection, characterized in that, include: The EEG data preprocessing module is used to acquire raw EEG data and preprocess the acquired raw EEG data. The feature selection module based on differential evolution is used to select the optimal feature subset based on preprocessed EEG data using a differential evolution-based feature selection method. This includes: introducing a feature association weight matrix and a feature redundancy index; employing a population initialization strategy combining these two factors to divide the population into four subpopulations, which are then merged into a single population for evolution; guiding individual mutations through the feature association weight matrix and optimizing the solution quality using non-dominated ranking and classification error rate priority criteria; and introducing a feature optimization adaptive grid mechanism in the fitness space to refine the dense grid and repeatedly optimize solutions to select the optimal feature subset. The depression identification module is used to construct an adaptive hierarchical fusion network model based on Transformer, and train it based on the optimal feature subset to obtain a depression identification reference model and obtain reference identification results.
2. The depression identification system based on differential evolutionary feature selection according to claim 1, characterized in that, The preprocessing includes filtering, reference reconstruction and artifact removal, data segmentation and baseline correction.
3. The depression identification system based on differential evolutionary feature selection according to claim 1, characterized in that, The feature redundancy index is introduced, which includes: for multiple feature vectors, calculating the cosine similarity value between each pair of feature vectors, and integrating multiple cosine similarity values to form the feature redundancy index.
4. The depression identification system based on differential evolutionary feature selection according to claim 1, characterized in that, The four subpopulations include P1, P2, P3, and P4, where P1 represents the set of individuals formed by random combinations of features with a feature association weight greater than the preset threshold after deleting features with a feature association weight less than the preset threshold; P2 represents the set of inferior solutions formed without considering redundant features after deleting features with a feature association weight less than the preset threshold; P3 represents the set of elite individuals formed by features with a feature association weight greater than the preset threshold and redundant features removed; and P4 represents the set of elite individuals formed by features with a feature association weight greater than the preset threshold but without considering redundant features.
5. A depression identification system based on differential evolutionary feature selection according to claim 1, characterized in that, The mutation of individuals is guided by the feature association weight matrix, and the quality of the solution is optimized by combining non-dominated ranking and classification error rate priority criteria, including: Calculate the offset weight matrix based on the feature association weight matrix and the mean of the feature association weight matrix; Based on the offset weight matrix, the mutation vector is adjusted by weight-guided fusion through Hadamard product; Calculate the redundancy value of the features and the median of the redundancy index of each feature; Based on the adjusted mutation vector and the median of the feature redundancy index, features are selected by combining non-dominated ranking and classification error rate priority criteria. The selection conditions are: the feature redundancy value is lower than the median of the feature redundancy index, and the corresponding dimension value of the adjusted mutation vector is positive.
6. A depression identification system based on differential evolutionary feature selection according to claim 1, characterized in that, An adaptive mesh mechanism for feature optimization is introduced into the fitness space. This mechanism refines the dense mesh and repeatedly optimizes the solution to select the optimal subset of features, including: The population is mapped to the fitness space and divided into dynamic grid cells. The number of individuals in each dynamic grid is counted. If the number of individuals in a dynamic grid exceeds the preset threshold for the number of individuals in a grid, it is marked as a dense grid. Perform non-dominated sorting on individuals in the dense grid and select non-dominated solutions to enter the next generation of the population; if all individuals in the dense grid are non-dominated solutions, then use the error rate as the priority criterion and retain individuals with an error rate less than a preset error rate threshold. The dense grid is further subdivided into smaller subgrids. The number of individuals is counted and detected repeatedly in the subgrids. If the subgrid is still a dense grid, the subdivision continues. Individuals with fitness values less than a preset fitness threshold in a dense grid are modified by deleting features with the lowest feature association weight and high redundancy, and adding features with high feature association weight and low redundancy. This is used to select the optimal feature subset.
7. A depression identification system based on differential evolutionary feature selection according to claim 1, characterized in that, Constructing an adaptive hierarchical fusion network model based on Transformer, including: Standard sine-cosine position encoding is used to inject position information and form encoder input data; The input data is processed by a Transformer encoder for feature extraction. The Transformer encoder consists of four layers, each of which includes a multi-head self-attention mechanism, a feedforward network, residual connections, and layer normalization. Calculate the weighted sum of different layers, and take the mean of the fused features along the time dimension to obtain the global feature representation; The model is mapped to 2D through a fully connected layer, and the probability distribution of the categories is calculated through an activation function to construct a reference model for depression identification.
Citation Information
Patent Citations
Depression detection method and system based on electroencephalogram signals and storable medium
CN114869298A
Self-adaptive Lasso-based depression feature extraction method and system
CN118520336A