Online social network user representation method and device based on context path

By adopting a context path-based walk strategy and K-means clustering method in the online social network heterogeneous graph, the problem of difficulty in capturing high-order relationships and the need to professionally define metapaths in the prior art is solved, and a more effective user representation and clustering effect is achieved.

CN117540232BActive Publication Date: 2025-05-02GUANGZHOU UNIVERSITY
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311176802.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-13
Publication Date
2025-05-02
Estimated Expiration
2043-09-13

AI Technical Summary

Technical Problem

When the prior art deals with heterogeneous graphs of online social networks, it is difficult to effectively capture the high-order relationships between nodes, and professionals are required to define metapaths, which has problems such as information loss and increased model complexity.

Method used

Using a context-based path method, the high-order relationship between nodes is captured through a walk strategy in the online social network heterogeneous graph, a vector representation of user nodes is generated, and user division is performed through K-means clustering, avoiding the difficulty of metapath definition and information loss.

Benefits of technology

It realizes more efficiently capturing the high-order relationships between nodes in heterogeneous graphs, improves the robustness and clustering effect of the model, and reduces the dependence on professional knowledge.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117540232B_ABST
    Figure CN117540232B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and device for representing online social network users based on context path, including: using user and network data to extract features and obtain node vectors and online social network heterogeneous graphs; constructing an online social network user representation model, using a context path-based walking method on the heterogeneous graph to capture the hidden high-order relationships between different nodes in the heterogeneous graph; using a graph encoder to process node vectors and introduce an attention mechanism to obtain vector representations of user nodes and cluster users. The present invention provides a new method for classifying network users, avoiding the problem of professionals defining meta-paths and the problem of context paths and relationships of different lengths having the same weight, and can learn more effective node vectors, thereby improving the robustness of the model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of image classification, and in particular relates to a method and device for representing online social network users based on context paths. Background Art

[0002] With the rapid development of the Internet, more and more people are participating in social networks. They usually register accounts on various social platforms and share their views on certain things on the social platforms. Therefore, if the users on the social networking platform can be divided into different communities, we can have a more comprehensive understanding of the users and apply it in scenarios such as recommendation systems and network security.

[0003] The task of user segmentation in online social networks can usually obtain features from two dimensions: user attributes and user social relationships. Traditional methods generally measure the degree of users in social network graphs. In recent years, due to the outstanding performance of deep learning methods in feature extraction, deep learning-based methods have been widely used, but they usually select one or two dimensions of user information for simple user segmentation, which may produce unsatisfactory results. Moreover, online social networks are complex heterogeneous graphs with multiple nodes and relationships, but most previous methods regard them as homogeneous graphs and use homogeneous graph-based methods to process them, which will cause many disadvantages, such as information loss. Because when using homogeneous graph methods to process heterogeneous graphs, the type information of vertices and edges needs to be ignored by converting heterogeneous graphs into homogeneous graphs, and the rich features and heterogeneous properties of heterogeneous graphs cannot be captured, which seriously affects the modeling and analysis effects of heterogeneous graphs. In addition, different types of vertices and edges in heterogeneous graphs need to be converted to the same type, which often requires the introduction of a large number of virtual nodes and edges to expand the heterogeneous graph, thereby increasing the complexity and training efficiency of the model, and the interpretability of the model is also poor. This is unacceptable for analyzing online social networks. Afterwards, many researchers proposed a meta-path-based approach to process heterogeneous graphs. By defining different types of meta-paths in heterogeneous graphs, the structure and characteristics of heterogeneous graphs can be better captured. Compared with processing heterogeneous graphs on homogeneous graphs, the meta-path processing method has better modeling and expression capabilities, and can also effectively utilize the structural characteristics of heterogeneous graphs. However, there are several obvious defects in the meta-path-based approach. First, the selection and definition of meta-paths are not easy. When processing heterogeneous graphs, different meta-paths need to be defined for different types of vertices and edges. This means that a deeper understanding of heterogeneous graphs is required before processing them. It is difficult to select appropriate meta-paths for some complex heterogeneous graphs. Moreover, the definition of meta-paths often requires domain knowledge and requires reasonable interpretation of tasks and data. For some more complex heterogeneous graphs, the definition of meta-paths is very difficult. Second, the number of meta-paths grows exponentially with the length of the path, which means that it is almost impossible to find all meaningful meta-paths to capture high-order relationships. In addition, different meta-paths contribute differently to relationships in online social networks. How to distinguish the importance of different meta-paths is also a huge challenge. Summary of the invention

