Training method and device of graph neural network

Through the fusion training of masked autoencoders and contrastive learning technology, the graph neural network can simultaneously capture the local information and global information of the graph structure data, solving the problem of difficulty in obtaining the global information of the entire graph in the existing technology, and improving the graph neural network Performance in whole image processing tasks.

CN118569304APending Publication Date: 2024-08-30BEIJING OCEANBASE TECHNOLOGY CO LTD +1
View PDF 0 Cites 5 Cited by

Patent Information

Application Number
CN202410545218.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-04-30
Publication Date
2024-08-30

AI Technical Summary

Technical Problem

Existing graph neural networks have poor performance in graph processing tasks in the whole graph dimension, mainly because they can only obtain local neighborhood information and are difficult to obtain global information, resulting in limited performance in whole graph processing tasks.

Method used

Using the fusion training method of masked autoencoder and contrastive learning technology, through the shared encoder architecture, combined with the masked autoencoder module and the contrastive learning module, the mask graph data and the target graph data are used for encoding, and the node feature loss and contrast are calculated. Loss, adjust the encoder parameters until the convergence conditions are met, and realize the graph neural network's ability to perceive the global information of the entire graph.

Benefits of technology

It improves the graph neural network's ability to perceive the global information of the entire image, enhances the performance in the entire image processing task, simplifies the training algorithm process, and avoids the fusion strategy of additional embedding vectors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118569304A
    Figure CN118569304A
Patent Text Reader

Abstract

One or more embodiments of the invention provide a graph neural network training method and device, and the method achieves the fusion training of MAE and CL through a shared encoder architecture. The trained GNN can capture local information and global information of graph structure data at the same time, the perception ability of the GNN to the global information of the whole graph is improved, and then the performance of the GNN in a whole graph processing task is improved. Moreover, in the network training process, the MAE and the CL share the same encoder, an additional fusion strategy for embedding vectors is not needed, and the algorithm training process is simplified.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] One or more embodiments of the present specification relate to the field of graph data technology, and in particular, to a method and device for training a graph neural network. Background Art

[0002] Graph data is a data structure composed of nodes and edges, which is mainly used to represent complex or irregular data relationships. It is widely used in data scenarios such as social networks, knowledge graphs, and molecular structures. Graph Neural Network (GNN) is a neural network architecture designed specifically for graph data.

[0003] In practical applications, self-supervised learning is usually used to train graph neural networks. For example, Masked AutoEncoders (MAE) technology can be used for training. However, MAE can often only obtain local neighborhood information and it is difficult to obtain global information of the entire graph, which limits the network training effect. Summary of the invention

[0004] In view of this, in order to improve the task performance and effect of graph neural networks, one or more embodiments of this specification provide a graph neural network training method and device, a graph data processing method and device, an electronic device, a storage medium, and a computer program.

[0005] In a first aspect, this specification provides a method for training a graph neural network, comprising:

[0006] Acquire sample graph data, perform mask processing on node features of the sample graph data to obtain mask graph data, and perform enhancement processing on the data structure of the sample graph data to obtain target graph data;

[0007] Inputting the mask image data and the target image data into a graph neural network to be trained, encoding the mask image data using an encoder of the graph neural network to obtain a first image embedding vector, and encoding the target image data to obtain a second image embedding vector;

[0008] determining a node feature loss based on the first graph embedding vector and determining a contrast loss based on a difference between the first graph embedding vector and the second graph embedding vector, the node feature loss representing a difference between the reconstructed graph data and the sample graph data;

[0009] Based on the node feature loss and contrast loss, the parameters of the encoder of the graph neural network are adjusted until the convergence conditions are met to obtain a trained graph neural network.

[0010] In some implementations, masking the node features of the sample graph data to obtain masked graph data includes:

[0011] Randomly sampling the nodes in the sample graph data to obtain a preset number of mask nodes;

[0012] Masking is performed on the node features of the mask nodes to obtain the mask graph data.

[0013] In some implementations, enhancing the data structure of the sample graph data to obtain target graph data includes:

[0014] A preset number of nodes and / or edges in the sample graph data are randomly discarded to obtain the target graph data.

[0015] In some implementations, determining a node feature loss based on the first graph embedding vector includes:

[0016] Inputting the first graph embedding vector into a decoder of the graph neural network to obtain a graph representation output by the decoder, wherein the graph representation is used to reconstruct the mask graph data;

[0017] The node feature loss is calculated based on the first graph embedding vector, the graph representation, and the node features of the sample graph data.

[0018] In some implementations, determining the contrast loss based on a difference between the first image embedding vector and the second image embedding vector includes:

[0019] Performing spatial mapping on the first image embedding vector to obtain a first comparison vector, and performing spatial mapping on the second image embedding vector to obtain a second comparison vector;

[0020] The contrast loss is calculated based on the similarities and differences between each node pair in the first contrast vector and the second contrast vector.

[0021] In some embodiments, the training method of the present specification further comprises:

[0022] Determine the variance of each node feature in the first graph embedding vector and the second graph embedding vector, and calculate the discrimination loss of the first graph embedding vector and the second graph embedding vector based on a preset constraint condition, wherein the preset constraint condition is used to constrain the minimum variance of the first graph embedding vector and the second graph embedding vector;

[0023] Based on the node feature loss and contrast loss, adjusting parameters of the encoder of the graph neural network until a convergence condition is met to obtain a trained graph neural network, including:

[0024] Based on the node feature loss, the contrast loss and the discrimination loss, the parameters of the encoder of the graph neural network are adjusted until the convergence conditions are met to obtain a trained graph neural network.

[0025] In some embodiments, the training method of the present specification further comprises:

[0026] Reconstructing a second adjacency matrix included in the mask graph data based on the graph representation, and determining a first loss term according to a difference between the second adjacency matrix and a first adjacency matrix included in the original sample graph data;

[0027] Determining a second loss term based on edge differences represented by the first adjacency matrix and the second adjacency matrix;

[0028] Determining a third loss term based on a relative distance between any two nodes in the graph representation;

[0029] Determining an adjacency matrix loss according to the first loss term, the second loss term, and the third loss term;

[0030] Based on the node feature loss and contrast loss, adjusting parameters of the encoder of the graph neural network until a convergence condition is met to obtain a trained graph neural network, including:

[0031] Based on the node feature loss, the contrast loss and the adjacency matrix loss, the parameters of the encoder of the graph neural network are adjusted until the convergence conditions are met to obtain a trained graph neural network.

[0032] In a second aspect, this specification provides a graph data processing method, including:

[0033] Get the graph data to be processed;

