Heterogeneous graph neural network training method and system based on community consistency
Through the heterogeneous graph neural network training method based on community consistency, sub-graph collections are generated and MMD loss function is designed, which solves the problem of insufficient cross-domain knowledge fusion and dynamic topological adaptability of traditional graph neural networks, and realizes efficient node classification and semantic fidelity on super-large-scale heterogeneous graphs.
Patent Information
- Application Number
- CN202510816770.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-18
- Publication Date
- 2025-08-19
- Estimated Expiration
- 2045-06-18
AI Technical Summary
Traditional graph neural networks have shortcomings in cross-domain knowledge fusion, dynamic topological adaptability and semantic fidelity, especially when dealing with hyper-large-scale heterogeneous graphs, which are highly complex and dynamic topological adaptability.
A heterogeneous graph neural network training method based on community consistency is adopted. By generating a sub-graph set of heterogeneous graphs, an MMD loss function is designed and a composite loss function is constructed, and a gradient inversion is used to update parameters. Combined with Laplace matrix trace constraints and kernel space mapping technology, quantitative monitoring and topological maintenance of feature distribution differences are achieved.
When processing super-large-scale heterogeneous data such as open academic maps and cross-platform social networks, accurate node classification and computational efficiency are achieved, reducing the amount of parameters, and improving the dynamic adaptability and semantic fidelity of the model.
Smart Images