[0004] The main purpose of the present invention is to overcome the shortcomings and deficiencies of the prior art, and to provide a context path-based online social network user representation method and device, which analyzes user and network data, then constructs an online social network heterogeneous graph, and uses a context path-based walking method on the heterogeneous graph to capture the hidden high-order relationships between different nodes in the heterogeneous graph, and then obtains a vector representation of the user nodes, and finally clusters the users through the K-means method, avoiding the problem of professionals defining meta-paths and the problem of context paths and relationships of different lengths having the same weights, and can learn more effective node vectors, thereby improving the robustness of the model.

[0005] In order to achieve the above object, the present invention adopts the following technical solutions:

[0006] In a first aspect, the present invention provides a method for representing online social network users based on context paths, comprising the following steps:

[0007] The method for representing online social network users based on context path is characterized by comprising the following steps:

[0008] Utilize user and network data to extract features and obtain node vectors and online social network heterogeneous graphs; the user and network data include user attribute data, user tweet data and user static attention network data; the node vector includes a feature vector based on user attributes and a feature vector based on tweets; the online social network heterogeneous graph uses user nodes as main nodes and tweet nodes as auxiliary nodes;

[0009] Construct an online social network user representation model, calculate the context path probability according to the given context path length, iteratively use the walking strategy to walk between two main nodes in the online social network heterogeneous graph, capture the auxiliary nodes of the main node within the given context path length range, generate and embed the main graph and auxiliary graph, and then train the online social network user representation model;

[0010] The node vectors are processed by using a graph encoder, and the embedded main graph and auxiliary graph are mapped into a unified summaryvector. Then, a node elimination mechanism is implemented on the summary vector, and the attention score is calculated to train the online social network user representation model. The context path information is obtained through iteration. The context path information is spliced ​​proportionally using the trained online social network user representation model to obtain the representation vector of the user node and cluster the users.

[0011] As a preferred technical solution, the user and network data are used to extract user and network features, and node vectors and online social network heterogeneous graphs are obtained, specifically:

[0012] The static network data of the user includes the user account ID and all the account IDs that the user follows; the user and network data also includes a data set of the relationship between the user and the tweets;

[0013] Utilize user attribute data to extract and horizontally splice and fuse user attribute features to obtain a feature vector based on user attributes;

[0014] Use word frequency-inverse text frequency to process user tweet data, extract the features of each tweet, and obtain the tweet feature vector;

[0015] By using the user's static attention network data and constructing an encoding mapping dictionary, the user account ID is used as the user node of the online social network heterogeneous graph; the original tweet ID in the user's tweet data is mapped to an index ranging from 0 as an auxiliary node of the online social network heterogeneous graph; according to the dataset of the relationship between users and tweets, the edges between user nodes and tweet nodes, as well as between tweet nodes and tweet nodes are constructed to obtain the online social network heterogeneous graph.

[0016] As a preferred technical solution, the context path probability is calculated according to the given context path length, specifically,

[0017] Given a context path length k, the objective function of the online social network user representation model is set to maximize the probability of co-occurrence of main types of nodes As follows:

[0018]

[0019] K represents the maximum length of a given context path. It's G P Middle node v i The k-length context neighbors, i.e., the neighbor set of the user node, ρ k Represents different context paths, G P represents the effective learning main graph, v i Represents nodes i, v in the main graph j Represents the neighbor node j of node i.

[0020] As a preferred technical solution, the embedding of the main graph and the auxiliary graph and then training of the online social network user representation model is specifically as follows:

[0021] A graph neural network is used to recursively embed the high-order relationship of each node into the context information vector c k In, to represent the relationship information of all context paths of length k;

[0022] After several information transfers, all context paths of length k are embedded into the context information vector c kIn , the probability of the context path between two main nodes is approximated by the context information vector of each node, combined with the user attribute feature vector, and calculated using the softmax function:

[0023]

[0024]

[0025] where z i and z j It is to learn v i and v j Node embedding, and represents the context information vector, ⊙ represents the element vector product operation, σ represents the sigmoid function, Represents node v i and node v j The weights of the context paths connected by length k, v i Represents node i, v j Represents the neighbor node j of node i;

[0026] By introducing the attention mechanism, the objective function is simplified to the following formula:

[0027]

[0028] where α k Expressed as the importance of context paths of different lengths, G P Represents the effective learning main graph, It's G P Medium i The set of k-length context neighbors, i.e. user nodes;

[0029] Through negative sampling technology, the objective function is converted into a loss function. The formula is as follows:

[0030]

[0031] in Yes i The set of negative context neighbors, logα k Indicates prevention of α k Too little punishment;

[0032] Optimize the parameters and obtain a trained online social network user representation model.

[0033] As a preferred technical solution, the processing of node vectors using a graph encoder also includes the following steps:

[0034] The context information vector of each node is obtained by weighted averaging the embedding vectors of neighbor nodes in the embedded main graph and auxiliary graph. The formula is as follows:

[0035]

[0036]

[0037] in Represents G S The summary vector of the graph at level l, Represents G T summaryvector of the graph at level l, and represents the context information vector of the l-1th layer, S and T represent the relationship r ST The source and target node types in G S Represented as a graph composed of node type S, G T Represents the graph composed of node type T.

[0038] As a preferred technical solution, the summary vector is subjected to a node elimination mechanism, and the attention score is calculated to train the online social network user representation model, specifically,

[0039] For user nodes that have never tweeted or have no personal information, the formula is as follows:

[0040] G′=NodeDropout(G)

[0041] h=Mean(C)

[0042] Where C represents the set of context information vectors of all nodes in the graph G′, G represents the original input graph, and h represents the summary vector;

[0043] After obtaining the summary vector of each graph, in the lth layer, each relationship r is calculated ST The h-head attention score Right now

[0044]

[0045]

[0046]

[0047] Where S and T represent the relationship r ST The source and target node types in and Respectively represent G S and G T The summary vector of the graph at level l, and is the context information vector of the l-1th layer, Express The query vector obtained by linear transformation QLinear, Express The query vector key vector obtained by linear transformation KLinear, QLinear and KLinear represent linear projection functions, which map the summary vector to the key vector and query vector in multi-head attention; Represents the relationship ST The attention weights at the head of layer l; G S Represented as a graph composed of node type S, G T Represents the graph composed of node type T.

[0048] As a preferred technical solution, the context path information is spliced ​​proportionally, specifically:

[0049] After independent calculations for each head at layer l-1, the importance of different relationships between nodes is obtained, and the importance of different relationships between nodes is obtained by aggregating the nodes v i The context neighbors of node v are concatenated together to obtain node v i Final Output

[0050]

[0051] Where N s (i) represents node v i In Figure G S For each relation r associated with a node type T in ST The adjacent neighbors in represents the context vector of node j at layer l-1, σ represents the sigmoid function, is the trainable parameter of the lth layer, H is the number of heads of multi-head attention, and || represents the concatenation operation;

[0052] Run the online social network user representation model several times, with context path information of length k

[0053] A gating vector is set at each layer, and the new aggregation vector is fused with the node expression of the upper layer in proportion, that is:

[0054]

[0055] Where β represents the gate vector, is the embedding of the auxiliary graph in layer l-1, Represents the embedding of the main image in layer l-1.

[0056] In a second aspect, the present invention further provides an online social network user representation system based on context path, which is applied to the online social network user representation method based on context path, and includes a feature engineering module, a graph construction module and a graph node representation learning module;

[0057] The feature engineering module uses user and network data to extract features and obtain node vectors and online social network heterogeneous graphs; the user and network data include user attribute data, user tweet data and user static attention network data; the node vector includes a feature vector based on user attributes and a tweet feature vector; the online social network heterogeneous graph uses user nodes as main nodes and tweet nodes as auxiliary nodes;

[0058] The graph construction module constructs an online social network user representation model, calculates the context path probability according to a given context path length, iteratively walks between two main nodes in the online social network heterogeneous graph using a walking strategy, captures auxiliary nodes of the main node within the given context path length range, generates and embeds the main graph and the auxiliary graph, and then trains the online social network user representation model;

[0059] The graph node representation learning module uses a graph encoder to process node vectors, maps the embedded main graph and auxiliary graph into a summary vector of a unified form, then implements a node elimination mechanism for the summary vector, and calculates the attention score to train an online social network user representation model, and obtains context path information through iteration; using the trained online social network user representation model, the context path information is spliced ​​in proportion to obtain the representation vector of the user node and cluster the users.

[0060] In a third aspect, the present invention provides an electronic device, the electronic device comprising:

[0061] at least one processor; and,

[0062] a memory communicatively connected to the at least one processor; wherein,

[0063] The memory stores computer program instructions that can be executed by the at least one processor, and the computer program instructions are executed by the at least one processor to enable the at least one processor to perform the online social network user representation method based on context path.

[0064] In a fourth aspect, the present invention provides a computer-readable storage medium storing a program, which, when executed by a processor, implements the online social network user representation method based on context path.

[0065] Compared with the prior art, the present invention has the following advantages and beneficial effects:

[0066] (1) The present invention adopts a context path-based method to capture high-order relationships hidden between nodes in heterogeneous graphs, avoiding the problem of requiring professionals to define meta-paths. It also introduces an attention mechanism to capture the importance of different relationships and the importance of context paths of different lengths, avoiding the problem of context paths and relationships of different lengths having the same weight, and can learn more effective node vectors.