[0034] Inputting the graph data into a pre-trained graph neural network, and encoding the graph data using an encoder of the graph neural network to obtain a corresponding graph embedding vector, wherein the graph neural network is trained by the method described in any of the above embodiments;

[0035] The graph embedding vector is input into the corresponding task network to obtain the task result predicted by the task network.

[0036] In a third aspect, this specification provides a training device for a graph neural network, including:

[0037] A data processing module is configured to obtain sample graph data, perform mask processing on node features of the sample graph data to obtain mask graph data, and perform enhancement processing on a data structure of the sample graph data to obtain target graph data;

[0038] An encoder module is configured to input the mask image data and the target image data into a graph neural network to be trained, encode the mask image data using an encoder of the graph neural network to obtain a first image embedding vector, and encode the target image data to obtain a second image embedding vector;

[0039] The network training module is configured to determine a node feature loss based on the first graph embedding vector, and determine a contrast loss based on the difference between the first graph embedding vector and the second graph embedding vector, wherein the node feature loss represents the difference between the reconstructed graph data and the sample graph data; based on the node feature loss and the contrast loss, the encoder of the graph neural network is parameter adjusted until the convergence condition is met, thereby obtaining a trained graph neural network.

[0040] In some embodiments, the data processing module is configured to:

[0041] Randomly sampling the nodes in the sample graph data to obtain a preset number of mask nodes;

[0042] Masking is performed on the node features of the mask nodes to obtain the mask graph data.

[0043] In some embodiments, the data processing module is configured to:

[0044] A preset number of nodes and / or edges in the sample graph data are randomly discarded to obtain the target graph data.

[0045] In some implementations, the network training module is configured to:

[0046] Inputting the first graph embedding vector into a decoder of the graph neural network to obtain a graph representation output by the decoder, wherein the graph representation is used to reconstruct the mask graph data;

[0047] The node feature loss is calculated based on the first graph embedding vector, the graph representation, and the node features of the sample graph data.

[0048] In some implementations, the network training module is configured to:

[0049] Performing spatial mapping on the first image embedding vector to obtain a first comparison vector, and performing spatial mapping on the second image embedding vector to obtain a second comparison vector;

[0050] The contrast loss is calculated based on the similarities and differences between each node pair in the first contrast vector and the second contrast vector.

[0051] In some implementations, the network training module is configured to:

[0052] Determine the variance of each node feature in the first graph embedding vector and the second graph embedding vector, and calculate the discrimination loss of the first graph embedding vector and the second graph embedding vector based on a preset constraint condition, wherein the preset constraint condition is used to constrain the minimum variance of the first graph embedding vector and the second graph embedding vector;

[0053] Based on the node feature loss and contrast loss, adjusting parameters of the encoder of the graph neural network until a convergence condition is met to obtain a trained graph neural network, including:

[0054] Based on the node feature loss, the contrast loss and the discrimination loss, the parameters of the encoder of the graph neural network are adjusted until the convergence conditions are met to obtain a trained graph neural network.

[0055] In some implementations, the network training module is configured to:

[0056] Reconstructing a second adjacency matrix included in the mask graph data based on the graph representation, and determining a first loss term according to a difference between the second adjacency matrix and a first adjacency matrix included in the original sample graph data;

[0057] Determining a second loss term based on edge differences represented by the first adjacency matrix and the second adjacency matrix;

[0058] Determining a third loss term based on a relative distance between any two nodes in the graph representation;

[0059] Determining an adjacency matrix loss according to the first loss term, the second loss term, and the third loss term;

[0060] Based on the node feature loss and contrast loss, adjusting parameters of the encoder of the graph neural network until a convergence condition is met to obtain a trained graph neural network, including:

[0061] Based on the node feature loss, the contrast loss and the adjacency matrix loss, the parameters of the encoder of the graph neural network are adjusted until the convergence conditions are met to obtain a trained graph neural network.

[0062] In a fourth aspect, this specification provides a graph data processing device, including:

[0063] A data acquisition module, configured to acquire graph data to be processed;

[0064] A graph neural network module is configured to input the graph data into a pre-trained graph neural network, and encode the graph data using an encoder of the graph neural network to obtain a corresponding graph embedding vector, wherein the graph neural network is trained by the method described in any of the above embodiments;

[0065] The task network module is configured to input the graph embedding vector into the corresponding task network to obtain the task result predicted and output by the task network.

[0066] In a sixth aspect, this specification provides an electronic device, including:

[0067] processor;

[0068] A memory for storing processor-executable instructions, wherein the processor implements the steps of the method described in any of the above embodiments by running the executable instructions.

[0069] In a seventh aspect, the present specification provides a computer-readable storage medium having computer instructions stored thereon, which, when executed by a processor, implement the steps of the method described in any of the above-mentioned embodiments.

[0070] In an eighth aspect, the present specification provides a computer program product, comprising a computer program / instruction, which, when executed by a processor, implements the steps of the method described in any of the above-mentioned embodiments.

[0071] The training method of the graph neural network implemented in the present specification realizes the fusion training of masked autoencoder MAE and contrastive learning CL through a shared encoder architecture, so that the trained GNN can simultaneously capture the local information and global information of the graph structure data, improve the GNN's perception of the global information of the whole graph, and thus improve the performance of the GNN in the whole graph processing task. Moreover, during the network training process, the masked autoencoder MAE and contrastive learning CL share the same encoder, and no additional embedding vector fusion strategy is required, simplifying the training algorithm process. BRIEF DESCRIPTION OF THE DRAWINGS

[0072] Figure 1 This is a schematic diagram of graph data provided by an exemplary embodiment.

[0073] Figure 2 It is a principle block diagram of a graph neural network training method provided by an exemplary embodiment.

[0074] Figure 3 It is a flowchart of a graph neural network training method provided by an exemplary embodiment.

[0075] Figure 4 This is a schematic diagram of the principle of preprocessing sample graph data in a graph neural network training method provided by an exemplary embodiment.

[0076] Figure 5 It is a flowchart of preprocessing sample graph data in a graph neural network training method provided by an exemplary embodiment.

[0077] Figure 6 It is a flowchart of determining node feature loss in a graph neural network training method provided by an exemplary embodiment.

[0078] Figure 7 It is a flowchart for determining contrast loss in a graph neural network training method provided by an exemplary embodiment.

[0079] Figure 8 It is a flowchart of determining the adjacency matrix loss in a graph neural network training method provided by an exemplary embodiment.

[0080] Fig. 9 It is a flowchart of a graph data processing method provided by an exemplary embodiment.

[0081] Fig.10 It is a schematic diagram of a graph data processing method provided by an exemplary embodiment.

[0082] Fig.11 It is a structural block diagram of a graph neural network training device provided by an exemplary embodiment.

