Social media-based interpretable dynamic graph network revenue prediction model training method

By constructing a dynamic graph network model for social media, combining textual temporal memory and multi-layer graph attention network, the problem of temporal modeling of social media topic sentiment was solved, achieving efficient and accurate prediction of financial asset prices and improving the interpretability of the model.

CN122472895APending Publication Date: 2026-07-28HEFEI UNIV OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610954753.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-06-30
Publication Date
2026-07-28

AI Technical Summary

Technical Problem

Existing technologies cannot effectively capture the temporal evolution of topic sentiment and the correlation between topics in social media, resulting in insufficient modeling accuracy, low computational efficiency, and poor interpretability in financial asset price prediction.

Method used

We employ an interpretable dynamic graph network revenue prediction model based on social media. By constructing a topic association graph, text temporal memory units, multi-layer graph attention network, and classifier, and combining a rolling window strategy and KL regularization, we can achieve dynamic modeling and prediction of social media data.

Benefits of technology

It improves the accuracy and efficiency of financial asset price prediction, enhances the interpretability of the model, outputs topic contribution through graph attention network, reduces computational overhead, and optimizes engineering deployment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122472895A_ABST
    Figure CN122472895A_ABST
Patent Text Reader

Abstract

The application discloses a social media-based interpretable dynamic graph network benefit prediction model training method, relates to the technical field of text analysis and market prediction, and obtains market data and related social media data of a financial asset to divide the data by weeks; for the social media data of each week, a topic is taken as a node, and similarity between topics is taken as an edge weight, a topic correlation graph of each week is constructed to obtain weekly graph data; a prediction model performs time sequence updating and market prediction according to the weekly graph data; a text time sequence memory unit obtains a current week topic memory vector according to a current week topic text embedding vector and in combination with a last week topic memory vector; a multi-layer graph attention network captures the correlation features between nodes through an attention mechanism and adopts attention weights for weighted summation to obtain a current week global graph embedding; and a classifier outputs a next week price change prediction result. The application solves the problem that the prior art cannot effectively capture the time sequence evolution of topic sentiment and the correlation between topics.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the technical field of text analysis and market forecasting, and in particular to a training method for interpretable dynamic graph network revenue forecasting models based on social media. Background Technology

[0002] Financial asset prices are influenced by multiple factors, including market sentiment and technological advancements, exhibiting volatile characteristics. Social media has become a core carrier of market sentiment, with users sharing their views on financial assets in real time through posts and discussions. Emotional signals such as "optimism" and "anxiety" embedded in the text show a strong correlation with price fluctuations. However, existing computer systems face significant limitations in feature extraction and modeling capabilities when processing large-scale social media text data with high dimensionality, dynamic evolution, and complex topological structures.

[0003] Currently, the mainstream technical solutions for sentiment analysis of social media texts can be categorized into three types. The first type is the traditional method based on sentiment dictionaries or single-text natural language processing. This method captures the semantics of single texts by constructing dictionaries or pre-trained language models, but treats each post as an independent sample, ignoring the relationships between topics to which posts belong and the global network structure, resulting in a single dimension of information. The second category comprises improved methods that incorporate graph models, exploring the extraction of topic-related features using graph networks. However, these methods generally suffer from significant architectural flaws: some methods employ a linear concatenation of time-step features based on user behavior, failing to construct a global topological graph with topics as nodes, thus failing to model potential dependencies between topics; others, while constructing graph structures, remain at the level of static graphs or snapshot-style analysis, extracting only macroscopic statistical indicators such as node degree and connected components, neither representing topic nodes as dense vectors through graph representation learning nor capturing the temporal evolution of topic sentiment; there are also graph neural network methods for text classification, whose long short-term memory networks and graph attention networks only operate on word sequences and static syntactic dependencies within a single document, unable to adapt to the dynamic graph network scenarios in social media where topic nodes dynamically become dormant based on posting activity and their states need to continuously evolve across periods. The third category consists of methods based on complex deep learning, attempting to improve feature extraction accuracy through a large number of parameters, but the computational overhead is enormous, making it difficult to meet real-time processing requirements, and their internal feature propagation mechanism is a "black box," resulting in severely insufficient interpretability.

[0004] In summary, existing technologies have not yet solved the core limitation of effectively maintaining and updating the historical states of topic nodes across cycles within a single architecture, while simultaneously extracting dynamically evolving topological features. This makes it impossible to jointly model the spatiotemporal evolution characteristics of social media dynamic graph networks, and they also exhibit significant shortcomings in computational efficiency and interpretability. Therefore, there is an urgent need for a social media sentiment classification technology that can balance modeling accuracy, dynamic evolution capture capabilities, and engineering practicality. Summary of the Invention

[0005] To overcome the shortcomings of the prior art, this invention provides a training method for an interpretable dynamic graph network revenue prediction model based on social media, which solves the problem that the prior art cannot effectively capture the temporal evolution of topic sentiment and the correlation between topics.

[0006] To achieve the above objectives, the present invention adopts the following technical solution, including: A training method for interpretable dynamic graph network revenue prediction models based on social media includes the following steps: S1, obtain market data and related social media data for financial assets; divide social media data and market data by week. Social media data includes post posting date, topic, author, and text. Market data refers to price data of financial assets. This involves semantically encoding the text of posts in social media data to obtain text embedding vectors; generating price change labels for the following week based on the price fluctuations of the following week relative to the current week's price, and associating these labels with the social media data of the current week. S2, for weekly social media data, constructs a weekly topic association graph with topics as nodes and the similarity between topics as edge weights, thus obtaining weekly graph data; S3. Construct a predictive model, which includes a textual temporal memory unit, a multi-layer graph attention network, and a classifier. The predictive model performs temporal updates and market predictions based on weekly graph data, as detailed below: Initialize the topic memory vector; The current week's topic text is embedded into the vector input text temporal memory unit, combined with the previous week's topic memory vector, and then the current week's topic memory vector is obtained through the forget gate, output gate and candidate memory generator; The current week's topic memory vector is used as the node feature and input into a multi-layer graph attention network. The attention mechanism captures the correlation features between nodes to obtain the current week's attention weight vector. The attention weights are then used to perform a weighted summation of the node features to obtain the current week's global graph embedding. The current week's global graph is embedded into the input classifier, and combined with the current week's market data, the result of the price change prediction for next week is output. S4 uses the acquired social media and market data to train a prediction model, which is then used for market forecasting.