[0067] (2) The present invention extracts features of multiple dimensions from users of online social networks, including the basic attributes of online social users themselves, and the tweets published by users as the initial feature vectors of the nodes of the constructed heterogeneous graph model, which can better express the node information and provide a better initial embedding for the model, making the data easier to operate, thereby improving the accuracy of downstream tasks;

[0068] (3) In order to improve the accuracy of online social network user segmentation, the present invention also defines some rules to remove nodes to improve the computational efficiency of the graph encoder and reduce the interference of some noise nodes. It also uses a vector concatenation method similar to linear combination to solve the over-smoothing problem in the GNN model. BRIEF DESCRIPTION OF THE DRAWINGS

[0069] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0070] Figure 1 It is a flowchart of a method for representing online social network users based on context paths according to an embodiment of the present invention;

[0071] Figure 2 It is a structural diagram of an online social network user representation system based on context path according to an embodiment of the present invention;

[0072] Figure 3 4 is a structural diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0073] In order to enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present application.

[0074] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described in this application may be combined with other embodiments.

[0075] See also Figure 1 , this embodiment proposes a method for representing online social network users based on context path, comprising the following steps:

[0076] S1. Using user and network data, extract features and obtain node vectors and heterogeneous graphs of online social networks;

[0077] Optionally, the user and network data include user attribute data, user tweet data and user's static follow network data;

[0078] Preferably, the user attribute data also includes the user's personal description, number of fans, number of followers, and number of posts;

[0079] Furthermore, the user's personal description includes account ID, gender, verification status, province, and occupation type;

[0080] For basic attribute information such as gender, verification status, province, occupation type, etc., the encoding method of categorical features can be used for processing. For example, label encoding, one-hot encoding, technical encoding, etc.; categorical features are similar to gender, and there are only two types. If the gender is male, it is marked as "1", and if the gender is female, it is marked as "0"; Based on this, the various types of user features are horizontally spliced ​​and fused to obtain the feature vector of each user's attribute features, denoted as i. For the number of fans, the number of followers, and the number of posts, some encoding methods can also be used for encoding, such as discrete encoding, standardized encoding, logarithmic encoding, etc., denoted as b, and then the feature vectors i and b are horizontally spliced, that is, z = [i, b], and the feature vector z based on the user's attributes can be obtained for each user;

[0081] Optionally, the node vector includes a feature vector based on user attributes and a tweet feature vector;

[0082] Optionally, the online social network heterogeneous graph has user nodes as main nodes and tweet nodes as auxiliary nodes;

[0083] Preferably, the method utilizes user and network data to extract user and network features and obtain node vectors and online social network heterogeneous graphs, specifically as follows:

[0084] The static network data of the user includes the user account ID and all the account IDs that the user follows; the user and network data also includes a data set of the relationship between the user and the tweets;

[0085] S11. Using user attribute data, extract and horizontally splice and fuse user attribute features to obtain a feature vector based on user attributes;

[0086] S12. Process the user tweet data using word frequency-inverse text frequency, extract features of each tweet, and obtain a tweet feature vector;

[0087] Term frequency-inverse text frequency, i.e., TF-IDF, is used to evaluate the importance of a word to a document in a document collection; further, the calculation of term frequency-inverse text frequency specifically includes the following steps:

[0088] The calculation formula of TF-IDF is:

[0089]

[0090] Then, calculate the IDF:

[0091]

[0092] Where N is the total number of documents tweeted by the user, df is the number of documents containing the word, and the denominator is added with 1 to avoid the denominator being 0 (that is, all documents do not contain the word);

[0093] Then calculate TF-IDF:

[0094] TF-IDF = term frequency (TF) × inverse document frequency (IDF)

[0095] TF-IDF is proportional to the number of times a word appears in a document and inversely proportional to the number of times the word appears in the entire user's tweets. Words with large TF-IDF values ​​have good category differentiation capabilities. Then, the words with the largest TF-IDF value in each tweet are selected as keywords of the tweet. Then, a feature matrix T of each user's tweet data is obtained. The feature vector of each user's tweet corresponds to each row vector of the feature matrix T.

[0096] S13. Using the user's static attention network data, by constructing a coding mapping dictionary, the user account ID is used as a user node in the online social network heterogeneous graph;

[0097] Furthermore, step S13 specifically includes merging and removing duplicate account IDs in the user social relationship data (the total number is n), sorting them, and then using a function in Python to map the original account IDs to indexes in the range of [0, n-1]. After the account IDs are re-indexed, they are used as nodes of the graph;

[0098] S14. Mapping the original tweet ID in the user tweet data to an index ranging from 0 as an auxiliary node of the heterogeneous graph of the online social network;

[0099] S15. According to the data set of the relationship between users and tweets, construct edges between user nodes and tweet nodes, and between tweet nodes and tweet nodes, and obtain a heterogeneous graph of online social networks;

