Social behavior prediction method, device, equipment and medium based on content perception
By encoding the historical postings and network topology features of nodes in the social network, and combining text features for social behavior prediction, the problem of not considering content text in the existing technology is solved, and higher prediction accuracy and effects are achieved.
Patent Information
- Application Number
- CN202311787800.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-25
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2043-12-25
AI Technical Summary
The existing technology fails to effectively consider the content text of user behavior in social influence prediction, resulting in low result evaluation.
By obtaining the social network graph, encoding the node's historical posts and network topology characteristics, obtaining social triplet samples, combining the source node, target node and text features for embedding coding, using the prediction model to predict behavioral probability, and improving the prediction by training the model accuracy.
It improves the accuracy of social behavior prediction, improves AUC and F1 scores, and is especially suitable for scenarios where user behavior needs to be evaluated.
Smart Images

Figure CN117764233B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of social network, and specifically relates to a social behavior prediction method, device, equipment and medium based on content perception. Background Art
[0002] In recent years, social media has become one of the most ubiquitous applications. People are used to and willing to share interesting content happening around us on social media. Other users can take actions on the content according to their preferences (e.g., retweet, like, etc.). The underlying reasons behind positive actions can be attributed to several factors. One is the relationship between these users, especially the local network between the source and target users. Another is the extent to which the content attracts users to share it with their followers. To the best of our knowledge, existing work has not systematically analyzed all the factors.
[0003] Social influence is a key concept in social sciences that describes the broad phenomenon that an individual's behavior is influenced by others in a social environment, both real and virtual. In 1958, Kelman identified three varieties of social influence: compliance, identification, and internalization. Since then, many efforts have been made to characterize, analyze, and predict social influence.
[0004] Social influence prediction has become one of the most important problems in the field of social network analysis, which can help us discover the rationale behind social influence. However, the prediction of social influence is difficult because there are many factors behind the prediction. One important factor is the role of social networks, which is reflected in the graph structure of social networks. Therefore, capturing the structure of social networks is the key to predicting social influence. Another factor in social influence prediction in social media is content. High-quality content is more likely to be noticed in online social media, so we need to consider the content text for prediction.
[0005] There are some studies exploring the prediction of social influence based on different factors. The first is the purely text feature-based method. The text-based method uses various text-related statistical features to effectively model social influence. For example, there is a forwarding pattern where indifferent, neutral and positive tweets spread more widely than mixed neutral and negative tweets. Secondly, BPF++ (Bayesian Poisson Decomposition++) uses various social influences and tweet similarities to enhance performance, and it further incorporates the trust level between users into its framework. However, these methods face a trade-off between accuracy and computing resources, which will compromise their effectiveness when scaling up in the context of big data analysis and real-time data stream processing.
[0006] The second is the graph neural network-based method. Due to the user-level mechanism in social influence, each user is only influenced by his / her immediate neighbors. The graph-based method is another research main line. Topical Affinity Propagation (TAP) aims to simulate the influence on different topics in academic networks and heterogeneous networks. Later, with the emergence of deep learning, the introduction of deep learning can greatly improve the performance of prediction. DeepInf proposed an end-to-end framework to predict social influence by learning the potential characteristics of users. The framework uses GAT (graph attention network) to model the surrounding nodes of the predicted user, that is, modeling the characteristics of the users around the target user and whether to take the expected action to predict the probability of the central user to take the corresponding action. As an improvement of DeepInf, DiffuseGNN further proposed a hierarchical graph neural network method to capture structure-based social features. However, these methods ignore the rich textual information of the prediction. For example, predicting whether user r forwards a post of user u is not only affected by the local network structure of users r and u, but also by the text information of the post.
[0007] From a technical point of view, how to obtain the characteristics of each user node becomes a key issue. There are two existing methods. The first is to directly embed the graph: DeepWalk first regards the path of the graph as a sentence and uses Skip-Gram technology to derive the potential node representation. LINE defines the loss function to maintain the first-order or second-order proximity respectively. Node2vec innovatively defines the general concept of node network neighborhood and designs a biased random walk process that can effectively explore various neighborhood changes. The second is the method based on graph neural network: In recent years, due to the popularity and progress of GNN (graph neural network), GNN (graph neural network) represents an extension of deep learning technology tailored for graph structured data. This type of method passes the characteristics of the node itself with the surrounding nodes through message passing (MessagePassing), so that each node has the attributes of other neighboring nodes. Typical methods of this type include variants such as GCN, GAT, GIN, and these GNN (graph neural network) structures have also become the backbone networks of DeepInf and DiffuseGNN introduced above.
[0008] Most existing works focus on the influence of user characteristics (gender, age, geographic location, etc.) or other users in the user's social network on the user's behavior, but do not pay attention to the impact of the content itself on user behavior, which is often extremely important.
[0009] In summary, the existing technology for predicting social influence has the problem of not considering the impact of the content of user behavior on the prediction, resulting in a low evaluation result. Summary of the invention
[0010] In view of the above analysis, the embodiments of the present invention aim to provide a content-aware social behavior prediction method, device, equipment and medium to solve the problem that the prediction of social influence in the prior art does not consider the impact of the content text of user behavior on the prediction, resulting in a low result evaluation.
[0011] The present invention provides a social behavior prediction method based on content perception, comprising the following steps:
[0012] Obtain a social network graph, wherein the social network graph includes historical posts of a node;
[0013] Encoding the social network graph to obtain an embedding matrix, the embedding matrix including feature embeddings corresponding to nodes, the embedding matrix being generated based on a fusion of the historical posting features and the network topology features of the nodes;
[0014] Acquire a social triplet sample based on the social network graph, wherein the social triplet sample includes a source node, a post from the source node, and a target node, and the social triplet sample also includes a behavior label;
[0015] Based on the embedding matrix, a source node feature embedding corresponding to the source node and a target node feature embedding corresponding to the target node are obtained, the source node post is encoded to obtain a text feature embedding, and the source node feature embedding, the text feature embedding and the target node feature embedding are concatenated to obtain an input vector;
[0016] Inputting the input vector into the prediction model to perform probability prediction on the behavior of the target node with respect to the posting of the source node, and determining the prediction loss value based on the probability prediction result and the behavior label;
[0017] The prediction model is trained based on the loss value, and the prediction model obtained by the training is used to predict the behavior of the target node with respect to the posting of the source node.
[0018] In some embodiments, encoding the social network graph to obtain an embedding matrix includes:
[0019] Obtain a first graph, wherein the first graph includes a source node and a target node, and the nodes of the first graph have historical posts;
[0020] Encoding the historical posts to obtain a feature matrix of the first graph, wherein the feature matrix includes text features corresponding to nodes;
[0021] Randomly masking edge and node text features of the graph according to the adjacency matrix of the first graph and the feature matrix to obtain at least a second graph and a third graph;
[0022] Encoding the adjacency matrix and the feature matrix of the second graph by an encoder to obtain a first embedding matrix, and encoding the adjacency matrix and the feature matrix of the third graph by the encoder to obtain a second embedding matrix;
[0023] Constructing a node feature reconstruction loss and an edge reconstruction loss according to the first embedding matrix and the second embedding matrix, and determining a loss value according to the node feature reconstruction loss and the edge reconstruction loss;
[0024] The encoder is trained according to the loss value, and the encoder obtained by the training encodes the graph to obtain an embedding matrix.
[0025] In some embodiments, encoding the source node post to obtain text feature embedding includes:
[0026] The source node post is encoded through the multilingual e5-large model to obtain the text feature embedding.
[0027] In some embodiments, the deep neural network of the prediction model includes a multi-layer perceptron.
[0028] In some embodiments, before inputting the input vector into the prediction model, the method further includes:
[0029] The input vector is preprocessed, where the preprocessing includes batch normalization and random dropout.
[0030] In some embodiments, the social triplet samples are divided into positive samples and negative samples based on the behavior labels;
[0031] Training the prediction model based on the loss value includes:
[0032] The prediction model is adjusted based on the probability prediction result so that the prediction loss value obtained according to the positive sample gradually decreases during the iteration, and the prediction loss value obtained according to the negative sample gradually increases during the iteration.
[0033] In some embodiments, the calculation method of the predicted loss value is expressed as:
[0034]
[0035] Among them, l sip represents the prediction loss value, K represents the number of all social triplet samples, Represents the behavior label of the social triplet sample. If the target node generates an action in response to the source node’s post otherwise score represents the probability prediction result.
[0036] The present invention also provides a social behavior prediction device based on content perception, comprising:
[0037] An acquisition module is configured to acquire a social network graph, wherein the social network graph includes historical posts of a node;
[0038] a fusion encoding module configured to encode the social network graph to obtain an embedding matrix, wherein the embedding matrix includes feature embeddings corresponding to nodes, and the embedding matrix is generated based on the historical posts and the network topology of the nodes;
[0039] A sample acquisition module is configured to acquire a social triplet sample based on the social network graph, wherein the social triplet sample includes a source node, a source node post, and a target node, and the social triplet sample also includes a behavior label;
[0040] An input generation module is configured to obtain a source node feature embedding corresponding to the source node and a target node feature embedding corresponding to the target node based on the embedding matrix, encode the source node post to obtain a text feature embedding, and concatenate the source node feature embedding, the text feature embedding and the target node feature embedding to obtain an input vector;
[0041] A loss determination module is configured to input the input vector into a prediction model to perform probability prediction on the behavior of the target node with respect to the posting of the source node, and determine a prediction loss value based on the probability prediction result and the behavior label;
[0042] The prediction training module is configured to train the prediction model based on the loss value, and the prediction model obtained by training is used to predict the behavior of the target node with respect to the posting of the source node.
[0043] The present invention also provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the content-aware social behavior prediction method as described in any of the above embodiments is implemented.
[0044] The present invention also provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the content-aware based social behavior prediction method as described in any of the above embodiments is implemented.
[0045] The above embodiments of the present invention have at least the following beneficial effects:
[0046] On the one hand, the embodiment of the present invention uses an encoder to perform feature embedding encoding on the node historical posts and network structure of the social network graph itself from the node perspective, and on the other hand, by connecting the encoding of the source node posts and the feature embeddings of the target node and the source node respectively, the prediction model can take into account the influence of the user's own content text features and the text features of his posts on the behavior of the target node when making predictions. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] In order to more clearly illustrate the embodiments of this specification or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the embodiments of this specification. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.
[0048] Figure 1 A schematic diagram of a process flow of a content-aware social behavior prediction method provided by an embodiment of the present invention;
[0049] Figure 2 A schematic diagram of the architecture of a social behavior prediction device based on content perception provided by the present invention;
[0050] Figure 3 This is a schematic diagram of the electronic device architecture provided by the present invention. DETAILED DESCRIPTION
[0051] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. It should be noted that, in the absence of conflict, the embodiments and features in the embodiments disclosed in this disclosure can be combined, separated, interchanged and / or rearranged with each other. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0052] The terms used here are for the purpose of describing specific embodiments, and are not intended to be restrictive. As used here, unless the context clearly indicates otherwise, the singular forms "one (kind, person)" and "said (the)" are also intended to include plural forms. In addition, when the terms "comprise" and / or "include" and their variations are used in this specification, it is explained that there are stated features, integral bodies, steps, operations, parts, assemblies and / or their groups, but it is not excluded that there are or add one or more other features, integral bodies, steps, operations, parts, assemblies and / or their groups. It should also be noted that, as used here, the terms "substantially", "approximately" and other similar terms are used as approximate terms and not as degree terms, so that they are used to explain the inherent deviations of the measured values, calculated values and / or the values provided that will be recognized by those of ordinary skill in the art.
[0053] The present disclosure is described below through several specific embodiments. In order to keep the following description of the embodiments of the present invention clear and concise, the present invention omits the detailed description of known functions and known components. Figure 1 The embodiment of the present invention provides a method for predicting social behavior based on content perception, comprising the following steps:
[0054] The present invention provides a social behavior prediction method based on content perception, comprising the following steps:
[0055] Obtain a social network graph, wherein the social network graph includes historical posts of a node;
[0056] Encoding the social network graph to obtain an embedding matrix, the embedding matrix including feature embeddings corresponding to nodes, the embedding matrix being generated based on a fusion of the historical posting features and the network topology features of the nodes;
[0057] Acquire a social triplet sample based on the social network graph, wherein the social triplet sample includes a source node, a post from the source node, and a target node, and the social triplet sample also includes a behavior label;
[0058] Based on the embedding matrix, a source node feature embedding corresponding to the source node and a target node feature embedding corresponding to the target node are obtained, the source node post is encoded to obtain a text feature embedding, and the source node feature embedding, the text feature embedding and the target node feature embedding are concatenated to obtain an input vector;
[0059] Inputting the input vector into the prediction model to perform probability prediction on the behavior of the target node with respect to the posting of the source node, and determining the prediction loss value based on the probability prediction result and the behavior label;
[0060] The prediction model is trained based on the loss value, and the prediction model obtained by the training is used to predict the behavior of the target node with respect to the posting of the source node.
[0061] It should be understood that the data of the embodiment of the present invention may come from the original social network graph G of the current social network platform. The nodes in the original social network graph G may be several users who are socializing. Since the amount of data in the social network graph is too large, in order to facilitate operation, before the above embodiment, the social network graph may be subjected to subgraph extraction calculation. For the sake of description, the extracted subgraph may also be referred to as a social network graph. The calculation process includes:
[0062] Select several social triple samples (u, t, r), where u is the posting user, that is, the source node; t is the text content posted by user u, that is, the source node post; r is the user to be predicted, that is, the target node. Based on the selected source node and target node, a breadth-first search (BFS) is performed to extract the subnetwork of nodes u and r from the social network graph G, so that the subnetwork extraction is completed when the number of nodes contained in the subnetwork reaches the set number. Preferably, the set number can be 30, 50, 70 or 90. After experiments, it is known that the training effect is better when the node capacity of the subnetwork is 50. In this embodiment, a node capacity of 50 is used as an example for explanation. It should be understood that the amount of data of the original social network graph G is too large. In this embodiment, the social network graph in this embodiment is obtained by extracting subgraphs based on source nodes and target nodes.
[0063] In some embodiments, encoding the social network graph to obtain an embedding matrix includes:
[0064] Obtain a first graph, wherein the first graph includes a source node and a target node, and the nodes of the first graph have historical posts;
[0065] Encoding the historical posts to obtain a feature matrix of the first graph, wherein the feature matrix includes text features corresponding to nodes;
[0066] Randomly masking edge and node text features of the graph according to the adjacency matrix of the first graph and the feature matrix to obtain at least a second graph and a third graph;
[0067] Encoding the adjacency matrix and the feature matrix of the second graph by an encoder to obtain a first embedding matrix, and encoding the adjacency matrix and the feature matrix of the third graph by the encoder to obtain a second embedding matrix;
[0068] Constructing a node feature reconstruction loss and an edge reconstruction loss according to the first embedding matrix and the second embedding matrix, and determining a loss value according to the node feature reconstruction loss and the edge reconstruction loss;
[0069] The encoder is trained according to the loss value, and the encoder obtained by the training encodes the graph to obtain an embedding matrix.
[0070] It should be understood that the first graph may be the social network graph mentioned in the above embodiment, or may be a social network graph with a certain number of nodes extracted by other means, and the present invention is not limited to this.
[0071] In addition, in some embodiments, the encoder is a graph neural network (GNN) based encoder, where the type of the graph neural network can be, for example, a graph attention network (GAT) or a graph convolutional network (GCN).
[0072] In some embodiments, encoding the historical posts to obtain a feature matrix of the first graph includes:
[0073] Obtaining several historical posts of the node;
[0074] Encode historical posts through the multilingual e5-large model to obtain text feature embeddings of historical posts;
[0075] Performing average pooling on the text feature embeddings of the plurality of historical posts to obtain the text feature of the node;
[0076] Until all the nodes of the first graph are traversed, the feature matrix is obtained based on the text features of each node.
[0077] Specifically, for example, take 50 historical articles of each node, encode them through the multilingual e5-large model to obtain 50 text feature embedding vectors, and then calculate the average vector as the text feature of the node. Then, the feature matrix X is formed through the text features corresponding to all nodes in the first figure. X is expressed as:
[0078] X=[x 1 ;x 2 ;...;x n ], where X represents the feature matrix, x i Represents the text feature corresponding to the i-th node in the first graph.
[0079] In some embodiments, randomly masking edge and node text features of the graph according to the adjacency matrix and the feature matrix of the first graph to obtain at least a second graph and a third graph includes:
[0080] Generate a first random mask matrix, and mask the feature matrix of the first image by using the first random mask matrix to obtain the feature matrix of the second image, which is expressed as:
[0081] X′=XοM 1 =[x 1 οm1 ;x 2 οm 2 ;...;x n οm n ];
[0082] Where X′ represents the characteristic matrix of the second graph, x i represents the text feature corresponding to node i, ο represents the Hadamard product, m i Represents the first random mask matrix M 1 The i-th mask vector of corresponds to node i;
[0083] generating a second random mask matrix, and masking the adjacency matrix of the first graph by the second random mask matrix to obtain the adjacency matrix of the second graph;
[0084] Generate a third random mask matrix, and mask the feature matrix of the first image by the third random mask matrix to obtain the feature matrix of the third image;
[0085] A fourth random mask matrix is generated, and the adjacency matrix of the first graph is masked by the fourth random mask matrix to obtain the adjacency matrix of the third graph.
[0086] The first random mask matrix and the third random mask matrix are used to perform different mask operations on the feature matrix of the first graph. The second random mask matrix and the fourth random mask matrix are used to perform different mask operations on the adjacency matrix of the first graph. Two subgraphs of the first graph, namely the second graph and the third graph, are obtained by masking the feature matrix twice and the adjacency matrix twice. The network structure and feature information of the second graph and the third graph are incomplete and different from those of the first graph. Subsequently, the encoder is used to encode it and loss reconstruction training is performed so that the encoder can better learn the text feature information and structural information of the social network graph G in various situations, thereby improving the generalization ability of the encoder.
[0087] In some embodiments, the mask vectors are composed of 0 and 1 that obey Bernoulli distribution. The mask vectors include mask vectors in four random mask matrices. The random mask vectors that conform to Bernoulli distribution make the distribution of the work of this embodiment consistent with that of the previous related work, so as to compare the results of this embodiment with the results of the previous work with control variables, avoid the influence of the results caused by inconsistent data distribution, so that the data correspondence can better reflect the ability of the encoder itself.
[0088] Next, before constructing the node feature reconstruction loss according to the first embedding matrix and the second embedding matrix, the second image and the third image must first be encoded by the encoder to obtain the first embedding matrix and the second embedding matrix. The acquisition method is expressed as:
[0089]
[0090]
[0091] Where H represents the first embedding matrix, f E Represents the encoder. The encoder input includes the adjacency matrix and feature matrix of the graph. Specifically, G′ 1 represents the adjacency matrix of the second graph, represents the feature matrix of the second graph, Q represents the second embedding matrix, G′ 2 represents the adjacency matrix of the third graph, Represents the characteristic matrix of the third graph.
[0092] In some embodiments, constructing a node feature reconstruction loss and an edge reconstruction loss according to the first embedding matrix and the second embedding matrix, and determining a loss value according to the node feature reconstruction loss and the edge reconstruction loss includes:
[0093] The node feature reconstruction loss is constructed based on the first embedding matrix and the second embedding matrix, which is expressed as:
[0094]
[0095] Among them l 1 represents the node feature reconstruction loss, N represents the number of nodes in the first graph, and h i represents the vector corresponding to node i in the first embedding matrix, q i represents the vector corresponding to node i in the second embedding matrix, l(h i ,q i ) or l(q i ,h i ) represents the consistency score of the feature embedding of node i based on the second and third graphs, l(h i ,q i ) is expressed as:
[0096] Where θ represents the score function and τ represents the temperature coefficient.
[0097] In the representation of the consistency score, this embodiment not only takes into account that the embedding of the same node obtained by the encoder under different circumstances should be close or consistent, but also takes into account that the encoder should make the representations of different nodes in the same graph or different graphs different. Therefore, when calculating the consistency score of the construction loss, for each node, the loss function is calculated by comparing the representations of the same node in different views, the representations of different nodes in the same view, and the representations of different nodes in different views, so that the reliability of the encoder encoding is guaranteed. Since the consistency score is not symmetrical, the node feature reconstruction loss function of the final node feature level is as shown in the above formula l 1 As shown in the representation.
[0098] Furthermore, in some practical scenarios, it is observed that many relationships are generated due to the interaction between the authors of posts (source nodes) and the people who reply to these posts (target nodes). Therefore, the formation of edges in social networks also contains text-type relationships. Therefore, in addition to the contrastive learning of node text features, the reconstruction of adjacent edge relationships should also be considered.
[0099] Here, one of the two views generated based on the first graph in the above embodiment, namely the second graph or the third graph (both views provide equivalent representation capabilities) is used to obtain the set ε of edges covered (discarded) by the mask as positive samples. In this embodiment, the first embedding matrix H of the second graph is selected as an example for explanation. In order to ensure that the losses of node text feature reconstruction and edge reconstruction run on the same scale, this embodiment also uses negative edge sampling for contrastive learning. Specifically, random negative sampling is used to obtain the set ε of negative edges - .
[0100] Then, the feature embeddings of the two endpoints of each edge are extracted from the first embedding matrix H, and their cosine similarity is calculated as the existence probability of the edge. Finally, the positive and negative samples will use the InfoNCE loss function to calculate the loss. The InfoNCE loss function makes the feature embedding representations of the two end nodes of similar edge samples as close as possible, and the feature embedding representations of the two end nodes of dissimilar edge samples as far apart as possible.
[0101] Specifically, in some embodiments, constructing a node feature reconstruction loss and an edge reconstruction loss according to the first embedding matrix and the second embedding matrix, and determining a loss value according to the node feature reconstruction loss and the edge reconstruction loss includes:
[0102] Constructing an edge reconstruction loss based on the first embedding matrix or the second embedding matrix includes:
[0103] Selecting the second image or the third image as an edge sample source image to construct an edge sample set, the edge sample set including positive edge samples and negative edge samples, the positive edge samples including masked edges in the edge sample source image, and the negative edge samples being obtained by performing negative edge sampling on the edge sample source image;
[0104] Based on the embedding matrix of the edge sample source graph, the similarity of the feature embeddings corresponding to the two end nodes of the edge sample is obtained, and the edge reconstruction loss is constructed according to the similarity, which is expressed as:
[0105]
[0106] Among them l 2 represents the edge reconstruction loss, ε represents the set of positive edge samples, |ε| represents the number of positive edge samples, (w,v) represents the feature embedding corresponding to the nodes at both ends of the positive edge samples, and ε - represents the set of negative edge samples, (w′, v′) represents the feature embedding corresponding to the nodes at both ends of the negative edge samples, τ represents the temperature coefficient, and f represents the similarity.
[0107] After obtaining the two loss functions of edge reconstruction loss, the two are weighted to obtain the total loss of the pre-training stage as follows:
[0108] l pretrain = l 1 +λ*l 2 ; where l pretrain represents the loss value determined according to the node feature reconstruction loss and the edge reconstruction loss, and λ represents the set weight. The encoder parameters are updated by back propagation based on the loss value.
[0109] In some embodiments, after encoding the graph by the encoder obtained through training to obtain an embedding matrix, the method further includes:
[0110] Get the feature embedding corresponding to a node.
[0111] The above is the pre-training process. The GNN encoder is obtained through pre-training. The encoder is finally used to try to effectively capture the network topology pattern and text information from different users. Intuitively speaking, the GNN encoder has general prior knowledge from the social network structure and user text after pre-training. It can be used to extract the fusion representation of information such as the user's network structure and the user's text features in the social network graph, that is, the feature embedding of the node.
[0112] In some embodiments, encoding the source node post to obtain text feature embedding includes:
[0113] The source node post is encoded through the multilingual e5-large model to obtain the text feature embedding.
[0114] Then, based on the encoder provided in the above embodiment, the social network graph of user node u (source node) and user node r (target node) containing the social triple sample (u, t, r) is encoded to obtain an embedding matrix, which contains the fusion feature information of the historical posting features of each node user and the network topology features of the node. Based on this, the feature embedding of user node u and user node r is obtained. The acquisition process is expressed as:
[0115] h u ,h r =f E (G u,r ,X u,r );where h u represents the feature embedding of user node u, h r represents the feature embedding of user node r, f E represents the encoder, G u,r Represents the adjacency matrix of the social network graph, X u,r A feature matrix representing a social network graph.
[0116] Then the source node feature embedding, text feature embedding and target node feature embedding are concatenated to obtain the input vector, which is expressed as:
[0117] input=Concat(h u ,t,h r ), input represents the input vector, and Concat represents the concatenation operation function.
[0118] In some embodiments, the deep neural network of the prediction model includes a multi-layer perceptron (MLP).
[0119] In some embodiments, before inputting the input vector into the prediction model, the method further includes:
[0120] The input vector is preprocessed, including batch normalization and random dropout, to accelerate convergence and offset overfitting.
[0121] It should be understood that the output of the multi-layer perceptron (MLP) is the feature extraction result of the input vector, and then the extraction result needs to be activated by an activation function to obtain the final output of the neural network of the prediction model. The process is expressed as:
[0122] score = Sigmoid(MLP(input)); score represents the probability prediction result, Sigmoid represents the activation function, which can reduce the input to the interval (0,1) to simulate the probability of the user taking corresponding actions.
[0123] In some embodiments, the social triplet samples are divided into positive samples and negative samples based on the behavior labels;
[0124] Training the prediction model based on the loss value includes:
[0125] The prediction model is adjusted based on the probability prediction result so that the prediction loss value obtained according to the positive sample gradually decreases in the iteration, and the prediction loss value obtained according to the negative sample gradually increases in the iteration. Preferably, in some embodiments, this process also includes fine-tuning and updating the encoder.
[0126] In some embodiments, the calculation method of the predicted loss value is expressed as:
[0127]
[0128] Among them, l sip represents the prediction loss value, K represents the number of all social triplet samples, Represents the behavior label of the social triplet sample. If the target node generates an action in response to the source node’s post otherwise score represents the probability prediction result.
[0129] The model proposed in the embodiment of the present invention exceeds all current mainstream models in terms of AUC and F1 scores. AUC refers to the area under the ROC curve (Receiver Operating Characteristic curve), which is used to evaluate the performance of binary classification. F1 is the harmonic mean of precision and recall.
[0130] Among them, the encoder-based GAT methods generally outperform the GCN-based methods, with the GAT encoder model's AUC scores being 75.6, 81.1, and 67.1 in the three datasets, and consistently outperforming the GCN encoder model's AUC scores, which were recorded as 74.0, 79.7, and 64.5. This is mainly attributed to the different contributions of each person's features in a social network. Unlike GCN, which evenly measures the contributions of different nodes, GAT can select the most influential user attributes for feature aggregation.
[0131] Unlike other GNN-based methods, many existing GNN models choose to use the user's demographic attributes as initial node features. Compared with DiffuseGNN (AUC scores of 66.1, 65.9, and 65.8 on three datasets, respectively), the AUC on the Twitter-Retweet dataset was improved by 14.3%, the Twitter-Reply dataset was improved by 23.1%, and the Weibo dataset was improved by 1.9%. In contrast, the model of the embodiment of the present invention uses the user's historical tweet features as the basic node attributes. This choice makes the model of the present invention particularly suitable for scenarios where user behavior needs to be evaluated based on text features. It is worth noting that text and graph structure features belong to two different modalities. Direct messaging of text features may complicate the learning process of the model. To solve this problem, the pre-training stage of the framework of the present invention allows the GNN model to effectively integrate graph structure and text features through the tasks of node-level contrastive learning and edge-level mask reconstruction. Subsequently, the framework of the embodiment of the present invention fine-tunes the pre-trained encoder in downstream tasks.
[0132] The present invention also provides a social behavior prediction device based on content perception, comprising:
[0133] An acquisition module is configured to acquire a social network graph, wherein the social network graph includes historical posts of a node;
[0134] a fusion encoding module configured to encode the social network graph to obtain an embedding matrix, wherein the embedding matrix includes feature embeddings corresponding to nodes, and the embedding matrix is generated based on the historical posts and the network topology of the nodes;
[0135] A sample acquisition module is configured to acquire a social triplet sample based on the social network graph, wherein the social triplet sample includes a source node, a source node post, and a target node, and the social triplet sample also includes a behavior label;
[0136] An input generation module is configured to obtain a source node feature embedding corresponding to the source node and a target node feature embedding corresponding to the target node based on the embedding matrix, encode the source node post to obtain a text feature embedding, and concatenate the source node feature embedding, the text feature embedding and the target node feature embedding to obtain an input vector;
[0137] A loss determination module is configured to input the input vector into a prediction model to perform probability prediction on the behavior of the target node with respect to the posting of the source node, and determine a prediction loss value based on the probability prediction result and the behavior label;
[0138] The prediction training module is configured to train the prediction model based on the loss value, and the prediction model obtained by training is used to predict the behavior of the target node with respect to the posting of the source node.
[0139] The present invention also provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the content-aware social behavior prediction method as described in any of the above embodiments is implemented.
[0140] The present invention also provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the content-aware based social behavior prediction method as described in any of the above embodiments is implemented.
[0141] Computer readable storage media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0142] The professionals should further realize that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to the function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0143] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0144] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A content-aware social behavior prediction method, characterized in that: The following steps are involved: Obtain a social network graph, wherein the social network graph includes historical posts of a node; Encoding the social network graph to obtain an embedding matrix, the embedding matrix including feature embeddings corresponding to nodes, the embedding matrix being generated based on a fusion of the historical posting features and the network topology features of the nodes; Acquire a social triplet sample based on the social network graph, wherein the social triplet sample includes a source node, a post from the source node, and a target node, and the social triplet sample also includes a behavior label; Based on the embedding matrix, a source node feature embedding corresponding to the source node and a target node feature embedding corresponding to the target node are obtained, the source node post is encoded to obtain a text feature embedding, and the source node feature embedding, the text feature embedding and the target node feature embedding are concatenated to obtain an input vector; Inputting the input vector into the prediction model to perform probability prediction on the behavior of the target node with respect to the posting of the source node, and determining the prediction loss value based on the probability prediction result and the behavior label; The prediction model is trained based on the loss value, and the prediction model obtained by the training is used to predict the behavior of the target node with respect to the posting of the source node; Encoding the social network graph to obtain an embedding matrix includes: Obtain a first graph, wherein the first graph includes a source node and a target node, and the nodes of the first graph have historical posts; Encoding the historical posts to obtain a feature matrix of the first graph, wherein the feature matrix includes text features corresponding to nodes; Randomly masking edge and node text features of the graph according to the adjacency matrix of the first graph and the feature matrix to obtain at least a second graph and a third graph; Encoding the adjacency matrix and the feature matrix of the second graph by an encoder to obtain a first embedding matrix, and encoding the adjacency matrix and the feature matrix of the third graph by the encoder to obtain a second embedding matrix; Constructing a node feature reconstruction loss and an edge reconstruction loss according to the first embedding matrix and the second embedding matrix, and determining a loss value according to the node feature reconstruction loss and the edge reconstruction loss; The encoder is trained according to the loss value, and the encoder obtained by the training encodes the graph to obtain an embedding matrix; Randomly masking edge and node text features of the graph according to the adjacency matrix and the feature matrix of the first graph to obtain at least a second graph and a third graph, including: Generate a first random mask matrix, and mask the feature matrix of the first image by using the first random mask matrix to obtain the feature matrix of the second image, which is expressed as: ; in represents the characteristic matrix of the second graph, represents the text feature corresponding to node i, represents the Hadamard product, Represents the first random mask matrix The i-th mask vector of corresponds to node i; generating a second random mask matrix, and masking the adjacency matrix of the first graph by the second random mask matrix to obtain the adjacency matrix of the second graph; Generate a third random mask matrix, and mask the feature matrix of the first image by the third random mask matrix to obtain the feature matrix of the third image; generating a fourth random mask matrix, and masking the adjacency matrix of the first graph by the fourth random mask matrix to obtain the adjacency matrix of the third graph; Constructing a node feature reconstruction loss and an edge reconstruction loss according to the first embedding matrix and the second embedding matrix, and determining a loss value according to the node feature reconstruction loss and the edge reconstruction loss, including: The node feature reconstruction loss is constructed based on the first embedding matrix and the second embedding matrix, which is expressed as: ; in represents the node feature reconstruction loss, N represents the number of nodes in the first graph, represents the vector corresponding to node i in the first embedding matrix, represents the vector corresponding to node i in the second embedding matrix, or represents the consistency score of the feature embedding of node i based on the second and third graphs, ,in represents the score function, and τ represents the temperature coefficient.
2. The method for predicting social behavior based on content perception according to claim 1, characterized in that: Encoding the source node post to obtain text feature embedding includes: The source node post is encoded through the multilingual e5-large model to obtain the text feature embedding.
3. The method for predicting social behavior based on content perception according to claim 1, characterized in that: The deep neural network of the prediction model includes a multi-layer perceptron.
4. The method for predicting social behavior based on content perception according to claim 1, characterized in that: Before inputting the input vector into the prediction model, the following steps are also included: The input vector is preprocessed, where the preprocessing includes batch normalization and random dropout.
5. The method for predicting social behavior based on content perception according to claim 1, characterized in that: The social triplet samples are divided into positive samples and negative samples based on the behavior labels; Training the prediction model based on the loss value includes: The prediction model is adjusted based on the probability prediction result so that the prediction loss value obtained according to the positive sample gradually decreases during the iteration, and the prediction loss value obtained according to the negative sample gradually increases during the iteration.
6. The method for predicting social behavior based on content perception according to claim 1, characterized in that: The calculation method of the predicted loss value is expressed as: ; in, represents the prediction loss value, K represents the number of all social triplet samples, Represents the behavior label of the social triplet sample. If the target node generates an action in response to the source node’s post ,otherwise , Represents the probability prediction result.
7. A social behavior prediction device based on content perception, characterized in that: include: An acquisition module is configured to acquire a social network graph, wherein the social network graph includes historical posts of a node; a fusion encoding module configured to encode the social network graph to obtain an embedding matrix, wherein the embedding matrix includes feature embeddings corresponding to nodes, and the embedding matrix is generated based on the historical posts and the network topology of the nodes; A sample acquisition module is configured to acquire a social triplet sample based on the social network graph, wherein the social triplet sample includes a source node, a source node post, and a target node, and the social triplet sample also includes a behavior label; An input generation module is configured to obtain a source node feature embedding corresponding to the source node and a target node feature embedding corresponding to the target node based on the embedding matrix, encode the source node post to obtain a text feature embedding, and concatenate the source node feature embedding, the text feature embedding and the target node feature embedding to obtain an input vector; A loss determination module is configured to input the input vector into a prediction model to perform probability prediction on the behavior of the target node with respect to the posting of the source node, and determine a prediction loss value based on the probability prediction result and the behavior label; A prediction training module is configured to train the prediction model based on the loss value, and the prediction model obtained by the training is used to predict the behavior of the target node with respect to the posting of the source node; Encoding the social network graph to obtain an embedding matrix includes: Obtain a first graph, wherein the first graph includes a source node and a target node, and the nodes of the first graph have historical posts; Encoding the historical posts to obtain a feature matrix of the first graph, wherein the feature matrix includes text features corresponding to nodes; Randomly masking edge and node text features of the graph according to the adjacency matrix of the first graph and the feature matrix to obtain at least a second graph and a third graph; Encoding the adjacency matrix and the feature matrix of the second graph by an encoder to obtain a first embedding matrix, and encoding the adjacency matrix and the feature matrix of the third graph by the encoder to obtain a second embedding matrix; Constructing a node feature reconstruction loss and an edge reconstruction loss according to the first embedding matrix and the second embedding matrix, and determining a loss value according to the node feature reconstruction loss and the edge reconstruction loss; The encoder is trained according to the loss value, and the encoder obtained by the training encodes the graph to obtain an embedding matrix; Randomly masking edge and node text features of the graph according to the adjacency matrix and the feature matrix of the first graph to obtain at least a second graph and a third graph, including: Generate a first random mask matrix, and mask the feature matrix of the first image by using the first random mask matrix to obtain the feature matrix of the second image, which is expressed as: ; in represents the characteristic matrix of the second graph, represents the text feature corresponding to node i, represents the Hadamard product, Represents the first random mask matrix The i-th mask vector of corresponds to node i; generating a second random mask matrix, and masking the adjacency matrix of the first graph by the second random mask matrix to obtain the adjacency matrix of the second graph; Generate a third random mask matrix, and mask the feature matrix of the first image by the third random mask matrix to obtain the feature matrix of the third image; generating a fourth random mask matrix, and masking the adjacency matrix of the first graph by the fourth random mask matrix to obtain the adjacency matrix of the third graph; Constructing a node feature reconstruction loss and an edge reconstruction loss according to the first embedding matrix and the second embedding matrix, and determining a loss value according to the node feature reconstruction loss and the edge reconstruction loss, including: The node feature reconstruction loss is constructed based on the first embedding matrix and the second embedding matrix, which is expressed as: ; in represents the node feature reconstruction loss, N represents the number of nodes in the first graph, represents the vector corresponding to node i in the first embedding matrix, represents the vector corresponding to node i in the second embedding matrix, or represents the consistency score of the feature embedding of node i based on the second and third graphs, ,in represents the score function, and τ represents the temperature coefficient.
8. An electronic device, characterized in that: It comprises a memory and a processor, the memory stores a computer program, and when the computer program is executed by the processor, the content-aware based social behavior prediction method as described in any one of claims 1 to 6 is implemented.
9. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed by a processor, the content-aware based social behavior prediction method as described in any one of claims 1-6 is implemented.