Figure CN120338028B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of graph neural networks and heterogeneous data processing, and specifically relates to a heterogeneous graph neural network training method and system based on community consistency. Background Art
[0002] In the field of heterogeneous graph data processing, traditional graph models have the inherent defect of insufficient modeling of multi-relational dependencies. The Heterogeneous Graph Transformer (HGT) significantly improved the representation ability of heterogeneous networks at the time by introducing a meta-relation-aware attention mechanism. The classic HGT architecture achieves differential interaction modeling between different types of nodes by distinguishing the relationship patterns between node types and edge types, and has been verified in many fields such as academic network analysis. Various improved methods have been developed subsequently to optimize different dimensions: the multi-scale semantic fusion method based on hierarchical aggregation improves the utilization of local topological information, the multi-tokenization expansion scheme enhances the ability to capture long-distance dependencies, and the dynamic scene adaptation formula expands the scope of model application to the field of time-varying graphs. However, existing HGT variants generally face computational complexity bottlenecks when processing ultra-large-scale heterogeneous graphs, and their adaptability to dynamic topologies still needs to be improved.
[0003] Existing heterogeneous graph neural networks mainly face the following technical problems:
[0004] 1. Semantic collapse: During multi-layer feature propagation, the structured information of nodes within a community is easily disturbed by noise, resulting in distribution shift.
[0005] 2. Feature confusion: Heterogeneous interactions across node types weaken the topological continuity of nodes of the same type;
[0006] 3. Insufficient dynamic adaptation: The evolution of community structure in large-scale graphs is not explicitly modeled. Summary of the Invention
[0007] The purpose of this invention is to solve the problems of deficiencies in traditional graph neural networks in cross-domain knowledge fusion, dynamic topological adaptability and semantic fidelity, and propose a heterogeneous graph neural network training method and system based on community consistency.
[0008] The technical solution of the present invention is as follows: In a first aspect, a heterogeneous graph neural network training method based on community consistency comprises the following steps:
[0009] Generate a subgraph set of a heterogeneous graph based on community division rules;
[0010] Extract the node feature matrix of each subgraph in the subgraph set, slice each node feature matrix to obtain the subgraph feature matrix aligned with the input, and design the MMD loss function;
[0011] A composite loss function is constructed based on the MMD loss function, and the parameters of the heterogeneous graph neural network are updated through gradient reversal to complete the training of the heterogeneous graph neural network.
[0012] Preferably, the subgraph set of the heterogeneous graph is generated based on the community division rule, specifically:
[0013] According to the heterogeneous graph A collection of node types Establish a homogeneous community division system and classify node types , and its corresponding homogeneous community is , and then get the complete community set ,in, represents a set of heterogeneous graph vertices, represents an edge set;
[0014] Constructing a homogeneous node set , and then a homogeneous community is obtained through two-step neighborhood expansion The set of common neighbor nodes ,in, represents a set of vertices in a homogeneous set of nodes, Represents the node type mapping function, Edges representing common neighbors across classes of nodes of the same class;
[0015] Based on the common neighbor node set Constructing a subgraph A collection of nodes ;
[0016] Based on the common neighbor node set Constructing a subgraph The edge set ,in, Represents the homogeneous edges within the community, , Represents heterogeneous edges across types, with ,in, represents the edge type mapping function, represents homogeneous edges, represents heterogeneous edges;
[0017] Complete the construction of node sets and edge sets of all subgraphs to obtain the subgraph set .
[0018] As a preference, when generating a subgraph set of a heterogeneous graph based on the community division rule, each subgraph Regularization constraints are implemented independently to optimize the quality of subgraph generation, specifically:
[0019] Using the spectral graph theory method, the cohesion and connectivity of the subgraph are balanced by the trace constraint of the Laplace matrix. For subgraph The normalized Laplace matrix of ,in, represents the node feature matrix, represents the trace of the Laplacian matrix, represents the transpose of the matrix, represents the set of real numbers, Representing a subgraph The node set of Represents the feature vector dimension.
[0020] As a preference, according to the subgraph node set For nodes in heterogeneous graphs The original attribute characteristics Rearrange the index and then use the predefined node type mapping function Align the feature matrix, specifically: The node collection in Perform feature slicing operations to generate an initial feature matrix of a specific type ,in, Indicates the number of nodes, Indicates the node type subscript, Representation node The initial eigenvector of
[0021] The initial feature matrix Input into the heterogeneous graph neural network, it is iteratively updated through different levels in turn. The output of the layer network is ,in is the activation function, are learnable weights, is the bias term, Represents the first Layer network output, when When the value is 1, the 0th layer network output of the heterogeneous graph neural network , represents the set of real numbers, represents the feature vector dimension;
[0022] Perform type projection operation on the inter-layer propagation of heterogeneous graph neural network to extract the first Subgraph feature matrix of layer network .
[0023] As a preference, the type projection operation is specifically: The corresponding feature submatrix , filter operators by type Extract the sub-graph feature matrix of the current layer :
[0024]
[0025] in, Indicates the Layer network nodes The corresponding eigenvector.
[0026] Preferably, the designed MMD loss function is specifically:
[0027] Through the kernel function Establish a reproducing kernel Hilbert space and calculate the initial characteristic matrix in the reproducing kernel Hilbert space The expected value of the internal kernel matrix and the internal cohesion measure of the post-processing feature matrix; the post-processing feature matrix is ;
[0028] Constructing the initial feature matrix and post-processing feature matrix The cross-kernel matrix is then used to calculate the expected similarity between samples across stages;
[0029] According to the expected value of the internal kernel matrix of the initial feature matrix, the internal cohesion measure of the post-processed feature matrix and the expected similarity between samples across stages, the MMD loss function is constructed by squared deviation.
[0030] Preferably, the calculation formula of the expected value of the internal kernel matrix of the initial feature matrix is:
[0031]
[0032] in, represents the expected value of the internal kernel matrix of the initial feature matrix, and Indicates that the network is at layer 0. and The eigenvectors of the two nodes, , , represents the kernel function;
[0033] The calculation formula of the internal cohesion measure of the post-processing feature matrix is:
[0034]
[0035] in, represents the internal cohesion measure of the post-processed feature matrix, and Indicates in layer network, and The eigenvectors of the two nodes;
[0036] The calculation formula for the expected similarity between samples across stages is:
[0037]
[0038] in, Represents the expected similarity between samples across stages;
[0039] The calculation formula of the MMD loss function is:
[0040]
[0041] in, represents the MMD loss.
[0042] Preferably, the composite loss function is:
[0043]
[0044] in, represents the compound loss, represents the supervision label set, represents the cross entropy loss function, Represents the loss function part of the downstream task, Indicates the correct value. represents the predicted value, represents the learnable regularization coefficient, represents a subgraph, represents a subgraph set, Represents the MMD loss function value of the subgraph G.
[0045] The beneficial effects of the present invention are:
[0046] This paper designs a structure-aware dynamic regularization framework that balances topology preservation and computational efficiency during subgraph generation through Laplacian matrix trace constraints. It also constructs a differentiable community consistency assessment module that uses kernel space mapping technology to quantitatively monitor feature distribution differences. These techniques enable the present invention to achieve accurate node classification with fewer parameters when processing extremely large-scale heterogeneous data such as the Open Academic Graph (OAG) and cross-platform social networks.
[0047] The second aspect is a heterogeneous graph neural network training system based on community consistency, including:
[0048] A topology-aware subgraph generation module, which is used to generate a subgraph set of a heterogeneous graph based on community partitioning rules;
[0049] The feature drift monitoring module is used to extract the node feature matrix of each subgraph in the subgraph set, slice each node feature matrix to obtain the subgraph feature matrix aligned with the input, and design the MMD loss function;
[0050] The adaptive regularization control module is used to construct a composite loss function based on the MMD loss function, and update the parameters of the heterogeneous graph neural network through gradient reversal to complete the training of the heterogeneous graph neural network.
[0051] In a third aspect, a computer-readable storage medium stores computer instructions. In response to a computer reading the computer instructions in the storage medium, the computer executes the community consistency-based heterogeneous graph neural network training method as described in the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] Figure 1 Shown is a flowchart of a community consistency-based heterogeneous graph neural network training method.
[0053] Figure 2 Shown is a topological structure diagram of the academic network heterogeneous graph model according to Example 1 of the present invention.
[0054] Figure 3 Shown is a heterogeneous academic network diagram constructed in Example 1 of the present invention.
[0055] Figure 4 Shown is a visualization diagram of community partitions according to Example 1 of the present invention. DETAILED DESCRIPTION
[0056] The exemplary embodiments of the present invention will now be described in detail with reference to the accompanying drawings. It should be understood that the embodiments shown and described in the accompanying drawings are merely exemplary and are intended to illustrate the principles and spirit of the present invention, rather than to limit the scope of the present invention.
[0057] Example 1:
[0058] like Figure 1 As shown, a heterogeneous graph neural network training method based on community consistency includes the following steps:
[0059] S1. Generate a subgraph set of a heterogeneous graph based on community division rules;
[0060] S2. Extract the node feature matrix of each subgraph in the subgraph set, slice each node feature matrix to obtain a subgraph feature matrix aligned with the input, and design the MMD loss function;
[0061] S3. Construct a composite loss function based on the MMD loss function, and update the parameters of the heterogeneous graph neural network through gradient reversal to complete the training of the heterogeneous graph neural network.
[0062] The heterogeneous graph neural network in the present invention is used to solve the data analysis and mining of related heterogeneous graphs such as academic information heterogeneous graphs, biological information heterogeneous graphs, and online product purchase heterogeneous graphs.
[0063] In this embodiment, step S1 is specifically as follows:
[0064] According to the heterogeneous graph A collection of node types Establish a homogeneous community division system and classify node types , and its corresponding homogeneous community is , and then get the complete community set ; From the perspective of set theory, the division of homogeneous communities must meet two basic conditions: completeness condition Ensure that all nodes are included in the classification system; non-intersection conditions This ensures the strict exclusivity of the category division. This type-attribute-based division method effectively inherits the multimodal characteristics of heterogeneous graphs and establishes a structural foundation for subsequent subgraph analysis.
[0065] Constructing a homogeneous node set , and then a homogeneous community is obtained through two-step neighborhood expansion The set of common neighbor nodes ,in, represents a set of vertices in a homogeneous set of nodes, Represents the node type mapping function, Edges representing common neighbors across classes of nodes of the same class;
[0066] Based on the common neighbor node set Constructing a subgraph A collection of nodes ;
[0067] Based on the common neighbor node set Constructing a subgraph The edge set ,in, Represents the homogeneous edges within the community, , Represents heterogeneous edges across types, with ,in, represents the edge type mapping function, represents homogeneous edges, represents heterogeneous edges;
[0068] Complete the construction of node sets and edge sets of all subgraphs to obtain the subgraph set .
[0069] Heterogeneous graph: A heterogeneous graph with a typed structure can be formally defined as , where the vertex set and edge sets Constraints are performed through two type mapping functions: node type mapping function , which maps vertices to a set of predefined node types Specific types in edge type mapping function , which maps edges to a set of predefined relationship types A specific type in .
[0070] The academic network heterogeneous graph model of this embodiment consists of three heterogeneous node types and five types of semantically associated edge relationships. Its topological structure is as follows: Figure 2 Specifically, the graph structure includes: a set of academic entity nodes {A, P, F}, where A represents the author node (Author), P represents the paper node (Paper), and F represents the research field node (Field); a set of multi-edge types includes five types of knowledge associations: teacher-student guidance relationship (AA), author-paper affiliation relationship (AP), academic achievement citation relationship (PP), research field affiliation relationship (PF), and field hierarchy relationship (FF).
[0071] Homogeneous community: for node type Related structures, homogeneous communities It is formally defined as the set of closures that satisfy the node belonging condition, that is, if and only if All satisfied ,in Characterizes the classification of node types with specific semantics in the graph structure. Such communities Essentially constitutes a graph The node set in the heterogeneous graph is composed of single-type nodes. Further, the homogeneous community is defined as The set of homogeneous edges in is , its mathematical representation can be expressed as This edge set essentially measures the internal connection density of nodes of the same type in the topological space. Figure 3As shown in the figure, it contains three homogeneous sub-network structures: the academic subject sub-network is composed of all author nodes (A), and the entities are connected through the teacher-student guidance relationship (AA); the academic achievement sub-network is composed of all paper nodes (P), and the semantic association between nodes is realized through the paper citation relationship (PP); the subject field sub-network integrates all research field nodes (F), and its hierarchical knowledge system is structured through field affiliation (FF). It should be emphasized that the native nodes of these three homogeneous sub-networks are completely inherited from the basic heterogeneous network, i.e. Figure 2 The topological structure shown in the figure maintains the structural homogeneity of the topological properties of its edges during the evolution process.
[0072] Common neighbors of homogeneous points: set subgraph structure There are two node types in AND Class Node, for nodes and , if the edge set satisfies and , then it is called for , Cross-class common neighbor nodes. In homogeneous communities (in ), the cross-class common neighbors of all similar node pairs constitute the set Furthermore, the community The corresponding common neighbor set In the original picture The heterogeneous edge set generated in can be expressed as .like Figure 3 and Figure 4 As shown in the figure, the community evolution mechanism proposed in this embodiment explains how homogeneous communities achieve the process of merging nodes into communities through the topological association of common neighbors. Specifically: in the construction of author communities, based on the second-order collaborative relationship of author-paper-author (APA) (such as Figure 3 In the process of forming a paper community, the paper entities (P nodes) with common co-authorship relationships are incorporated into the author community. In the process of forming a paper community, the co-authorship relationship of paper-author-paper (PAP) and the theme relationship of paper-field-paper (PFP) are used as the dual mechanism (e.g. Figure 3 The dotted line shows the collaborative embedding of author entities (node A) and subject domain entities (node F). Similarly, domain communities are connected through the knowledge network of domain-paper-domain (FPF). Figure 3 The dotted line shows that the paper entities (P nodes) with common domain attributes are effectively integrated into the domain community.
[0073] Community partitioned subgraph: for node type , by extracting its corresponding homogeneous community The set of all nodes and their homogeneous co-occurring neighbor nodes in , from the original image Constructing subgraph structure , where the vertex set By community elements With neighboring nodes Union composition, edge set Integrates community connections Interconnect edges with neighbors , the set of all homogeneous subgraphs constructed by repeating this process for each node type is .like Figure 4 The community partitioning visualization shown here demonstrates a structured partitioning paradigm for homogeneous community subgraphs. Its core features are as follows: the author community, extending from the neighborhood of node A, fully constructs a composite topological structure based on the direct collaboration network (AA) and the second-degree collaborative network (APA), forming a knowledge collaboration graph consisting of author nodes, paper nodes, and their associated edges. The paper community, while preserving paper co-occurrence relationships (PP), deeply integrates the multi-dimensional relationships of the co-author network (PAP) and the subject clustering network (PFP), constructing a three-dimensional integrated network encompassing knowledge subjects, carriers, and classifications. The field community, with the subject ontology (FF) as its core, extends the boundaries of academic resources through the field knowledge penetration path (FPF), forming a dynamic mapping system between disciplinary concepts and research results. This structural characteristic verifies that the meta-path-guided community partitioning mechanism in heterogeneous academic networks can effectively maintain the topological integrity of domain knowledge.
[0074] In this embodiment, when generating a subgraph set of a heterogeneous graph based on the community division rule, each subgraph Regularization constraints are implemented independently to optimize the quality of subgraph generation, specifically:
[0075] Using the spectral graph theory method, the cohesion and connectivity of the subgraph are balanced by the trace constraint of the Laplace matrix. For subgraph The normalized Laplace matrix of ,in, represents the node feature matrix, represents the trace of the Laplacian matrix, represents the transpose of the matrix, represents the set of real numbers, Representing a subgraph The node set of Represents the feature vector dimension.
[0076] In this embodiment, step S2 is specifically as follows:
[0077] According to the subgraph node set For nodes in heterogeneous graphs The original attribute characteristics Rearrange the index to get the initial feature matrix ,in, Representation node The initial eigenvector of represents the transpose of the matrix, represents the set of real numbers, Indicates the subgraph size, represents the feature vector dimension;
[0078] Mapping functions by predefined node types Align the feature matrix, specifically: The node collection in Perform feature slicing operations to generate an initial feature matrix of a specific type ,in, Indicates the number of nodes, Indicates the node type subscript, Representation node The initial eigenvector of
[0079] In the feature transfer process of heterogeneous graph neural network, the feature matrix is iteratively updated between different layers. The output of the layer network is ,in is the activation function, are learnable weights, is the bias term, Indicates the Layer network output;
[0080] Perform type projection operation on the inter-layer propagation of heterogeneous graph neural network to extract the subgraph feature matrix of each layer ,in, Indicates that the node type is All nodes in The feature representation vector of the layer, Represents the neural network layer, Represents the subgraph feature matrix output by the entire heterogeneous graph neural network;
[0081] The type of projection operation is specifically: The corresponding feature submatrix , filter operators by type Extract the type features of the current layer, namely the subgraph feature matrix :
[0082]
[0083] in, Indicates the Layer network nodes The corresponding eigenvector.
[0084] In this embodiment, the designed MMD loss function is specifically:
[0085] For the initial feature matrix Perform multi-layer feature propagation to obtain the post-processing feature matrix ;in, Indicates the layer 0 network The feature representation vector of each node, represents the set of real numbers, Indicates the number of nodes, represents the feature vector dimension, Indicates the Layer Network The feature representation vector of each node, Represents the transpose of a matrix;
[0086] Through the kernel function A reproducing kernel Hilbert space is established, and the expected value of the internal kernel matrix of the initial feature matrix and the internal cohesion measure of the post-processing feature matrix are calculated in the reproducing kernel Hilbert space. The calculation formula of the expected value of the internal kernel matrix of the initial feature matrix is:
[0087]
[0088] in, represents the expected value of the internal kernel matrix of the initial feature matrix, and Indicates that the network is at layer 0. and The eigenvectors of the two nodes, , , represents the kernel function;
[0089] The calculation formula of the internal cohesion measure of the post-processing feature matrix is:
[0090]
[0091] in, represents the internal cohesion measure of the post-processed feature matrix, and Indicates in layer network, and The eigenvectors of the two nodes;
[0092] Construct the cross kernel matrix of the initial feature matrix and the post-processing feature matrix, and then calculate the expected similarity between samples across stages:
[0093]
[0094] in, It represents the expected similarity between samples across stages, which captures the correlation level between the original information and the transformed information during feature transfer. The value range depends on the properties of the kernel function and the hyperparameter settings.
[0095] According to the expected value of the internal kernel matrix of the initial feature matrix, the internal cohesion measure of the post-processing feature matrix, and the similarity expectation between samples across stages, the MMD loss function is constructed by squared deviation:
[0096]
[0097] in, Represents MMD loss, and its geometric meaning can be interpreted as: in the reproducing kernel Hilbert space, the square of the distance between the mean vectors of two types of distributions is equal to the sum of their respective self-similarity minus twice the mutual similarity. In the embodiment of the present invention, the radial basis function is used as the kernel function (Gaussian kernel), which is expressed as:
[0098]
[0099] in, Represents a vector and vector A function of the distance between Indicates the natural base The exponential function with base , represents the bandwidth parameter, which is adaptively determined using the median heuristic method, taking the median of the Euclidean distances of all sample pairs as the parameter baseline. This measurement method has three significant advantages: first, it allows for nonparametric testing without assuming the data distribution; second, it effectively handles similarity calculations in high-dimensional feature spaces through kernel techniques; and third, it maintains translation invariance, avoiding measurement bias caused by coordinate system changes. At the algorithmic implementation level, block matrix calculation techniques are used to reduce spatial complexity, ensuring that this method can be scalable to large-scale community feature analysis scenarios.
[0100] In this embodiment, the composite loss function is:
[0101]
[0102] in, represents the compound loss, represents the supervision label set, represents the cross entropy loss function, Represents the loss function part of the downstream task, Indicates the correct value. represents the predicted value, represents the learnable regularization coefficient, represents a subgraph, represents a subgraph set, Represents the MMD loss function value of the subgraph G; the composite loss function formula realizes the balance between task-driven optimization and structural order-preserving constraints. The former ensures the performance of the model on specific downstream tasks, and the latter maintains the topological characteristics of the graph by forcing the consistency of the subgraph feature distribution.
[0103] The formula for updating the parameters of the heterogeneous graph neural network by gradient reversal is:
[0104]
[0105] in, represents the weight matrix of the heterogeneous graph neural network, Indicates assignment, represents the partial differential parameter, Represents the partial differential symbol.
[0106] Example 2:
[0107] Based on Example 1, the embodiment of the present invention conducts OGB academic graph benchmark testing and verification. This solution has significant advantages, and the experimental results are shown in Table 1.
[0108] Table 1 OGB academic graph benchmark verification results
[0109]
[0110] Experiments show that this method can significantly improve GNNs in terms of structural stability, training efficiency, and interpretability. In terms of structural stability, feature drift within communities was reduced by 32.7% (p < 0.01). In terms of training efficiency, the proposed method achieved a 75.3% convergence speedup on a graph with tens of millions of nodes. In terms of interpretability, t-SNE visualization showed that the proposed method improved the clarity of GNN subject boundaries by 2.3 times.
[0111] Example 3:
[0112] Based on Example 1, an embodiment of the present invention provides a heterogeneous graph neural network training system based on community consistency, which is used to configure and execute a heterogeneous graph neural network training method based on community consistency in Example 1. The system includes:
[0113] A topology-aware subgraph generation module, which is used to generate a subgraph set of a heterogeneous graph based on community partitioning rules;
[0114] The feature drift monitoring module is used to extract the node feature matrix of each subgraph in the subgraph set, slice each node feature matrix to obtain the subgraph feature matrix aligned with the input, and design the MMD loss function;
[0115] The adaptive regularization control module is used to construct a composite loss function based on the MMD loss function, and update the parameters of the heterogeneous graph neural network through gradient reversal to complete the training of the heterogeneous graph neural network.
[0116] In this embodiment, an electronic device is also provided, including a memory, a processor, and a computer program stored on the memory and running on the processor, and the processor executes the program to implement part or all of the steps of the community consistency-based heterogeneous graph neural network training method as described in Example 1.
[0117] In this embodiment, the electronic device may include: a processor, a memory, a bus and a communication interface. The processor, the communication interface and the memory are connected through a bus. The memory stores a computer program that can be run on the processor. When the processor runs the computer program, it executes part or all of the steps of the community consistency-based heterogeneous graph neural network training method provided in the aforementioned embodiment 1 of this application.
[0118] The system in the embodiment of the present invention can also be a computer-readable storage medium, which stores a computer program. When the computer program is executed, some or all steps of the community consistency-based heterogeneous graph neural network training method as described in Example 1 are implemented.
[0119] The program code for implementing the method of the present invention can be written in any combination of one or more programming languages. Such program code can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device so that when the program code is executed by the processor or controller, the functions / operations specified in the flow chart and / or block diagram are implemented. The program code can be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0120] In the context of the present invention, machine-readable medium can be a tangible medium that can contain or store a program for use with an instruction execution system, device or equipment or used in combination with an instruction execution system, device or equipment. Machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. Machine-readable medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. More specific examples of machine-readable storage media can include electrical connections based on one or more lines, portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), optical fibers, portable compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0121] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0122] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), and the Internet.
[0123] A computer system may include a client and a server. The client and server are generally remote from each other and typically interact through a communication network. The client-server relationship arises through computer programs running on the respective computers and having a client-server relationship with each other. The server may be a cloud server, a server in a distributed system, or a server integrated with a blockchain.
[0124] Those skilled in the art will appreciate that the embodiments described herein are intended to help readers understand the principles of the present invention, and it should be understood that the scope of protection of the present invention is not limited to such specific descriptions and embodiments. Those skilled in the art can make various other specific variations and combinations based on the technical teachings disclosed in the present invention without departing from the essence of the present invention, and such variations and combinations are still within the scope of protection of the present invention.
Claims
1. A heterogeneous graph neural network training method based on community consistency, characterized by: The following steps are involved: Generate a subgraph set of a heterogeneous graph based on community division rules; Extract the node feature matrix of each subgraph in the subgraph set, slice each node feature matrix to obtain the subgraph feature matrix aligned with the input, and design the MMD loss function; A composite loss function is constructed based on the MMD loss function, and the heterogeneous graph neural network parameters are updated through gradient reversal to complete the heterogeneous graph neural network training; the subgraph set of the heterogeneous graph is generated based on the community division rule, specifically: According to the heterogeneous graph A collection of node types Establish a homogeneous community division system and classify node types , and its corresponding homogeneous community is , and then get the complete community set ,in, represents a set of heterogeneous graph vertices, represents an edge set; the heterogeneous graph is an academic network heterogeneous graph, and the node types include author nodes, paper nodes, and research field nodes; Constructing a homogeneous node set , and then a homogeneous community is obtained through two-step neighborhood expansion The set of common neighbor nodes ,in, represents a set of vertices in a homogeneous set of nodes, Represents the node type mapping function, Edges representing common neighbors across classes of nodes of the same class; Based on the common neighbor node set Constructing a subgraph A collection of nodes ; Based on the common neighbor node set Constructing a subgraph The edge set ,in, Represents the homogeneous edges within the community, , Represents heterogeneous edges across types, with ,in, represents the edge type mapping function, represents homogeneous edges, represents heterogeneous edges; Complete the construction of node sets and edge sets of all subgraphs to obtain the subgraph set ; The composite loss function is: in, represents the compound loss, represents the supervision label set, represents the cross entropy loss function, Represents the loss function part of the downstream task, Indicates the correct value, represents the predicted value, represents the learnable regularization coefficient, represents a subgraph, represents a subgraph set, Represents the MMD loss function value of the subgraph G.
2. The method for training heterogeneous graph neural networks based on community consistency according to claim 1 is characterized in that: When generating a subgraph set of a heterogeneous graph based on the community division rule, Regularization constraints are implemented independently to optimize the quality of subgraph generation, specifically: Using the spectral graph theory method, the cohesion and connectivity of the subgraph are balanced by the trace constraint of the Laplace matrix. For subgraph The normalized Laplace matrix of ,in, represents the node feature matrix, represents the trace of the Laplace matrix, the superscript represents the transpose of the matrix, represents the set of real numbers, Representing a subgraph The node set of Represents the feature vector dimension.
3. The method for training heterogeneous graph neural networks based on community consistency according to claim 1, characterized in that: The node feature matrix of each subgraph in the subgraph set is extracted, and a slicing operation is performed on each node feature matrix to obtain a subgraph feature matrix aligned with the input, specifically: According to the subgraph node set For nodes in heterogeneous graphs The original attribute characteristics Rearrange the index and then use the predefined node type mapping function Align the feature matrix, specifically: The node collection in Perform feature slicing operations to generate an initial feature matrix of a specific type ,in, Indicates the number of nodes, Indicates the node type subscript, Representation node The initial eigenvector of The initial feature matrix Input into the heterogeneous graph neural network, it is iteratively updated through different levels in turn. The output of the layer network is ,in is the activation function, are learnable weights, is the bias term, Represents the first Layer network output, when When the value is 1, the 0th layer network output of the heterogeneous graph neural network , represents the set of real numbers, represents the feature vector dimension; Perform type projection operation on the inter-layer propagation of heterogeneous graph neural network to extract the first Subgraph feature matrix of layer network .
4. The method for training heterogeneous graph neural networks based on community consistency according to claim 3 is characterized in that: The type of projection operation is specifically: The corresponding feature submatrix , filter operators by type Extract the sub-graph feature matrix of the current layer : in, Indicates the Layer network nodes The corresponding eigenvector.
5. The method for training heterogeneous graph neural networks based on community consistency according to claim 3 is characterized in that: The designed MMD loss function is specifically: Through the kernel function Establish a reproducing kernel Hilbert space and calculate the initial characteristic matrix in the reproducing kernel Hilbert space The expected value of the internal kernel matrix and the internal cohesion measure of the post-processing feature matrix; the post-processing feature matrix is ; Constructing the initial feature matrix and post-processing feature matrix The cross-kernel matrix is then used to calculate the expected similarity between samples across stages; According to the expected value of the internal kernel matrix of the initial feature matrix, the internal cohesion measure of the post-processed feature matrix and the expected similarity between samples across stages, the MMD loss function is constructed by squared deviation.
6. The method for training heterogeneous graph neural networks based on community consistency according to claim 5, characterized in that: The calculation formula of the expected value of the internal kernel matrix of the initial feature matrix is: in, represents the expected value of the internal kernel matrix of the initial feature matrix, and Indicates that the network is at layer 0. and The eigenvectors of the two nodes, , , represents the kernel function; The calculation formula of the internal cohesion measure of the post-processing feature matrix is: in, represents the internal cohesion measure of the post-processed feature matrix, and Indicates in layer network, and The eigenvectors of the two nodes; The calculation formula for the expected similarity between samples across stages is: in, Represents the expected similarity between samples across stages; The calculation formula of the MMD loss function is: in, represents the MMD loss.
7. A heterogeneous graph neural network training system based on community consistency, characterized by: include: A topology-aware subgraph generation module, which is used to generate a subgraph set of a heterogeneous graph based on community partitioning rules; The subgraph set of the heterogeneous graph generated based on the community division rule is specifically: According to the heterogeneous graph A collection of node types Establish a homogeneous community division system and classify node types , and its corresponding homogeneous community is , and then get the complete community set ,in, represents a set of heterogeneous graph vertices, Represents an edge set; the heterogeneous graph is an academic network heterogeneous graph, and the node types include author nodes, paper nodes, and research field nodes; construct a homogeneous node set , and then a homogeneous community is obtained through two-step neighborhood expansion The set of common neighbor nodes ,in, represents a set of vertices in a homogeneous set of nodes, Represents the node type mapping function, Edges representing common neighbors across classes of nodes of the same class; Based on the common neighbor node set Constructing a subgraph A collection of nodes ; Based on the common neighbor node set Constructing a subgraph The edge set ,in, Represents the homogeneous edges within the community, , Represents heterogeneous edges across types, with ,in, represents the edge type mapping function, represents homogeneous edges, represents heterogeneous edges; Complete the construction of node sets and edge sets of all subgraphs to obtain the subgraph set ; The feature drift monitoring module is used to extract the node feature matrix of each subgraph in the subgraph set, slice each node feature matrix to obtain the subgraph feature matrix aligned with the input, and design the MMD loss function; Adaptive regularization control module, which is used to construct a composite loss function based on the MMD loss function and update the parameters of the heterogeneous graph neural network through gradient reversal to complete the training of the heterogeneous graph neural network; The composite loss function is: in, represents the compound loss, represents the supervision label set, represents the cross entropy loss function, Represents the loss function part of the downstream task, Indicates the correct value. represents the predicted value, represents the learnable regularization coefficient, represents a subgraph, represents a subgraph set, Represents the MMD loss function value of the subgraph G.
8. A computer-readable storage medium, characterized in that The storage medium stores computer instructions. In response to the computer reading the computer instructions in the storage medium, the computer executes the community consistency-based heterogeneous graph neural network training method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Node classification method based on heterogeneous information network few-sample learning
CN114239711A
Non-supervision community detection method and device based on heterogeneous network, equipment and medium
CN117390470A