[0007] Preferably, step S2 specifically includes the following steps: S21, extract the current week's active topics as nodes in the current week's topic association graph, wherein the current week's active topics include historical topics with new posts and topics that have appeared in the current week; S22, Construct a sparse matrix ,matrix The dimension is the number of active topics in the current week × the total number of authors globally. If the first... If a topic has an nth author involved, then the sparse matrix... elements in Otherwise ; S23, based on sparse matrices The similarity between any two topics is calculated using the Jaccard coefficient, which is the ratio of the number of co-authors between the two topics to the size of the union of the sets of authors participating in the two topics. Based on the similarity between any two topics, a topic similarity matrix is ​​obtained. ,matrix The dimension is the number of active topics in the current week × the number of active topics in the current week; S24, based on topic similarity matrix A dynamic threshold is used to filter valid edges and construct the current week's topic association graph; the dynamic threshold is selected as the set quantile of non-zero similarity value.

[0008] Preferably, in step S3, the specific processing procedure of the text temporal memory unit is as follows: The current week's topic text embedding vector is , The dimension is The topic memory vector for last week was , The dimension is The current week's topic text embedding vector is composed of the text embedding vectors of all posts related to the topic in the current week. Embed the current week's topic text into a vector Memory vector of the topic from last week Perform concatenation to obtain the concatenated input. The dimension of the concatenated input is ; Indicates the concatenation function; A linear transformation is performed on the dimensions of the concatenated input and the memory vector of the previous week's topic. A forgetting gate is constructed using the sigmoid function as the activation function to calculate the memory retention rate from the previous week. The forgetting gate output is... ; A linear transformation is performed on the dimensions of the concatenated input and the previous week's topic memory vector. An output gate is constructed using the Sigmoid function as the activation function to calculate the proportion of candidate memory outputs. The output gate outputs... ; A candidate memory generator is constructed by performing a linear transformation on the dimensions of the concatenated input and the previous week's topic memory vector, using the Tanh function as the activation function. This generator is used to calculate the candidate memories for the current week. The output of the candidate memory generator is... ; By combining historical memory and candidate memory, we obtain the memory vector for the current week's topic. ; in, For the Sigmoid function, It is the hyperbolic tangent function. For element-wise product operation, It is a linear transformation function; This serves as the memory vector for the current week's topic. This is the candidate memory vector for the topic of the current week, i.e., the candidate memory; This is the memory vector for the previous week's topics, i.e., historical memory; The proportion of candidate memory output; The percentage of historical memory retained; t represents the current week; t-1 represents the previous week.

[0009] Preferably, in step S3, the specific processing procedure of the multi-layer graph attention network is as follows: The multi-layer graph attention network comprises multiple attention layers connected in sequence; each attention layer uses multiple attention heads for parallel computation, and the outputs of each attention head are concatenated to obtain the output of that attention layer, as shown in the following formula: ; Where k is the kth attention head, and there are a total of K attention heads; Let i be the set of neighboring nodes of topic i; The linear transformation weights for the k-th attention head; The node features of topic i output by the p-th layer; The node features of topic j output from layer p-1; The node features of topic i are input to the multi-layer graph attention network, i.e., the topic memory vector for the current week. It is a non-linear activation function; An operator that concatenates the outputs of K attention heads; The attention score of the node pair after normalization of the k-th attention head; Each attention head calculates the attention score for the node pair using an attention mechanism, as shown in the following formula: ; in, The attention score for the node pair consisting of topics i and j; The node features for topics i and j; The parameter matrix is ​​a linear transformation matrix; The attention coefficient vector; LeakyReLU piecewise linear activation function; This is the vector composed of the attention scores of topic i and all topics, i.e., the attention vector of topic i. The attention score for the normalized node pair; It is a normalized exponential function; The j-th value in the normalized attention vector of topic i is the attention score of the node pair consisting of topic i and j after normalization. The final attention layer outputs the node feature vector. Based on node feature vectors Calculate the attention score for each node, and normalize the attention scores to obtain the attention weight vector. The formula is as follows: ; in, It is a normalized exponential function; It is a linear transformation function; The node feature vector output by the last attention layer With attention weight vector We perform a weighted summation to obtain the global graph embedding, using the following formula: ; in, Node feature vectors The first in Each node's characteristics For global graph embedding, Attention weight vector The first in Attention weights for each node.

[0010] Preferably, in step S3, the specific processing procedure of the classifier is as follows: Embed the current week's global map Input the classifier and combine it with the market data of the current week, including the opening price, highest price, lowest price, and closing price. Output the predicted price changes for next week: ; in, This represents the opening price, highest price, lowest price, and closing price for the current week. Embed for the global graph of the current week; The result is a price change forecast for next week, used to predict whether the closing price of the following week will rise or fall relative to the closing price of the current week; MLP stands for Multilayer Perceptron. This is a concatenation function.

[0011] Preferably, in step S4, during the training of the prediction model, a rolling window strategy is used to verify the model's generalization ability, as shown below: S41, arrange all weekly plot data in chronological order, initialize and divide the training window and test window according to a preset ratio, and expand the training window and test window as the prediction week rolls forward; the test window is the weekly plot data outside the training window; S42, for each training window, reinitialize the prediction model and optimizer, train the model based on the weekly graph data within the training window, and update the model parameters and topic memory vector; loss function The difference between the binary cross-entropy loss and the KL regularization term is used, and the formula is as follows: ; in, The regularization coefficient is used. Labels for next week's price changes; The forecast of price changes for the following week, output by the predictive model; This represents the attention weight vector for the current week; It is a discrete uniform distribution; Let KL divergence be a metric. The cross-entropy loss is used for binary classification. The gradient is calculated through backpropagation, and the optimizer is invoked to update the model parameters. S43, based on the trained prediction model, predicts weekly data within the test window, calculates accuracy metrics, and evaluates model performance.

