Node classification method and device based on multi-granularity graph comparative learning
By introducing multi-grained spatial structure and comparison learning methods in graph comparison learning, optimizing node embedding representation solves the problem of large graph comparison learning time and memory overhead in the existing technology, and improving the efficiency and model performance of node classification.
Patent Information
- Application Number
- CN202411931333.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-26
- Publication Date
- 2025-04-29
- Estimated Expiration
- 2044-12-26
AI Technical Summary
The existing graph comparison learning method performs extensive node comparisons on the entire original graph, resulting in large time and memory overhead, and failure to effectively consider the connection between information in different layers, resulting in poor model performance.
A node classification method based on multi-grain size graph comparison learning is proposed. Through the multi-grain size space construction module and the multi-grain size comparison learning module, the adjacency matrix is updated in combination with node attributes, and a hierarchical multi-grain size spatial structure is constructed, and the node embedding representation is optimized through the coarse-grained layer for the coarse-grained layer and the coarse-grained layer for the finer-grained layer.
It effectively reduces the time cost of graph comparison learning, improves the efficiency of node classification, and improves the performance of the model by considering the connection between information of different layers.
Smart Images

Figure CN119357782B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of graph comparative learning, and in particular to a node classification method and device based on multi-granularity graph comparative learning. Background Art
[0002] Graph neural networks (GNNs) are designed to learn low-dimensional vector representations of each node in the graph through recursive message passing and aggregation mechanisms between nodes, which have shown excellent performance in various machine learning tasks such as node classification, link prediction, and chemical molecule prediction. Usually GNNs rely heavily on a large amount of manually labeled data to define and optimize learning objectives, however, this labeled information is usually expensive or difficult to obtain, which limits the application of GNNs.
[0003] Graph Self-Supervised Learning (GSSL) has been extensively studied, inspired by the success of self-supervised learning in the fields of computer vision (CV) and natural language processing (NLP). The core idea of Graph Self-Supervised Learning is to extract supervisory information from unlabeled graph data using pre-training tasks, and then train the encoder based on this supervisory information to learn valuable representations for downstream tasks. GSSL can be divided into two categories: graph contrastive learning and graph generative learning.
[0004] Graph contrastive learning has become a promising trend in graph self-supervised learning. It measures the similarity between positive and negative samples, bringing the representations of similar positive samples closer together while pushing the representations of different negative samples further apart. Therefore, the construction of positive and negative samples and the calculation of similarity are crucial to the success of graph contrastive learning (GCL).
[0005] However, existing graph comparative learning methods require extensive node comparison on the entire original graph, which consumes a lot of time and memory overhead. In addition, existing methods process the information of each layer separately without considering the connection between information of different layers, and the trained model performs poorly. Summary of the invention
[0006] The present application aims to solve one of the technical problems in the related art at least to some extent.
[0007] To this end, the first purpose of this application is to propose a node classification method based on multi-granularity graph comparative learning, which effectively reduces the time cost of graph comparative learning while ensuring the performance of graph comparative learning and improves the efficiency of node classification.
[0008] The second objective of the present application is to propose a node classification device based on multi-granularity graph comparative learning.
[0009] To achieve the above objectives, the first embodiment of the present application proposes a node classification method based on multi-granularity graph comparative learning, including:
[0010] Obtain graph structure data and preprocess the graph structure data;
[0011] The preprocessed graph structure data is input into the graph contrast learning model to obtain the graph node embedding representation. The graph contrast learning model includes a multi-granularity space construction module and a multi-granularity contrast learning module. The multi-granularity space construction module updates the adjacency matrix in combination with node attributes and uses a coarsening method to construct a coarse-grained graph that integrates attribute information. A hierarchical multi-granularity space structure is constructed based on the original graph and the coarsening graph. The multi-granularity graph includes the original graph and the coarsening graph. The coarse-grained map obtained ,The multi-granularity contrastive learning module obtains the optimized node embedding representation through the contrastive learning method of the coarsest granularity layer to the coarsest granularity layer and the coarsest granularity layer to the finer granularity layer;
[0012] Node classification is performed based on the graph node embedding representation to obtain the classification results.
[0013] Optionally, in one embodiment of the present application, the graph structure data is represented as:
[0014]
[0015] in, express A collection of nodes, express The collection of edges, represents the node feature matrix;
[0016] Preprocess the graph structure data, including:
[0017] Normalize the node features;
[0018] Convert the directed edges in the graph structure data into undirected edges.
[0019] Optionally, in one embodiment of the present application, the multi-granularity space construction module is specifically used to:
[0020] Integrate the node attribute information into the adjacency matrix to generate an adjacency matrix integrating the attribute information;
[0021] Use the coarsening technique to iteratively process the adjacency matrix of the fused attribute information to construct a coarse-grained graph of the fused attribute information;
[0022] A hierarchical multi-granularity spatial structure is constructed based on the original image and each layer of coarse-grained image;
[0023] Among them, updating the adjacency matrix includes:
[0024] Use the K-means algorithm to cluster nodes based on their features and calculate the similarity between nodes of the same type.
[0025] The similarity between nodes is combined with the adjacency matrix to form a new adjacency matrix;
[0026] The coarsening technique is used to iteratively process the adjacency matrix of the fused attribute information to construct a coarse-grained graph of the fused attribute information, including:
[0027] Pair conduct The coarse-grained image obtained by the second coarsening is:
[0028]
[0029] in, express A collection of nodes, express The collection of edges, Represents the node feature matrix of the coarse graph after m times of coarsening; A more fine-grained picture is ;
[0030] Based on the original image and each layer of coarse-grained image, a hierarchical multi-granularity spatial structure is constructed, including:
[0031] Based on the original image and coarse-grained graph Forming a hierarchical multi-granularity spatial structure.
[0032] Optionally, in one embodiment of the present application, the multi-granularity contrast learning module is specifically used to:
[0033] Input the multi-granularity graph into the neural network learning model to form node embedding of the multi-granularity graph, and perform contrastive learning of the coarsest-granularity layer against the coarsest-granularity layer and contrastive learning of the coarsest-granularity layer against the finer-granularity layer based on the node embedding of the multi-granularity graph, and train the model according to the graph contrastive learning loss;
[0034] Input the original image into the converged model and use the output of the model as the optimized node embedding representation;
[0035] Among them, the contrastive learning of the coarsest-grained layer to the coarsest-grained layer is carried out, including:
[0036] For the coarsest-grained graph Every node on Calculate the most similar node set and use the student-teacher model for linear comparison to calculate the loss, recorded as loss 1;
[0037] Conduct comparative learning of the coarsest-grained layer against the finer-grained layers, including:
[0038] The coarsest-grained layer After refinement and finer-grained layers Perform contrastive learning to calculate the loss and record it as loss 2;
[0039] The model is trained based on graph contrastive learning loss, including:
[0040] Optimize the neural network learning model according to loss 1 and loss 2 until the model converges.
[0041] To achieve the above-mentioned purpose, the second embodiment of the present application proposes a node classification device based on multi-granularity graph comparative learning, including:
[0042] A data acquisition module is used to acquire graph structure data and preprocess the graph structure data;
[0043] The graph contrast learning module is used to input the preprocessed graph structure data into the graph contrast learning model to obtain the graph node embedding representation. The graph contrast learning model includes a multi-granularity space construction module and a multi-granularity contrast learning module. The multi-granularity space construction module updates the adjacency matrix in combination with the node attributes, and uses a coarsening method to construct a coarse-grained graph that integrates the attribute information. A hierarchical multi-granularity space structure is constructed based on the original graph and the coarsening graph. The multi-granularity graph includes the original graph and the coarsening graph. The coarse-grained map obtained ,The multi-granularity contrastive learning module obtains the optimized node embedding representation through the contrastive learning method of the coarsest granularity layer to the coarsest granularity layer and the coarsest granularity layer to the finer granularity layer;
[0044] The node classification module is used to classify nodes based on the graph node embedding representation to obtain classification results.
[0045] Optionally, in one embodiment of the present application, the graph structure data is represented as:
[0046]
[0047] in, express A collection of nodes, express The collection of edges, represents the node feature matrix;
[0048] Preprocess the graph structure data, including:
[0049] Normalize the node features;
[0050] Convert the directed edges in the graph structure data into undirected edges.
[0051] Optionally, in one embodiment of the present application, the multi-granularity space construction module is specifically used to:
[0052] Integrate the node attribute information into the adjacency matrix to generate an adjacency matrix integrating the attribute information;
[0053] Use the coarsening technique to iteratively process the adjacency matrix of the fused attribute information to construct a coarse-grained graph of the fused attribute information;
[0054] A hierarchical multi-granularity spatial structure is constructed based on the original image and each layer of coarse-grained image;
[0055] Among them, updating the adjacency matrix includes:
[0056] Use the K-means algorithm to cluster nodes based on their features and calculate the similarity between nodes of the same type.
[0057] The similarity between nodes is combined with the adjacency matrix to form a new adjacency matrix;
[0058] The coarsening technique is used to iteratively process the adjacency matrix of the fused attribute information to construct a coarse-grained graph of the fused attribute information, including:
[0059] Pair conduct The coarse-grained image obtained by the second coarsening is:
[0060]
[0061] in, express A collection of nodes, express The collection of edges, Represents the node feature matrix of the coarse graph after m times of coarsening; A more fine-grained picture is ;
[0062] Based on the original image and each layer of coarse-grained image, a hierarchical multi-granularity spatial structure is constructed, including:
[0063] Based on the original image and coarse-grained graph Forming a hierarchical multi-granularity spatial structure.
[0064] Optionally, in one embodiment of the present application, the multi-granularity contrast learning module is specifically used to:
[0065] Input the multi-granularity graph into the neural network learning model to form node embedding of the multi-granularity graph, and perform contrastive learning of the coarsest-granularity layer against the coarsest-granularity layer and contrastive learning of the coarsest-granularity layer against the finer-granularity layer based on the node embedding of the multi-granularity graph, and train the model according to the graph contrastive learning loss;
[0066] Input the original image into the converged model and use the output of the model as the optimized node embedding representation;
[0067] Among them, the contrastive learning of the coarsest-grained layer to the coarsest-grained layer is carried out, including:
[0068] For the coarsest-grained graph Every node on Calculate the most similar node set and use the student-teacher model for linear comparison to calculate the loss, recorded as loss 1;
[0069] Conduct comparative learning of the coarsest-grained layer against the finer-grained layers, including:
[0070] The coarsest-grained layer After refinement and finer-grained layers Perform contrastive learning to calculate the loss and record it as loss 2;
[0071] The model is trained based on graph contrastive learning loss, including:
[0072] Optimize the neural network learning model according to loss 1 and loss 2 until the model converges.
[0073] The node classification method and device based on multi-granularity graph comparative learning of the embodiments of the present application use the paradigm of comparative learning between graphs at different levels in a multi-granularity space, provide new ideas for graph comparative learning, and apply the simulation prediction method to the model, so that the training time of the model is short and the memory consumption is low.
[0074] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0075] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:
[0076] Figure 1 A schematic diagram of a process flow of a node classification method based on multi-granularity graph comparative learning provided in Example 1 of the present application;
[0077] Figure 2 This is a diagram of the structure of a graph comparison learning model in an embodiment of the present application;
[0078] Figure 3A schematic diagram of the structure of a node classification device based on multi-granularity graph comparative learning provided in an embodiment of the present application. DETAILED DESCRIPTION
[0079] Embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present application, and should not be construed as limiting the present application.
[0080] Definition: Input an undirected graph network ,in express A collection of nodes, express A collection of edges. Represents a node, Represents two nodes and The edge between. Represents the node feature matrix. represents the coarsest-grained graph, Indicates A more fine-grained graph.
[0081] Based on the above definition, the problem that this application needs to solve can be formally defined as: 1. Comparison and 1. What kind of information should be collected and how to compare them; 2. How to predict the results that the current model may produce.
[0082] In order to avoid extensive node comparison on the original graph, this application uses a coarsening method to reduce the size of the graph and proposes to The nodes in The proposed method adopts a paradigm of comparing nodes in graphs to introduce hierarchical information into graph contrastive learning. It also uses the predicted information to train the current model, which shortens the training time of the model and reduces the memory consumption.
[0083] The following describes a node classification method and device based on multi-granularity graph comparative learning according to an embodiment of the present application with reference to the accompanying drawings.
[0084] Figure 1 A flowchart of a node classification method based on multi-granularity graph comparative learning provided in Example 1 of the present application.
[0085] like Figure 1 As shown, the node classification method based on multi-granularity graph contrast learning includes the following steps:
[0086] Step 101, obtaining graph structure data and preprocessing the graph structure data;
[0087] In this embodiment, the graph structure data obtained is: ;
[0088] In this embodiment, the data preprocessing process includes:
[0089] Graph data processing and data partitioning; normalize node features; if the edges in the data set are directed edges, convert all directed edges to undirected edges.
[0090] Step 102, input the preprocessed graph structure data into the graph contrast learning model to obtain the graph node embedding representation, wherein the graph contrast learning model includes a multi-granularity space construction module and a multi-granularity contrast learning module, the multi-granularity space construction module updates the adjacency matrix in combination with the node attributes, and uses a coarsening method to construct a coarse-grained graph that integrates the attribute information, and constructs a hierarchical multi-granularity space structure based on the original graph and the coarsening graph, and the multi-granularity graph includes the original graph and the coarsening graph. The coarse-grained map obtained ,The multi-granularity contrastive learning module obtains the optimized node embedding representation through the contrastive learning method of the coarsest granularity layer to the coarsest granularity layer and the coarsest granularity layer to the finer granularity layer;
[0091] In this embodiment, Figure 2 This is the structural diagram of the graph contrast learning model, such as Figure 2 As shown in Figure 2, the process of using the graph contrast learning model to generate graph node embedding representations includes:
[0092] (1) Constructing a multi-granularity spatial structure
[0093] The multi-granularity space construction module combines node attributes to update the adjacency matrix, so that the coarsening technique based on the adjacency matrix of the fused attribute information can construct a new graph that fused the attribute information; the original graph and the constructed coarse-grained graph form a hierarchical multi-granularity space structure. Specifically, the multi-granularity space construction module uses the k-means method on the original graph to cluster according to node features and calculate the similarity between nodes in the same class; the similarity between nodes is fused with the adjacency matrix to form a new adjacency matrix; based on the above adjacency matrix, the graph coarsening technique is used to form a multi-granularity space structure.
[0094] The process specifically includes:
[0095] 1) Calculate the similarity between nodes; first use the k-means algorithm according to the feature matrix , is the number of nodes in the original graph, is the dimension of node features, the nodes are clustered, and the result is expressed as , is the number of categories after clustering, and the attribute similarity between nodes belonging to the same category is calculated by the following formula , the attribute similarity between nodes of different classes is set to 0,
[0096]
[0097] in, and Is a node and nodes The node characteristics of Represents modulo operation;
[0098] 2) Update the adjacency matrix; in the original image The default weight of the edge is 1, and the node and nodes The weight between , updated by The weight of each edge in :
[0099]
[0100] 3) Construct a multi-granularity graph; To construct a multi-granularity space, a loop is required Specifically, in Figure The Louvain algorithm is used to coarsen multiple similar nodes into the same community, which is expressed as , is the number of communities after coarsening, and each community is constructed as a coarse node , coarse node and One-to-one correspondence, and the mapping matrix is obtained based on the mapping relationship between nodes and communities , and then use the following formula to calculate the coarse-grained graph The weight of the edge between the nodes is calculated at the end Node features ;
[0101]
[0102] in, express The adjacency matrix of express Midpoint and nodes The weight between
[0103]
[0104] in, , The dimension is .
[0105] (2) Graph Contrastive Learning in Multi-granularity Spaces
[0106] This part includes the contrastive learning method between the coarsest-grained layer and the coarsest-grained layer and the contrastive learning method between the coarsest-grained layer and the finer-grained layer. The specific steps are to input the multi-granularity space constructed in the multi-granularity space construction phase into the neural network learning model to form node embedding, and finally obtain the final node embedding of this model after a short training with a small number of iterations to obtain a node representation with better performance. The proposed multi-granularity contrastive learning provides a new idea for graph contrastive learning.
[0107] Specifically, the process includes:
[0108] 1) Node embedding: embedding the coarsest-grained graph Input to the encoder and encoder Learning node embeddings and , and then Input to encoder Learning node embeddings , as shown below:
[0109]
[0110]
[0111]
[0112] 2) Contrastive learning in multi-granularity space: First, to achieve contrastive learning on coarse-grained graphs, it is necessary to calculate the node Specifically, by calculating the feature matrix based on the coarse-grained graph The similarity matrix ; Select the first Similar nodes as the most similar node set of the node , and the set of neighbor nodes of this node Find the intersection and get the node The positive sample set , as shown below:
[0113]
[0114] Secondly, in order to achieve contrastive learning between multiple granularities, it is necessary to transform Node embedding scale, making it as large as The same, with the help of the mapping matrix , through the following formula, Transformed to , The dimension is ;
[0115]
[0116] in, is the embedding dimension;
[0117] The graph contrastive learning loss of the graph contrastive learning model consists of two: one is the contrastive learning loss of the coarsest layer to the coarsest layer, and the other is the contrastive learning loss of the coarsest layer and the finer layer: the contrastive learning loss on the coarse-grained graph needs to be consistent with the predictor. Combined, use the prediction results to further train the encoder . Embed the node As a predictor The input produces output, and the output result is recorded as , calculate the cosine similarity between the two as the contrastive learning loss on the coarse-grained graph; the contrastive learning loss between multi-grained graphs will be Node Embedding with Sub-Coarse-Grained Graphs Compare and calculate the loss.
[0118] For the two types of contrastive learning, the BYOL structure is used for contrastive learning on coarse-grained graphs, and InfoNCE is used as the loss function for contrastive learning between multiple granularities. The loss between positive samples and target nodes on coarse-grained graphs and the loss between nodes in multiple granularities are shown below:
[0119]
[0120]
[0121] in, ;
[0122] 3) Encoder optimization: The loss of contrastive learning between the coarsest layer and the coarsest layer and the loss of contrastive learning between the coarsest layer and the finer layer are integrated through weight parameters, and the Adam algorithm is used to minimize the objective function To optimize the encoder The objective function calculation formula is as follows:
[0123]
[0124] in, , are the weight parameters that control the loss of the contrastive learning of the coarsest layer against the coarsest layer and the loss of the contrastive learning of the coarsest layer and the finer layer respectively; after training the contrastive learning module multiple times until convergence, the final aggregation matrix of the module is This is the final learned graph node embedding representation matrix.
[0125] Step 103: perform node classification based on the graph node embedding representation to obtain a classification result.
[0126] In this embodiment, the final aggregation matrix By inputting it into the predictor, you can get node classification results with higher accuracy.
[0127] The node classification method based on multi-granularity graph comparative learning in the embodiment of the present application proposes a similarity measurement method within the same clustering result, only calculates the similarity between nodes in the same class after clustering, and sets the similarity between nodes of different classes to 0; considers comparing information between different layers to improve model performance, specifically, by comparing the information between coarsened graphs of different degrees to calculate the error, thereby improving model performance; uses the error detection method generated by refinement, obtains a refined adjacency matrix of the same scale as a finer-grained graph adjacency matrix by operating the coarsening matrix M with the coarsening matrix, and calculates the similarity between the refined adjacency matrix and the fine-grained graph adjacency matrix, and uses the InfoNCE formula to calculate the error; uses the predicted state to adjust the current state, obtains the predicted result by using a simple prediction method, and uses the predicted result to guide the current work. For example, the model is used to calculate the node representation Z of the coarsest-grained graph, and a possible result S of the node prediction is obtained by linear calculation, and the cosine similarity between S and Z is calculated as the loss, and the model is adjusted by reducing the loss.
[0128] Table 1
[0129]
[0130] As shown in Table 1, the present application consumes the least amount of time on each data set. Compared with previous methods, the time overhead of the present application is greatly reduced. In terms of performance, the present application is comparable to other methods, and even improves on some data sets, which shows the powerful performance of the present application.
[0131] In order to implement the above embodiment, the present application also proposes a node classification device based on multi-granularity graph comparative learning.
[0132] Figure 3 A schematic diagram of the structure of a node classification device based on multi-granularity graph comparative learning provided in an embodiment of the present application.
[0133] like Figure 3 As shown, the node classification device based on multi-granularity graph contrast learning includes:
[0134] A data acquisition module is used to acquire graph structure data and preprocess the graph structure data;
[0135] The graph contrast learning module is used to input the preprocessed graph structure data into the graph contrast learning model to obtain the graph node embedding representation. The graph contrast learning model includes a multi-granularity space construction module and a multi-granularity contrast learning module. The multi-granularity space construction module updates the adjacency matrix in combination with the node attributes, and uses a coarsening method to construct a coarse-grained graph that integrates the attribute information. A hierarchical multi-granularity space structure is constructed based on the original graph and the coarsening graph. The multi-granularity graph includes the original graph and the coarsening graph. The coarse-grained map obtained ,The multi-granularity contrastive learning module obtains the optimized node embedding representation through the contrastive learning method of the coarsest granularity layer to the coarsest granularity layer and the coarsest granularity layer to the finer granularity layer;
[0136] The node classification module is used to classify nodes based on the graph node embedding representation to obtain classification results.
[0137] Optionally, in one embodiment of the present application, the graph structure data is represented as:
[0138]
[0139] in, express A collection of nodes, express The collection of edges, represents the node feature matrix;
[0140] Preprocess the graph structure data, including:
[0141] Normalize the node features;
[0142] Convert the directed edges in the graph structure data into undirected edges.
[0143] Optionally, in one embodiment of the present application, the multi-granularity space construction module is specifically used to:
[0144] Integrate the node attribute information into the adjacency matrix to generate an adjacency matrix integrating the attribute information;
[0145] Use the coarsening technique to iteratively process the adjacency matrix of the fused attribute information to construct a coarse-grained graph of the fused attribute information;
[0146] A hierarchical multi-granularity spatial structure is constructed based on the original image and each layer of coarse-grained image;
[0147] Among them, updating the adjacency matrix includes:
[0148] Use the K-means algorithm to cluster nodes based on their features and calculate the similarity between nodes of the same type.
[0149] The similarity between nodes is combined with the adjacency matrix to form a new adjacency matrix;
[0150] The coarsening technique is used to iteratively process the adjacency matrix of the fused attribute information to construct a coarse-grained graph of the fused attribute information, including:
[0151] Pair conduct The coarse-grained image obtained by the second coarsening is:
[0152]
[0153] in, express A collection of nodes, express The collection of edges, Represents the node feature matrix of the coarse graph after m times of coarsening; A more fine-grained picture is ;
[0154] Based on the original image and each layer of coarse-grained image, a hierarchical multi-granularity spatial structure is constructed, including:
[0155] Based on the original image and coarse-grained graph Forming a hierarchical multi-granularity spatial structure.
[0156] Optionally, in one embodiment of the present application, the multi-granularity contrast learning module is specifically used to:
[0157] Input the multi-granularity graph into the neural network learning model to form node embedding of the multi-granularity graph, and perform contrastive learning of the coarsest-granularity layer against the coarsest-granularity layer and contrastive learning of the coarsest-granularity layer against the finer-granularity layer based on the node embedding of the multi-granularity graph, and train the model according to the graph contrastive learning loss;
[0158] Input the original image into the converged model and use the output of the model as the optimized node embedding representation;
[0159] Among them, the contrastive learning of the coarsest-grained layer to the coarsest-grained layer is carried out, including:
[0160] For the coarsest-grained graph Every node on Calculate the most similar node set and use the student-teacher model for linear comparison to calculate the loss, recorded as loss 1;
[0161] Conduct comparative learning of the coarsest-grained layer against the finer-grained layers, including:
[0162] The coarsest-grained layer After refinement and finer-grained layers Perform contrastive learning to calculate the loss and record it as loss 2;
[0163] The model is trained based on graph contrastive learning loss, including:
[0164] Optimize the neural network learning model according to loss 1 and loss 2 until the model converges.
[0165] It should be noted that the aforementioned explanation of the embodiment of the node classification method based on multi-granularity graph contrast learning is also applicable to the node classification device based on multi-granularity graph contrast learning of this embodiment, which will not be repeated here.
[0166] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example" or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, unless they are contradictory.
[0167] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In the description of this application, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.
[0168] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, fragment or portion of code comprising one or more executable instructions for implementing the steps of a custom logical function or process, and the scope of the preferred embodiments of the present application includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by technicians in the technical field to which the embodiments of the present application belong.
[0169] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in combination with these instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in combination with these instruction execution systems, devices or apparatuses. More specific examples (non-exhaustive list) of computer-readable media include the following: an electrical connection with one or more wires (electronic device), a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or processing in other suitable ways if necessary, and then stored in a computer memory.
[0170] It should be understood that the various parts of the present application can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0171] A person skilled in the art may understand that all or part of the steps in the method for implementing the above-mentioned embodiment may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.
[0172] In addition, each functional unit in each embodiment of the present application may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.
[0173] The storage medium mentioned above may be a read-only memory, a magnetic disk or an optical disk, etc. Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limiting the present application. A person of ordinary skill in the art may change, modify, replace and modify the above embodiments within the scope of the present application.
Claims
1. A node classification method based on multi-granularity graph contrast learning, characterized in that: include: Obtain graph structure data from the Coauthor-CS dataset, and preprocess the graph structure data; The preprocessed graph structure data is input into the graph contrast learning model to obtain the graph node embedding representation, wherein the graph contrast learning model includes a multi-granularity space construction module and a multi-granularity contrast learning module. The multi-granularity space construction module updates the adjacency matrix in combination with the node attributes, and uses a coarsening method to construct a coarse-grained graph that integrates the attribute information. A hierarchical multi-granularity space structure is formed based on the original graph and the coarsening graph. The multi-granularity graph includes the original graph and the coarsening graph. The coarse-grained map obtained The multi-granularity contrastive learning module obtains an optimized node embedding representation through a contrastive learning method of the coarsest granularity layer to the coarsest granularity layer and a contrastive learning method of the coarsest granularity layer to the finer granularity layer; Perform node classification based on graph node embedding representation to obtain classification results; The multi-granularity space construction module is specifically used for: Integrate the node attribute information into the adjacency matrix to generate an adjacency matrix integrating the attribute information; Use the coarsening technique to iteratively process the adjacency matrix of the fused attribute information to construct a coarse-grained graph of the fused attribute information; A hierarchical multi-granularity spatial structure is constructed based on the original image and each layer of coarse-grained image; Wherein, updating the adjacency matrix includes: Use the K-means algorithm to cluster nodes based on their features on the graph, calculate the similarity between nodes of the same class, and set the attribute similarity between nodes of different classes to 0; The similarity between nodes is combined with the adjacency matrix to form a new adjacency matrix; The method of iteratively processing the adjacency matrix of the fused attribute information using the coarsening technology to construct a coarse-grained graph of the fused attribute information includes: Pair conduct The coarse-grained image obtained by the second coarsening is: in, express A collection of nodes, express The collection of edges, Represents the node feature matrix of the coarse graph after m times of coarsening; A more fine-grained picture is ; The hierarchical multi-granularity spatial structure is formed based on the original image and each layer of coarse-grained image, including: Based on the original image and coarse-grained graph Forming a hierarchical multi-granularity spatial structure.
2. The node classification method based on multi-granularity graph contrast learning as claimed in claim 1, characterized in that: The graph structure data is represented as: in, express A collection of nodes, express The collection of edges, represents the node feature matrix; Preprocessing the graph structure data includes: Normalize the node features; Convert the directed edges in the graph structure data into undirected edges.
3. The node classification method based on multi-granularity graph contrast learning as claimed in claim 1, characterized in that: The multi-granularity contrast learning module is specifically used for: Input the multi-granularity graph into the neural network learning model to form node embedding of the multi-granularity graph, and perform contrastive learning of the coarsest-granularity layer against the coarsest-granularity layer and contrastive learning of the coarsest-granularity layer against the finer-granularity layer based on the node embedding of the multi-granularity graph, and train the model according to the graph contrastive learning loss; Input the original image into the converged model and use the output of the model as the optimized node embedding representation; The step of performing comparative learning of the coarsest-grained layer to the coarsest-grained layer includes: For the coarsest-grained graph Every node on Calculate the most similar node set and use the student-teacher model for linear comparison to calculate the loss, recorded as loss 1; Performing comparative learning of the coarsest-grained layer to the finer-grained layer includes: The coarsest-grained layer After refinement and finer-grained layers Perform contrastive learning to calculate the loss and record it as loss 2; The model is trained based on graph contrastive learning loss, including: Optimize the neural network learning model according to loss 1 and loss 2 until the model converges.
4. A node classification device based on multi-granularity graph contrast learning, characterized in that: include: A data acquisition module, used to acquire graph structure data from the Coauthor-CS dataset and preprocess the graph structure data; The graph contrast learning module is used to input the preprocessed graph structure data into the graph contrast learning model to obtain the graph node embedding representation, wherein the graph contrast learning model includes a multi-granularity space construction module and a multi-granularity contrast learning module. The multi-granularity space construction module updates the adjacency matrix in combination with the node attributes, and uses a coarsening method to construct a coarse-grained graph that integrates the attribute information. A hierarchical multi-granularity space structure is formed based on the original graph and the coarsening graph. The multi-granularity graph includes the original graph and the coarsening graph. The coarse-grained map obtained The multi-granularity contrastive learning module obtains an optimized node embedding representation through a contrastive learning method of the coarsest granularity layer to the coarsest granularity layer and a contrastive learning method of the coarsest granularity layer to the finer granularity layer; The node classification module is used to classify nodes based on the graph node embedding representation and obtain classification results; The multi-granularity space construction module is specifically used for: Integrate the node attribute information into the adjacency matrix to generate an adjacency matrix integrating the attribute information; Use the coarsening technique to iteratively process the adjacency matrix of the fused attribute information to construct a coarse-grained graph of the fused attribute information; A hierarchical multi-granularity spatial structure is constructed based on the original image and each layer of coarse-grained image; Wherein, updating the adjacency matrix includes: Use the K-means algorithm to cluster nodes based on their features on the graph, calculate the similarity between nodes of the same class, and set the attribute similarity between nodes of different classes to 0; The similarity between nodes is combined with the adjacency matrix to form a new adjacency matrix; The method of iteratively processing the adjacency matrix of the fused attribute information using the coarsening technology to construct a coarse-grained graph of the fused attribute information includes: Pair conduct The coarse-grained image obtained by the second coarsening is: in, express A collection of nodes, express The collection of edges, Represents the node feature matrix of the coarse graph after m times of coarsening; A more fine-grained picture is ; The hierarchical multi-granularity spatial structure is formed based on the original image and each layer of coarse-grained image, including: Based on the original image and coarse-grained graph Forming a hierarchical multi-granularity spatial structure.
5. The node classification device based on multi-granularity graph contrast learning as claimed in claim 4, characterized in that: The graph structure data is represented as: in, express A collection of nodes, express The collection of edges, represents the node feature matrix; Preprocessing the graph structure data includes: Normalize the node features; Convert the directed edges in the graph structure data into undirected edges.
6. The node classification device based on multi-granularity graph contrast learning as claimed in claim 4, characterized in that: The multi-granularity contrast learning module is specifically used for: Input the multi-granularity graph into the neural network learning model to form node embedding of the multi-granularity graph, and perform contrastive learning of the coarsest-granularity layer against the coarsest-granularity layer and contrastive learning of the coarsest-granularity layer against the finer-granularity layer based on the node embedding of the multi-granularity graph, and train the model according to the graph contrastive learning loss; Input the original image into the converged model and use the output of the model as the optimized node embedding representation; The step of performing comparative learning of the coarsest-grained layer to the coarsest-grained layer includes: For the coarsest-grained graph Every node on Calculate the most similar node set and use the student-teacher model for linear comparison to calculate the loss, recorded as loss 1; Performing comparative learning of the coarsest-grained layer to the finer-grained layer includes: The coarsest-grained layer After refinement and finer-grained layers Perform contrastive learning to calculate the loss and record it as loss 2; The model is trained based on graph contrastive learning loss, including: Optimize the neural network learning model according to loss 1 and loss 2 until the model converges.
Citation Information
Patent Citations
Video pedestrian re-identification method based on attention space-time diagram network
CN116797966A
False information detection method and system based on two-channel graph contrast learning
CN117609864A