[0100] S2. Build an online social network user representation model, calculate the context path probability according to the given context path length, iteratively use the walking strategy to walk between two main nodes in the online social network heterogeneous graph, capture the auxiliary nodes of the main node within the given context path length range, generate and embed the main graph and auxiliary graph, and then train the online social network user representation model;

[0101] Optionally, the context path probability is calculated according to a given context path length, specifically,

[0102] Given a context path length k, the objective function of the online social network user representation model is set to maximize the probability of co-occurrence of main types of nodes As follows:

[0103]

[0104] Where K represents the maximum length of a given context path. It's G P Medium i The set of k-length context neighbors, i.e. user nodes, ρ k Represents different context paths, G P represents the effective learning main graph, v i Represents nodes i, v in the main graph j represents the neighbor node j of node i;

[0105] Optionally, the embedding of the main graph and the auxiliary graph and then training of an online social network user representation model is specifically as follows:

[0106] A graph neural network is used to recursively embed the high-order relationship of each node into the context information vector c k In, to represent the relationship information of all context paths of length k;

[0107] After several information transfers, all context paths of length k are embedded into the context information vector c k In , the probability of the context path between two main nodes is approximated by the context information vector of each node, combined with the user attribute feature vector, and calculated using the softmax function:

[0108]

[0109]

[0110] where z i and z j It is to learn v i and v j Node embedding, and represents the context information vector, ⊙ represents the element vector product operation, σ represents the Sigmoid function, Represents node v i and node v j The weights of the context paths connected by length k, v i Represents node i, v j Represents the neighbor node j of node i;

[0111] By introducing the attention mechanism, the objective function is simplified to:

[0112]

[0113] where α k Expressed as the importance of context paths of different lengths, G P Represents the effective learning main graph, It's G P Medium i The set of k-length context neighbors, i.e. user nodes;

[0114] Through negative sampling technology, the objective function is converted into a loss function:

[0115]

[0116] in Yes i The set of negative context neighbors, logα k Indicates prevention of α k Too little punishment;

[0117] Optimize the parameters and obtain a trained online social network user representation model.

[0118] Furthermore, the method for optimizing parameters adopts the stochastic gradient descent SGD algorithm to optimize the parameters, and other optimizers may also be used for optimization;

[0119] Optionally, the walking strategy includes BFS, DFS, and random walking;

[0120] Optionally, the embeddings of the main image and the auxiliary image are learned by GCN through multiple iterations.

[0121] S3. Use the graph encoder to process the node vector, map the embedded main graph and auxiliary graph into a unified summary vector, then implement a node elimination mechanism for the summary vector, and calculate the attention score to train the online social network user representation model, and obtain the context path information through iteration; use the trained online social network user representation model to splice the context path information in proportion, obtain the representation vector of the user node and cluster the users.

[0122] Optionally, the processing of the node vector using the graph encoder further includes the following steps:

[0123] The context information vector of each node is obtained by weighted averaging the embedding vectors of neighbor nodes in the embedded main graph and auxiliary graph.

[0124]

[0125]

[0126] in Represents G S The summary vector of the graph at level l, Represents G T summaryvector of the graph at level l, and represents the context information vector of the l-1th layer, S and T represent the relationship r ST The source and target node types in G S It represents a graph composed of nodes of type S, G T Represents a graph composed of nodes of type T;

[0127] Preferably, the operation of the node vector by the graph encoder further includes averaging the embedding vectors of all nodes, aggregating node information by an autoencoder or using an attention mechanism, etc.;

[0128] Optionally, in order to improve the robustness of the model, the context path information is spliced ​​proportionally, specifically:

[0129] After independent calculations for each head at layer l-1, the importance of different relationships between nodes is obtained, and the importance of different relationships between nodes is obtained by aggregating the nodes v i The context neighbors of node v are concatenated together to obtain node v i Final Output

[0130]

[0131] Where N s (i) represents node v i In Figure G S For each relation r associated with a node type T in ST The adjacent neighbors in represents the context vector of node j at layer l-1, σ represents the sigmoid function, is the trainable parameter of the lth layer, H is the number of heads of multi-head attention, and || represents the concatenation operation;

[0132] Run the online social network user representation model several times, with context path information of length k

[0133] A gating vector is set at each layer, and the new aggregation vector is fused with the node expression of the upper layer in proportion, that is:

[0134]

[0135] Where β represents the gate vector, is the embedding of the auxiliary graph in layer l-1, represents the embedding of the main image in layer l-1;

[0136] Preferably, main image G P The final context information vector of each node on Can be obtained from Get from

[0137] Preferably, the gating vector β is a learnable parameter that can be learned using a separate GNN;

[0138] Preferably, the K-means method is used to cluster users.