[0012] Preferably, it also includes an explanation process for the basis of the model's decision-making, the explanation process including: S5, based on the topic attention weight of the current week, uses the attention weight threshold to filter the important topics of the current week; The important topics refer to those whose attention weight exceeds the adaptive threshold; wherein, the adaptive threshold is dynamically determined according to the set quantile of the current week's topic attention weight, and is used to filter out the key semantic information that contributes the most to the current period's revenue prediction. This will be used to construct a dataset of important topics for the current week. ;in, This is a key topic of the current week. Text embedding vectors, composed of important topics The text embedding vectors of all posts in the current week constitute the text; As an important topic A globally unique ID. As an important topic The name, This is a key topic of the current week. Attention weights; This represents the number of important topics this week. S6, perform joint dimensionality reduction and clustering of the important topics based on revenue and semantics to generate semantic cluster representations that explain the decision-making logic of the model and the basis for the prediction model's decisions; step S6 is detailed below: S61, The text embedding vectors of all important topics in the text form a high-dimensional feature matrix, and UMAP dimensionality reduction is performed to obtain a low-dimensional embedding matrix. S62, Based on the low-dimensional embedding matrix, use a density clustering algorithm (such as HDBSCAN) to cluster important topics, identify densely distributed areas of topics, and obtain a set of topic clusters. ,in, For the first A cluster of topics, The number of topic clusters; each topic cluster represents a group of potential topics that are similar in semantics and benefit impact patterns. S63, based on topic clusters formed by important topic clustering, uses the c-TF-IDF algorithm to form semantic representations for each topic cluster, including: Build class documentation: for each topic cluster This generates a topic cluster by combining the post texts of all important topics within the current week. Class Documentation ; The c-TF-IDF algorithm formula is used to quantify the semantic importance of words to topic clusters: ; in, For words Conversation clusters The semantic importance; For words In the class document Word frequency in; The average number of words for all document types. , for Total word count; For words Total word frequency across all document types; Extract semantic tags: for each topic cluster Select several words with high semantic importance as topic clusters. The semantic tags are used to form semantic representations of each topic cluster; these semantic representations serve as the basis for interpreting the semantic grouping of topics corresponding to different attention focuses in the prediction model.

[0013] The present invention also provides an electronic device, which includes a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the aforementioned training method for an interpretable dynamic graph network revenue prediction model based on social media.

[0014] The present invention also provides a computer program product, characterized in that it includes a computer program / instruction that, when executed by a processor, implements the aforementioned training method for an interpretable dynamic graph network revenue prediction model based on social media.

[0015] The present invention also provides a readable storage medium, characterized in that it stores a computer program thereon, which, when executed, implements the training method for the interpretable dynamic graph network revenue prediction model based on social media.

[0016] The advantages of this invention are: (1) The profit prediction model of this invention effectively integrates the semantic information and topic association features of social media texts to capture the impact of market sentiment and hot topics on financial asset prices. Employing a textual temporal memory unit, it can continuously update the topic memory vector, retaining the semantic features of historical topics and solving the problem of temporal modeling of dynamic changes in social media topics. Based on a multi-layer graph attention network, it adaptively captures the association weights between topics through an attention mechanism, strengthening the contribution of important topics to the prediction results. This hybrid architecture simultaneously models the temporal dimension (topic semantic evolution) and the spatial dimension (topic topological associations) from a computer data processing perspective, effectively improving prediction accuracy.

[0017] (2) The topic association graph of this invention adopts a weekly dynamic construction method, calculates topic similarity by combining the Jaccard coefficient, and filters effective edges through dynamic thresholds, thus avoiding the lag of static graph structures. The dynamic subgraph sampling mechanism adopted in this invention controls the single computation overhead in large-scale social media data scenarios and improves algorithm efficiency.

[0018] (3) The training process of this invention adopts a rolling window strategy and a KL regularization term: the rolling window strategy enables the model to iteratively update the topic memory vector on a weekly basis on time-series data, ensuring the model's generalization ability to dynamic graph data; the KL regularization term constrains the attention weights to simulate the real attention distribution of the platform and avoid overfitting. The above mechanisms effectively optimize the training stability and generalization performance of the model when facing non-stationary, dynamically changing graph data.

[0019] (4) This invention directly quantifies the contribution of each topic to the prediction result through the topic attention weights output by the graph attention network, and filters important topics affecting financial asset prices based on attention weight thresholds. Furthermore, it uses UMAP dimensionality reduction, HDBSCAN clustering, and c-TF-IDF algorithms to perform dimensionality reduction and clustering on the high-dimensional sparse text data of important topics, generating semantic labels for topic clusters. This presents the core factors driving price changes through a causal link of "prediction → attention filtering → dimensionality reduction clustering → semantic interpretation." This interpretable link improves the transparency of the model's decision-making process at the algorithmic level, effectively enhancing the model's interpretability.

[0020] (5) This invention decouples the semantic clustering analysis of complex topics from the main prediction model by designing a context-aware topic modeling approach. This design effectively reduces the overall computational overhead and optimization cost of the process while ensuring the model's performance, and optimizes the feasibility of complex models in engineering deployment scenarios.

[0021] (6) This invention integrates dynamic graph construction, subgraph sampling, text temporal memory units, and multi-layer graph attention networks into a collaborative technical system, achieving end-to-end spatiotemporal joint modeling of social media topic networks. This architecture can continuously learn and simulate the structured changes of topic networks over time from streaming social media data, overcoming the limitations of traditional methods that can only handle static graphs or snapshot-style graph sequences. It represents a systematic technical improvement to existing graph analysis paradigms. Attached Figure Description

[0022] Figure 1 This is a flowchart of the training method for the interpretable dynamic graph network revenue prediction model based on social media according to the present invention.