[0083] Fig.12 It is a structural block diagram of a graph data processing device provided by an exemplary embodiment.

[0084] Fig.13 is a structural block diagram of an electronic device provided by an exemplary embodiment. DETAILED DESCRIPTION

[0085] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this manual are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0086] Graph data is a data structure composed of nodes (entities) and edges (relationships). Different from structured data such as images and text, graph data is mainly used to represent complex or irregular data, such as social networks, knowledge graphs, molecular structures, etc.

[0087] For example Figure 1 shows a graph data structure, see Figure 1 As shown in the figure, graph data includes several nodes and edges connecting the nodes. In the graph data, two nodes with a direct connection relationship are called neighbor nodes, such as node 1 and node 2, node 1 and node 3, and node 3 and node 4. Nodes such as node 1 and node 4 that have no direct connection relationship but an indirect connection relationship are called k-hop neighbors. K-hop neighbors refer to neighbors that are connected through k layers from the current node. For example, node 1 and node 4 are 2-hop neighbor nodes.

[0088] Graph database is a database designed for processing graph data. Unlike traditional relational or non-relational databases, graph database focuses on the relationship between nodes and edges. Graph Neural Network (GNN) is the most commonly used deep learning model for processing graph data in graph databases. Graph Neural Network (GNN) can understand and utilize the complex relationship between nodes and edges in graph data, so it can process complex and unstructured graph data and provide good performance for graph data processing tasks.

[0089] In practical applications, since graph data has little label information, self-supervised learning methods are usually used to train graph neural networks (GNNs). Self-supervised learning does not require manual labels and is trained by maximizing the information of the data itself. In related technologies, the self-supervised learning process for graph neural networks is mainly carried out using MAE (Masked Auto Encoders).

[0090] MAE is a self-supervised learning framework that performs self-supervised learning by randomly masking part of the input data and reconstructing the masked part. For example, when training a GNN, you can randomly select some nodes in the graph and mask the features of these nodes. Then use the GNN encoder to encode the masked graph to obtain a graph representation. Then, based on the encoded graph representation, use the decoder to reconstruct the masked node features, and build a loss function to measure the difference between the reconstructed features and the original features to optimize and update the GNN network parameters and achieve network training.

[0091] Through practical applications, it is found that the MAE training method leads to poor performance of GNN in graph processing tasks under the whole graph dimension, such as graph classification tasks. Further research shows that this is because the GNN encoder usually uses fewer network layers, such as 2 or 3 layers, so it can only obtain feature information of 2 or 3 hop neighbors of each node, that is, GNN can only obtain information from the local neighborhood of the node, and cannot obtain global information of the whole graph, which leads to limited performance of the whole graph processing task.

[0092] Based on this, this specification provides a graph neural network training method and device, a graph data processing method and device, an electronic device, a storage medium, and a computer program, aiming to improve the graph neural network GNN training process, thereby improving GNN's perception of the global information of the entire graph, thereby improving GNN's task performance and effects.

[0093] In some embodiments, this specification provides a method for training a graph neural network, which can be executed by an electronic device that deploys the graph neural network, such as a personal computer, server, mobile terminal, etc., and this specification does not limit this.

[0094] In the implementation of this specification, the contrastive learning CL (Contrastive Learning) technology is combined on the basis of the MAE training architecture. Contrastive learning CL is a self-supervised learning technology that trains the network model by comparing the representations of positive and negative samples. In the training of graph neural networks, the goal of contrastive learning is to let GNN learn the similarities between the same nodes and distinguish the differences between different nodes. Contrastive learning CL can compare nodes that are far apart in the graph, so that it can perceive the global information of the entire graph, but due to the lack of the ability to reconstruct node features and edges, it cannot learn local information well.

[0095] Therefore, in the implementation of this specification, the masked autoencoder MAE is combined with the contrastive learning CL technology, and a fusion training architecture is designed to enable GNN to take into account the perception capabilities of local and global information, thereby improving the performance of GNN.

[0096] Figure 2 The GNN training architecture in some embodiments of this specification is shown below. Figure 2 Explain the training architecture of GNN.

[0097] See also Figure 2 As shown, the training architecture of this specification includes two parts, namely: a masked self-encoding module 101 and a contrastive learning module 102. The masked self-encoding module 101 is used to reconstruct masked nodes and / or edges according to masked input data, and the contrastive learning module 102 perceives the global information of the entire graph by comparing the graph representation of the masked self-encoding module 101 with the enhanced input data.

[0098] It is worth noting that in the implementation manner of this specification, a shared encoder is designed in the GNN network structure, that is, the encoder is simultaneously connected to the mask self-encoding module 101 and the contrastive learning module 102, so that during the network training process, the global information perceived by the contrastive learning module 102 can be passed to the mask self-encoding module 101 by optimizing the parameters of the encoder, thereby enhancing the GNN encoder's ability to capture local and global information. Figure 3Provide explanation.

[0099] like Figure 3 As shown, in some embodiments, the training method of the graph neural network exemplified in this specification includes:

[0100] S310, acquiring sample graph data, performing mask processing on node features of the sample graph data to obtain mask graph data, and performing enhancement processing on the data structure of the sample graph data to obtain target graph data.

[0101] Sample graph data refers to sample data used for GNN training. Sample graph data is a graph structure, that is, it is composed of nodes and edges connecting nodes. In combination with the above, it can be seen that in the implementation of this specification, the training of GNN includes two parts, namely, the mask self-encoding module 101 and the contrast learning module 102. Therefore, it is necessary to construct sample data for the two modules respectively, for example, construct mask graph data for the mask self-encoding module 101, and construct positive and negative sample data for the contrast learning module 102.

[0102] In the implementation manner of this specification, after the sample image data is obtained, the sample image data can be preprocessed to obtain the sample data required by the masked self-encoding module 101 and the contrastive learning module 102 .

[0103] by Figure 4 For example, the sample graph data includes 5 nodes, and the connection relationship between the nodes is shown in the figure. The colored box of each node in the figure is the node feature vector corresponding to the node. In the example of this specification, the node features of some nodes in the sample graph data can be masked to achieve masking of the sample graph data.

[0104] For example Figure 4 As shown in , the node features of node 1 and node 3 can be masked. There are many specific ways of masking, such as setting the feature value of the node feature to zero, or randomly replacing the node feature vector, etc. This specification does not limit this. Figure 4 It can be seen in the example that after masking nodes 1 and 3, the obtained graph data is the mask graph data corresponding to the sample graph data.