[0139] It should be noted that, for the sake of convenience, the aforementioned method embodiments are all expressed as a series of action combinations, but those skilled in the art should know that the present invention is not limited to the described order of actions, because according to the present invention, certain steps can be performed in other orders or simultaneously.

[0140] Based on the same idea as the online social network user representation method based on context path in the above embodiment, the present invention also provides an online social network user representation system based on context path, which can be used to execute the above online social network user representation method based on context path. For ease of explanation, the structural diagram of the embodiment of the online social network user representation system based on context path only shows the parts related to the embodiment of the present invention. Those skilled in the art can understand that the illustrated structure does not constitute a limitation on the device, and may include more or fewer components than shown in the diagram, or combine certain components, or arrange the components differently.

[0141] See also Figure 2 In another embodiment of the present application, a context path-based online social network user representation method system 10 is provided, the system comprising a feature engineering module 11, a graph construction module 12 and a graph node representation learning module 13;

[0142] The feature engineering module 11 uses user and network data to extract features and obtain node vectors and online social network heterogeneous graphs; the user and network data include user attribute data, user tweet data and user static attention network data; the node vector includes a feature vector based on user attributes and a tweet feature vector; the online social network heterogeneous graph uses user nodes as main nodes and tweet nodes as auxiliary nodes;

[0143] The graph construction module 12 constructs an online social network user representation model, calculates the context path probability according to a given context path length, iteratively uses a walking strategy to walk between two main nodes in the online social network heterogeneous graph, captures auxiliary nodes of the main node within the given context path length range, generates and embeds the main graph and the auxiliary graph, and then trains the online social network user representation model;

[0144] The graph node representation learning module 13 uses a graph encoder to process node vectors, maps the embedded main graph and auxiliary graph into a summary vector of a unified form, then implements a node elimination mechanism for the summary vector, and calculates the attention score to train the online social network user representation model, and obtains context path information through iteration; using the trained online social network user representation model, the context path information is spliced ​​in proportion to obtain the representation vector of the user node and cluster the users.

[0145] It should be noted that the context path-based online social network user representation system of the present invention corresponds one-to-one to the context path-based online social network user representation method of the present invention. The technical features and beneficial effects described in the above-mentioned embodiment of the context path-based online social network user representation method are applicable to the embodiment of the context path-based online social network user representation method. For specific contents, please refer to the description in the embodiment of the method of the present invention, which will not be repeated here. This is hereby declared.

[0146] In addition, in the implementation of the context path-based online social network user representation system in the above embodiment, the logical division of each program module is only an example. In actual application, the above functions can be assigned to different program modules as needed, for example, for the convenience of corresponding hardware configuration requirements or software implementation. That is, the internal structure of the context path-based online social network user representation system is divided into different program modules to complete all or part of the functions described above.

[0147] See also Figure 3 In one embodiment, an electronic device for implementing a context path-based online social network user representation method is provided. The electronic device 20 may include a first processor 21, a first memory 22 and a bus, and may also include a computer program stored in the first memory 22 and executable on the first processor 21, such as a context path-based online social network user representation program 23.

[0148] The first memory 22 includes at least one type of readable storage medium, and the readable storage medium includes a flash memory, a mobile hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory, etc.), a magnetic memory, a disk, an optical disk, etc. In some embodiments, the first memory 22 may be an internal storage unit of the electronic device 20, such as a mobile hard disk of the electronic device 20. In other embodiments, the first memory 22 may also be an external storage device of the electronic device 20, such as a plug-in mobile hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device 20. Further, the first memory 22 may also include both an internal storage unit of the electronic device 20 and an external storage device. The first memory 22 may not only be used to store application software and various types of data installed in the electronic device 20, such as the code of the online social network user representation program 23 based on the context path, but also be used to temporarily store data that has been output or is to be output.

[0149] In some embodiments, the first processor 21 may be composed of an integrated circuit, for example, a single packaged integrated circuit, or a plurality of packaged integrated circuits with the same or different functions, including one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and combinations of various control chips. The first processor 21 is the control core (ControlUnit) of the electronic device, and uses various interfaces and lines to connect various components of the entire electronic device, and executes various functions and processes data of the electronic device 20 by running or executing programs or modules stored in the first memory 22, and calling data stored in the first memory 22.

[0150] Figure 3 Only an electronic device with components is shown, and those skilled in the art will understand that Figure 3 The structure shown does not constitute a limitation on the electronic device 20 , and may include fewer or more components than shown in the figure, or combine certain components, or arrange the components differently.

[0151] The context path-based online social network user representation program 23 stored in the first memory 22 of the electronic device 20 is a combination of multiple instructions, and when executed in the first processor 21, it can achieve:

[0152] Utilize user and network data to extract features and obtain node vectors and online social network heterogeneous graphs; the user and network data include user attribute data, user tweet data and user static attention network data; the node vector includes a feature vector based on user attributes and a feature vector based on tweets; the online social network heterogeneous graph uses user nodes as main nodes and tweet nodes as auxiliary nodes;

[0153] Construct an online social network user representation model, calculate the context path probability according to the given context path length, iteratively use the walking strategy to walk between two main nodes in the online social network heterogeneous graph, capture the auxiliary nodes of the main node within the given context path length range, generate and embed the main graph and auxiliary graph, and then train the online social network user representation model;

[0154] The node vectors are processed by using a graph encoder, and the embedded main graph and auxiliary graph are mapped into a unified summaryvector. Then, a node elimination mechanism is implemented on the summary vector, and the attention score is calculated to train the online social network user representation model. The context path information is obtained through iteration. The context path information is spliced ​​proportionally using the trained online social network user representation model to obtain the representation vector of the user node and cluster the users.

[0155] Furthermore, if the module / unit integrated in the electronic device 20 is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a non-volatile computer-readable storage medium. The computer-readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a mobile hard disk, a magnetic disk, an optical disk, a computer memory, and a read-only memory (ROM).

[0156] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the program can be stored in a non-volatile computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0157] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0158] The above embodiments are preferred implementation modes of the present invention, but the implementation modes of the present invention are not limited to the above embodiments. Any other changes, modifications, substitutions, combinations, and simplifications that do not deviate from the spirit and principles of the present invention should be equivalent replacement methods and are included in the protection scope of the present invention.

Claims

1. A context path-based online social network user representation method, characterized in that: The steps include: Utilize user and network data to extract features and obtain node vectors and online social network heterogeneous graphs; the user and network data include user attribute data, user tweet data and user static attention network data; the node vector includes a feature vector based on user attributes and a tweet feature vector; the online social network heterogeneous graph uses user nodes as main nodes and tweet nodes as auxiliary nodes; the method of extracting features and obtaining node vectors and online social network heterogeneous graphs using user and network data is specifically as follows: The static network data of the user includes the user account ID and all the account IDs that the user follows; the user and network data also includes a data set of the relationship between the user and the tweets; Utilize user attribute data to extract and horizontally splice and fuse user attribute features to obtain a feature vector based on user attributes; Use word frequency-inverse document frequency to process user tweet data, extract the features of each tweet, and obtain the tweet feature vector; Based on the user's static attention network data, the user account ID is used as the user node of the heterogeneous graph of the online social network; Map the original tweet IDs in the user tweet data to indexes starting from 0 as auxiliary nodes of the heterogeneous graph of online social networks; Constructing online social network heterogeneous graph based on the edges between user nodes and auxiliary nodes and between auxiliary nodes; Construct an online social network user representation model, calculate the context path probability according to the given context path length, iteratively use the walking strategy to walk between two main nodes in the online social network heterogeneous graph, capture the auxiliary nodes of the main node within the given context path length range, generate the main graph and the auxiliary graph, and embed the main graph and the auxiliary graph into the online social network user representation model, and then train the online social network user representation model; The graph encoder is used to process nodes, and the embedded main graph and auxiliary graph are mapped into a unified summary vector. Then, a node elimination mechanism is implemented on the summary vector, and the attention score is calculated to train the online social network user representation model, and the context path information is obtained through iteration. The context path information is spliced ​​proportionally using the trained online social network user representation model to obtain the representation vector of the user node and cluster the users. The node elimination mechanism is implemented on the summary vector, and the attention score is calculated to train the online social network user representation model, specifically: For user nodes that have never tweeted or have no personal information, the formula is as follows: G′=NodeDropout(G) h=Mean(C) Where C represents the set of context information vectors of all nodes in the graph G′, G represents the original input graph, and h represents the summary vector; After obtaining the summary vector of each graph, in the lth layer, each relationship r is calculated sT The h-head attention score Right now Where S and T represent the relationship r ST The source and target node types in and Respectively represent G S and G T The summary vector of the graph at level l, and is the context information vector of the l-1th layer, Express After linear transformation The resulting query vector, Express After linear transformation The resulting query vector key vector, and Represents the linear projection function, mapping the summary vector to the key vector and query vector in the multi-head attention; Represents the relationship ST The attention weights at the head of layer l; G S Represented as a graph composed of node type S, G T Represents the graph composed of node type T.

2. The method for representing online social network users based on context path according to claim 1, characterized in that: The context path probability is calculated according to the given context path length, specifically, Given a context path length k, the objective function of the online social network user representation model is set to maximize the probability of co-occurrence of the main nodes K represents the maximum length of a given context path. It's G P Middle node v i The k-length context neighbors, i.e., the neighbor set of the user node, ρ k Represents different context paths, G P represents the effective learning main graph, v i Represents nodes i, v in the main graph j Represents the neighbor node j of node i.