[0023] Figure 2 This is a diagram of the architecture of the prediction model of the present invention. Detailed Implementation

[0024] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.

[0025] Example 1 like Figure 1 As shown, this invention provides a training method for an interpretable dynamic graph network revenue prediction model based on social media, comprising the following steps: S1. Acquire social media data (forum data) and financial asset market data related to financial assets, and store the data in CSV format. Among them, the social media data that reflects market sentiment includes the post posting date, the topic to which the post belongs, the post author (the poster, i.e., the author participating in the topic), the post content (i.e., the text), etc., and the market data includes the opening price, the highest price, the lowest price, the closing price, etc.

[0026] The social media and market data underwent preliminary preprocessing, as detailed below: Convert the posting date in social media data to a datetime type.

[0027] Delete duplicate posts, posts with no valid content, and posts with a character length of less than 3 from social media data.

[0028] Clean the non-ASCII characters in the string column of social media post content, filter out garbled characters, special symbols, non-Chinese and non-English characters, and standardize the text format.

[0029] Market data is grouped by week, the last closing price of each week is calculated, and the percentage change in price each week is calculated. Based on the weekly price changes, price change labels are generated: the percentage change in price between the last closing price of the following week and the last closing price of the current week is calculated, the continuous percentage change in price is converted into discrete category labels, and then converted into dictionary format to generate a change label of "price increase or decrease next week"; this label is added to each record of the current week in the social media data; records with missing labels are deleted.

[0030] The post content (i.e., text) of social media data is semantically encoded using a pre-trained language model to generate a fixed-dimensional text embedding vector. The globally unique ID pre-trained language model is selected from a series of text embedding layer models. In this embodiment, the specific configuration of the pre-trained language model is as follows: qwen3-embedding-8B is selected as the pre-trained language model, the text embedding vector is the mean pooling result output from the last hidden layer of the model, and the dimension of the text embedding vector is 128-1024 dimensions.

[0031] Initialize the data based on the pre-processed social media data and construct a custom dataset, including: Based on the topic to which the post belongs, the initial post is marked and the replies are removed to standardize the topic format.

[0032] Sort by post publication date and extract all unique weeks.

[0033] Sort the topics and authors of posts to construct a global mapping, realizing the mapping of "topic → globally unique ID" and "author → globally unique ID".

[0034] Social media data is segmented by week based on post publication date, generating weekly cycle identifiers.

[0035] Social media data is aggregated weekly based on a weekly cycle identifier. The first tag in each group of social media data is taken to generate a weekly price tag dictionary, realizing the mapping from "weekly" to "price tag".

[0036] Using "weekly + topic" as a composite index, the corresponding text embedding vector is extracted to generate the weekly topic text embedding vector, thus realizing the mapping from "weekly + topic → weekly topic text embedding vector".

[0037] Based on a custom weekly cycle identifier in the dataset, one sample corresponds to one week, so that the number of samples is equal to the number of unique weeks.

[0038] Focusing on a single week's sample, we extracted all active topics and their participating authors for that week.

[0039] Filter all historical data up to the current week, count the historical authors involved in each topic, and convert the author list for each topic into an author set.

[0040] Construct a historical participation dictionary using topics as keys and sets of historical authors who participated in the topic as values.

[0041] Construct a new empty set into the historical participation dictionary to ensure that new topics can be merged.

[0042] S2 takes as input all active topics and their participating authors, a dictionary of historical participants, a dictionary mapping topics to globally unique IDs, and a dictionary mapping authors to globally unique IDs each week, and constructs a weekly topic association graph to obtain weekly graph data. Specifically, the topic association graph is an undirected graph with topics as nodes and the similarity between topics as edge weights.

[0043] The specific process of constructing a topic association graph includes: Newly emerging topics will be included in the current week's active topics. The current week's active topics include historical topics with new posts and topics that have emerged in the current week.

[0044] Initialize the author set for the current week's topic, take the initial author set of newly emerging topics as the participating authors for the current week's newly emerging topics, and add them to the historical participation dictionary.

[0045] Use the list of active topics for the current week as the node set of the topic association graph for the current week. If the number of topics is less than 2, no edges can be formed, and a special case of a graph structure containing only nodes is returned.

[0046] Construct a temporary index mapping for topics in the current week's topic association graph. Based on the historical participation dictionary, traverse each topic in the current week's topic association graph and obtain its historical participating authors. For each author, if it exists in the mapping dictionary from author to globally unique ID, record the temporary index of the topic as the row index and the globally unique ID of the author as the column index. If all topics in the current week's topic association graph have no valid author associations (e.g., all are newly appearing topics with no participating authors), return the special case of a graph structure containing only nodes.

[0047] A sparse matrix is ​​constructed based on topic temporary indexes as rows and author globally unique IDs as columns. (The number of active topics in the current week is listed as the total number of authors globally). The topic has a first If an author participates, then the element Otherwise .

[0048] The Jaccard coefficient is used to calculate the strength of association (similarity) between topics. The association strength is quantified by the co-participating authors, and the formula is as follows: ; in, The number of co-authors for the two topics. , Each topic , The total number of authors; For the topic , The strength of the association (similarity) between topics; constructing a topic similarity matrix based on the similarity between topics. , The dimension is the number of active topics in the current week × the number of active topics in the current week.

[0049] Extracting the topic similarity matrix The off-diagonal values ​​of the upper triangular matrix are used to avoid duplicate similarity calculations and extract valid similarity values. This filters the topic similarity matrix. Weak connections with elements close to 0 are identified, and only meaningful similarity values ​​are retained, i.e., only valid connections are preserved. If the topic similarity matrix... If elements in the graph have valid connections, the 95th percentile is used as the threshold to ensure that only strong associations are retained; if the topic similarity matrix... If no elements in the graph are connected, use the default value of 0.01 to avoid the graph being empty.

[0050] Based on topic similarity matrix A dynamic threshold is used to filter valid edges, selecting those with similarity higher than the threshold (95th percentile). A graph processing tool is then used to construct a topic association graph for the current week.