[0105] Continue to refer to Figure 4 In this example, the target graph data can be obtained by performing structural enhancement processing on the sample graph data. The purpose of the structural enhancement processing is to change the structure of the original sample graph data. In some embodiments, nodes and / or edges can be randomly sampled and discarded, thereby changing the data structure of the sample graph data to obtain the target image data. For example Figure 4 In the example, the target graph data is obtained by discarding node 3, node 5, and the edge connecting nodes 3 and 5.

[0106] S320. Input the mask image data and the target image data into the graph neural network to be trained, use the encoder of the graph neural network to encode the mask image data to obtain a first image embedding vector, and encode the target image data to obtain a second image embedding vector.

[0107] Combination Figure 2 As shown, in the implementation manner of this specification, the shared encoder is connected to the mask self-encoding module 101 and the contrast learning module 102 at the same time, so that the encoder can be used to encode the mask image data and the target image data respectively.

[0108] It can be understood that in the field of machine learning, the role of the encoder is to convert the input data into a more compact or higher-level feature vector, so as to facilitate analysis and processing. In the implementation of this specification, the goal of network training for GNN is to optimize the network parameters of the encoder, so as to improve the encoder's perception of global and local information, thereby improving the performance of GNN in processing graph data tasks.

[0109] Combination Figure 2 As shown, in the implementation manner of this specification, the mask graph data and the target graph data are input into the encoder to be trained, and the encoder can encode the input data and then output its corresponding graph embedding vector. The graph embedding vector (Graph Embedding) refers to the vector representation of each node in the graph.

[0110] Specifically, the mask image data is input into the encoder to be trained, and after the encoder encodes the mask image data, the corresponding first image embedding vector H1 can be obtained, and then the first image embedding vector H1 is input into the mask self-encoding module 101. At the same time, the target image data is input into the encoder to be trained, and after the encoder encodes the target image data, the corresponding second image embedding vector H2 can be obtained, and then the second image embedding vector H2 is input into the contrast learning module 102.

[0111] S330: Determine a node feature loss based on the first graph embedding vector, and determine a contrast loss based on a difference between the first graph embedding vector and the second graph embedding vector.

[0112] In combination with the foregoing, it can be seen that the training architecture of the implementation mode of this specification includes two parts: a masked self-encoding module 101 and a contrastive learning module 102, so the constructed loss function also needs to include at least two parts: a node feature loss and a contrastive loss.

[0113] The node feature loss refers to the difference between the node features of the masked nodes reconstructed by the masked self-encoding module 101 and the actual node features, while the contrast loss refers to the loss obtained by comparing the features of the positive and negative node pairs in the first graph embedding vector and the second graph embedding vector. The purpose is to let the GNN focus on learning the features of positive node pairs (i.e., the same nodes) and distinguishing the features of negative node pairs (i.e., different nodes).

[0114] In some embodiments, the first graph embedding vector H1 can be first decoded using the GNN encoder. In the GNN network, the decoder is used to reconstruct and predict the masked node features in the graph, thereby outputting the obtained graph representation. The graph representation can be understood as a vector representation of the entire graph. In this specification, the graph representation output by the encoder is used to reconstruct the masked node features. Then, the node feature loss is calculated based on the first graph embedding vector H1, the graph representation, and the original sample graph data. This process is described below in this specification.

[0115] In some embodiments, in combination Figure 2 As shown, the input of the contrastive learning module 102 includes two parts, namely, the first graph embedding vector H1 and the second graph embedding vector H2. In the contrastive learning process, positive and negative node pairs can be constructed for the nodes in the first graph embedding vector H1 and the nodes in the second graph embedding vector H2. The positive node pair refers to the same nodes in the first graph embedding vector H1 and the second graph embedding vector H2, and the negative node pair refers to the different nodes in the first graph embedding vector H1 and the second graph embedding vector H2. Then, by comparing the features of the positive and negative sample pairs, the contrastive loss is calculated based on the similarities and differences of the sample pairs. This process is described below in this specification.

[0116] S340. Based on the node feature loss and contrast loss, adjust the parameters of the encoder of the graph neural network until the convergence conditions are met to obtain the trained graph neural network.

[0117] In the implementation mode of this specification, the loss function of training GNN includes at least two parts: node feature loss and contrast loss. It can be understood that the node feature loss is a loss constructed based on the masked autoencoder MAE, which represents the difference between the reconstructed masked node features and the real node features, reflecting the local neighborhood information of the node. The contrast loss is a loss constructed based on contrastive learning CL, which compares the positive and negative node pairs of the whole graph, so that information far away from the node can be perceived and global information can be captured.

[0118] Therefore, in the implementation of this specification, the network parameters of the shared encoder are tuned by combining node feature loss and contrast loss, so that GNN can simultaneously learn local information and global information of graph structure data, thereby improving GNN's perception of the global information of the entire graph.

[0119] In some embodiments, the network parameters of the GNN encoder can be adjusted based on the node feature loss and contrast loss through back propagation and optimization algorithms to complete a round of network training. It can be understood that the training process of the neural network is usually multiple rounds of iterative training. After completing a round of iterative training, the above-mentioned S310~S340 method process can be repeated again, and multiple rounds of iterative training can be performed until the convergence conditions are met. The parameter adjustment operation of the encoder can be stopped to complete the GNN network training. It can be understood that the convergence conditions of GNN training can be set according to the specific scenario requirements, such as meeting the number of iterations, the effect of the network model meets the set requirements, etc., and this specification will not go into details.

[0120] From the above, it can be seen that in the implementation of this specification, the fusion training of masked self-encoding MAE and contrastive learning CL is realized through a shared encoder architecture, so that the trained GNN can simultaneously capture the local information and global information of the graph structure data, improve the GNN's perception of the global information of the whole graph, and thus improve the performance of GNN in the whole graph processing task. Moreover, during the network training process, the masked self-encoding MAE and contrastive learning CL share the same encoder, and no additional embedding vector fusion strategy is required, simplifying the training algorithm process.

[0121] like Figure 5 As shown, in some embodiments, the training method exemplified in this specification, the process of mask image data and target image data, includes:

[0122] S510 , randomly sample nodes in the sample graph data to obtain a preset number of mask nodes.

[0123] S520 , performing mask processing on node features of mask nodes to obtain mask graph data.

[0124] S530: Randomly discard a preset number of nodes and / or edges in the sample graph data to obtain target graph data.

[0125] In the implementation manner of this specification, the purpose of performing mask processing on the sample graph data is to mask the features of some nodes in the sample graph data, thereby obtaining mask graph data with missing node feature information.

[0126] by Figure 4 As shown in the figure, for the node set V included in the sample graph data, the mask node set can be randomly sampled from it Mask node set The mask nodes include multiple mask nodes obtained by random sampling, and the number of mask nodes can be preset according to requirements.