3. The method for representing online social network users based on context path according to claim 1, characterized in that: The method of processing the node vector using the graph encoder further includes the following steps: The context information vector of each node is obtained by weighted averaging the embedding vectors of neighbor nodes in the embedded main graph and auxiliary graph. The formula is as follows: in Represents G S The summary vector of the graph at level l, Represents G T The summary vector of the graph at level l, and represents the context information vector of the l-1th layer, S and T represent the relationship r ST The source node type and target node type in G S Represented as a graph composed of node type S, G T Represents the graph composed of node type T.

4. The method for representing online social network users based on context path according to claim 1, characterized in that: The main graph and the auxiliary graph are embedded into the online social network user representation model, and then the online social network user representation model is trained, specifically, A graph neural network is used to recursively embed the high-order relationship of each node into the context information vector c k In, to represent the relationship information of all context paths of length k; After several information transfers, all context paths of length k are embedded into the context information vector c k In , the probability of the context path between two main nodes is approximated by the context information vector of each node, combined with the user attribute feature vector, and calculated using the softmax function: where z i and z j It is to learn v i and v j Node embedding, and represents the context information vector, ⊙ represents the element vector product operation, σ represents the sigmoid function, Represents node v i and node v j The weights of the context paths connected by length k, v i Represents node i, v j Represents the neighbor node j of node i; By introducing the attention mechanism, the objective function is simplified to the following formula: where α k Expressed as the importance of context paths of different lengths, G P Indicates effective learning main graph, It's G P Medium i A set of context neighbors of length k, where context neighbors are user nodes; Through negative sampling technology, the objective function is converted into a loss function. The formula is as follows: in Yes i The set of negative context neighbors, logα k Indicates prevention of α k Too small penalty; K represents the maximum length of a given context path Optimize the parameters and obtain a trained online social network user representation model.

5. The method for representing online social network users based on context path according to claim 1, characterized in that: The context path information is spliced ​​in proportion, specifically: After independent calculations for each head at layer l-1, the importance of different relationships between nodes is obtained, and the importance of different relationships between nodes is obtained by aggregating the nodes v i The context neighbors of node v are concatenated together to obtain node v i Final Output Where N s (i) represents node v i In Figure G S For each relation r associated with a node type T in ST The adjacent neighbor nodes in represents the context vector of neighbor node j at layer l-1, σ represents the sigmoid function, is the trainable parameter of the lth layer, H is the number of heads of multi-head attention, and || represents the concatenation operation; Run the online social network user representation model several times to obtain context path information of length k A gating vector is set at each layer, and the new aggregation vector is fused with the node expression of the upper layer in proportion, that is: Where β represents the gate vector, is the embedding of the auxiliary graph in layer l-1, Represents the embedding of the main image in layer l-1.

6. An online social network user representation system based on context path, characterized in that: The context path-based online social network user representation method applied to any one of claims 1-5, comprising a feature engineering module, a graph construction module and a graph node representation learning module; The feature engineering module uses user and network data to extract features and obtain node vectors and online social network heterogeneous graphs; the user and network data include user attribute data, user tweet data and user static attention network data; the node vector includes a feature vector based on user attributes and a tweet feature vector; the online social network heterogeneous graph uses user nodes as main nodes and tweet nodes as auxiliary nodes; The graph construction module constructs an online social network user representation model, calculates the context path probability according to a given context path length, iteratively walks between two main nodes in the online social network heterogeneous graph using a walking strategy, captures auxiliary nodes of the main node within the given context path length range, generates and embeds the main graph and the auxiliary graph, and then trains the online social network user representation model; The graph node representation learning module uses a graph encoder to process node vectors, maps the embedded main graph and auxiliary graph into a summary vector of a unified form, then implements a node elimination mechanism for the summary vector, and calculates the attention score to train an online social network user representation model, and obtains context path information through iteration; using the trained online social network user representation model, the context path information is spliced ​​in proportion to obtain the representation vector of the user node and cluster the users.

7. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores computer program instructions that can be executed by the at least one processor, and the computer program instructions are executed by the at least one processor to enable the at least one processor to execute the online social network user representation method based on context path as described in any one of claims 1-5.

8. A computer-readable storage medium storing a program, characterized in that: When the program is executed by a processor, the online social network user representation method based on context path described in any one of claims 1 to 5 is implemented.

Citation Information

Patent Citations

  • Social platform user attribute prediction method and system, mobile device and storage medium

    CN115952438A

  • Method for detecting social robot in heterogeneous graph based on graph neural network

    CN116578970A