[0051] Based on the weekly topic association graph, a dynamic graph dataset of complete samples is constructed that can be directly input into the model, including: From the topics in the current week's topic association graph, filter out the valid active topics that exist in the mapping dictionary from topic to globally unique ID; For each valid active topic, obtain the text embedding vector of all its posts in the current week, and generate the topic text embedding vector for the current week. Update the node ID (i.e., the temporary index of the topic) of the current week's topic association graph to the globally unique ID of the topic to obtain a globally unique identifier; The text embedding vector of the current week's topic is used as the semantic feature of the node and attached to the graph data. The graph data is then a two-dimensional tensor with a shape of the number of nodes (number of active topics in the current week) × the dimension of the text embedding vector. If there is no text embedding vector, an empty tensor is generated. Add corresponding tags to the topic association graph (sample) for the current week.

[0052] S3, Build a predictive model, such as Figure 2 As shown, the prediction model includes: a text temporal memory unit (TMU), a multi-layer graph attention network (GAT), and a classifier, which performs time-series updates and market predictions based on weekly graph data. Details are as follows: Initialize the topic memory vector; The current week's topic text is embedded into the vector input text temporal memory unit, combined with the previous week's topic memory vector, and then the current week's topic memory vector is obtained through the forget gate, output gate and candidate memory generator; The current week's topic memory vector is used as the node feature and input into a multi-layer graph attention network. The attention mechanism captures the correlation features between nodes, and the attention weights are used to perform a weighted summation of the node features to obtain the current week's global graph embedding. The current week's global graph is embedded into the input classifier, and combined with the current week's market data, the output is a prediction of price changes for the following week.

[0053] The specific processing procedure of the text-sequential memory unit is as follows: The Text Temporal Memory Unit (TMU) consists of five parts: a splicing layer, a forgetting gate, an output gate, a candidate memory generator, and a memory update unit. Specifically, it includes the following steps: The parameters of each gate module and all layers within each gate are initialized in a loop. The weights of the linear layers are uniformly initialized using Xavier, and the biases of the linear layers are initialized to 0.

[0054] Before performing the splicing, since the nodes in the weekly topic association graph are dynamically added and deleted, it is necessary to first obtain and align the previous week's topic memory vector corresponding to the current week's active topic: if the current week's active topic is a new topic appearing for the first time, then its corresponding previous week's topic memory vector is initialized to a zero vector; if the current week's active topic is a recurring topic that has appeared in history but was dormant in the previous week, then the output of the most recent active week of the topic is extracted from the global memory dictionary as the previous week's topic memory vector; at the same time, for historical topics that are dormant in the current week, their memory vectors in the global memory dictionary are frozen and will not be updated forward this week.

[0055] The splicing layer embeds the current week's topic text into a vector. (dimension) (and the result obtained after the above alignment process)

[0056] Last week's topic memory vector (dimension) The input is obtained by concatenating the given data. ; in, To embed the current week's topic text into a vector Memory vector of the topic from last week The concatenated input is obtained after concatenation, and the dimension of the concatenated input is... ; This represents the concatenation function.

[0057] A linear transformation is performed on the dimensions of the concatenated input and the historical topic memory vector (i.e., the topic memory vector of the previous week). A forgetting gate is constructed using the Sigmoid function as the activation function to control the retention ratio of historical memory (i.e., the memory of the previous week). ; in, Indicates will Dimensional transformation ; Similarly, a linear transformation is performed on the dimensions of the concatenated input and the historical topic memory vector, and an output gate is constructed using the Sigmoid function as the activation function to control the output ratio of candidate memories. ; A candidate memory generator is constructed by performing a linear transformation on the dimensions of the concatenated input and the historical topic memory vector, and using the Tanh function as the activation function, to generate candidate memories for the current week. ; Forward propagation is performed based on the current week's topic text embedding vector and the previous week's topic memory vector. The memory update unit integrates historical memory and current week's candidate memory (new memory) to obtain the updated current week's topic memory vector: ; in, This represents the Sigmoid function. It is the hyperbolic tangent function. For element-wise product operation, Represents a linear transformation; This serves as the memory vector for the current week's topic. This is the candidate memory vector for the current week's topics; The proportion of candidate memory output; The proportion to be preserved for historical memory; This is the memory vector for last week's topic.

[0058] The specific processing steps of a multi-layer graph attention network are as follows: The current week's topic memory vector is used as the node feature and input into a multi-layer graph attention (GAT) network. The attention mechanism captures the correlation features between nodes (i.e., between topics). The node features output by the multi-layer graph attention network are weighted and summed using attention weights to obtain the current week's global graph embedding.

[0059] The specific parameters of the multi-layer graph attention network are as follows: it includes two attention layers (GATconv layers) and one attention aggregation layer; the input dimension of the first attention layer (GATconv layer 1) is... Output dimension is The number of attention heads is 4; the input dimension of the second attention layer (GATconv layer 2) is... (Attention head output splicing), output dimension is The number of attention heads is 4.

[0060] Each attention layer uses multiple attention heads for parallel computation, and the outputs of each attention head are concatenated to form the output of that attention layer, as shown in the following formula: ; Where k is the kth attention head, and there are a total of K attention heads; Let i be the set of neighboring nodes of topic i; The linear transformation weights for the k-th attention head; The node features of topic i output by the p-th layer; The node features of topic j output from layer p-1; The node features of topic i are input to the multi-layer graph attention network, i.e., the topic memory vector for the current week. An operator that concatenates the outputs of K attention heads; The attention score of the node pair after normalization of the k-th attention head; It is a non-linear activation function with an output range of ; ; Each attention head calculates the attention score for the node pair using an attention mechanism, as shown in the following formula: ; in, The attention score for the node pair consisting of topics i and j; The node features for topics i and j; The parameter matrix is ​​a linear transformation matrix; This is the attention coefficient vector; This is the vector composed of the attention scores of topic i and all topics, i.e., the attention vector of topic i. The attention score for the normalized node pair; It is a normalized exponential function; Let j be the j-th value in the normalized attention vector of topic i, i.e., the attention score of the node pair consisting of topics i and j after normalization; LeakyReLU piecewise linear activation function; ; ; The final attention layer outputs the node feature vector. Based on node feature vectors Calculate the attention score for each node, and normalize the attention scores to obtain the attention weight vector. The formula is as follows: ; in, It is a normalized exponential function; It is a linear transformation function; The attention aggregation layer of a multi-layer graph attention network aggregates the node feature vectors output by the last attention layer. With attention weight vector We perform a weighted summation to obtain the global graph embedding, using the following formula: ; in, Node feature vectors The first in Each node's characteristics For global graph embedding, Attention weight vector The first in Attention weights for each node.