[0127] In some implementations, the mask node set can be obtained by random sampling according to a specific distribution condition. For example, Bernoulli distribution can be used to randomly sample mask nodes.

[0128] After randomly sampling to obtain mask nodes, the node features of these mask nodes can be masked, for example Figure 4 In the example, the values ​​of the node features of mask nodes 1 and 3 may be set to zero, so that nodes 1 and 3 complete the masking process.

[0129] Through the above method, after randomly sampling and feature masking the nodes in the sample graph data, we can get, for example Figure 4 In the mask graph data shown in , the node feature values ​​of some nodes in the mask graph data are zero.

[0130] In some implementations, a preset number of nodes and / or edges in the sample graph data may be randomly discarded to obtain the target graph data. Figure 4 As shown, nodes and / or edges can be randomly sampled in the sample graph data, and then the sampled nodes and / or edges can be discarded. For example, the node feature value of the sampled node can be set to 0, and all edges connected to the node can be removed. It can be understood that in the process of obtaining the target graph data, only some nodes can be discarded, only some edges can be discarded, or some edges and some nodes can be discarded at the same time, and this specification does not limit this.

[0131] Through the above method, after discarding the nodes and / or edges in the sample graph data, we can obtain, for example Figure 4 The target graph data shown in .

[0132] like Figure 6 As shown, in some embodiments, the training method exemplified in this specification, the process of determining the node feature loss includes:

[0133] S610. Input the first graph embedding vector into a decoder of a graph neural network to obtain a graph representation output by the decoder.

[0134] S620: Calculate the node feature loss based on the first graph embedding vector, the graph representation, and the node features of the sample graph data.

[0135] Combination Figure 2As shown, after obtaining the mask map data, the mask map data is input into the encoder of the GNN to obtain the first map embedding vector H1 output by the encoder. The first map embedding vector H1 is a multi-dimensional vector matrix, which contains the node features of each node in the graph and the adjacency matrix. The adjacency matrix is ​​a common representation method for graph structure data and is used to represent the connection relationship between each node in the graph.

[0136] For example, in the previous example, for the mask node set Each node v in i , and its corresponding node features Feature matrix belonging to the masked nodes Given an encoder f E and decoder f D , input the mask image data into the encoder f E After that, we get the encoder f E The output first graph embedding vector H1 is expressed as: Where A represents the adjacency matrix.

[0137] Then, the first graph embedding vector H1 is input into the decoder f D , get the decoder f D The output graph representation Z is expressed as: Z = f D (A, H1), the graph representation Z is the graph representation after reconstructing the masked node features. In one example, the node feature loss can be scaled cosine error It is expressed as:

[0138]

[0139] In formula (1), represents the node feature loss, v i Represents a mask node set The nodes in x i Represents node v i Node features in the original sample graph data, h i Represents node v i Node features in the first graph embedding vector, z i Represents node v i In the graph representation, γ represents the node feature and the hyperparameter for adjusting the convergence speed.

[0140] It is understandable that node feature loss It represents the difference between the reconstructed masked node features and the actual node features. Therefore, by minimizing the node feature loss function expressed by the above formula (1), the node feature reconstruction of GNN can be constrained.

[0141] like Figure 7As shown, in some embodiments, the training method exemplified in this specification, the process of determining the contrast loss includes:

[0142] S710: Perform spatial mapping on the first image embedding vector to obtain a first comparison vector, and perform spatial mapping on the second image embedding vector to obtain a second comparison vector.

[0143] S720 , calculating the comparison loss based on the similarities and differences between each node pair in the first comparison vector and the second comparison vector.

[0144] Combining the principle of contrastive learning CL, it can be understood that the contrastive learning process refers to comparing the features of positive and negative sample pairs, so that the model focuses on learning the features of positive sample pairs and distinguishes the features of negative sample pairs.

[0145] Combination Figure 2 As shown, the input of the contrastive learning module 102 includes the first image embedding vector H1 and the second image embedding vector H2. The determination process of the first image embedding vector H1 can be referred to above and will not be repeated here. For the second image embedding vector H2, after obtaining the target image data, the target image data is input into the encoder f of the GNN. E , encoder f E Encode the adjacency matrix of the target graph data and obtain the second graph embedding vector H2 expressed as: in, An adjacency matrix representing the target graph data.

[0146] Then, in the example of this specification, the contrastive learning module 102 includes two projection layers, namely projection layer 1 and projection layer 2. The projection layer is a network layer of one or more layers, and the function of the projection layer is to map the input embedding vector to different vector spaces and reduce the dimension of the embedding vector.

[0147] See also Figure 2 As shown, the first image embedding vector H1 is input to the projection layer 1, and is spatially mapped and dimensionally reduced by the projection layer 1 to obtain a mapped space vector, that is, a first comparison vector U. Similarly, the second image embedding vector H2 is input to the projection layer 2, and is spatially mapped and dimensionally reduced by the projection layer 2 to obtain a mapped space vector, that is, a second comparison vector V. In some embodiments, the mapping process can be expressed as:

[0148] U=σ(g1(H1,ψ1)),

[0149] V=σ(g2(H2,ψ2)) (2)

[0150] In formula (2), U represents the first contrast vector, V represents the second contrast vector, σ() represents the activation function, ψ represents the projection layer parameter, g1 represents projection layer 1, and g2 represents projection layer 2.

[0151] In the implementation manner of this specification, the positive sample pair of contrastive learning CL is defined as: the node u in the first contrast vector i The same node v in the second comparison vector i The positive node pairs (u i , v i ). Similarly, the negative sample pairs of contrastive learning CL can be defined as: negative node pairs composed of nodes in the first contrast vector and different nodes in the second contrast vector.

[0152] Then, for each positive node pair (u i , v i ) can use the contrast loss function to calculate the contrast loss. For each positive node pair (u i , v i )’s contrast loss function, taking InfoNCE as an example, is expressed as:

[0153]

[0154] In formula (3), l c Represents a positive node pair (u i , v i ), s() represents the similarity function, and τ represents the hyperparameter. It can be understood that the overall goal of the contrast loss is to maximize the mutual information of the positive sample pairs, so the final contrast loss is It is expressed as:

[0155]

[0156] The contrast loss can be calculated by the above formula (4):

[0157] In some implementations, after obtaining the node feature loss and contrast loss After that, the network parameters of the GNN encoder can be adjusted and optimized based on these two loss functions until the convergence conditions are met to obtain the trained GNN.

