Heterogeneous graph node representation learning method and device, equipment and storage medium
Through the heterogeneous graph node representation learning method of convolutional subgraph encoder and convolution-guided attention mechanism components, the problems of high computation cost and poor versatility of high-order relations in heterogeneous graphs are solved, and efficient high-order relation semantic capture and node representation learning are achieved.
Patent Information
- Application Number
- CN202510598522.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-09
- Publication Date
- 2025-09-05
AI Technical Summary
Existing technologies have high computational costs, long time consumption, and poor versatility when processing high-order relations in heterogeneous graphs, making it difficult to effectively capture the semantics of high-order relations.
A heterogeneous graph node representation learning method using convolutional subgraph encoder and convolutional guided attention mechanism components is proposed to generate high-quality node vector representations by determining subgraph representations and performing graph propagation based on attention weights.
It significantly improves the expressiveness and generalization performance of heterogeneous graph node representation learning networks, can effectively perceive high-order relational semantics, and reduce computational costs and time consumption.
Smart Images

Figure CN120597928A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method, apparatus, device and storage medium for learning heterogeneous graph node representation. Background Art
[0002] Network data mining and analysis has become a significant research area today. In network data, the interactions between different entities can generally be effectively described and abstracted using graphs. In complex systems, graphs often have multiple types of nodes and edges, representing different categories of entities and relationships. These graphs are classified as heterogeneous graphs (as opposed to homogeneous graphs, which have only a single type of nodes and edges) and are widely found in real life. For example, academic networks contain node types such as "paper," "author," "conference," and "research field."
[0003] Graph representation learning is a method for representing or encoding graph structures, primarily including algorithms based on matrix decomposition, random walks, and graph neural networks. Graph neural networks have seen numerous innovations and applications in both theory and industry for homogeneous graphs, and significant breakthroughs have been made in training large-scale homogeneous graphs. However, training large-scale heterogeneous graphs remains challenging.
[0004] Compared to traditional homogeneous graphs, heterogeneous graphs pose greater challenges to node representation learning techniques. First, heterogeneous graphs contain a variety of node types, such as users, products, and articles. Different types of nodes have different feature spaces, making it difficult to accurately model all nodes using a unified feature space. Second, heterogeneous graphs have diverse edge types, representing different semantics. This places higher demands on the ability of graph neural networks to perceive and aggregate multidimensional information. Third, high-order relationships are prevalent in heterogeneous graphs, such as the "author-paper-author" relationship representing co-authorship in academic networks and the "user-product-user" relationship representing co-purchase in user-product networks. These high-order relationships reflect the salient relational semantics between non-adjacent node pairs and are particularly important for learning high-quality representations. However, high-order relationships suffer from various characteristics, such as length-unstructured crossover or overlap. This makes it difficult for the neighborhood aggregation paradigm based on graph neural networks to effectively capture this high-order relational semantic information, limiting the quality of node representation.
[0005] Existing techniques typically use type-independent parameters to address the challenges posed by node and edge types. For different node types, independent encoders are used to transform features. For different edge types, some techniques implicitly represent them using a combination of node types, while others isolate and propagate different types separately. These approaches have proven effective. However, existing approaches to addressing the challenges of high-order relations exhibit divergence and significant limitations.
[0006] Meta-path-based heterogeneous graph neural networks address the aforementioned high-order relational challenges by leveraging meta-paths. By exploiting the one-to-one correspondence between meta-paths and high-order relations, these methods generate a series of subgraphs with fixed node and edge types and a single high-order relation. Graph neural networks are then used to independently learn node representations for each subgraph, before fusing the different meta-paths. While these methods explicitly capture high-order relational semantics, they also introduce additional data constraints and model complexity. The choice of meta-path significantly impacts method performance; inappropriate selection can lead to information loss or noise, ultimately degrading model performance. In real-world applications, selecting appropriate meta-paths requires a deep understanding of the target scenario. Given that the total number of potential meta-paths scales exponentially with the number of edge types and increases exponentially with path length, selecting a valid list of meta-paths is challenging and computationally expensive to verify. Furthermore, the validity of meta-paths can change due to dynamic changes in features and topology. These limitations limit the generalizability of these methods. Furthermore, increasing the number and length of meta-paths significantly increases computational overhead, limiting model efficiency. Test results on some datasets show that meta-path-based methods take at least twice as long as meta-path-independent methods. This is because the computational time of meta-path-independent models is only related to the original graph structure, while meta-path-based models incur additional overhead due to the increased number of meta-paths in scenarios with more complex relationships. Summary of the Invention
[0007] The present invention provides a heterogeneous graph node representation learning method, apparatus, equipment and storage medium to address the defects of the prior art in capturing high-order relational semantics, such as long time consumption, high computational cost and poor versatility. By determining subgraph representations and performing graph propagation calculations based on attention weights, the heterogeneous graph node representation learning network can effectively perceive high-order relational semantics, thereby significantly improving the expressive power and generalization performance of the heterogeneous graph node representation learning network.
[0008] In a first aspect, the present invention provides a method for learning node representation in a heterogeneous graph, comprising the following steps: Obtaining a heterogeneous graph and a node feature matrix; the heterogeneous graph is represented as a network structure containing multiple types of nodes and edges, and the node feature matrix is represented as a feature matrix describing the semantic relationship between the multiple types of nodes; The heterogeneous graph and the node feature matrix are input into the heterogeneous graph node representation learning network for learning to determine the node vector representation of each type of node; the node vector representation representation effectively captures the node features and effectively captures the structure and relational semantics of the nodes in the heterogeneous graph; the heterogeneous graph node representation learning network is obtained by training based on heterogeneous graph samples and node feature samples; the heterogeneous graph node representation learning network at least includes: a convolutional subgraph encoder component and a convolutional guided attention mechanism component; the convolutional subgraph encoder component representation is used to determine multi-hop tokens based on the heterogeneous graph and the node feature matrix; the multi-hop token representation is a subgraph representation corresponding to different hop numbers; the convolutional guided attention mechanism component representation is used to calculate the attention weight based on the subgraph representation and the heterogeneous graph, so as to perform graph propagation calculation based on the attention weight to obtain the node vector representation.
[0009] Preferably, according to a heterogeneous graph node representation learning method provided by the present invention, the convolutional subgraph encoder component representation is used to determine multi-hop tokens based on the heterogeneous graph and the node feature matrix, including: Inputting the heterogeneous graph into the convolutional subgraph encoder component for graph sampling processing to generate multiple subgraphs; each subgraph corresponds to a certain number of hops; Input the node feature matrix into the convolutional subgraph encoder component for feature mapping processing to obtain corresponding node tokens; the node tokens are represented as feature representations corresponding to each type of node; The plurality of subgraphs and the node tokens are subjected to encoding aggregation processing to generate the multi-hop tokens.
[0010] Preferably, according to a heterogeneous graph node representation learning method provided by the present invention, the convolution-guided attention mechanism component comprises at least: a semantic fuser, an attention calculation component, and a decoder; The convolution-guided attention mechanism component representation is used to calculate attention weights based on the subgraph representation and the heterogeneous graph, so as to perform graph propagation calculation according to the attention weights to obtain the node vector representation, including: Performing vector fusion processing on the multi-hop tokens based on the semantic fuser to generate a subgraph-enhanced node representation; Calculating attention weights between different nodes based on the node representation enhanced by the subgraph and the heterogeneous graph based on the attention calculation component, and performing weighted aggregation of neighbor messages based on the attention weights to generate high-quality personalized node representations; Node representation learning is performed on high-quality personalized node representations based on the decoder to generate the node vector representation of each type of node, and the node vector representation is used for downstream tasks.
[0011] Preferably, according to a heterogeneous graph node representation learning method provided by the present invention, the subgraph enhanced node representation contains the personalized characteristics of the node and the global information of the node neighborhood, so that the convolution-guided attention mechanism component considers the semantic relevance of the arbitrary two nodes and the target node when judging the importance of the edge between any two nodes, and considers the importance of the arbitrary two nodes in the high-order relationship propagation process based on the neighborhood representation.
[0012] Preferably, according to a heterogeneous graph node representation learning method provided by the present invention, the method further includes a heterogeneous graph node representation learning network based on high-order relationship perception; the learning steps of the heterogeneous graph node representation learning network based on high-order relationship perception at least include: Before performing encoding aggregation processing on the plurality of subgraphs and the node tokens to generate the multi-hop tokens, different types of node feature matrices are mapped to the same data space to generate a mapped node embedding matrix; Subgraph encoding processing is performed based on the mapped node embedding matrix and the heterogeneous graph to generate multi-hop tokens, so as to determine the node vector representation of each type of node according to the multi-hop tokens.
[0013] Preferably, according to a heterogeneous graph node representation learning method provided by the present invention, the method further includes a heterogeneous graph node representation learning network for large-scale data; the learning steps of the heterogeneous graph node representation learning network for large-scale data at least include: The step of using the convolutional subgraph encoder component to perform subgraph encoding to determine multi-hop tokens is decoupled from the node feature matrix mapping, and the step of using the convolutional guided attention mechanism component to perform graph propagation to obtain the node vector representation is decoupled from the node feature matrix mapping; in the mapping decoupling process, a message aggregation process that does not contain trainable parameters is used, and only the node features of the message aggregation results are mapped.
[0014] In a second aspect, the present invention further provides a heterogeneous graph node representation learning device, comprising the following modules: An acquisition module is used to acquire a heterogeneous graph and a node feature matrix; the heterogeneous graph is represented as a network structure containing multiple types of nodes and edges, and the node feature matrix is represented as a feature matrix describing the semantic relationship between multiple types of nodes; A learning module is used to input the heterogeneous graph and the node feature matrix into a heterogeneous graph node representation learning network for learning, and determine the node vector representation of each type of node; the node vector representation representation effectively captures the node features and effectively captures the structure and relational semantics of the node in the heterogeneous graph; the heterogeneous graph node representation learning network is obtained by training based on heterogeneous graph samples and node feature samples; the heterogeneous graph node representation learning network at least includes: a convolutional subgraph encoder component and a convolutional guided attention mechanism component; the convolutional subgraph encoder component representation is used to determine multi-hop tokens based on the heterogeneous graph and the node feature matrix; the multi-hop token representation is a subgraph representation corresponding to different hop numbers; the convolutional guided attention mechanism component representation is used to calculate the attention weight based on the subgraph representation and the heterogeneous graph, so as to perform graph propagation calculation based on the attention weight to obtain the node vector representation.
[0015] In a third aspect, the present invention also provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the heterogeneous graph node representation learning method as described above is implemented.
[0016] In a fourth aspect, the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements any of the heterogeneous graph node representation learning methods described above.
[0017] In a fifth aspect, the present invention further provides a computer program product, comprising a computer program, which, when executed by a processor, implements any of the above-described heterogeneous graph node representation learning methods.
[0018] The present invention provides a heterogeneous graph node representation learning method, device, equipment and storage medium, which obtains a heterogeneous graph and a node feature matrix; the heterogeneous graph is represented as a network structure containing multiple types of nodes and edges, and the node feature matrix is represented as a feature matrix that describes the semantic relationship between multiple types of nodes; the heterogeneous graph and the node feature matrix are input into a heterogeneous graph node representation learning network for learning to determine the node vector representation of each type of node; the node vector representation effectively captures the node features and effectively captures the structure and relationship semantics of the node in the heterogeneous graph; the heterogeneous graph node representation learning network is obtained by training based on heterogeneous graph samples and node feature samples; the heterogeneous graph node representation learning network at least includes: a convolutional subgraph encoder component and a convolutional guided attention mechanism component; the convolutional subgraph encoder component is represented for determining multi-hop tokens based on the heterogeneous graph and the node feature matrix; the multi-hop tokens are represented as subgraph representations corresponding to different hop numbers; the convolutional guided attention mechanism component is represented for calculating attention weights based on the subgraph representation and the heterogeneous graph, so as to perform graph propagation calculations based on the attention weights to obtain the node vector representation. It is used to solve the defects of existing technologies in capturing high-order relational semantics, such as long time consumption, high computational cost and poor versatility. By determining subgraph representation and performing graph propagation calculations based on attention weights, the heterogeneous graph node representation learning network can effectively perceive high-order relational semantics, thereby significantly improving the expressive power and generalization performance of the heterogeneous graph node representation learning network. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the technical solutions in the present invention or the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0020] Figure 1 This is one of the flow charts of the heterogeneous graph node representation learning method provided by the present invention.
[0021] Figure 2 This is the second schematic diagram of the heterogeneous graph node representation learning method provided by the present invention.
[0022] Figure 3 It is a structural diagram of the heterogeneous graph node representation learning device provided by the present invention.
[0023] Figure 4 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0024] To make the objectives, technical solutions, and advantages of the present invention more clear, the technical solutions of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the embodiments described are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making any creative efforts shall fall within the scope of protection of the present invention.
[0025] The following combination Figures 1-4 The present invention describes a heterogeneous graph node representation learning method, apparatus, device and storage medium, which are used to solve the defects of the prior art in capturing high-order relational semantics, such as long time consumption, high computational cost and poor versatility. By determining subgraph representations and performing graph propagation calculations based on attention weights, the heterogeneous graph node representation learning network can effectively perceive high-order relational semantics, thereby significantly improving the expressive power and generalization performance of the heterogeneous graph node representation learning network.
[0026] Figure 1 This is one of the flow charts of a heterogeneous graph node representation learning method provided by the present invention, such as Figure 1 As shown, the method may include but is not limited to steps S100 to S200: S100, obtaining a heterogeneous graph and a node feature matrix; the heterogeneous graph is represented as a network structure including multiple types of nodes and edges, and the node feature matrix is represented as a feature matrix describing the semantic relationship between multiple types of nodes; S200, input the heterogeneous graph and the node feature matrix into the heterogeneous graph node representation learning network for learning, and determine the node vector representation of each type of node; the node vector representation representation effectively captures the node features and effectively captures the structure and relationship semantics of the node in the heterogeneous graph; the heterogeneous graph node representation learning network is obtained by training based on heterogeneous graph samples and node feature samples; the heterogeneous graph node representation learning network at least includes: a convolutional subgraph encoder component and a convolutional guided attention mechanism component; the convolutional subgraph encoder component representation is used to determine multi-hop tokens based on the heterogeneous graph and the node feature matrix; the multi-hop token representation is a subgraph representation corresponding to different hop numbers; the convolutional guided attention mechanism component representation is used to calculate the attention weight based on the subgraph representation and the heterogeneous graph, so as to perform graph propagation calculation based on the attention weight to obtain the node vector representation.
[0027] In step S100 of some embodiments, a heterogeneous graph and a node feature matrix are obtained; the heterogeneous graph is represented as a network structure containing multiple types of nodes and edges, and the node feature matrix is represented as a feature matrix that describes the semantic relationship between multiple types of nodes.
[0028] This paper provides a heterogeneous graph node representation learning method. By using a heterogeneous graph node representation learning network, the method combines a heterogeneous graph (containing multiple types of nodes and edges) with a node feature matrix to generate a node vector representation for each node type. This node vector representation simultaneously captures: node characteristics (such as attribute information), graph structure information (such as neighbor relationships and path dependencies), and type semantic relationships (constraints on different node / edge types).
[0029] The heterogeneous graph learning method provided by this invention can be applied to commodity trading scenarios. A heterogeneous graph is represented as a network structure containing multiple types of nodes and edges. The nodes of this heterogeneous graph can be defined as various node types based on transaction types, such as user, commodity, and category, and are identified with discrete labels. The relationship between a user's purchase of a commodity and the category to which the commodity belongs is defined as an edge type in the heterogeneous graph, and the edge must carry type information.
[0030] The node feature matrix can include feature representation: each node corresponds to a feature vector, which can be multimodal (such as text, image features).
[0031] Type separation: Features of different types of nodes are stored independently but share the same semantic space.
[0032] For example, a node feature matrix composed of user features, product features, and category features.
[0033] In step S200 of some embodiments, the heterogeneous graph and the node feature matrix are input into a heterogeneous graph node representation learning network for learning to determine a node vector representation of each type of node; the node vector representation representation effectively captures node features and effectively captures the structure and relational semantics of nodes in the heterogeneous graph; the heterogeneous graph node representation learning network is obtained by training based on heterogeneous graph samples and node feature samples; the heterogeneous graph node representation learning network includes at least: a convolutional subgraph encoder component and a convolutional guided attention mechanism component; the convolutional subgraph encoder component representation is used to determine multi-hop tokens based on the heterogeneous graph and the node feature matrix; the multi-hop token representation is a subgraph representation corresponding to different hop numbers; the convolutional guided attention mechanism component representation is used to calculate attention weights based on the subgraph representation and the heterogeneous graph, so as to perform graph propagation calculations based on the attention weights to obtain the node vector representation.
[0034] It can be understood that the heterogeneous graph node representation learning network can adopt heterogeneous GNN (such as RGCN, LightGCN, GCN) and support type-aware message passing.
[0035] The heterogeneous graph node representation learning network includes at least: type-constrained convolution: selectively aggregating neighbor information based on edge type; feature fusion: combining node features with aggregated structural information; and nonlinear transformation: capturing high-level semantics through multi-layer GNN.
[0036] The loss function when training heterogeneous graph node representation learning networks is designed to dynamically select the loss function based on the availability of supervision signals, balancing structure preservation and task discrimination.
[0037] The role of contrastive loss (unsupervised scenario) is to pull the positive sample (same type / related nodes) vector and push away the negative sample.
[0038] In some embodiments, the step of performing the contrastive loss (unsupervised scenario) may include the following steps: 1. Positive sample construction: pairs of nodes of the same type (such as users and users, products and products); related node pairs (such as users and purchased products, products and their categories).
[0039] 2. Negative sample construction: Randomly sample different types of node pairs (such as users and categories); node pairs that are not directly related (such as users and unpurchased products).
[0040] 3. Use the loss function calculation formula to calculate the contrast loss.
[0041] 4. The optimization goal is to minimize the difference between the similarity of positive samples and the similarity of negative samples.
[0042] For example, in an e-commerce graph, user nodes should be close to the product representations they purchased, and far away from the product representations that other users did not purchase.
[0043] The role of the supervisory signal (supervised scenario) is to use node labels (such as categories in classification tasks) to directly optimize the discriminability of the representation. The optimization goal is to minimize the difference between the predicted probability and the true label.
[0044] Example: In the user credit scoring task, the representation of labeled users (such as "high risk" and "low risk") is directly used for classification, optimizing the cross-entropy loss.
[0045] After determining the node vector representation for each type of node, the node vector representation can be applied to downstream tasks to directly use the node vector representation.
[0046] Downstream tasks may at least include classification tasks, link prediction tasks, and recommendation tasks.
[0047] In some embodiments, for example, to predict which categories a user belongs to, which products belong to, and which categories a category belongs to, a heterogeneous graph consisting of users, products, and categories and a node feature matrix are input into a heterogeneous graph node representation learning network for learning. This determines the node vector representation of each type of node, i.e., the vector representation of user nodes, the vector representation of product nodes, and the vector representation of category nodes.
[0048] In some embodiments, the category of the target user node can be accurately determined from the categories of multiple user nodes based on the vector representation of the user node. For example, there may be 10 categories of user nodes, such as the elderly, children, adult men, adult women, etc. Through the above steps, it is possible to accurately and quickly determine which category the target user belongs to based on the representation vector of the user node of the target user.
[0049] Similarly, we can also accurately and quickly predict the target product category and category based on the vector representation of the product node and the vector representation of the category node. This allows us to quickly recommend products and product categories to users when performing recommendation tasks.
[0050] The following are some professional terms and formulas used in the embodiments of the present invention: Heterogeneous Graph is used to represent a complex network structure containing multiple types of nodes and edges. Its formal definition is ,in, is a node set, is the edge set, is a set of node types, is a set of edge types. When , the graph is called a heterogeneous graph. Otherwise, the graph degenerates into a homogeneous graph.
[0051] Specifically, each node There are corresponding types , each edge Expressed as ,in, , with edge type .
[0052] Message propagation is the basic paradigm for node representation learning in heterogeneous graph node representation learning networks. The core idea of this paradigm is to learn node representations through message passing and aggregation between nodes. Given an input heterogeneous graph and node feature matrix , where the node The feature is represented as a vector of length d .
[0053] Heterogeneous graph node representation learning network l Nodes in the layer i The representation update process can be defined as: in, Indicates that node i is in l The updated representation of the layer, f is the element-by-element feature transformation function, Indicates that node i is in l Aggregation results of the layers, Representation node i The neighbor set of (including itself), For the l The trainable parameter matrix of the layer, Represents the weight of the edge in message propagation, satisfying .
[0054] According to the message propagation weight The calculation method of heterogeneous graph nodes indicates that the learning network can be divided into different types. As shown in the figure, convolutional networks (GCNs) assign the same weight to all edges of the same node, that is, average aggregation of all neighboring node information: Different from graph convolutional networks, graph attention networks (GATs) calculate semantically aware personalized weights through the attention mechanism: Weight Obtained by normalizing the attention score calculation: Among them, the attention function is the similarity scoring function between nodes, which is On the basis of the expression and The attention score is calculated and then converted into the message propagation coefficient by normalization to ensure .
[0055] In some embodiments of the present invention, the present invention provides a heterogeneous graph node representation learning method to achieve , the goal is to learn a mapping function , each node Represented as a low-dimensional embedding vector , i.e., node vector representation. The learned node vector representation can effectively capture node features, their structure and relational semantics in heterogeneous graphs, and thus support downstream tasks such as node classification and link prediction with high quality.
[0056] In some embodiments of the present invention, the heterogeneous graph node representation learning network includes at least: a convolutional subgraph encoder component, a convolutional guided attention mechanism component; The step of inputting the heterogeneous graph and the node feature matrix into a heterogeneous graph node representation learning network for learning to determine a node vector representation of each type of node includes: Inputting the heterogeneous graph and the node feature matrix into the convolutional subgraph encoder component for encoding processing to generate multi-hop tokens; the multi-hop tokens are represented as subgraph representations corresponding to different hop numbers; The heterogeneous graph and the multi-hop token are input into the convolution-guided attention mechanism component for attention calculation processing to determine the node vector representation of each type of node.
[0057] It is understandable that if Figure 2 As shown, in the convolutional subgraph encoder component, the heterogeneous graph represented by the graph structure and the node feature matrix are encoded to generate multi-hop tokens, i.e., multi-hop subgraph tokens. The heterogeneous graph and multi-hop subgraph tokens are then input into the convolutional guided attention mechanism component for attention calculation processing to determine the node vector representation of each type of node.
[0058] Furthermore, through multi-layer convolution operations, the subgraph structure information of the node is extracted hop by hop, and subgraph representations of different hop numbers (multi-hop tokens) are generated to provide structured features for the subsequent attention mechanism.
[0059] The role of the convolution-guided attention mechanism component is to dynamically calculate the weights of different hop information based on multi-hop tokens and heterogeneous graph structures, aggregate multi-scale subgraph features, and generate the final node vector representation.
[0060] That is, the heterogeneous graph, multi-hop token and node feature matrix are input into the convolution-guided attention mechanism component, the multi-hop token and node feature matrix are combined to form extended features, and then the attention weights are calculated based on the extended features and the heterogeneous graph, and weighted aggregation is performed to generate a node vector representation of each type of node.
[0061] For example, in the convolutional subgraph encoder, different transfer matrices or "feature mapping parameter matrices" are used according to the types of nodes and edges (such as users, products, and purchase relationships) to preserve type semantics.
[0062] Example: The convolution weights of the user-item edge and the transfer matrix of the item-category edge are independent of each other or the "feature mapping parameter matrix".
[0063] Multi-hop tokens hierarchical information: low hop counts (e.g., 1-hop) capture local structure (immediate neighbors), while high hop counts (e.g., 3-hop) capture global context.
[0064] The attention mechanism dynamically weighs the importance of different hops to avoid interference from long-distance noise.
[0065] Pre-extract multi-hop subgraph features through convolution to reduce the computational complexity of attention. β type Adapt attention weights to the semantic requirements of different node types (e.g., users focus more on recent interactions, while products rely more on category information).
[0066] In some embodiments of the present invention, the convolutional subgraph encoder component characterizes determining multi-hop tokens based on a heterogeneous graph and a node feature matrix, including: Inputting the heterogeneous graph into the convolutional subgraph encoder component for graph sampling processing to generate multiple subgraphs; each subgraph corresponds to a certain number of hops; Input the node feature matrix into the convolutional subgraph encoder component for feature mapping processing to obtain corresponding node tokens; the node tokens are represented as feature representations corresponding to each type of node; The plurality of subgraphs and the node tokens are subjected to encoding aggregation processing to generate the multi-hop tokens.
[0067] It can be understood that, first, according to the preset maximum hop number K (such as K=3), the neighbor range of each node is expanded layer by layer. For example: 1-hop subgraph: direct neighbor nodes (directly connected by edges). 2-hop subgraph: neighbors of neighbors (indirectly connected). K-hop subgraph: K-level neighbor relationships.
[0068] Second, type-constrained sampling: only neighbors that match the edge type (such as the "purchase" relationship between user-item edges) are retained to avoid invalid cross-type connections. Finally, subgraph generation: for each node, K subgraphs of different hop counts are generated. Each subgraph contains the node and its k-hop neighbors.
[0069] The above steps at least capture multi-scale structural information: a low hop count (such as 1-hop) reflects local direct connections, and a high hop count (such as 3-hop) captures global context.
[0070] Preserve type semantics: Filter by edge type to ensure that the subgraph only contains semantically related nodes (for example, users are only associated with products / categories).
[0071] Furthermore, the steps of generating a node token include at least but are not limited to the following steps: 1. Node feature input: Group the node feature matrix X (such as user attributes and product descriptions) by node type.
[0072] 2. Type-aware mapping: Apply a feature mapping function (such as MLP or embedding layer) to each node type (such as user, product) 3. Output node token: Each node v gets a feature representation, namely the node token.
[0073] The purpose of the above steps is to extract node features: converting raw features (such as text or numerical values) into low-dimensional vectors, preserving node attribute information. Differentiated type representation: This mapping ensures that the feature spaces of nodes of different categories are independent, avoiding semantic confusion (e.g., different feature distributions for users and products).
[0074] Furthermore, the steps of encoding aggregation processing and generating a multi-hop token may include but are not limited to: 1. Subgraph feature extraction step: For each k-hop subgraph, the structural information is aggregated through graph convolution (such as RGCN) to obtain the latent representation of the k-hop subgraph.
[0075] 2. Multi-hop token splicing step: Splice the subgraph representations of all hops and the node tokens according to the hop dimension to form the spliced k-hop subgraph information.
[0076] 3. Cross-hop fusion step: Through attention or pooling operations, the information of different hops is weightedly fused to obtain multi-hop tokens based on the weight of each node v for the k-th hop and the information of the spliced k-hop subgraph.
[0077] The functions of the above steps include at least: Fusion of structure and features: combining the node's own features (low-level semantics) with the multi-hop subgraph structure (high-level semantics) to generate a global representation.
[0078] Dynamic weight allocation: Through the attention mechanism, the contributions of different hops are adaptively adjusted (for example, important nodes rely more on their neighbors, and category nodes require global information).
[0079] The decoupling of type constraints and hop counts in the embodiment of the present invention has the following technical effects: subgraph sampling and feature mapping are both based on node / edge types, avoiding cross-type noise interference.
[0080] Multi-hop tokens preserve the hop dimension, supporting subsequent modules (such as attention) to distinguish structural information at different scales.
[0081] The maximum hop count K in this embodiment of the present invention is adjustable, balancing computational complexity and capturing long-distance dependencies. Classified feature mapping adapts to heterogeneous scenarios (e.g., the varying feature distributions of users, products, and categories in e-commerce graphs).
[0082] The multi-hop tokens generated by the embodiments of the present invention can be directly used for tasks such as classification and link prediction, or as input to the attention mechanism to further improve the representation capability.
[0083] In the embodiment of the present invention, taking a user node as an example: First, graph sampling is performed to generate 1-hop (directly purchased products) and 2-hop (product category) subgraphs of the user node.
[0084] Then perform feature mapping processing to map user attributes (such as age and gender) into node vectors.
[0085] Finally, the encoding aggregation process is performed: 1- Hop-subgraph aggregation of product embeddings, 2- Hop-subgraph aggregation of category embeddings. [NodeToken; S1; S2] is concatenated and weighted based on attention (e.g., if users pay more attention to product features, categories have a lower weight).
[0086] Then output a multi-hop token: a comprehensive representation that integrates the user's own attributes, directly purchased products, and indirectly related categories.
[0087] In some embodiments of the present invention, the convolution-guided attention mechanism component includes at least: a semantic fuser, an attention calculation component, and a decoder; The convolution-guided attention mechanism component representation is used to calculate attention weights based on the subgraph representation and the heterogeneous graph, so as to perform graph propagation calculation according to the attention weights to obtain the node vector representation, including: Performing vector fusion processing on the multi-hop tokens based on the semantic fuser to generate a subgraph-enhanced node representation; Calculating attention weights between different nodes based on the node representation enhanced by the subgraph and the heterogeneous graph based on the attention calculation component, and performing weighted aggregation of neighbor messages based on the attention weights to generate high-quality personalized node representations; Node representation learning is performed on high-quality personalized node representations based on the decoder to generate the node vector representation of each type of node, and the node vector representation is used for downstream tasks.
[0088] The attention calculation component calculates attention weights between different nodes based on the node representation enhanced by the subgraph and the heterogeneous graph. It is understandable that in a heterogeneous graph, each node may be connected to nodes of the same type or different types. When calculating attention, the attention score of each edge is first calculated, and the attention score is calculated using (parameters related to the edge type and the representation of the two nodes connected by the edge). Then, the attention scores of the neighbors corresponding to each edge type are normalized using softmax to obtain the attention weights. That is, the edges connected to the nodes are grouped by type, and the attention weights are calculated independently within each group.
[0089] It can be understood that the embodiment of the present invention dynamically fuses the multi-hop subgraph information of the heterogeneous graph with the node features through the convolution-guided attention mechanism component, generating high-quality vector representations of each type of node for downstream tasks (such as node classification, link prediction, recommendation systems, etc.).
[0090] The function of the semantic fuser (Subgraph-Enhanced Fusion) is to perform vector fusion on multi-hop tokens (subgraph representations of different hop numbers) to generate node representations that contain structural information and enhance the feature expression of the node itself.
[0091] The execution steps of the semantic fuser are: Input: Multi-hop token T=[T1,T2,…,TK] ( K is the maximum number of hops, each TK correspond k- Jump subgraph representation), and node original features X .
[0092] Fusion strategy: Concatenation: Concatenate subgraph representations of different hop counts with the original features to form extended features: .
[0093] Type-aware fusion: Design independent fusion functions for different node types (such as users and products) to preserve type specificity.
[0094] Output: Subgraph enhanced node representation : The shape is [|V|,d], where d is the hidden layer dimension.
[0095] Furthermore, in an e-commerce recommendation scenario, a user node’s multi-hop token may include: 1-hop: features of directly purchased products. 2-hop: features of the categories to which these products belong. 3-hop: features of other users who purchased similar products.
[0096] The semantic fuser combines this information with the original user features (such as age and gender) to generate an enhanced representation that contains local and global structures.
[0097] Furthermore, the role of the attention calculation component is to dynamically calculate the importance weights between nodes based on the subgraph enhanced node representation and graph structure, and generate personalized representations.
[0098] The execution steps of the input attention calculation component include: Node representation of input subgraph enhancement , and the adjacency matrix A of the heterogeneous graph (including edge type information).
[0099] Then use the query Q and key K based on Generate and support type awareness (such as users querying products, products querying categories).
[0100] Edge type constraint: Only node pairs that match the edge type are allowed to participate in attention calculation (for example, users can only follow products and cannot directly follow categories).
[0101] Attention score calculation: ,in, is the neighbor set of node i.
[0102] Dynamic weight adjustment: Introduce edge type bias βtype to adjust weights to adapt to type semantics (e.g., the weight of a "purchase" edge is higher than that of a "browse" edge).
[0103] Supports multi-head attention to capture multi-dimensional correlations.
[0104] Output: High-quality node personalized representation H: shape is [|V|,d].
[0105] In some embodiments, in a social network, attention calculation for a user node may assign higher weights to friend nodes (1-hop) (direct social relationships), lower weights to friends of friends (2-hop) (indirect relationships), and dynamically suppress contributions from irrelevant nodes (e.g., users with significantly different interests).
[0106] Furthermore, the decoder is used to convert personalized node representations into fixed-dimensional vectors suitable for downstream tasks (such as classification and link prediction).
[0107] Input the high-quality node personalized representation H and node type label (optional, used for classification encoding) into the decoder, perform decoding according to the decoding strategy, and output the node vector representation ,in, The dimension required by downstream tasks.
[0108] Decoding strategies include: For different downstream tasks, different training strategies can be adopted by changing the decoder and label. For node classification tasks, a semi-supervised strategy can be adopted to train V-HCAN using given node category labels and a trainable parameter matrix as the decoder.
[0109] For link prediction tasks, this embodiment employs an unsupervised model training strategy, using dot products or DistMult as decoders to decode node pair features into the probability of an edge between them. When constructing labels, the edge set can be divided into training, validation, and test sets. Only edges in the training set are used to reconstruct the graph for training. During the validation and testing phases, sampling techniques are used to construct negative edges.
[0110] Type-aware decoding: Design independent decoders for different node types (such as user , for commercial use .
[0111] Regularization: Add Dropout or BatchNorm to prevent overfitting.
[0112] Furthermore, in product recommendations, the decoder represents the user , mapped to a fixed-dimensional vector , used to calculate the similarity with the candidate items (such as dot product or cosine similarity).
[0113] In some embodiments of the present invention, the heterogeneous graph node representation learning method provided by the present invention is applied to the e-commerce recommendation scenario, that is, the heterogeneous graph node representation learning method based on the e-commerce recommendation scenario. The specific process steps are as follows: 1. Input: Heterogeneous graph: User (U) - Purchase -> Item (I) - Belongs to -> Category (C).
[0114] Node features: user (age, gender), product (price, brand), category (level).
[0115] Multi-hop tokens: products purchased directly by the user (1-hop), the category to which the product belongs (2-hop), and other users who purchased similar products (3-hop).
[0116] 2. Semantic Fusion: Concatenates user features, 1-hop product features, and 2-hop category features to generate enhanced representations.
[0117] 3. Attention calculation component: The user node calculates the attention weight of the product and category, with recently purchased products receiving higher weights. This suppresses interference from distant users (e.g., 3-hop users).
[0118] 4. Decoder: Maps user representations into fixed-dimensional vectors to predict the items they are likely to purchase.
[0119] 5. Downstream tasks: Link prediction: Calculate the similarity between users and candidate products and generate a recommendation list.
[0120] Node classification: determine whether the user is a high-value customer, segment product categories, and aggregate users into groups.
[0121] Through the collaborative work of the semantic fuser, attention calculation component and decoder, the convolution-guided attention mechanism can efficiently capture the multi-scale structural information and node features of heterogeneous graphs, generate high-quality typed node representations, and provide strong support for downstream tasks.
[0122] In some embodiments of the present invention, the method further includes a heterogeneous graph node representation learning network based on high-order relationship awareness; the learning step of the heterogeneous graph node representation learning network based on high-order relationship awareness includes at least: Before the convolutional subgraph encoder component represents a step for determining multi-hop tokens according to the heterogeneous graph and the node feature matrix, different types of node feature matrices are mapped to the same data space to generate a mapped node embedding matrix; Subgraph encoding processing is performed based on the mapped node embedding matrix and the heterogeneous graph to generate multi-hop tokens, so as to determine the node vector representation of each type of node according to the multi-hop tokens.
[0123] It can be understood that, as shown in Table 1 and Algorithm 3.1 below, these are the training steps for the heterogeneous graph node representation learning network based on high-order relationship perception.
[0124] Based on the HCAN framework, this embodiment proposes a simple and effective model, V-HCAN (Vanilla HCAN), which is a heterogeneous graph node representation learning network based on high-order relationship perception, by specifically defining each component in the framework.
[0125] In order to capture the semantic information of node types and map different types of node features into a unified data space, the embodiment of the present invention V-HCAN first performs a feature mapping step before subgraph encoding. This step includes a type-specific multi-layer perceptron (MLP) module, and the specific process is expressed as follows: in, is the feature matrix of the input node, l Indicates the current V-HCAN network layer, Indicates that only nodes of type The node embedding matrix of is the node embedding matrix output by the previous layer, A series of independently trainable MLP modules corresponding to node types, is the node embedding matrix after mapping.
[0126] Furthermore, V-HCAN performs subgraph encoding based on node embeddings. While many graph learning methods can be used as subgraph encoders, their performance and efficiency vary significantly. This paper provides an efficient encoding method that fully aggregates neighborhood information while minimizing memory and time overhead, thus preventing the subgraph encoding step from becoming a bottleneck in model efficiency.
[0127] Therefore, this paper designs an efficient heterogeneous subgraph encoder that gradually generates heterogeneous subgraph representations according to the number of hops in a non-parametric graph convolution process. These generated subgraph representations are called multi-hop tokens. The recursive calculation process of multi-hop tokens is expressed as: Where A represents the adjacency matrix without self-connection, represents the diagonal matrix of the adjacency matrix, for k Jump subgraph representation, that is, k Hop token. For example, 0 hop token equals node feature , 1 The jump token represents the average feature of the immediate neighbors, and so on.
[0128] After the parameterless propagation is completed, V-HCAN uses the MLP module again to further encode the type information into the multi-hop token: in, represents the type-specific node embedding matrix derived from the jump token, is the updated jump token.
[0129] In some embodiments, V-HCAN adopts a subgraph attention mechanism to learn forward-looking attention that perceives high-order relational semantics through subgraph representations. After obtaining the updated multi-hop tokens, V-HCAN first organizes them into a unified embedding: Among them, || represents the vector splicing operation, K It is a hyperparameter of the model, which controls the maximum number of convolution hops in formula (6).
[0130] Next, the edge attention coefficient is calculated as follows: in, Indicates that node i is of type The set of neighbors connected by the edges, is the activation function, is a trainable parameter vector, and is a trainable parameter matrix.
[0131] In an embodiment of the present invention, in an attention-based heterogeneous graph neural network, the weights assigned by nodes to messages in each propagation step are normalized, meaning that the weight of each message is less than 1. Consequently, high-order relational information gradually decays along the multi-hop propagation path as the weights are multiplied, potentially resulting in a low attention score that mismatches its actual importance. This biased attention in existing graph neural networks results in the loss of high-order information during multi-hop propagation.
[0132] Therefore, embodiments of the present invention retain low-attention information while learning personalized preferences, which helps capture long-range semantic information.
[0133] This paper proposes a novel counterweight payload module (CPM) for attention-based graph aggregation. CPM aggregates messages using inverted weights, for example, by subtracting the normalized attention weight from a constant (in this implementation, the constant used is 1), thereby assigning low weights to high-attention messages and high weights to low-attention messages.
[0134] In this way, CPM reaggregates information that would otherwise be discarded to generate a new representation, which we call balanced load and uses as supplementary information to the node representation. This mechanism ensures that all information received by the current node is fully propagated, thereby reducing the loss of long-distance information during multi-hop propagation. The balance coefficient is defined as: Where, is the balance coefficient, is the attention coefficient.
[0135] Based on the attention coefficient and balance coefficient , the aggregation operation is defined as follows: in, is a trainable parameter matrix. This attention-based message propagation ensures that V-HCAN mines the personalized preferences of nodes from the global information of the neighborhood and improves the quality of node representation.
[0136] Furthermore, V-HCAN incorporates the widely adopted residual connection technique, which can alleviate the over-smoothing and gradient vanishing problems in graph neural networks, by updating node representations through aggregate embeddings. The update rule is defined as: in, and are trainable parameters, The first l The node embedding matrix output by the layer is used as the input to the next layer to continue the model calculation. The output of the last layer of V-HCAN will be applied to the downstream task to calculate the loss function and optimize the model parameters through backpropagation.
[0137] Table 1 is as follows: Algorithm 3.1 in Table 1 shows the pseudo code of the overall training process of the V-HCAN model. Given the feature matrix , V-HCAN first uses MLP to map features to the same data space (lines 4-5). Then, V-HCAN enters a K The hop subgraph encoding process generates multi-hop tokens (lines 6-11). The multi-hop tokens are then used in the heterogeneous subgraph attention mechanism to calculate the importance scores of neighbors (lines 12-14).
[0138] In this step, the V-HCAN implementation also uses a multi-head attention mechanism to enhance training stability. Next, the balance coefficient is calculated (line 15). Graph propagation is then performed based on the attention coefficient and the balance coefficient to generate high- and low-attention information representations (line 16).
[0139] Finally, the node embedding is updated using residual connections (line 18). Since no pre-computation or manual meta-path selection is required during the training of V-HCAN, the proposed method can be trained in an end-to-end manner. For different downstream tasks, V-HCAN can be trained by changing the decoder and label in lines 21-22 of Algorithm 3.1. Y to adopt different training strategies.
[0140] For node classification tasks, this paper adopts a semi-supervised strategy, using given node category labels and a trainable parameter matrix as a decoder to train V-HCAN. For link prediction tasks, this paper adopts an unsupervised strategy for model training, using dot product or DistMult as a decoder to decode the features of node pairs into the probability of an edge between them. Y When , the edge set is divided into training set, validation set and test set, and only the edges in the training set are used to reconstruct the graph for training. In the validation and testing stages, sampling techniques are used to construct negative edges.
[0141] In some embodiments of the present invention, the method further includes a heterogeneous graph node representation learning network for large-scale data; the learning step of the heterogeneous graph node representation learning network for large-scale data at least includes: In the step of inputting the heterogeneous graph and the node feature matrix into the convolutional subgraph encoder component for encoding and generating multi-hop tokens, the step of heterogeneous graph propagation and the step of node feature matrix mapping are decoupled to obtain a decoupled K - Jump subgraph.
[0142] It can be understood that the following Table 2 shows Algorithm 3.2, which represents the training steps of the Heterogeneous Graph Node Representation Learning Network (D-HCAN) for large-scale data.
[0143] Table 2 is shown below: Furthermore, one of the main limitations of existing meta-path-independent heterogeneous graph neural networks is their poor scalability. This is primarily due to the fact that these methods rely on specially designed parameterized graph propagation processes to enhance the model's ability to capture heterogeneous semantics. While these parameters enhance model performance, they incur significant time overhead on large-scale graph data and often lead to out-of-memory issues. In contrast, scalable heterogeneous graph neural network models typically rely on meta-paths. However, the HCAN framework proposed in this paper can be extended to different scenarios by flexibly switching specific components.
[0144] This embodiment demonstrates the scalability of HCAN. By integrating memory-efficient graph neural network components with HCAN, we propose D-HCAN (Decoupled HCAN)—an efficient, meta-path-free, and scalable heterogeneous graph neural network model for large-scale graph data. Similar to many popular graph neural networks, the feature mapping and propagation processes in HCAN's subgraph encoder can also be decoupled. Specifically, the decoupled K-hop subgraph encoding process can be expressed as: in, is a row-normalized adjacency matrix. In order to capture the semantic differences of different relations in heterogeneous graphs, this embodiment uses edge-type specific adjacency matrices Perform graph propagation, which includes types Therefore, the subgraph encoder generates a list of node embedding matrices with different relational semantics, denoted as The specific process is as follows: D-HCAN then uses a simple non-parametric attention mechanism to aggregate personalized high-level information for each node based on the correlation of node embeddings after convolution and converted into edge weights. Since multiple embeddings are generated for each node, the standardized attention coefficient is calculated separately as follows: Then perform attention-based aggregation operation: Filter out After removing the zero elements in , D-HCAN maps the node embeddings using a feed-forward neural network (FFN). It then concatenates the embeddings of each node and performs feature transformation using an MLP module to fuse the embeddings of individual nodes into a unified representation. Algorithm 3.2 shows the pseudocode for the D-HCAN training process. D-HCAN follows the computational flow of the HCAN framework, with lines 4-7 corresponding to the subgraph encoder component and lines 8-17 corresponding to the convolution-guided attention component. Experimental results from embodiments of the present invention demonstrate that, compared to previous methods, D-HCAN achieves superior performance and efficiency on large-scale graph data, highlighting the scalability advantages of HCAN.
[0145] The present invention provides a heterogeneous graph node representation learning method, device, equipment and storage medium, which obtains a heterogeneous graph and a node feature matrix; the heterogeneous graph is represented as a network structure containing multiple types of nodes and edges, and the node feature matrix is represented as a feature matrix that describes the semantic relationship between multiple types of nodes; the heterogeneous graph and the node feature matrix are input into a heterogeneous graph node representation learning network for learning to determine the node vector representation of each type of node; the node vector representation effectively captures the node features and effectively captures the structure and relationship semantics of the node in the heterogeneous graph; the heterogeneous graph node representation learning network is obtained by training based on heterogeneous graph samples and node feature samples; the heterogeneous graph node representation learning network at least includes: a convolutional subgraph encoder component and a convolutional guided attention mechanism component; the convolutional subgraph encoder component is represented for determining multi-hop tokens based on the heterogeneous graph and the node feature matrix; the multi-hop tokens are represented as subgraph representations corresponding to different hop numbers; the convolutional guided attention mechanism component is represented for calculating attention weights based on the subgraph representation and the heterogeneous graph, so as to perform graph propagation calculations based on the attention weights to obtain the node vector representation. It is used to solve the defects of existing technologies in capturing high-order relational semantics, such as long time consumption, high computational cost and poor versatility. By determining subgraph representation and performing graph propagation calculations based on attention weights, the heterogeneous graph node representation learning network can effectively perceive high-order relational semantics, thereby significantly improving the expressive power and generalization performance of the heterogeneous graph node representation learning network.
[0146] The heterogeneous graph node representation learning device provided by the present invention is described below. The heterogeneous graph node representation learning device described below and the heterogeneous graph node representation learning method described above can refer to each other.
[0147] like Figure 3 FIG. 1 is a schematic diagram of the structure of a heterogeneous graph node representation learning device provided by the present invention, which includes the following modules: An acquisition module 310 is configured to acquire a heterogeneous graph and a node feature matrix; the heterogeneous graph is represented as a network structure containing multiple types of nodes and edges, and the node feature matrix is represented as a feature matrix describing the semantic relationships between multiple types of nodes; The learning module 320 is used to input the heterogeneous graph and the node feature matrix into the heterogeneous graph node representation learning network for learning, and determine the node vector representation of each type of node; the node vector representation representation effectively captures the node features and effectively captures the structure and relational semantics of the node in the heterogeneous graph; the heterogeneous graph node representation learning network is obtained by training based on heterogeneous graph samples and node feature samples; the heterogeneous graph node representation learning network at least includes: a convolutional subgraph encoder component and a convolutional guided attention mechanism component; the convolutional subgraph encoder component representation is used to determine multi-hop tokens based on the heterogeneous graph and the node feature matrix; the multi-hop token representation is a subgraph representation corresponding to different hop numbers; the convolutional guided attention mechanism component representation is used to calculate the attention weight based on the subgraph representation and the heterogeneous graph, so as to perform graph propagation calculation based on the attention weight to obtain the node vector representation.
[0148] Preferably, the heterogeneous graph node representation learning device provided by the present invention is specifically used to input the heterogeneous graph into the convolutional subgraph encoder component for graph sampling processing to generate multiple subgraphs; each subgraph corresponds to a certain number of hops; Input the node feature matrix into the convolutional subgraph encoder component for feature mapping processing to obtain corresponding node tokens; the node tokens are represented as feature representations corresponding to each type of node; The plurality of subgraphs and the node tokens are subjected to encoding aggregation processing to generate the multi-hop tokens.
[0149] Preferably, the heterogeneous graph node representation learning device provided by the present invention is specifically used for a convolution-guided attention mechanism component that includes at least: a semantic fusion component, an attention calculation component, and a decoder; Performing vector fusion processing on the multi-hop tokens based on the semantic fuser to generate a subgraph-enhanced node representation; Calculating attention weights between different nodes based on the node representation enhanced by the subgraph and the heterogeneous graph based on the attention calculation component, and performing weighted aggregation of neighbor messages based on the attention weights to generate high-quality personalized node representations; Node representation learning is performed on high-quality personalized node representations based on the decoder to generate the node vector representation of each type of node, and the node vector representation is used for downstream tasks.
[0150] Preferably, the heterogeneous graph node representation learning device provided by the present invention is specifically used for the node representation of the subgraph enhancement, which includes the personalized characteristics of the node and the global information of the node neighborhood, so that the convolution-guided attention mechanism component considers the semantic relevance of the arbitrary two nodes and the target node when judging the importance of the edge between any two nodes, and considers the importance of the arbitrary two nodes in the high-order relationship propagation process based on the neighborhood representation.
[0151] Preferably, the heterogeneous graph node representation learning device provided by the present invention is specifically used for a heterogeneous graph node representation learning network based on high-order relationship perception; the learning steps of the heterogeneous graph node representation learning network based on high-order relationship perception at least include: Before performing encoding aggregation processing on the plurality of subgraphs and the node tokens to generate the multi-hop tokens, different types of node feature matrices are mapped to the same data space to generate a mapped node embedding matrix; Subgraph encoding processing is performed based on the mapped node embedding matrix and the heterogeneous graph to generate multi-hop tokens, so as to determine the node vector representation of each type of node according to the multi-hop tokens.
[0152] Preferably, the heterogeneous graph node representation learning device provided by the present invention is specifically used for a heterogeneous graph node representation learning network for large-scale data; the learning steps for the heterogeneous graph node representation learning network for large-scale data at least include: The step of using the convolutional subgraph encoder component to perform subgraph encoding to determine multi-hop tokens is decoupled from the node feature matrix mapping, and the step of using the convolutional guided attention mechanism component to perform graph propagation to obtain the node vector representation is decoupled from the node feature matrix mapping; in the mapping decoupling process, a message aggregation process that does not contain trainable parameters is used, and only the node features of the message aggregation results are mapped.
[0153] The present invention provides a heterogeneous graph node representation learning method, device, equipment and storage medium, which obtains a heterogeneous graph and a node feature matrix; the heterogeneous graph is represented as a network structure containing multiple types of nodes and edges, and the node feature matrix is represented as a feature matrix that describes the semantic relationship between multiple types of nodes; the heterogeneous graph and the node feature matrix are input into a heterogeneous graph node representation learning network for learning to determine the node vector representation of each type of node; the node vector representation effectively captures the node features and effectively captures the structure and relationship semantics of the node in the heterogeneous graph; the heterogeneous graph node representation learning network is obtained by training based on heterogeneous graph samples and node feature samples; the heterogeneous graph node representation learning network at least includes: a convolutional subgraph encoder component and a convolutional guided attention mechanism component; the convolutional subgraph encoder component is represented for determining multi-hop tokens based on the heterogeneous graph and the node feature matrix; the multi-hop tokens are represented as subgraph representations corresponding to different hop numbers; the convolutional guided attention mechanism component is represented for calculating attention weights based on the subgraph representation and the heterogeneous graph, so as to perform graph propagation calculations based on the attention weights to obtain the node vector representation. It is used to solve the defects of existing technologies in capturing high-order relational semantics, such as long time consumption, high computational cost and poor versatility. By determining subgraph representation and performing graph propagation calculations based on attention weights, the heterogeneous graph node representation learning network can effectively perceive high-order relational semantics, thereby significantly improving the expressive power and generalization performance of the heterogeneous graph node representation learning network.
[0154] Figure 4 An example of a physical structure diagram of an electronic device is shown below. Figure 4As shown, the electronic device may include: a processor (processor) 410 , a communication interface (Communications Interface) 420 , a memory (memory) 430 and a communication bus 440 , wherein the processor 410 , the communication interface 420 , and the memory 430 communicate with each other via the communication bus 440 . The processor 410 can call the logic instructions in the memory 430 to execute a heterogeneous graph node representation learning method, which includes: obtaining a heterogeneous graph and a node feature matrix; the heterogeneous graph is represented as a network structure containing multiple types of nodes and edges, and the node feature matrix is represented as a feature matrix that describes the semantic relationship between multiple types of nodes; the heterogeneous graph and the node feature matrix are input into the heterogeneous graph node representation learning network for learning to determine the node vector representation of each type of node; the node vector representation effectively captures the node features and effectively captures the structure and relationship semantics of the node in the heterogeneous graph; the heterogeneous graph node representation learning network is obtained by training based on heterogeneous graph samples and node feature samples; the heterogeneous graph node representation learning network includes at least: a convolutional subgraph encoder component and a convolutional guided attention mechanism component; the convolutional subgraph encoder component is represented for determining multi-hop tokens based on the heterogeneous graph and the node feature matrix; the multi-hop token is represented as a subgraph representation corresponding to different hop numbers; the convolutional guided attention mechanism component is represented for calculating attention weights based on the subgraph representation and the heterogeneous graph, so as to perform graph propagation calculation based on the attention weights to obtain the node vector representation.
[0155] Furthermore, the logic instructions in the aforementioned memory 430 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the portion that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product, stored in a storage medium, includes instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, a mobile hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0156] On the other hand, the present invention also provides a computer program product, which includes a computer program, which can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute a heterogeneous graph node representation learning method provided by the above methods, which includes: obtaining a heterogeneous graph and a node feature matrix; the heterogeneous graph is represented as a network structure containing multiple types of nodes and edges, and the node feature matrix is represented as a feature matrix describing the semantic relationship between multiple types of nodes; the heterogeneous graph and the node feature matrix are input into a heterogeneous graph node representation learning network for learning to determine the node vector representation of each type of node; the node vector The quantity representation characterization effectively captures node features and effectively captures the structure and relational semantics of nodes in the heterogeneous graph; the heterogeneous graph node representation learning network is obtained by training based on heterogeneous graph samples and node feature samples; the heterogeneous graph node representation learning network at least includes: a convolutional subgraph encoder component and a convolutional guided attention mechanism component; the convolutional subgraph encoder component representation is used to determine multi-hop tokens based on the heterogeneous graph and the node feature matrix; the multi-hop token representation is a subgraph representation corresponding to different hop numbers; the convolutional guided attention mechanism component representation is used to calculate the attention weight based on the subgraph representation and the heterogeneous graph, so as to perform graph propagation calculation based on the attention weight to obtain the node vector representation.
[0157] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which is implemented by a processor to execute a heterogeneous graph node representation learning method provided by the above methods, the method comprising: obtaining a heterogeneous graph and a node feature matrix; the heterogeneous graph is represented as a network structure containing multiple types of nodes and edges, and the node feature matrix is represented as a feature matrix describing the semantic relationship between multiple types of nodes; the heterogeneous graph and the node feature matrix are input into a heterogeneous graph node representation learning network for learning to determine a node vector representation of each type of node; the node vector representation representation effectively captures the node features and Effectively capture the structure and relational semantics of nodes in the heterogeneous graph; the heterogeneous graph node representation learning network is obtained by training based on heterogeneous graph samples and node feature samples; the heterogeneous graph node representation learning network includes at least: a convolutional subgraph encoder component and a convolutional guided attention mechanism component; the convolutional subgraph encoder component representation is used to determine multi-hop tokens based on the heterogeneous graph and the node feature matrix; the multi-hop token representation is a subgraph representation corresponding to different hop numbers; the convolutional guided attention mechanism component representation is used to calculate the attention weight based on the subgraph representation and the heterogeneous graph, so as to perform graph propagation calculation based on the attention weight to obtain the node vector representation.
[0158] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, i.e., they may be located in one location or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of the present embodiment. Persons of ordinary skill in the art will be able to understand and implement the present invention without inventive effort.
[0159] Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented using software plus a necessary general-purpose hardware platform, or of course, hardware. Based on this understanding, the essence of the above technical solution, or the portion that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, or an optical disk, and includes a number of instructions for causing a computer device (such as a personal computer, server, or network device) to execute the methods described in each embodiment or certain portions of the embodiments.
[0160] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.
Claims
1. A heterogeneous graph node representation learning method, characterized in that: include: Obtain heterogeneous graph and node feature matrix; The heterogeneous graph is represented as a network structure containing multiple types of nodes and edges, and the node feature matrix is represented as a feature matrix describing the semantic relationship between multiple types of nodes; Inputting the heterogeneous graph and the node feature matrix into a heterogeneous graph node representation learning network for learning to determine a node vector representation for each type of node; the node vector representation effectively captures node features and effectively captures the structure and relationship semantics of the node in the heterogeneous graph; the heterogeneous graph node representation learning network is trained based on heterogeneous graph samples and node feature samples; The heterogeneous graph node representation learning network includes at least: a convolutional subgraph encoder component and a convolutional guided attention mechanism component; the convolutional subgraph encoder component representation is used to determine multi-hop tokens based on the heterogeneous graph and the node feature matrix; the multi-hop token representation is a subgraph representation corresponding to different hop numbers; the convolutional guided attention mechanism component representation is used to calculate the attention weight based on the subgraph representation and the heterogeneous graph, so as to perform graph propagation calculation based on the attention weight to obtain the node vector representation.
2. The heterogeneous graph node representation learning method according to claim 1, characterized in that: The convolutional subgraph encoder component characterization is used to determine multi-hop tokens based on a heterogeneous graph and a node feature matrix, including: Inputting the heterogeneous graph into the convolutional subgraph encoder component for graph sampling processing to generate multiple subgraphs; each subgraph corresponds to a certain number of hops; Input the node feature matrix into the convolutional subgraph encoder component for feature mapping processing to obtain corresponding node tokens; the node tokens are represented as feature representations corresponding to each type of node; The plurality of subgraphs and the node tokens are subjected to encoding aggregation processing to generate the multi-hop tokens.
3. The heterogeneous graph node representation learning method according to claim 1, characterized in that: The convolution-guided attention mechanism component includes at least: semantic fusion component, attention calculation component, and decoder; The convolution-guided attention mechanism component representation is used to calculate attention weights based on the subgraph representation and the heterogeneous graph, so as to perform graph propagation calculation according to the attention weights to obtain the node vector representation, including: Performing vector fusion processing on the multi-hop tokens based on the semantic fuser to generate a subgraph-enhanced node representation; Calculating attention weights between different nodes based on the node representation enhanced by the subgraph and the heterogeneous graph based on the attention calculation component, and performing weighted aggregation of neighbor messages based on the attention weights to generate high-quality personalized node representations; Node representation learning is performed on high-quality personalized node representations based on the decoder to generate the node vector representation of each type of node, and the node vector representation is used for downstream tasks.
4. The heterogeneous graph node representation learning method according to claim 3, characterized in that: The subgraph enhanced node representation includes at least the personalized features of the node and the global information of the node neighborhood, so that the convolution-guided attention mechanism component considers the semantic relevance of the arbitrary two nodes and the target node when judging the importance of the edge between any two nodes, and considers the importance of the arbitrary two nodes in the high-order relationship propagation process based on the neighborhood representation.
5. The heterogeneous graph node representation learning method according to claim 2, characterized in that: The method also includes a heterogeneous graph node representation learning network based on high-order relationship awareness; The learning steps of the heterogeneous graph node representation learning network based on high-order relationship perception at least include: Before performing encoding aggregation processing on the plurality of subgraphs and the node tokens to generate the multi-hop tokens, different types of node feature matrices are mapped to the same data space to generate a mapped node embedding matrix; Subgraph encoding processing is performed based on the mapped node embedding matrix and the heterogeneous graph to generate multi-hop tokens, so as to determine the node vector representation of each type of node according to the multi-hop tokens.
6. The heterogeneous graph node representation learning method according to claim 2, characterized in that: The method further includes a heterogeneous graph node representation learning network for large-scale data; the learning steps of the heterogeneous graph node representation learning network for large-scale data at least include: The step of using the convolutional subgraph encoder component to perform subgraph encoding to determine multi-hop tokens is decoupled from the node feature matrix mapping, and the step of using the convolutional guided attention mechanism component to perform graph propagation to obtain the node vector representation is decoupled from the node feature matrix mapping; in the mapping decoupling process, a message aggregation process that does not contain trainable parameters is used, and only the node features of the message aggregation results are mapped.
7. A heterogeneous graph node representation learning device, characterized in that: include: Acquisition module, used to obtain heterogeneous graphs and node feature matrices; The heterogeneous graph is represented as a network structure containing multiple types of nodes and edges, and the node feature matrix is represented as a feature matrix describing the semantic relationship between multiple types of nodes; A learning module is configured to input the heterogeneous graph and the node feature matrix into a heterogeneous graph node representation learning network for learning, and determine a node vector representation of each type of node; the node vector representation effectively captures the node features and effectively captures the structure and relationship semantics of the node in the heterogeneous graph; the heterogeneous graph node representation learning network is trained based on heterogeneous graph samples and node feature samples; The heterogeneous graph node representation learning network includes at least: a convolutional subgraph encoder component and a convolutional guided attention mechanism component; the convolutional subgraph encoder component representation is used to determine multi-hop tokens based on the heterogeneous graph and the node feature matrix; the multi-hop token representation is a subgraph representation corresponding to different hop numbers; the convolutional guided attention mechanism component representation is used to calculate the attention weight based on the subgraph representation and the heterogeneous graph, so as to perform graph propagation calculation based on the attention weight to obtain the node vector representation.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that: When the processor executes the program, the heterogeneous graph node representation learning method according to any one of claims 1 to 6 is implemented.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for learning heterogeneous graph node representation according to any one of claims 1 to 6 is implemented.
10. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the method for learning heterogeneous graph node representation according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Heterogeneous graph neural network calculation method for aggregating high-order neighbor nodes
CN114723037A
Graph representation learning method based on multi-source interactive fusion
CN114756713A
Cited By
Spectrogram convolutional network heterogeneous graph representation learning method based on path collaborative graph enhancement
CN121787494A