[0061] The specific processing steps of the classifier are as follows: By embedding the global graph into the input classifier and combining it with the current week's market data, the project outputs a prediction of price changes for the following week. ; in, The data for the current week includes the opening price, highest price, lowest price, and closing price. Embed for the global graph of the current week; The result is a price change forecast for next week, used to predict whether the closing price of the following week will rise or fall relative to the closing price of the current week; MLP stands for Multilayer Perceptron. This is a concatenation function.

[0062] S4. Use the social media data and market data obtained in step S1 to train a prediction model. The trained prediction model is then used for market forecasting.

[0063] During the training of the prediction model, a rolling window backtesting method was used to verify the generalization ability of the prediction model, as shown below: The initial training window size is set to 80% of the total weekly graph data as the training set and the remaining 20% ​​as the test set, with a KL regularization coefficient of 0.01.

[0064] Using Adam as the optimizer, the loss function is trained using binary cross-entropy loss (BCEWithLogitsLoss) + DL divergence regularization, which can sparsify the attention weights; the loss function... The formula is as follows: ; in, The regularization coefficient is used. Labels for next week's price changes; The forecast of price changes for the following week, output by the predictive model; This represents the attention weight vector for the current week; It is a discrete uniform distribution; Let KL divergence be a metric. This is the cross-entropy loss for binary classification.

[0065] The gradient is calculated through backpropagation, and the optimizer is invoked to update the model parameters and topic memory vector.

[0066] The trained prediction model is used to predict weekly data within the test window, and the accuracy index is calculated to evaluate the model performance.

[0067] Example 2 Furthermore, such as Figure 1 As shown, this embodiment also filters important topics, selecting those that significantly contribute to price prediction and removing redundant topics with small weights to reduce subsequent clustering noise, i.e., step S5, as detailed below: Based on the topic attention weights for the current week, an attention weight threshold is used to filter important topics for the current week. Important topics are those with attention weights greater than the attention weight threshold; the attention weight threshold is selected as the 90th percentile of the topic attention weights for the current week.

[0068] Important topics that meet the attention weight threshold are retained to form an important topic set. ,in, The text embedding vector of the important topic k in the current week is composed of the text embedding vectors of all posts about the important topic k in the current week. A globally unique ID for the important topic k. The name of the important topic k, The attention weight of k as the most important topic of the current week; This represents the number of important topics this week.

[0069] Example 3 Furthermore, such as Figure 1 As shown, this embodiment also performs dimensionality reduction and clustering operations on the important topics of the current week, and forms semantic representations for each topic cluster, i.e., step S6, as detailed below: S61, perform UMAP dimensionality reduction on the high-dimensional feature matrices corresponding to all important topics to obtain low-dimensional feature matrices, including: Extracting high-dimensional feature matrices: from Extract the text embedding vectors of all important topics k. To form a high-dimensional feature matrix ; The dimension of the high-dimensional feature; Configure dimensionality reduction parameters: set the number of nearest neighbors, the nearest neighbor distance threshold, the dimensionality after dimensionality reduction, and a fixed random seed; Perform dimensionality reduction: reduce the high-dimensional feature matrix Input UMAP model, output low-dimensional feature matrix , The dimension of the low-dimensional features; minimizing the loss function during dimensionality reduction. The formula is: ; in, As an important topic In a higher-dimensional space, the nearest neighbor set, As an important topic Non-nearest neighbor sets in high-dimensional space; As an important topic and Euclidean distance in low-dimensional space; As an important topic The nearest neighbor distance threshold; It is the Sigmoid function; nearest neighbor refers to the Euclidean distance being less than the nearest neighbor distance threshold; S62, based on a low-dimensional feature matrix, uses the HDBSCAN clustering algorithm to cluster important topics, resulting in a set of topic clusters. ,in, For the z-th topic cluster, Number of topic clusters; S63, based on topic clusters formed by important topic clustering, uses the c-TF-IDF algorithm to form semantic representations for each topic cluster, including: Build class documentation: for each topic cluster This generates a topic cluster by combining the post texts of all important topics within the current week. Class Documentation ; The formula for quantifying the semantic importance of words to a topic cluster is: ; in, For words Conversation clusters The semantic importance; For words In the class document Word frequency in; The average number of words for all document types. , for Total word count; For words Total word frequency across all document types; Extract semantic tags: for each topic cluster Select several words with high semantic importance as topic clusters. The semantic tags are used to form semantic representations of each topic cluster.

[0070] To further demonstrate the positive effects of the above embodiments, considering that on-chain digital assets have no real price and are greatly affected by social media sentiment, this invention conducts the following simulation experiment based on the above technical solution, using a certain on-chain digital asset as a scenario.

[0071] 1. Data acquisition and preprocessing stage.

[0072] Data on transaction and forum discussions of a certain on-chain digital asset market were collected from websites such as dune.com. After data cleaning and processing, including removing missing values ​​and deduplication, more than 2 million discussion posts and daily price series data from 2015 to 2025 were finally obtained.

[0073] The qwen3-embedding-8B pre-trained language model is used to semantically encode the post text, generating a 768-dimensional semantic vector for each post. The vector data is stored in pickle format.