[0158] From the above, it can be seen that in the implementation of this specification, the fusion training of masked self-encoding MAE and contrastive learning CL is realized through a shared encoder architecture, so that the trained GNN can simultaneously capture the local information and global information of the graph structure data, improve the GNN's perception of the global information of the whole graph, and thus improve the performance of GNN in the whole graph processing task. Moreover, during the network training process, the masked self-encoding MAE and contrastive learning CL share the same encoder, and no additional embedding vector fusion strategy is required, simplifying the training algorithm process.

[0159] In the above implementation, the node feature loss of the reconstructed node With contrast loss Combined, jointly constrain the training process of the GNN encoder. In other embodiments, the adjacency matrix loss can be further combined By reconstructing the adjacency matrix to characterize the connection relationship of the masked nodes, the connection prediction and node clustering performance of GNN are further improved. Figure 8 Provide explanation.

[0160] like Figure 8 As shown, in some embodiments, the training method of the example in this specification further includes:

[0161] S810, reconstructing a second adjacency matrix included in the mask graph data based on the graph representation, and determining a first loss term according to a difference between the second adjacency matrix and a first adjacency matrix included in the original sample graph data.

[0162] In some embodiments, after obtaining the first graph embedding vector output by the encoder Afterwards, the first graph embedding vector H1 is decoded by the decoder to obtain the graph representation Z = f D (A, H1), and then the adjacency matrix of the entire graph can be further reconstructed according to the graph representation Z to obtain the second adjacency matrix Afterwards, based on the reconstructed second adjacency matrix The difference between the first adjacency matrix A of the original sample graph data determines the first loss term l MSE .

[0163] For example, in one example, the first loss term l MSE Taking the mean square error as an example, it is expressed as:

[0164]

[0165] In formula (5), represents the second adjacency matrix, A represents the first adjacency matrix, A ij Represents node v i and v j The edges between them, N represents the number of nodes, and Z represents the graph representation. The first loss term l MSE That is, it represents the difference between the reconstructed connection relationship in the second adjacency matrix and the actual connection relationship in the first adjacency matrix, thereby minimizing the first loss term l MSE to constrain network training.

[0166] S820. Determine a second loss term based on edge differences represented by the first adjacency matrix and the second adjacency matrix.

[0167] In the first loss term represented by the above formula (5), which uses the mean square error to evaluate the difference between the reconstructed second adjacency matrix and the original first adjacency matrix, considering the discreteness and sparsity of the adjacency matrix, using the mean square error alone may cause the network to overfit to zero, thereby reducing network performance.

[0168] Therefore, in the embodiment of this specification, the second loss term l is introduced by further evaluating the difference between the edges of the nodes in the first adjacency matrix and the second adjacency matrix. BCE , the second loss term l BCE For example, it can be the cross entropy loss, expressed as:

[0169]

[0170] In formula (6), represents the second adjacency matrix, A represents the first adjacency matrix, A ij Represents node v i and v j The edges between them, N represents the number of nodes.

[0171] S830. Determine a third loss term based on the relative distance between any two nodes in the graph representation.

[0172] In some embodiments, considering the low data density of graph data, the degree distribution of nodes follows a power-law distribution. The degree distribution of nodes represents the number of other nodes connected to a certain node, which is difficult to effectively estimate using only the above-mentioned mean square error and cross entropy loss. In addition, the coexistence of low-degree nodes and high-degree nodes further causes GNN to fail in Euclidean space and hinders training speed.

[0173] Therefore, in this embodiment, the third loss term l can be further constructed based on the relative distance of the nodes in the graph representation Z. DIST , the third loss term l DIST Represents the relative distance loss between nodes, expressed as:

[0174]

[0175] In formula (7), E represents the edge set, Z represents the graph representation, and z i and z j Represents node v i and v j The corresponding eigenvector in the graph representation Z, D() represents the distance function.

[0176] S840. Determine an adjacency matrix loss according to the first loss item, the second loss item, and the third loss item.

[0177] Combining S810 to S830, it can be seen that in the implementation mode of this specification, the adjacency matrix loss That is, it includes the first loss term l mentioned above MSE , the second loss term l BCE And the third loss term l DIST , expressed as:

[0178]

[0179] In the above implementation, the adjacency matrix is ​​reconstructed to characterize the connection relationship of the masked nodes, thereby constructing the adjacency matrix loss That is, the loss used to constrain GNN training includes three parts: node feature loss Contrastive loss and the adjacency matrix loss Therefore, the network parameters of the GNN encoder can be adjusted and optimized based on these three loss functions until the convergence conditions are met to obtain the trained GNN. This process will not be described in detail.

[0180] From the above, it can be seen that in the implementation of this specification, by reconstructing the adjacency matrix to characterize the connection relationship of the masked nodes, the GNN model can better focus on the node connection relationship, and it can also facilitate the encoder to get rid of the constraints brought by fitting extreme values, and improve the connection prediction and GNN node clustering performance. In addition, in the adjacency matrix loss, by combining the mean square error loss, cross entropy loss and node relative distance loss, the risk of overfitting in GNN training is reduced and the model training speed is improved.

[0181] In addition, it is worth mentioning that in the MAE self-supervised learning process, it is easy to cause feature over-smoothing when reconstructing adjacent nodes, that is, adjacent nodes tend to have similar reconstructed features, which will damage the performance of tasks that rely on node features, such as node classification, resulting in poor performance of GNN in these task scenarios.

[0182] To this end, in some implementations of the present specification, a discrimination loss for graph embedding vectors is further introduced. The discrimination loss can improve feature discrimination by increasing the variance of graph embedding vector nodes and reduce the risk of over-smoothing between node features.

[0183] In some embodiments, the loss of discrimination A regularized standard deviation based on variance can be used, expressed as:

[0184]

[0185] In formula (9), h represents the node feature in the first or second graph embedding vector, Var(h) represents the variance of the node feature in the graph embedding vector, and ∈ is a preset constraint condition, which is a scalar and its function is to constrain the minimum variance to prevent the loss function from decreasing to 0. Represents the loss of discrimination.

[0186] In combination with the above, in the implementation of this specification, a discrimination loss is further introduced, that is, the loss used to constrain GNN training includes four parts, namely: node feature loss Contrastive loss Adjacency Matrix Loss And the discrimination loss Therefore, the network parameters of the GNN encoder can be adjusted and optimized based on these four loss functions until the convergence conditions are met to obtain the trained GNN. This process will not be described in detail.

[0187] From the above, it can be seen that in the implementation mode of this specification, the feature discrimination is improved by introducing a discrimination loss for the graph embedding vector and increasing the variance of the graph embedding vector nodes, so that the encoder maps the input to different spaces within a specific variance range, prevents collapse to the same vector, and reduces the risk of over-smoothing between node features.

[0188] The above implementation method describes the training method of the graph neural network of this specification. After the graph neural network GNN training is completed, GNN can be used to process graph data tasks. Fig. 9 Provide explanation.

