Social media depression detection method based on symptom time sequence and multi-dimensional interpretability
By introducing a time-attention mechanism and the SHAP method into social media depression detection, a highly interpretable depression detection model is generated, which solves the problems of insufficient focus on key time segments and insufficient interpretability in existing technologies, and achieves high accuracy and clinical adaptability.
Patent Information
- Application Number
- CN202511546725.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-28
- Publication Date
- 2026-01-27
AI Technical Summary
Existing social media depression detection methods lack focused modeling of key time segments and interpretability, resulting in insufficient accuracy and interpretability, making them difficult to apply in clinical settings.
We employ a symptom-time and multi-dimensional interpretability-based approach. By integrating a temporal attention mechanism with a dual interpretability module, and utilizing an explicit temporal attention mechanism and the SHAP method, we generate a temporal-dimensional attention heatmap and a symptom-dimensional SHAP attribution map, thereby enabling us to focus on key time segments and interpret the symptom dimension.
It significantly improves the accuracy and interpretability of depression detection. The model achieves an accuracy of 96.30% and an F1 score of 94.71% on real datasets. Furthermore, it enhances clinical adaptability through interpretability mechanisms, supporting its application in real-world medical scenarios.
Smart Images

Figure CN121416004A_ABST
Abstract
Description
[0001] The present application relates to the technical field of natural language processing and mental health detection, in particular to a social media depression detection method based on symptom time sequence and multi-dimensional explainability. BACKGROUND
[0002] Early detection and intervention are of great significance for depression treatment. In recent years, social media has become an important data source for mental health research due to its large user base, real-time nature, and true emotional expression. By analyzing social media text data, potential depression patients can be efficiently identified, providing a new path for early intervention and screening of depression. Compared with traditional questionnaire surveys or doctor diagnoses, depression detection based on social media has the advantages of low cost, wide coverage, and strong privacy protection. In particular, in an anonymous environment, users are more likely to express their true emotions.
[0003] Currently, there are two main methods for depression detection based on social media: one is a static method that considers user behavior as static overall features, but ignores the evolution of depression state in the time dimension; the other is a dynamic time series modeling method that can capture emotional fluctuations at different times, but most time series classification models use global pooling operations, which cannot focus on key time points, resulting in insensitive response to important symptom signals and affecting the accuracy and explainability of the detection. In addition, existing depression detection methods are mostly "black box" structures, lacking explainability, making it difficult to establish a correspondence between the prediction results and clinical symptoms, which makes it difficult for doctors to verify the reliability of the model and seriously hinders clinical application.
[0004] In view of the above technical defects, a solution is proposed. SUMMARY
[0005] To solve the above-mentioned problems, the present application proposes a social media depression detection method based on symptom time sequence and multi-dimensional explainability, which realizes the coordinated improvement of model performance and explainability by fusing time attention mechanism and dual explainability module. This method faces the challenges of lack of focus modeling on key time segments and limited explainability of decision-making process, which affects its application in actual scenarios.
[0006] The purpose of the present application can be achieved by the following technical solutions: A social media depression detection method based on symptom time sequence and multi-dimensional explainability, comprising the following steps: Step 1, calculate the similarity score of user's social media text and DSM-5 depression symptoms, and construct a multi-dimensional time series feature matrix representing the dynamic evolution of depression symptoms based on the similarity score; Step 2: Utilize a time series feature extraction network with an embedded explicit time attention mechanism, taking the multivariate time series feature matrix constructed in Step 1 as input, and output the user's depression risk prediction result and time attention weights. Step 3: Combine the DSM-5 diagnostic criteria with the SHAP method to achieve a dual interpretable output of the prediction results: A time-dimensional attention heatmap is generated based on the time attention weights, and key text annotations are generated based on the attention heatmaps for time-dimensional interpretation. Based on the calculation of the total contribution of various depressive symptoms to the prediction results using the SHAP method, a SHAP symptom attribution map is drawn to interpret the symptom dimensions.
[0007] In a preferred embodiment of the present invention, step 1 specifically includes: Step 11, Social Media Text Sequence Representation: For each user, select their social media texts in chronological order to form an input sequence; Step 12, Symptom definition statement vector representation: Based on the DSM-5 diagnostic criteria for depression, a set of texts defining multiple types of depressive symptoms is defined. Each social media text and each type of depressive symptom is vector-encoded using a pre-trained semantic model. Step 13, calculate the similarity score between social media text and depressive symptoms: use cosine similarity to measure the semantic relevance between social media text and depressive symptoms; Step 14, Feature Matrix Construction: Based on the semantic correlation between social media texts and depressive symptoms calculated in Step 13, construct a multivariate time-series feature matrix for each user.
[0008] In a preferred embodiment of the present invention, step 14 is followed by: Step 15: Standardize and perform dimensional consistency processing on the multivariate time series feature matrix. All feature values in the multivariate time series feature matrix are standardized using z-score. Users with fewer posts than the selected number of posts are padded with zeros to ensure that the input dimensions of the multivariate time series feature matrix are consistent.
[0009] In a preferred embodiment of the present invention, step 2 specifically includes: Step 21, Multi-scale convolutional feature extraction: A time series feature extraction network containing parallel multi-branch convolutional modules is used to model the multivariate time series feature matrix. The time series feature extraction network is implemented using the InceptionTime architecture. The formula for deep convolutional modeling of the multivariate time series feature matrix using the InceptionTime network is as follows: In the above formula, InceptionModule represents a feature extractor composed of multiple parallel convolutional blocks. F represents the feature matrix output after feature extraction by the InceptionModule; X represents the input multivariate time series feature matrix; T represents the number of time steps; C represents the number of channels in the extracted feature matrix.
[0010] Step 22: Introduce an explicit attention mechanism onto the feature matrix output in step 21: First, the attention score is calculated using a fully connected layer, with the following formula: Then, the attention weight distribution at each time step is obtained by normalizing using the softmax function: In the above formula, 'a' represents the attention weight. For learnable parameters, each This indicates that the model considers the t-th time step to be important; Step 23, Attention Weighted Convergence: Based on the attention distribution learned in Step 22, the features in the feature matrix are weighted and summed to obtain a fixed-dimensional feature vector z, as shown in the formula: In the above formula, For the features at time step t, The corresponding attention weights are used to obtain the final fixed-dimensional feature vector z; Step 24, classification output: The feature vector z obtained in step 23 is used as input, and finally, it is passed through a fully connected layer and softmax activation to output the binary classification probability result. The standard cross-entropy loss is used for training.
[0011] In a preferred embodiment of the present invention, step 3 specifically includes: Step 31: Draw an attention heatmap for interpretation over time, and output the weight distribution for each time step, using the following formula: In the above formula, This represents the intermediate features at time step t, i.e., the features in the feature matrix F output by the time series feature extraction network corresponding to time step t. ∈(0,1) represents the normalized attention weight, indicating the degree of attention paid to that point in time; Step 32: Generate key text annotations based on the attention heatmap and interpret them in the time dimension. Select the top k time steps with the highest attention values and automatically display their original text content to form key text annotations that facilitate observation of the correspondence between model attention and depressive language behavior.
[0012] In a preferred embodiment of the present invention, step 3 further includes: Step 33: Draw a SHAP symptom attribution map to interpret the symptom dimensions. Introduce the SHAP method to calculate the SHAP value of the features. The formula is: In the above formula, F' is the set of all input features, and S is a subset of F' that does not contain the i-th feature. This represents the marginal contribution of the i-th feature to the final prediction; For the input multivariate time series feature matrix For the eigenvector at each time step t Calculate the SHAP value separately : Finally, the SHAP values at all time steps are weighted and aggregated to obtain the overall attribution vector for each symptom dimension in the entire time series. : According to the DSM-5 diagnostic criteria for depression, the symptom dimensions are mapped to k=11 symptom dimensions, each symptom... Corresponding to a set of feature indexes Calculate its contribution value The formula is: In the above formula, The total contribution of the k-th type of depressive symptom to the prediction results is represented by a horizontal bar chart, forming a Symptom Level SHAP Attribution Chart to reveal the specific clinical symptom explanations corresponding to the model's judgment results.
[0013] In a preferred embodiment of the present invention, step 3 further includes: Step 34 introduces a symptom interpretation mapping mechanism to interpret symptom dimensions, converting the symptom category of each dimension into a natural language description.
[0014] Compared with the prior art, the present invention has the following beneficial effects: 1. Significantly improved performance in depression detection: The multi-level interpretable temporal attention network proposed in this invention introduces an explicit temporal attention mechanism into the time series feature extraction network, achieving precise focus on key time steps. Experiments on the SWDD and WU3D real social media datasets show that the model achieves an accuracy of 96.30% and an F1 score of 94.71%, which is significantly better than existing baseline algorithms. 2. Breakthrough in emotion evolution modeling capabilities: By actively focusing on the most critical time segments in the prediction through an explicit time attention mechanism, the model enhances its ability to model the evolution of users' emotional states. This mechanism enables the model to identify dynamic features such as the duration of emotional lows, thereby improving the discrimination effect. 3. Enhanced Clinical Interpretability: A dual-layer interpretation mechanism integrating clinical semantics was designed, combining attention heatmaps and SHAP symptom attribution maps to collaboratively interpret model prediction results from both time and symptom dimensions. This significantly improves the interpretability and clinical adaptability of the model and provides technical support for the deployment of AI systems in real medical scenarios. Attached Figure Description
[0015] To facilitate understanding by those skilled in the art, the present invention will be further described below with reference to the accompanying drawings.
[0016] Figure 1 This is an overall framework diagram of the social media depression detection method based on symptom timing and multi-dimensional interpretability, according to an embodiment of the present invention.
[0017] Figure 2 This is a feature extraction framework diagram for multivariate time series features according to an embodiment of the present invention.
[0018] Figure 3 This is a diagram of a depression detection method based on an attention mechanism according to an embodiment of the present invention.
[0019] Figure 4 This is a diagram illustrating the multi-dimensional interpretability analysis method of an embodiment of the present invention.
[0020] Figure 5 This is an example of an attention heatmap of a depressed user over a time series of 500 time series.
[0021] Figure 6 This is a SHAP symptom contribution map according to an embodiment of the present invention. Detailed Implementation
[0022] To provide a clearer and more complete explanation of the technical solutions and implementation details of this invention, the following will describe the invention in further detail with reference to the accompanying drawings in the embodiments. Obviously, the described embodiments are merely some embodiments of this invention, and not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0023] refer to Figure 1 A social media depression detection method based on symptom timing and multidimensional interpretability includes the following three steps: Step 1: Symptom temporal feature extraction. Calculate the text similarity score between the user's historical social media posts and DSM-5 depressive symptoms to construct a multivariate time series representing the dynamic evolution of depressive symptoms. Please refer to [link to relevant documentation]. Figure 2 As shown, the specific implementation method of step 1 is as follows: Step 11, Social Media Text Sequence Representation: For each user, select their social media texts in chronological order to form an input sequence; This invention utilizes two social media depression datasets: the Sina Weibo Depression Dataset (SWDD) and the Weibo User Depression Detection Dataset (WU3D). SWDD is the first large-scale depression dataset to comprehensively collect users' Twitter history, while WU3D includes over 10,000 users with depression and over 20,000 users without depression, each containing rich information fields. 3,500 users with depression and 3,500 users without depression were randomly selected from the SWDD and WU3D datasets, respectively, as experimental datasets, denoted as SWDD-7 and WU3D-7. The datasets were further divided into three subsets: 60% for training, 20% for validation, and 20% for testing. Each subset contained the same number of users with depression and those without depression. Statistical data are summarized in Table 1. Table 1 Summary of Statistical Data Data preprocessing: Data preprocessing mainly focused on cleaning up tweet text and time series preprocessing, using the rules in Table 2 to clean up Sina Weibo text; Table 2 Weibo Text Preprocessing Rules For time series preprocessing: The number of posts by Weibo users often varies, leading to inconsistencies in the length of the multivariate time series obtained for each sample. To better convert these posts into fixed values for use in multivariate time series classification models for depression detection, the time series needs to be padded and standardized. Research shows that analyzing a user's posts on social media over three months can effectively determine whether the user is depressed. By analyzing the user's average monthly posts, a reasonable upper limit for posts is found to be 500. Therefore, zero-padding is used to increase the length of the multivariate time series to 500, thus ensuring the consistency of the obtained multivariate time series length.
[0024] Step 12, Symptom Definition and Sentence Vector Representation: Based on the DSM-5 diagnostic criteria for depression, a set of m=11 core symptom texts is defined. Each social media text and each symptom is vector-encoded using a pre-trained semantic model. Step 13: Calculate the similarity between social media text and symptoms, using cosine similarity to measure the semantic relevance between social media text and symptoms; Step 14, Feature Matrix Construction: Through the above calculations, a multivariate time series feature matrix for each user is constructed. Step 15: Standardization and dimensional consistency processing. All features are z-score standardized. Users with fewer posts than the number of selected posts are padded with zeros to ensure consistent input dimensions.
[0025] Step 2: Depression Detection and Attention Focusing. An explicit temporal attention mechanism is introduced into the time series feature extraction network to enhance the model's ability to discriminate key time steps, outputting the user's depression risk and temporal attention weights. Please refer to [link to relevant documentation]. Figure 3 As shown, the specific implementation method of step 2 is as follows: Step 21, Multi-scale convolutional feature extraction: A time series feature extraction network containing parallel multi-branch convolutional modules is used to model the multivariate time series. This time series feature extraction network can be implemented using the InceptionTime architecture. The InceptionTime network is used to perform deep convolutional modeling on the multivariate time series, as shown in the formula: In the above formula, InceptionModule represents a feature extractor composed of multiple parallel convolutional blocks, and C is the number of channels extracted.
[0026] Step 22, introduce an explicit attention mechanism on the feature matrix: First, the attention score is calculated using a fully connected layer, with the following formula: Then, the attention weight distribution at each time step is obtained by normalizing using the softmax function: In the above formula, These are learnable parameters. Each This indicates that the model considers the t-th time step to be important.
[0027] Step 23, Attention-weighted convergence: Based on the learned attention distribution, the features are weighted and summed to obtain the final representation, as shown in the formula: In the above formula, For the features at time step t, The corresponding weights are used to obtain a feature vector z of fixed dimensions. Step 24: Classify the output. Finally, the binary classification probability result is output through a fully connected layer and softmax activation, and the standard cross-entropy loss is used for training.
[0028] To verify the effectiveness of MITA-Net, this paper selects eight representative time series classification models as comparison baselines, including four machine learning methods (ROCKET, GS, HC2, TSF) and four deep learning methods (MCNN, MCDCNN, TWIESN, InceptionTime).
[0029] (1) Performance on the SWDD-7 dataset Table 3. Experimental results comparing the method of the present invention with other baselines. As shown in Table 3, on the SWDD-7 dataset, MITA-Net significantly outperforms all compared methods, achieving the highest scores in all four dimensions: Accuracy (94.63%), Precision (94.91%), Recall (94.51%), and F1-score (94.71%). Compared to the closest performing deep model, InceptionTime, MITA-Net improves the F1-score by 2.56 percentage points, indicating that the proposed attention mechanism and feature fusion method can more fully extract the emotional dynamics and semantic cues in Weibo time series data.
[0030] Further analysis reveals that traditional machine learning methods generally underperform deep models. Among them, TSF (F1-score=84.22%) and HC2 (F1-score=81.61%), the two strongest traditional methods, still lag significantly behind MITA-Net, indicating a bottleneck in their expressive power when facing the strong unstructured features and semantic variations in Weibo corpora. Lightweight models like ROCKET and GS, with F1-scores of only 74.35% and 76.11% respectively, rely more on statistical features and struggle to fully model long-term user sentiment evolution. Regarding deep models, while TWIESN and InceptionTime possess strong temporal modeling capabilities (F1-scores of 91.70% and 92.15% respectively), their lack of explicit attention mechanisms results in insufficient focus on key Weibo posts, leading to slightly lower overall performance. In contrast, MITA-Net effectively extracts contextual representations and utilizes temporal attention to focus on high-weight Weibo posts, significantly improving prediction accuracy and robustness.
[0031] (2) Performance on the WU3D-7 dataset As shown in Table 3, the WU3D-7 dataset is more challenging than SWDD-7, containing a higher proportion of multimodal elements (such as image information), unstructured text, and noise levels. Despite this, MITA-Net still achieved an accuracy of 91.13% and an F1 score of 91.14%, maintaining its leading position and demonstrating its excellent cross-dataset generalization ability.
[0032] Traditional machine learning methods showed a more significant decline on this dataset. For example, the F1-scores for ROCKET and GS dropped to 71.13% and 73.71%, respectively, possibly due to their inability to effectively model the ambiguity and semantic drift in short Weibo posts. Furthermore, even classic deep learning models such as MCNN and MCDCNN only achieved F1-scores of 82.93% and 82.41%, respectively, indicating limitations in handling more complex user behavior data.
[0033] Based on the experimental results from both datasets, MITA-Net achieved the best performance across all metrics, particularly leading by 1.5% to 3% in the F1-score, demonstrating stable performance across different corpus structures and user behavior patterns. Thanks to its multi-source information fusion structure, its ability to focus on key microblogs through a temporal attention mechanism, and the auxiliary optimization of interpretive modules such as SHAP, MITA-Net not only excels in classification accuracy but also exhibits strong robustness and interpretability. This result provides solid experimental support for its application in practical depression recognition systems.
[0034] Step 3: Dual interpretability analysis. Combining the DSM-5 diagnostic criteria and the SHAP method, an attention heatmap in the time dimension and an attribution map in the symptom dimension are generated. Combined with simplified explanations of clinical symptoms, the predictive results are output with dual interpretability. Please refer to [link to relevant documentation]. Figure 4 As shown, the specific implementation method of step 3 is as follows: Step 31: Draw an attention heatmap for interpretation over time, and output the weight distribution for each time step, using the following formula: In the above formula, Let be the intermediate feature representation at time step t. ∈(0,1) represents the normalized attention weight, indicating the degree of attention paid to that point in time.
[0035] Step 32: Generate key text annotations for interpretation in the time dimension. Select the top k time steps with the highest attention values and automatically display their original text content to form key text annotations, which facilitates observation of the correspondence between model attention and depressive language behavior. In the time dimension, the explicit attention mechanism embedded in MITA-Net outputs attention weights for each input microblog post. See also... Figure 5 As shown, Figure 5 The image shows a heatmap of attention distribution for a depressed user across 500 time steps, with color intensity reflecting the level of attention. It can be seen that the model significantly focuses attention on a small number of key tweets (0-15, 35-45, 70-90, 110-135), which generally contain psychological characteristics such as low mood and self-doubt, clearly correlated with depressive tendencies.
[0036] In addition, this invention also simultaneously generates the original Weibo posts corresponding to the aforementioned high-attention-value regions and their manually annotated results, helping readers intuitively understand why the model focuses on specific Weibo content, as shown in Table 4. This part of the text is automatically selected from high-attention-value locations and displayed after manual review to ensure semantic clarity and reasonable content.
[0037] Table 4 Key Weibo annotations with corresponding attention scores Step 33: Draw a SHAP symptom attribution map to interpret the symptom dimensions. Introduce the SHAP method to calculate the SHAP value of the features. The formula is: In the above formula, F' is the set of all input features, and S is a subset excluding the i-th feature. This represents the marginal contribution of feature i to the final prediction.
[0038] For the input time series For the eigenvector at each time step t Calculate the SHAP value separately: Finally, the SHAP values at all time steps are weighted and aggregated to obtain the overall attribution vector for each symptom dimension in the entire time series: According to the DSM-5 diagnostic criteria for depression, the symptom dimensions are mapped to k=11 symptom dimensions, each symptom... Corresponding to a set of feature indexes The contribution value is calculated using the following formula: In the above formula, The total contribution of the k-th type of depressive symptom to the prediction results is represented by a horizontal bar chart, forming a symptom level SHAP attribution chart, which is used to reveal the specific clinical symptom explanations corresponding to the model's judgment results. Step 34 introduces a symptom interpretation mapping mechanism to interpret the symptom dimensions, converting the symptom category of each dimension (such as suicidal ideation) into a human-understandable language description (repeatedly thinking about death, wanting to die, suicide, ending life, self-harm by cutting wrists with a razor blade, wanting to jump off a building to commit suicide, planning suicide), so that non-professional readers can also understand the psychological meaning represented by each type of SHAP value.
[0039] In terms of symptoms, this paper introduces SHAP (SHapley Additive exPlanations) to perform local attribution analysis on the model prediction results. Figure 6 The results show the SHAP contribution scores of MITA-Net for this user on the eleven dimensions of depressive symptoms in DSM-5, revealing the main basis for the model's final determination of "depression".
[0040] like Figure 6 As shown, the model primarily focuses on typical symptoms such as "suicidal ideation," "loss of energy," and "feelings of worthlessness," with its SHAP value significantly higher than other dimensions. This symptom distribution is highly consistent with the core symptom descriptions of major depressive disorder in the field of clinical psychology, indicating that the model's judgment logic has good interpretability and medical relevance. To enhance the comprehensibility of the visualization, a "symptom interpretation mapping" is also introduced in the figure, where each symptom category is explained through a brief description (e.g., "loss of interest" is mapped to "loss of interest or motivation in daily activities"), allowing readers without a psychology background to quickly understand the symptom meaning corresponding to each SHAP value.
Claims
1. A social media depression detection method based on symptom temporality and multi-dimensional interpretability, characterized in that, Includes the following steps: Step 1: Calculate the similarity score between the user's social media text and DSM-5 depressive symptoms, and construct a multivariate time series feature matrix representing the dynamic evolution of depressive symptoms based on the similarity score; Step 2: Utilize a time series feature extraction network with an embedded explicit time attention mechanism, taking the multivariate time series feature matrix constructed in Step 1 as input, and output the user's depression risk prediction result and time attention weights. Step 3: Combine the DSM-5 diagnostic criteria with the SHAP method to achieve a dual interpretable output of the prediction results: A time-dimensional attention heatmap is generated based on the time attention weights, and key text annotations are generated based on the attention heatmaps for time-dimensional interpretation. Based on the calculation of the total contribution of various depressive symptoms to the prediction results using the SHAP method, a SHAP symptom attribution map is drawn to interpret the symptom dimensions.
2. The social media depression detection method based on symptom timing and multi-dimensional interpretability according to claim 1, characterized in that, Step 1 specifically includes: Step 11, Social Media Text Sequence Representation: For each user, select their social media texts in chronological order to form an input sequence; Step 12, Symptom definition statement vector representation: Based on the DSM-5 diagnostic criteria for depression, a set of texts defining multiple types of depressive symptoms is defined. Each social media text and each type of depressive symptom is vector-encoded using a pre-trained semantic model. Step 13, calculate the similarity score between social media text and depressive symptoms: use cosine similarity to measure the semantic relevance between social media text and depressive symptoms; Step 14, Feature Matrix Construction: Based on the semantic correlation between social media texts and depressive symptoms calculated in Step 13, construct a multivariate time-series feature matrix for each user.
3. The social media depression detection method based on symptom timing and multi-dimensional interpretability according to claim 1, characterized in that, Step 14 is followed by: Step 15: Standardize and perform dimensional consistency processing on the multivariate time series feature matrix. All feature values in the multivariate time series feature matrix are standardized using z-score. Users with fewer posts than the selected number of posts are padded with zeros to ensure that the input dimensions of the multivariate time series feature matrix are consistent.
4. The social media depression detection method based on symptom timing and multi-dimensional interpretability according to claim 1, characterized in that, Step 2 specifically includes: Step 21, Multi-scale convolutional feature extraction: A time series feature extraction network containing parallel multi-branch convolutional modules is used to model the multivariate time series feature matrix. The time series feature extraction network is implemented using the InceptionTime architecture. The formula for deep convolutional modeling of the multivariate time series feature matrix using the InceptionTime network is as follows: In the above formula, InceptionModule represents a feature extractor composed of multiple parallel convolutional blocks. F represents the feature matrix output after feature extraction by the InceptionModule; X represents the input multivariate time series feature matrix; T represents the number of time steps; C represents the number of channels in the extracted feature matrix. Step 22: Introduce an explicit attention mechanism onto the feature matrix output in step 21: First, the attention score is calculated using a fully connected layer, with the following formula: Then, the attention weight distribution at each time step is obtained by normalizing using the softmax function: In the above formula, 'a' represents the attention weight. For learnable parameters, each This indicates that the model considers the t-th time step to be important; Step 23, Attention Weighted Convergence: Based on the attention distribution learned in Step 22, the features in the feature matrix are weighted and summed to obtain a fixed-dimensional feature vector z, as shown in the formula: In the above formula, For the features at time step t, The corresponding attention weights are used to obtain the final fixed-dimensional feature vector z; Step 24, classification output: The feature vector z obtained in step 23 is used as input, and finally, it is passed through a fully connected layer and softmax activation to output the binary classification probability result. The standard cross-entropy loss is used for training.
5. The social media depression detection method based on symptom timing and multi-dimensional interpretability according to claim 4, characterized in that, Step 3 specifically includes: Step 31: Draw an attention heatmap for interpretation over time, and output the weight distribution for each time step, using the following formula: In the above formula, This represents the intermediate features at time step t, i.e., the features in the feature matrix F output by the time series feature extraction network corresponding to time step t. ∈(0,1) represents the normalized attention weight, indicating the degree of attention paid to that point in time; Step 32: Generate key text annotations based on the attention heatmap and interpret them in the time dimension. Select the top k time steps with the highest attention values and automatically display their original text content to form key text annotations that facilitate observation of the correspondence between model attention and depressive language behavior.
6. The social media depression detection method based on symptom timing and multi-dimensional interpretability according to claim 4, characterized in that, Step 3 also includes: Step 33: Draw a SHAP symptom attribution map to interpret the symptom dimensions. Introduce the SHAP method to calculate the SHAP value of the features. The formula is: In the above formula, F' is the set of all input features, and S is a subset of F' that does not contain the i-th feature. This represents the marginal contribution of the i-th feature to the final prediction; For the input multivariate time series feature matrix For the eigenvector at each time step t Calculate the SHAP value separately : Finally, the SHAP values at all time steps are weighted and aggregated to obtain the overall attribution vector for each symptom dimension in the entire time series. : According to the DSM-5 diagnostic criteria for depression, the symptom dimensions are mapped to k=11 symptom dimensions, each symptom... Corresponding to a set of feature indexes Calculate its contribution value The formula is: In the above formula, The total contribution of the k-th type of depressive symptom to the prediction results is represented by a horizontal bar chart, forming a Symptom Level SHAP Attribution Chart to reveal the specific clinical symptom explanations corresponding to the model's judgment results.
7. The social media depression detection method based on symptom timing and multi-dimensional interpretability according to claim 6, characterized in that, Step 3 also includes: Step 34 introduces a symptom interpretation mapping mechanism to interpret symptom dimensions, converting the symptom category of each dimension into a natural language description.