[0074] Using the 90th percentile as a dynamic threshold, a graph processing tool was used to construct a weekly topic association graph. The weekly data was labeled based on weekly price fluctuations, and the training and test sets were divided in an 8:2 time ratio.

[0075] 2. Model building and training phase.

[0076] In this experiment, the model parameters were fine-tuned using grid search. Based on the experimental results, the topic memory vector dimension in the text temporal memory unit was determined to be 128-dimensional, the output dimensions of each layer of the multi-layer graph attention network were 512 and 128 respectively, and the model learning rate was 0.01.

[0077] 3. Model prediction and backtesting stage.

[0078] The model obtained using the above method was used to make predictions on the test set to obtain the rise and fall prediction results. Using a strategy of buying all positions when the prediction is rising and selling all positions when the prediction is falling, the backtesting results are shown in Table 1 below: Table 1. Backtesting Comparison Analysis of Each Model on a Certain On-Chain Digital Asset Dataset

[0079] Experimental results show that the method proposed in this invention significantly improves upon other methods in all metrics. This result confirms that interpretable dynamic graph networks based on social media text can effectively capture key sentiment signals, fully demonstrating the adaptability and effectiveness of this method in financial asset prediction scenarios.

[0080] 4. Text analysis and topic modeling stage.

[0081] Based on the important topics identified by the model, the topic modeling method is further applied to identify the core narrative. The model obtained by the method of this invention effectively identifies important topics such as inter-regional market differences, social media sentiment, alternative investment products, and blockchain technology iteration, and realizes interpretable analysis of key influencing factors in the digital cryptocurrency market.

[0082] The above are merely preferred embodiments of the present invention and are not intended to limit the scope of the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A training method for an interpretable dynamic graph network revenue prediction model based on social media, characterized in that, include: S1, obtain market data and related social media data for financial assets; Social media data and market data are divided into weekly categories. Social media data includes the posting date, the topic of the post, the author of the post, and the text of the post. Market data refers to the price data of financial assets. Semantically encode the text of posts in social media data to obtain text embedding vectors; generate price change labels for the following week based on the price increase or decrease of the following week relative to the current week's price. S2, for weekly social media data, uses topics as nodes and the similarity between topics as edge weights to construct a weekly topic association graph and obtain weekly graph data; S3. Construct a predictive model, which includes a textual temporal memory unit, a multi-layer graph attention network, and a classifier. The predictive model performs temporal updates and market forecasts based on weekly graph data, as detailed below: The topic text of the current week is embedded into the vector input text temporal memory unit, and combined with the topic memory vector of the previous week, the topic memory vector of the current week is obtained. The current week's topic memory vector is used as the node feature and input into a multi-layer graph attention network to capture the correlation features between nodes, obtain the current week's attention weight vector, and then the node features are weighted and summed to obtain the current week's global graph embedding. The current week's global graph is embedded into the input classifier, and combined with the current week's market data, the result of the price change prediction for next week is output. S4. Use the acquired data to train a prediction model, and the trained prediction model is used for market forecasting.

2. The training method for an interpretable dynamic graph network revenue prediction model based on social media according to claim 1, characterized in that, Step S2 specifically includes the following steps: S21, extract the current week's active topics as nodes in the current week's topic association graph, wherein the current week's active topics include historical topics with new posts and topics that have appeared in the current week; S22, Construct a sparse matrix ,matrix The dimension is the number of active topics in the current week × the total number of authors globally. If the first... If a topic has an nth author involved, then the sparse matrix... elements in Otherwise ; S23, based on sparse matrices The similarity between any two topics is calculated using the Jaccard coefficient, which is the ratio of the number of co-authors between the two topics to the size of the union of the sets of authors participating in the two topics. Based on the similarity between any two topics, a topic similarity matrix is ​​obtained. ,matrix The dimension is the number of active topics in the current week × the number of active topics in the current week; S24, based on topic similarity matrix A dynamic threshold is used to filter valid edges and construct the current week's topic association graph; the dynamic threshold is selected as the set quantile of non-zero similarity value.

3. The training method for an interpretable dynamic graph network revenue prediction model based on social media according to claim 1, characterized in that, In step S3, the specific processing procedure of the text temporal memory unit is as follows: The current week's topic text embedding vector is , The dimension is The topic memory vector for last week was , The dimension is The current week's topic text embedding vector is composed of the text embedding vectors of all posts related to the topic in the current week. Embed the current week's topic text into a vector Memory vector of the topic from last week Perform concatenation to obtain the concatenated input. The dimension of the concatenated input is ; Indicates the concatenation function; A linear transformation is performed on the dimensions of the concatenated input and the memory vector of the previous week's topic. A forgetting gate is constructed using the sigmoid function as the activation function to calculate the memory retention rate from the previous week. The forgetting gate output is... ; A linear transformation is performed on the dimensions of the concatenated input and the previous week's topic memory vector. An output gate is constructed using the Sigmoid function as the activation function to calculate the proportion of candidate memory outputs. The output gate outputs... ; A candidate memory generator is constructed by performing a linear transformation on the dimensions of the concatenated input and the previous week's topic memory vector, using the Tanh function as the activation function. This generator is used to calculate the candidate memories for the current week. The output of the candidate memory generator is... ; By combining historical memory and candidate memory, we obtain the memory vector for the current week's topic. ; in, For the Sigmoid function, It is the hyperbolic tangent function. For element-wise product operation, It is a linear transformation function; This serves as the memory vector for the current week's topic. This is the candidate memory vector for the topic of the current week, i.e., the candidate memory; This is the memory vector for the previous week's topics, i.e., historical memory; The proportion of candidate memory output; The percentage of historical memory retained; t represents the current week; t-1 represents the previous week.