[0189] like Fig. 9 As shown, an embodiment of this specification provides a method for processing graph data, the method comprising:

[0190] S910: Obtain graph data to be processed.

[0191] S920. Input the graph data into a pre-trained graph neural network, and use the encoder of the graph neural network to encode the graph data to obtain the corresponding graph embedding vector.

[0192] S930: Input the graph embedding vector into the corresponding task network to obtain the task result predicted by the task network.

[0193] According to the aforementioned network training process, it can be understood that in the implementation manner of this specification, the training of the GNN network is for the optimization of the shared encoder. After the encoder optimization is completed through the aforementioned training method, in the task prediction stage, the encoder can be connected to the corresponding task network to realize specific task processing.

[0194] In the implementation manner of this specification, the specific type and network structure of the task network can be selected and set according to the specific task scenario requirements, and this specification does not limit this.

[0195] For example, see Fig.10 As shown, the task network takes the support vector machine SVM as an example, and the graph data task takes graph classification as an example. First, for any graph data that needs to be classified, the graph data can be input into the encoder of the GNN. The encoder is pre-trained through the aforementioned training method process, and then the graph embedding vector output by the encoder can be obtained. After that, the graph embedding vector is input into the SVM network to obtain the task result predicted by the SVM output, that is, the category corresponding to the graph data. It can be understood that since the encoder learns the global and local information of the graph data, it can fully capture the global information in the whole graph classification task, thereby improving the task effect and accuracy.

[0196] Of course, those skilled in the art will understand that the task scenarios of graph data processing are not limited to the above examples, but may also be any other task scenarios suitable for implementation, such as node classification, etc. This specification does not impose any restrictions on this.

[0197] From the above, it can be seen that in the implementation of this specification, the fusion training of masked self-encoding MAE and contrastive learning CL is realized through a shared encoder architecture, so that the trained GNN can simultaneously capture the local information and global information of the graph structure data, improve the GNN's perception of the global information of the whole graph, and thus improve the performance of GNN in the whole graph processing task. Moreover, during the network training process, the masked self-encoding MAE and contrastive learning CL share the same encoder, and no additional embedding vector fusion strategy is required, simplifying the training algorithm process.

[0198] In some embodiments, this specification provides a training device for a graph neural network, such as Fig.11 As shown, the training device comprises:

[0199] The data processing module 10 is configured to obtain sample graph data, perform mask processing on node features of the sample graph data to obtain mask graph data, and perform enhancement processing on the data structure of the sample graph data to obtain target graph data;

[0200] The encoder module 20 is configured to input the mask image data and the target image data into a graph neural network to be trained, encode the mask image data using an encoder of the graph neural network to obtain a first image embedding vector, and encode the target image data to obtain a second image embedding vector;

[0201] The network training module 30 is configured to determine the node feature loss based on the first graph embedding vector, and determine the contrast loss based on the difference between the first graph embedding vector and the second graph embedding vector, wherein the node feature loss represents the difference between the reconstructed graph data and the sample graph data; based on the node feature loss and the contrast loss, the encoder of the graph neural network is adjusted in parameters until the convergence condition is met, thereby obtaining a trained graph neural network.

[0202] In some embodiments, the data processing module 10 is configured to:

[0203] Randomly sampling the nodes in the sample graph data to obtain a preset number of mask nodes;

[0204] Masking is performed on the node features of the mask nodes to obtain the mask graph data.

[0205] In some embodiments, the data processing module 10 is configured to:

[0206] A preset number of nodes and / or edges in the sample graph data are randomly discarded to obtain the target graph data.

[0207] In some implementations, the network training module 30 is configured to:

[0208] Inputting the first graph embedding vector into a decoder of the graph neural network to obtain a graph representation output by the decoder, wherein the graph representation is used to reconstruct the mask graph data;

[0209] The node feature loss is calculated based on the first graph embedding vector, the graph representation, and the node features of the sample graph data.

[0210] In some implementations, the network training module 30 is configured to:

[0211] Performing spatial mapping on the first image embedding vector to obtain a first comparison vector, and performing spatial mapping on the second image embedding vector to obtain a second comparison vector;

[0212] The contrast loss is calculated based on the similarities and differences between each node pair in the first contrast vector and the second contrast vector.

[0213] In some implementations, the network training module 30 is configured to:

[0214] Determine the variance of each node feature in the first graph embedding vector and the second graph embedding vector, and calculate the discrimination loss of the first graph embedding vector and the second graph embedding vector based on a preset constraint condition, wherein the preset constraint condition is used to constrain the minimum variance of the first graph embedding vector and the second graph embedding vector;

[0215] Based on the node feature loss, the contrast loss and the discrimination loss, the parameters of the encoder of the graph neural network are adjusted until the convergence conditions are met to obtain a trained graph neural network.

[0216] In some implementations, the network training module 30 is configured to:

[0217] Reconstructing a second adjacency matrix included in the mask graph data based on the graph representation, and determining a first loss term according to a difference between the second adjacency matrix and a first adjacency matrix included in the original sample graph data;

[0218] Determining a second loss term based on edge differences represented by the first adjacency matrix and the second adjacency matrix;

[0219] Determining a third loss term based on a relative distance between any two nodes in the graph representation;

[0220] Determining an adjacency matrix loss according to the first loss term, the second loss term, and the third loss term;

[0221] Based on the node feature loss, the contrast loss and the adjacency matrix loss, the parameters of the encoder of the graph neural network are adjusted until the convergence conditions are met to obtain a trained graph neural network.

[0222] In some embodiments, this specification provides a graph data processing device, such as Fig.12 As shown, the device comprises:

[0223] A data acquisition module 40 is configured to acquire graph data to be processed;

[0224] A graph neural network module 50 is configured to input the graph data into a pre-trained graph neural network, and encode the graph data using an encoder of the graph neural network to obtain a corresponding graph embedding vector, wherein the graph neural network is trained by the method described in any of the above embodiments;

[0225] The task network module 60 is configured to input the graph embedding vector into the corresponding task network to obtain the task result predicted and output by the task network.

[0226] In some implementations, this specification provides an electronic device, including:

[0227] processor;

[0228] A memory for storing processor-executable instructions, wherein the processor implements the steps of the method described in any of the above embodiments by running the executable instructions.

[0229] In some embodiments, the present specification provides a computer-readable storage medium having computer instructions stored thereon, which, when executed by a processor, implement the steps of the method described in any of the above embodiments.

[0230] In some embodiments, the present specification provides a computer program product, including a computer program / instruction, which implements the steps of the method described in any of the above embodiments when executed by a processor.

[0231] Fig.13 is a schematic structural diagram of a device provided by an exemplary embodiment. Fig.13 At the hardware level, the device includes a processor 702, an internal bus 704, a network interface 706, a memory 708, and a non-volatile memory 710, and may also include hardware required for other functions. One or more embodiments of this specification may be implemented based on software, such as the processor 702 reading the corresponding computer program from the non-volatile memory 710 into the memory 708 and then running it. Of course, in addition to the software implementation, one or more embodiments of this specification do not exclude other implementations, such as logic devices or a combination of software and hardware, etc., that is, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.

Claims

1. A training method for a graph neural network, characterized in that: include: Acquire sample graph data, perform mask processing on node features of the sample graph data to obtain mask graph data, and perform enhancement processing on the data structure of the sample graph data to obtain target graph data; Inputting the mask image data and the target image data into a graph neural network to be trained, encoding the mask image data using an encoder of the graph neural network to obtain a first image embedding vector, and encoding the target image data to obtain a second image embedding vector; determining a node feature loss based on the first graph embedding vector and determining a contrast loss based on a difference between the first graph embedding vector and the second graph embedding vector, the node feature loss representing a difference between the reconstructed graph data and the sample graph data; Based on the node feature loss and contrast loss, the parameters of the encoder of the graph neural network are adjusted until the convergence conditions are met to obtain a trained graph neural network.

2. The method according to claim 1, characterized in that Masking the node features of the sample graph data to obtain mask graph data includes: Randomly sampling the nodes in the sample graph data to obtain a preset number of mask nodes; Masking is performed on the node features of the mask nodes to obtain the mask graph data.

3. The method according to claim 1, characterized in that Performing enhancement processing on the data structure of the sample graph data to obtain target graph data includes: A preset number of nodes and / or edges in the sample graph data are randomly discarded to obtain the target graph data.

4. The method according to claim 1, characterized in that Determining a node feature loss based on the first graph embedding vector includes: Inputting the first graph embedding vector into a decoder of the graph neural network to obtain a graph representation output by the decoder, wherein the graph representation is used to reconstruct the mask graph data; The node feature loss is calculated based on the first graph embedding vector, the graph representation, and the node features of the sample graph data.

5. The method according to claim 1, characterized in that Determining a contrastive loss based on a difference between the first image embedding vector and the second image embedding vector includes: Performing spatial mapping on the first image embedding vector to obtain a first comparison vector, and performing spatial mapping on the second image embedding vector to obtain a second comparison vector; The contrast loss is calculated based on the similarities and differences between each node pair in the first contrast vector and the second contrast vector.

6. The method according to any one of claims 1 to 5, characterized in that: Also includes: Determine the variance of each node feature in the first graph embedding vector and the second graph embedding vector, and calculate the discrimination loss of the first graph embedding vector and the second graph embedding vector based on a preset constraint condition, wherein the preset constraint condition is used to constrain the minimum variance of the first graph embedding vector and the second graph embedding vector; Based on the node feature loss and contrast loss, adjusting parameters of the encoder of the graph neural network until a convergence condition is met to obtain a trained graph neural network, including: Based on the node feature loss, the contrast loss and the discrimination loss, the parameters of the encoder of the graph neural network are adjusted until the convergence conditions are met to obtain a trained graph neural network.

7. The method according to claim 4, characterized in that Also includes: Reconstructing a second adjacency matrix included in the mask graph data based on the graph representation, and determining a first loss term according to a difference between the second adjacency matrix and a first adjacency matrix included in the original sample graph data; Determining a second loss term based on edge differences represented by the first adjacency matrix and the second adjacency matrix; Determining a third loss term based on a relative distance between any two nodes in the graph representation; Determining an adjacency matrix loss according to the first loss term, the second loss term, and the third loss term; Based on the node feature loss and contrast loss, adjusting parameters of the encoder of the graph neural network until a convergence condition is met to obtain a trained graph neural network, including: Based on the node feature loss, the contrast loss and the adjacency matrix loss, the parameters of the encoder of the graph neural network are adjusted until the convergence conditions are met to obtain a trained graph neural network.

8. A graph data processing method, characterized in that: include: Get the graph data to be processed; Inputting the graph data into a pre-trained graph neural network, and encoding the graph data using an encoder of the graph neural network to obtain a corresponding graph embedding vector, wherein the graph neural network is trained by the method according to any one of claims 1 to 7; The graph embedding vector is input into the corresponding task network to obtain the task result predicted by the task network.

9. A training device for a graph neural network, characterized in that: include: A data processing module is configured to obtain sample graph data, perform mask processing on node features of the sample graph data to obtain mask graph data, and perform enhancement processing on a data structure of the sample graph data to obtain target graph data; An encoder module is configured to input the mask image data and the target image data into a graph neural network to be trained, encode the mask image data using an encoder of the graph neural network to obtain a first image embedding vector, and encode the target image data to obtain a second image embedding vector; The network training module is configured to determine a node feature loss based on the first graph embedding vector, and determine a contrast loss based on the difference between the first graph embedding vector and the second graph embedding vector, wherein the node feature loss represents the difference between the reconstructed graph data and the sample graph data; based on the node feature loss and the contrast loss, the encoder of the graph neural network is parameter adjusted until the convergence condition is met, thereby obtaining a trained graph neural network.

10. A graph data processing device, characterized in that: include: A data acquisition module, configured to acquire graph data to be processed; A graph neural network module, configured to input the graph data into a pre-trained graph neural network, and encode the graph data using an encoder of the graph neural network to obtain a corresponding graph embedding vector, wherein the graph neural network is trained by the method according to any one of claims 1 to 7; The task network module is configured to input the graph embedding vector into the corresponding task network to obtain the task result predicted and output by the task network.

11. An electronic device, characterized in that: include: processor; A memory for storing processor-executable instructions, wherein the processor implements the steps of the method according to any one of claims 1 to 8 by executing the executable instructions.

12. A computer-readable storage medium, characterized in that: Computer instructions are stored thereon, and when the instructions are executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.

13. A computer program product, characterized in that The method comprises a computer program / instruction, which, when executed by a processor, implements the steps of the method according to any one of claims 1 to 8.

Citation Information

Cited By

  • Robot perception data word segmentation characterization and learning method based on graph neural network

    CN119358552A

  • Graph neural network training method, apparatus and device, and readable storage medium

    CN119398094A

  • Circuit characterization method and device, computer equipment, storage medium and computer program product

    CN119538803A

  • Electric power large model pre-training method and device based on MAE and comparative learning

    CN121415180A

  • Methods for tokenization representation and learning of robotic perception data based on graph neural network

    US12814726B2