4. The training method for an interpretable dynamic graph network revenue prediction model based on social media according to claim 1 or 3, characterized in that, In step S3, the specific processing procedure of the multi-layer graph attention network is as follows: The multi-layer graph attention network comprises multiple attention layers connected in sequence; each attention layer uses multiple attention heads for parallel computation, and the outputs of each attention head are concatenated to obtain the output of that attention layer, as shown in the following formula: Where k is the kth attention head, and there are a total of K attention heads; Let i be the set of neighboring nodes of topic i; The linear transformation weights for the k-th attention head; The node features of topic i output by the p-th layer; The node features of topic j output from layer p-1; The node features of topic i are input to the multi-layer graph attention network, i.e., the topic memory vector for the current week. It is a non-linear activation function; An operator that concatenates the outputs of K attention heads; The attention score of the node pair after normalization of the k-th attention head; Each attention head calculates the attention score for the node pair using an attention mechanism, as shown in the following formula: in, The attention score for the node pair consisting of topics i and j; The node features for topics i and j; The parameter matrix is ​​a linear transformation matrix; The attention coefficient vector; LeakyReLU piecewise linear activation function; This is the vector composed of the attention scores of topic i and all topics, i.e., the attention vector of topic i. The attention score for the normalized node pair; It is a normalized exponential function; The j-th value in the normalized attention vector of topic i is the attention score of the node pair consisting of topic i and j after normalization. The final attention layer outputs the node feature vector. Based on node feature vectors Calculate the attention score for each node, and normalize the attention scores to obtain the attention weight vector. The formula is as follows: in, It is a normalized exponential function; It is a linear transformation function; The node feature vector output by the last attention layer With attention weight vector We perform a weighted summation to obtain the global graph embedding, using the following formula: in, Node feature vectors The first in Each node's characteristics For global graph embedding, Attention weight vector The first in Attention weights for each node.

5. The training method for an interpretable dynamic graph network revenue prediction model based on social media according to claim 1, characterized in that, In step S3, the specific processing procedure of the classifier is as follows: Embed the current week's global map Input the classifier and combine it with the market data of the current week, including the opening price, highest price, lowest price, and closing price. Output the predicted price changes for next week: in, These are the opening price, highest price, lowest price, and closing price for the current week. Embed for the global graph of the current week; The result is a price change forecast for next week, used to predict whether the closing price of the following week will rise or fall relative to the closing price of the current week; MLP stands for Multilayer Perceptron. This is a concatenation function.

6. The training method for an interpretable dynamic graph network revenue prediction model based on social media according to claim 1, characterized in that, In step S4, during the training of the prediction model, a rolling window strategy is used to verify the model's generalization ability, as shown below: S41, arrange all weekly chart data in chronological order, initialize and divide the training window and test window according to a preset ratio, and expand the training window and test window as the prediction week rolls forward; The test window is the weekly graph data outside the training window; S42, for each training window, reinitialize the prediction model and optimizer, train the model based on the weekly graph data within the training window, and update the model parameters and topic memory vector; loss function The difference between the binary cross-entropy loss and the KL regularization term is used, and the formula is as follows: in, The regularization coefficient is used. Labels for next week's price changes; The forecast of price changes for the following week, output by the predictive model; This represents the attention weight vector for the current week; It is a discrete uniform distribution; Let KL divergence be a metric. The cross-entropy loss is used for binary classification. The gradient is calculated through backpropagation, and the optimizer is invoked to update the model parameters. S43, based on the trained prediction model, predicts weekly data within the test window, calculates accuracy metrics, and evaluates model performance.

7. The training method for an interpretable dynamic graph network revenue prediction model based on social media according to claim 1, characterized in that, It also includes an explanation process for the basis of the model's decision-making, the explanation process including: S5, based on the topic attention weight of the current week, uses the attention weight threshold to filter the important topics of the current week; The important topics refer to those whose attention weight exceeds the adaptive threshold; wherein, the adaptive threshold is dynamically determined according to the set quantile of the current week's topic attention weight, and is used to filter out the key semantic information that contributes the most to the current period's revenue prediction. This will be used to construct a dataset of important topics for the current week. ;in, This is a key topic of the current week. Text embedding vectors, composed of important topics The text embedding vectors of all posts in the current week constitute the text; As an important topic A globally unique ID. As an important topic The name, This is a key topic of the current week. Attention weights; This represents the number of important topics this week. S6, perform joint dimensionality reduction and clustering of the important topics based on revenue and semantics to generate semantic cluster representations that explain the decision-making logic of the model and the basis for the prediction model's decisions; step S6 is detailed below: S61, The text embedding vectors of all important topics in the text form a high-dimensional feature matrix, and UMAP dimensionality reduction is performed to obtain a low-dimensional embedding matrix. S62, Based on the low-dimensional embedding matrix, density clustering algorithm is used to cluster important topics to obtain a set of topic clusters. ,in, For the first A cluster of topics, The number of topic clusters; each topic cluster represents a group of potential topics that are similar in semantics and benefit impact patterns. S63, based on topic clusters formed by important topic clustering, uses the c-TF-IDF algorithm to form semantic representations for each topic cluster, including: Build class documentation: for each topic cluster This generates a topic cluster by combining the post texts of all important topics within the current week. Class Documentation ; The c-TF-IDF algorithm formula is used to quantify the semantic importance of words to topic clusters: in, For words Conversation clusters The semantic importance; For words In the class document Word frequency in; The average number of words for all document types. , for Total word count; For words Total word frequency across all document types; Extract semantic tags: for each topic cluster Select several words with high semantic importance as topic clusters. The semantic tags are used to form semantic representations of each topic cluster; these semantic representations serve as the basis for interpreting the semantic grouping of topics corresponding to different attention focuses in the prediction model.

8. An electronic device, characterized in that, It includes a processor, a memory, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the training method for the interpretable dynamic graph network revenue prediction model based on social media as described in any one of claims 1 to 7.

9. A computer program product, characterized in that, It includes a computer program / instruction that, when executed by a processor, implements the training method for the interpretable dynamic graph network revenue prediction model based on social media as described in any one of claims 1 to 7.

10. A readable storage medium, characterized in that, It stores a computer program that, when executed, implements the training method for the interpretable dynamic graph network revenue prediction model based on social media as described in any one of claims 1 to 7.