Image embedding processing method and device, computer device and storage medium
By introducing a mutual information discriminator into the graph convolutional encoder, the graph embedding processing effect is evaluated, which solves the problem of poor graph autoencoder processing and improves the accuracy and efficiency of graph embedding.
Patent Information
- Application Number
- CN202311220576.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-20
- Publication Date
- 2025-11-04
- Estimated Expiration
- 2043-09-20
AI Technical Summary
The existing graph autoencoder in graph neural networks does not perform well, resulting in a large difference between the output graph embedding space vector and the original graph information, and poor graph embedding processing performance.
By adding a pre-trained mutual information discriminator to the pre-trained graph convolutional encoder, the mutual information discriminator is used to evaluate the information correlation between the graph embedding vectors and feature matrices before and after processing, so as to determine whether the graph convolutional encoder needs to be trained further, thereby improving the graph embedding processing effect.
It improves the graph embedding processing performance of graph convolutional encoders, enhances the correlation between graph embedding vectors and original graph information, and improves the accuracy and speed of graph processing tasks.
Smart Images

Figure CN117195950B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer, and particularly relates to a graph embedding processing method and device, computer equipment and a storage medium. BACKGROUND
[0002] A graph is a data structure composed of nodes and edges in a computer, and is often used to represent the relationship between elements. Currently, problems such as node classification, node clustering and community detection can be solved through graph analysis. Graph embedding is an efficient graph processing method, which maps the topological structure of a graph, node information and other content to a low-dimensional continuous graph embedding vector, and can improve the speed and accuracy of subsequent downstream tasks when processing the graph.
[0003] In the prior art, the graph embedding processing process is extended on the basis of a graph neural network (GNN) to a graph auto encoder (GAE). The GAE uses a graph convolution network as an encoder, and outputs a graph embedding space vector through the encoding processing of the GAE.
[0004] However, the processing effect of the graph auto encoder in the existing graph neural network is poor, so that the output graph embedding space vector has a large difference from the original graph information, and the processing effect of the graph embedding is poor. SUMMARY
[0005] The present application provides a graph embedding processing method, device, computer equipment and storage medium to solve the technical problem of poor processing effect of graph embedding.
[0006] In a first aspect, the present application provides a graph embedding processing method, comprising:
[0007] Obtaining graph information to be processed, and obtaining all node features and all edge features in the graph information. Determining a feature matrix according to all node features. Determining an adjacency matrix according to all edge features. Inputting the adjacency matrix and the feature matrix into a pre-trained graph convolution encoder to obtain a graph embedding vector corresponding to the graph information. Inputting the graph embedding vector and the feature matrix into a pre-trained mutual information discriminator to obtain a mutual information discrimination result corresponding to the graph information, wherein the mutual information discrimination result is used to indicate the information correlation degree of the graph embedding vector before and after the pre-trained graph convolution encoder and the feature matrix of the graph information, wherein the information correlation degree is used to indicate the graph embedding processing effect of the pre-trained graph convolution encoder and to determine whether the graph convolution encoder needs to be continuously trained.
[0008] Optionally, the method as above, the graph embedding model further comprises a negative sample generator module, wherein the negative sample generator module comprises a pre-trained negative sample generator and a pre-trained negative sample discriminator. Accordingly, the training process of the graph embedding model comprises: establishing an initial graph convolutional encoder, and iteratively training the initial graph convolutional encoder to obtain a pre-trained graph convolutional encoder. Establishing an initial mutual information discriminator, and iteratively training the initial mutual information discriminator to obtain a pre-trained mutual information discriminator. Establishing an initial negative sample generator, and iteratively training the initial negative sample generator to obtain a pre-trained negative sample generator. Establishing an initial negative sample discriminator, and iteratively training the initial negative sample discriminator to obtain a pre-trained negative sample discriminator.
[0009] Optionally, the method as above, the establishing an initial graph convolutional encoder, and iteratively training the initial graph convolutional encoder to obtain a pre-trained graph convolutional encoder comprises: establishing an initial graph convolutional encoder, wherein the initial graph convolutional encoder comprises encoder parameters. Obtaining a preset number of training sample graph information. Iteratively training the initial graph convolutional encoder according to the preset number of training sample graph information and a self-encoder loss function to obtain updated encoder parameters; wherein the self-encoder loss function is obtained by adding a reconstruction loss function and a loss function of a mutual information discriminator. Applying the updated encoder parameters to the initial graph convolutional encoder to obtain the pre-trained graph convolutional encoder.
[0010] Optionally, the method as above, the reconstruction loss function is:
[0011]
[0012]
[0013] wherein, L REC is a reconstruction loss value; Z is a graph embedding vector; is a reconstruction matrix; A i,j is a value of the i-th row and j-th column of the adjacency matrix; is a value of the i-th row and j-th column of the reconstruction matrix;
[0014] The loss function of the mutual information discriminator is:
[0015]
[0016] wherein, is a loss function value of the mutual information discriminator; A is an adjacency matrix; X is a feature matrix; E(A, X) is a result obtained by the adjacency matrix and the feature matrix through the pre-trained graph convolutional encoder; D MI(E(A,X)) is a result calculated by the pre-trained graph convolutional encoder, and the value obtained by the pre-trained mutual information discriminator.
[0017] Optionally, the method described above, the initial mutual information discriminator is established, and the initial mutual information discriminator is iteratively trained to obtain the pre-trained mutual information discriminator, comprising: establishing the initial mutual information discriminator, wherein the initial mutual information discriminator comprises mutual information discriminator parameters. The mutual information result of the feature data and the graph embedding vector is obtained as a positive sample. The mutual information result of the generated node feature matrix and the generated graph embedding vector generated by the pre-trained negative sample generator is obtained as a negative sample. According to the positive sample, the negative sample and the loss function of the mutual information discriminator, the initial mutual information discriminator is iteratively trained to obtain updated mutual information discriminator parameters. The updated mutual information discriminator parameters are applied to the initial mutual information discriminator to obtain the pre-trained mutual information discriminator.
[0018] Optionally, the method described above, the loss function of the mutual information discriminator is:
[0019]
[0020] In the formula, y is a label value predicted according to the pre-trained mutual information discriminator; is a real label value; D MI (MI(X,Z)) is a first predicted label value calculated after the positive sample passes through the pre-trained mutual information discriminator; D MI (MI(X ′ ,Z ′ )) is a second predicted label value calculated after the negative sample passes through the pre-trained mutual information discriminator; y~D MI (MI(X,Z)) indicates that the actually predicted label value can be regarded as data sampled from the first predicted label value; y~D MI (MI(X ′ ,Z ′ )) indicates that the actually predicted label value can be regarded as data sampled from the second predicted label value; L MI is a loss function constructed according to the predicted label value and the real label value.
[0021] Optionally, the method as described above, the initial negative sample discriminator is established, and the initial negative sample discriminator is iteratively trained to obtain the pre-trained negative sample discriminator, comprising: establishing the initial negative sample discriminator, wherein the initial negative sample discriminator comprises negative sample discriminator parameters. Obtain the generated node feature matrix, wherein the generated node feature matrix refers to the vector obtained after a random vector sampled from a prior distribution passes through the negative sample generator. According to the generated node feature matrix and the negative sample discriminator loss function, the initial negative sample discriminator is iteratively trained to obtain updated negative sample discriminator parameters. The updated negative sample discriminator parameters are applied to the initial negative sample discriminator to obtain the pre-trained negative sample discriminator.
[0022] Optionally, the method as described above, the negative sample discriminator loss function is:
[0023]
[0024] In the formula, is the loss function of the constructed negative sample discriminator; x ~ P data (x) represents that x is data sampled from the real data distribution P data (x) ; z' ~ P z′ (z') represents that z' is data sampled from the distribution of generated data, that is, the generated graph embedding vector; D NSG (x) is a negative sample discriminator used to judge whether x is a feature matrix or a generated graph embedding vector; G NSG (z ′ ) represents the generated graph embedding vector z ′ The generated node feature matrix obtained by the negative sample generator.
[0025] Optionally, the method as described above, the initial negative sample generator is established, and the initial negative sample generator is iteratively trained to obtain the pre-trained negative sample generator, comprising: establishing the initial negative sample generator, wherein the initial negative sample generator comprises negative sample generator parameters. Obtain the generated node feature matrix, wherein the generated node feature matrix refers to the vector obtained after a random vector sampled from a prior distribution passes through the negative sample generator. According to the generated node feature matrix and the negative sample generator loss function, the initial negative sample generator is iteratively trained to obtain updated negative sample generator parameters. The updated negative sample generator parameters are applied to the initial negative sample generator to obtain the pre-trained negative sample generator.
[0026] Optionally, the method as described above, the negative sample generator loss function is:
[0027]
[0028] L p =-log(D NSG (X p′ ))
[0029] In the formula, X' is a generated node feature matrix; The generated node feature matrix X' is obtained by pre-training a negative sample discriminator D NSG The loss function obtained with respect to the input X' is a gradient; α is a pessimistic degree, and the value range is [0, 1]; X p′ is a node feature matrix after the generated node feature matrix is updated; L p is the node feature matrix after the update, and the loss function is obtained again by the negative sample discriminator.
[0030] Optionally, after the updated negative sample generator parameter is applied to the initial negative sample generator to obtain the pre-trained negative sample generator, the method further includes: using a new negative sample discriminator loss function to additionally update the updated negative sample discriminator parameter. The new negative sample discriminator loss function is:
[0031]
[0032] X' = G NSG (Z')
[0033]
[0034]
[0035] In the formula, X' represents a generated node feature matrix obtained by a generated random vector Z' through a pre-trained negative sample generator; D NSG (X) represents a predicted label value of the feature matrix through the updated negative sample discriminator; D NSG (X') represents a predicted label value of the generated node feature matrix through the updated negative sample discriminator; D NSG (1|X) represents a probability that the updated negative sample discriminator predicts the feature matrix to be 1; (1|X) represents a probability that the updated negative sample discriminator predicts the feature matrix to be 1; D NSG (0|X') represents a probability that the updated negative sample discriminator predicts the generated node feature matrix to be 0; (0|X') represents a probability that the updated negative sample discriminator predicts the generated node feature matrix to be 0; β is a parameter value for controlling the KL loss, and is generally taken as (0, 1); D NSG (·|(X,X')) represents a predicted label value of all data including the feature matrix and the generated node feature matrix by the updated negative sample discriminator; This represents the predicted label value of the negative sample discriminator for all data, including the feature matrix and the generated node feature matrix, before the update. L represents the KL divergence of the predicted label values of the negative sample discriminator for all data before and after the update, used to measure the difference in their distributions; po This is the total loss function.
[0036] Secondly, this application provides an image embedding processing apparatus, comprising:
[0037] The feature acquisition module is used to acquire the graph information to be processed and to acquire the features of all nodes in the graph information.
[0038] The matrix determination module is used to determine the adjacency matrix and feature matrix based on the characteristics of all nodes.
[0039] The autoencoder module is used to input the adjacency matrix and feature matrix into the pre-trained graph convolutional encoder to obtain the graph embedding vector corresponding to the graph information.
[0040] The mutual information discrimination module is used to input the graph embedding vector and feature matrix into the pre-trained mutual information discriminator to obtain the mutual information discrimination result corresponding to the graph information. The mutual information discrimination result is used to indicate the information correlation between the graph embedding vector and the feature matrix of the graph information before and after processing by the pre-trained graph convolutional encoder. The information correlation is used to indicate the graph embedding processing effect of the pre-trained graph convolutional encoder and to determine whether it is necessary to continue training the graph convolutional encoder.
[0041] Thirdly, this application provides a computer device, including: a processor and a memory communicatively connected to the processor. The memory stores computer-executable instructions. The processor executes the computer-executable instructions stored in the memory to implement the method as described in the first aspect above.
[0042] Fourthly, this application provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the method described in the first aspect above.
[0043] The graph embedding processing method, apparatus, computer equipment, and storage medium provided in this application obtain the corresponding adjacency matrix and feature matrix from graph information. The adjacency matrix and feature matrix are then input into a pre-trained graph convolutional encoder to obtain the graph embedding vector corresponding to the graph information. Based on this, a pre-trained mutual information discriminator is added. The pre-trained mutual information discriminator evaluates the processing effect of the pre-trained graph convolutional encoder based on the information correlation between the graph embedding vector before and after processing and the feature matrix of the graph information, and determines whether further training of the graph convolutional encoder is needed, thereby improving the graph embedding processing effect of the graph convolutional encoder. Attached Figure Description
[0044] The accompanying drawings, which are incorporated herein and constitute part of the specification, illustrate embodiments consistent with the application and, together with the description, further serve to explain the principles of the application.
[0045] Figure 1 A system structure schematic diagram of a computer device provided for an embodiment of the application is shown in the following figure.
[0046] Figure 2 A flowchart of a graph embedding processing method provided for an embodiment of the application is shown in the following figure.
[0047] Figure 3 A structure schematic diagram of a graph embedding processing device provided for an embodiment of the application is shown in the following figure.
[0048] Figure 4 A hardware structure schematic diagram of a computer device provided for an embodiment of the application is shown in the following figure.
[0049] The specific embodiments of the application have been shown by the above-mentioned figures, and will be described in more detail hereinafter. These figures and the written description are not intended to limit the scope of the inventive concept in any way, but to illustrate the inventive concept for those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0050] The exemplary embodiments will be described in detail herein with reference to the attached drawings. The following description is made with reference to the accompanying drawings in which like reference numerals represent like elements, unless the context of use indicates otherwise. The following description of exemplary embodiments is not representative of all embodiments consistent with the present application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of the present application as detailed in the appended claims.
[0051] A graph is a data structure composed of nodes and edges in a computer, commonly used to represent the relationship between elements, and problems such as node classification, node clustering, and community detection can be solved by graph analysis. Graph embedding is an efficient method of graph processing, which maps the topological structure of the graph, node information and other content to a low-dimensional continuous graph embedding vector, which can improve the speed and accuracy of subsequent downstream tasks when processing the graph. In the prior art, the graph embedding processing process is expanded on the basis of the graph neural network to obtain a graph autoencoder, which uses a graph convolutional network as an encoder and outputs a graph embedding space vector through the encoding process of GAEs. However, the processing effect of the graph autoencoder in the existing graph neural network is not good, which makes the output graph embedding space vector have a large difference with the original graph information, and the processing effect of the graph embedding is poor.
[0052] To solve the above technical problems, the embodiment of the present application proposes the following technical idea: a pre-trained mutual information discriminator is added to the pre-trained graph convolutional encoder to indicate the information correlation degree of the graph embedding vectors and the feature matrix of the graph information before and after the pre-trained graph convolutional encoder is processed, so as to improve the processing effect of the graph embedding.
[0053] The technical solutions of the present application and how the technical solutions of the present application solve the above technical problems will be described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes can not be described in detail in some embodiments. The embodiments of the present application will be described below with reference to the drawings.
[0054] Figure 1 The system structure schematic diagram of the computer device provided by the embodiment of the present application is shown in FIG. 1. Figure 1 As shown in the figure, the computer device includes a receiving device 101, a processor 102 and a display device 103.
[0055] It can be understood that the structure shown in the embodiment of the present application does not constitute a specific limitation on the object recognition method. In other possible embodiments of the present application, the above architecture can include more or fewer components than the illustration, or combine certain components, or split certain components, or different component arrangement, which can be determined according to the actual application scene, and is not limited here. Figure 1 The components shown in the figure can be realized by hardware, software or a combination of software and hardware.
[0056] In the specific implementation process, the receiving device 101 can be an input / output interface or a communication interface, which can obtain the to-be-processed graph information and all node features in the graph information.
[0057] The processor 102 can determine the adjacency matrix and the feature matrix according to all node features in the graph information, input the adjacency matrix and the feature matrix into the pre-trained graph convolutional encoder to obtain the graph embedding vector corresponding to the graph information, and input the graph embedding vector and the feature matrix into the pre-trained mutual information discriminator to obtain the mutual information discrimination result corresponding to the graph information, which is used to indicate the information correlation degree of the graph embedding vectors and the feature matrix of the graph information before and after the pre-trained graph convolutional encoder is processed.
[0058] The display device 103 can be used to display the mutual information discrimination result and the like.
[0059] The display device can also be a touch display screen, which is used to receive user instructions while displaying the above-mentioned content, so as to realize the operation interaction with the user.
[0060] It should be understood that the above processor can be realized by reading the instructions in the memory of the processor and executing the instructions, or by chip circuit.
[0061] In addition, the network architecture and service scenarios described in the embodiments of the present application are used to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided by the embodiments of the present application. Those skilled in the art can know that, with the evolution of network architecture and the emergence of new service scenarios, the technical solutions provided by the embodiments of the present application are also applicable to similar technical problems.
[0062] Figure 2 The flowchart of the graph embedding processing method provided by an embodiment of the present application can be executed by the computer device shown in the embodiment. Figure 1 The computer device in the embodiment shown in the figure, wherein the computer device is deployed with a graph embedding model, and the graph embedding model includes a self-encoder module and a mutual information discriminator module, wherein the self-encoder module includes a pre-trained graph convolutional encoder, and the mutual information discriminator module includes a pre-trained mutual information discriminator, or other service devices with similar functions, which are not particularly limited in the embodiment. As shown in the figure, Figure 2 The method includes:
[0063] S201: Obtain the graph information to be processed, and obtain all node features and all edge features in the graph information.
[0064] The node features can be divided into features reflecting the importance of the nodes and features reflecting the structure of the nodes. The importance-related features include eigenvector centrality, between centrality and closeness centrality, and the structure-related features include clustering coefficients and graphlet degree vector (GDV). The edge feature extraction is actually to extract the features between two nodes. The edge features include distance features, local field overlap features and global field overlap features.
[0065] Specifically, the idea of the eigenvector centrality method is that the importance of a node is determined by the importance of the adjacent nodes.
[0066] For example, assume that the eigenvector centrality of node V is to be calculated. First, a special adjacency matrix about V is created, in which only the elements corresponding to the nodes connected to V are 1, and all other matrix elements are 0. Then, the eigenvalues and eigenvectors of the special adjacency matrix of V are calculated, and finally the eigenvector corresponding to the maximum eigenvalue is taken as the final result.
[0067] Specifically, the idea of the betweenness centrality method is that the more a node is a central hub, the more important it is, that is, if a node V is an internal node between some shortest path in the graph, then V is called a central hub of the shortest path.
[0068] For example, assuming that the betweenness centrality of V is to be calculated, first, all the shortest paths in the graph are found, then it is counted in which shortest paths V is a central hub, and finally, the number of paths including V and V being a central hub is counted as the betweenness centrality.
[0069] Specifically, the idea of the closeness centrality is that the more important a node, the shorter the distance to other nodes.
[0070] For example, assuming that the closeness centrality of a node is to be calculated, first, the shortest paths from the node V to each of the other nodes are found, then the shortest lengths are counted, and finally, the reciprocal of the sum of the shortest path lengths is taken as the closeness centrality.
[0071] Specifically, the clustering coefficient can reflect the connection density of the neighbor nodes of a node, and the specific calculation formula is:
[0072]
[0073] The GDV is used to measure the local topology of a node.
[0074] For example, assuming that the GDV of a node V is to be calculated, first, the connected graph sets under different numbers of nodes are listed, and the commonly used numbers of nodes are generally 2, 3, 4, and 5, then the number of occurrences of each connected graph set in the graph is counted, and finally, the GDV vector is obtained, and each element of the vector is the number of occurrences of each connected graph set in the graph.
[0075] Specifically, the distance feature is the shortest path length between two nodes, the local field overlap feature is the number of common nodes between two nodes, and the global field overlap feature is the number of paths of different path lengths between two nodes, and the calculation formula of the global field overlap feature is:
[0076] S[i,j] = (I - β * A) -1 -I
[0077] In the formula, A is an adjacency matrix, and S[i,j] represents the number of paths of different path lengths between nodes i and j.
[0078] S202: Determine a feature matrix according to all node features.
[0079] Specifically, the feature matrix of a node adopts X = [x1, x2,..., xn], where xi represents a feature of the node. n ] T ∈ Rn×b denotes the feature information of node v i using x i i ∈R 1×b , where b denotes the dimension of the feature vector.
[0080] S203: Determine the adjacency matrix according to all edge features.
[0081] Specifically, an adjacency matrix A = [a i,j ]∈R n×n is adopted to represent the connection relationship between nodes, where a i,j describes the relationship between node v i and v j .
[0082] S204: Input the adjacency matrix and the feature matrix into the pre-trained graph convolutional encoder to obtain the graph embedding vector corresponding to the graph information.
[0083] where the pre-trained graph convolutional encoder is composed of two layers of GCN (Graph Convolutional Networks), and each layer of GCN is usually defined as f(Z (l) ,A|W (l) ), where W (l) denotes the parameters of the l-th layer of GCN,
[0084] Specifically, the maximum value of l is specified as 2, and the intermediate result Z (l) of the l-th layer can be represented as:
[0085] Z (l) = f(Z (l-1) ,A|W (l-1) )
[0086] wherein l takes the values 1, 2. Z (0) denotes the node feature matrix X, i.e. Z (0) = X, and the final result of the graph embedding is Z (2) .
[0087] The calculation formula of GCN can be represented as:
[0088]
[0089]
[0090]
[0091]
[0092] In the formula, φ is an activation function of the convolution layer, I is a unit matrix of A, and A is an adjacency matrix.
[0093] S205: input the graph embedding vector and the feature matrix into the pre-trained mutual information discriminator to obtain a mutual information discrimination result corresponding to the graph information, wherein the mutual information discrimination result is used to indicate the information correlation degree of the graph embedding vector and the feature matrix of the graph information processed by the pre-trained graph convolutional encoder, and the information correlation degree is used to indicate the graph embedding processing effect of the pre-trained graph convolutional encoder and determine whether the graph convolutional encoder needs to be continuously trained.
[0094] Specifically, the graph embedding vector and the feature matrix are input into the pre-trained mutual information discriminator, and the mutual information discrimination result corresponding to the graph information is obtained through the calculation of the pre-trained mutual information discriminator, wherein the output value range of the mutual information discrimination result is [0, 1], and the greater the output value of the mutual information discrimination result, the better the graph embedding processing effect of the graph convolutional encoder.
[0095] As can be seen from the above, by obtaining the corresponding adjacency matrix and feature matrix from the graph information, inputting the adjacency matrix and feature matrix into the pre-trained graph convolutional encoder to obtain the graph embedding vector corresponding to the graph information, and on this basis, by adding the pre-trained mutual information discriminator, the pre-trained mutual information discriminator evaluates the processing effect of the pre-trained graph convolutional encoder based on the information correlation degree of the graph embedding vector and the feature matrix of the graph information before and after processing, and determines whether the graph convolutional encoder needs to be continuously trained, thereby improving the processing effect of the graph embedding of the graph convolutional encoder.
[0096] On the basis of the above embodiment, the graph embedding model further comprises a negative sample generator module, wherein the negative sample generator module comprises a pre-trained negative sample generator and a pre-trained negative sample discriminator, and correspondingly, the training process of the graph embedding model specifically comprises:
[0097] S301: establish an initial graph convolutional encoder, and iteratively train the initial graph convolutional encoder to obtain a pre-trained graph convolutional encoder.
[0098] Specifically, S301 comprises S3011-S3014:
[0099] S3011: establish an initial graph convolutional encoder, wherein the initial graph convolutional encoder comprises encoder parameters.
[0100] The graph convolutional encoder uses a graph convolutional neural network as an encoder, takes the feature matrix and the adjacency matrix as inputs, inputs them into the function of the graph convolutional neural network, and outputs a graph embedding vector with a dimension of 2.
[0101] S3012: obtain a preset number of training sample graph information.
[0102] S3013: According to the preset number of training sample graph information and the autoencoder loss function, the initial graph convolutional encoder is iteratively trained to obtain updated encoder parameters; wherein the autoencoder loss function is obtained by adding the reconstruction loss function and the loss function of the mutual information discriminator.
[0103] Wherein, because the adjacency matrix determines the structure of the graph, a good graph embedding vector should make the reconstructed adjacency matrix as similar as possible to the original adjacency matrix.
[0104] Specifically, in the training process of the graph convolutional encoder, the calculation formula of the reconstruction loss function is:
[0105]
[0106]
[0107] In the formula, A i,j represents the value of the i-th row and j-th column of the adjacency matrix A, and the value range is [0, 1]; represents the value of the i-th row and j-th column of the reconstructed matrix , and the value range is [0, 1]; Z is the graph embedding vector.
[0108] As can be seen from the reconstruction loss function, the closer the reconstructed adjacency matrix is to the original adjacency matrix, the better.
[0109] The calculation formula of the loss function of the mutual information discriminator is:
[0110]
[0111] In the formula, A is the adjacency matrix; X is the feature matrix; E(A, X) is the result calculated by the pre-trained graph convolutional encoder from the adjacency matrix and the feature matrix; D MI (E(A, X)) is the value obtained by the pre-trained mutual information discriminator from the result calculated by the pre-trained graph convolutional encoder.
[0112] The calculation formula of the autoencoder loss function is:
[0113] L AE = L REC + L DMI
[0114] In the formula, L AE is the autoencoder loss function value, L REC is the reconstruction loss function value, and L DMI is the loss function value of the mutual information discriminator.
[0115] The parameters of the graph convolutional encoder that minimize the encoder loss function value are taken as the updated encoder parameters.
[0116] S3014: Apply the updated encoder parameters to the initial graph convolutional encoder to obtain a pre-trained graph convolutional encoder.
[0117] Specifically, the parameters of the graph convolutional encoder that minimize the encoder loss function value are applied to the initial graph convolutional encoder, i.e., a pre-trained graph convolutional encoder is obtained.
[0118] S302: Establish an initial mutual information discriminator and iteratively train the initial mutual information discriminator to obtain a pre-trained mutual information discriminator.
[0119] Specifically, step S302 includes S3021-S3025:
[0120] S3021: Establish an initial mutual information discriminator, wherein the initial mutual information discriminator includes mutual information discriminator parameters.
[0121] Wherein, mutual information can measure the correlation of two random variables.
[0122] S3022: Obtain the mutual information result of the feature data and the graph embedding vector as a positive sample.
[0123] S3023: Obtain the mutual information result of the generated node feature matrix and the generated graph embedding vector generated by the pre-trained negative sample generator as a negative sample.
[0124] Specifically, the formula of mutual information is as follows:
[0125]
[0126]
[0127] In the formula, mutual information can be written as the KL divergence (Kullback-Leibler Divergence, an index used to measure the similarity of two probability distributions) of the joint distribution and the marginal distribution product.
[0128] S3024: Iteratively train the initial mutual information discriminator according to the positive sample, the negative sample, and the loss function of the mutual information discriminator to obtain updated mutual information discriminator parameters.
[0129] Specifically, the calculation formula of the loss function of the mutual information discriminator is:
[0130]
[0131] In the formula, y is the label value predicted according to the pre-trained mutual information discriminator; is a true label value; y ~ D MI (MI(X,Z)) is a first predicted label value calculated after the positive sample passes through the pre-trained mutual information discriminator; y ~ D MI (MI(X ′ ,Z ′ )) is a second predicted label value calculated after the negative sample passes through the pre-trained mutual information discriminator; y ~ D MI (MI(X,Z)) indicates that the actually predicted label value can be regarded as data sampled from the first predicted label value; y ~ D MI (MI(X ′ ,Z ′ )) indicates that the actually predicted label value can be regarded as data sampled from the second predicted label value; L MI is a loss function constructed according to the predicted label value and the true label value.
[0132] The parameters of the mutual information discriminator that minimize the loss function value of the mutual information discriminator are taken as the updated mutual information discriminator parameters.
[0133] S3025: Apply the updated mutual information discriminator parameters to the initial mutual information discriminator to obtain the pre-trained mutual information discriminator.
[0134] Specifically, the parameters of the mutual information discriminator that minimize the loss function value of the mutual information discriminator are applied to the initial mutual information discriminator, and the pre-trained mutual information discriminator is obtained.
[0135] S303: Establish an initial negative sample generator and iteratively train the initial negative sample generator to obtain a pre-trained negative sample generator.
[0136] Specifically, step S303 includes S3031-S3034:
[0137] S3031: Establish an initial negative sample discriminator, wherein the initial negative sample discriminator includes negative sample discriminator parameters.
[0138] The negative sample discriminator is a binary classification network model, and the graph generated by the negative sample generator is taken as a negative sample, and the real graph is taken as a positive sample.
[0139] S3032: Obtain a generated node feature matrix, wherein the generated node feature matrix is a vector obtained after a random vector sampled from a prior distribution passes through the negative sample generator.
[0140] S3033: Iteratively train the initial negative sample discriminator according to the generated node feature matrix and the negative sample discriminator loss function to obtain updated negative sample discriminator parameters.
[0141] Specifically, the calculation formula of the negative sample discriminator loss function is:
[0142]
[0143] In the formula, is the loss function of the constructed negative sample discriminator; x ~ P data (x) represents that x is data sampled from the real data distribution P data (x) is the feature matrix; z' ~ P z′ (z') represents that z' is data sampled from the distribution of generated data, that is, the generated graph embedding vector; D NSG (x) is the negative sample discriminator, which is used to judge whether x is the feature matrix or the generated graph embedding vector; G NSG (z ′ ) represents the generated graph embedding vector z ′ The generated node feature matrix obtained by the negative sample generator.
[0144] The parameters of the negative sample discriminator that minimize the loss function value of the negative sample discriminator are taken as the updated negative sample discriminator parameters.
[0145] S3034: Apply the updated negative sample discriminator parameters to the initial negative sample discriminator to obtain a pre-trained negative sample discriminator.
[0146] Specifically, the parameters of the negative sample discriminator that minimize the loss function value of the negative sample discriminator are applied to the initial negative sample discriminator, that is, a pre-trained negative sample discriminator is obtained.
[0147] S304: Establish an initial negative sample discriminator and iteratively train the initial negative sample discriminator to obtain a pre-trained negative sample discriminator.
[0148] Step S304 specifically includes S3041-S3044:
[0149] S3041: Establish an initial negative sample generator, wherein the initial negative sample generator includes negative sample generator parameters.
[0150] S3042: Obtain a generated node feature matrix, wherein the generated node feature matrix refers to a vector obtained after sampling a random vector from a prior distribution through a negative sample generator.
[0151] Wherein, the negative sample generator accepts noise input, generates a node feature matrix similar to the real graph, and interferes with the negative sample discriminator.
[0152] S3043: Based on the generated node feature matrix and the negative sample generator loss function, iteratively train the initial negative sample generator to obtain the updated negative sample generator parameters.
[0153] Specifically, the formula for calculating the loss function of the negative sample generator is as follows:
[0154]
[0155] L p =-log(D NSG (X p′ ))
[0156] In the formula, X ′ The generated node feature matrix; For the generated node feature matrix X ′ Through the pre-trained negative sample discriminator D NSG The resulting loss function with respect to input X ′ The gradient; α is the pessimism level, which ranges from [0,1]; X p′ The node feature matrix after being updated from the generated node feature matrix; L p The loss function is obtained by passing the updated node feature matrix through the negative sample discriminator again.
[0157] The parameters of the negative sample generator that minimize the loss function value of the negative sample generator will be used as the updated parameters of the negative sample generator.
[0158] S3044: Apply the updated negative sample generator parameters to the initial negative sample generator to obtain a pre-trained negative sample generator.
[0159] Specifically, the parameters of the negative sample generator that minimizes the loss function value of the negative sample generator are applied to the initial negative sample generator, thus obtaining the pre-trained negative sample generator.
[0160] In summary, by training a pre-trained negative sample generator, a pre-trained negative sample discriminator, and a pre-trained mutual information discriminator, and further training a pre-trained graph convolutional encoder, the ability of the graph convolutional encoder to process graph information is improved, resulting in better graph embedding processing performance.
[0161] In one embodiment of this application, based on the above embodiment, after step S3044 applies the updated negative sample generator parameters to the initial negative sample generator to obtain the pre-trained negative sample generator, it further includes:
[0162] Sa: Use the new negative sample discriminator loss function to perform additional updates on the updated negative sample discriminator parameters.
[0163] Specifically, the formula for calculating the loss function of the new negative sample discriminator is as follows:
[0164]
[0165] X ′ =G NSG (Z ′ )
[0166]
[0167]
[0168] In the formula, X ′ The generated random vector Z represents ′ The node feature matrix is generated through a pre-trained negative sample generator; D NSG (X) represents the predicted label value obtained by applying the updated negative sample discriminator to the feature matrix; D NSG (X ′ ) represents the predicted label value obtained by updating the negative sample discriminator through the generated node feature matrix; D NSG (1|X) represents the probability that the updated negative sample discriminant predicts a feature matrix of 1; D represents the probability that the negative sample discriminant predicts a feature matrix of 1 before the update; NSG (0|X ′ ) represents the probability that the node feature matrix predicted by the updated negative sample discriminator is 0; This represents the probability that the node feature matrix generated by the negative sample discriminator before the update is 0; β is a parameter used to control the KL loss, typically set to (0,1); D NSG (·|(X,X ′ )) represents the predicted label value of the updated negative sample discriminator for all data, including the feature matrix and the generated node feature matrix; This represents the predicted label value of the negative sample discriminator for all data, including the feature matrix and the generated node feature matrix, before the update. L represents the KL divergence of the predicted label values of the negative sample discriminator for all data before and after the update, used to measure the difference in their distributions; po This is the total loss function.
[0169] In summary, by designing a new loss function for the negative sample discriminator, the new loss function will adaptively adjust itself according to the KL divergence of the model before and after the update, so as to stably update the discriminator and further improve the model performance.
[0170] Figure 3This is a schematic diagram of the structure of an image embedding processing device provided in one embodiment of this application. Figure 3 As shown, the image embedding processing device includes: a feature acquisition module 301, a matrix determination module 302, an autoencoder module 303, and a mutual information discrimination module 304.
[0171] The feature acquisition module 301 is used to acquire the graph information to be processed and to acquire all node features in the graph information.
[0172] The matrix determination module 302 is used to determine the adjacency matrix and feature matrix based on the characteristics of all nodes.
[0173] The autoencoder module 303 is used to input the adjacency matrix and feature matrix into a pre-trained graph convolutional encoder to obtain the graph embedding vector corresponding to the graph information.
[0174] The mutual information discrimination module 304 is used to input the graph embedding vector and feature matrix into the pre-trained mutual information discriminator to obtain the mutual information discrimination result corresponding to the graph information. The mutual information discrimination result is used to indicate the information correlation between the graph embedding vector and the feature matrix of the graph information before and after processing by the pre-trained graph convolutional encoder. The information correlation is used to indicate the graph embedding processing effect of the pre-trained graph convolutional encoder and to determine whether it is necessary to continue training the graph convolutional encoder.
[0175] Optionally, in the method described above, the graph embedding processing apparatus further includes: a graph convolutional encoder training module 305, a mutual information discriminator training module 306, a negative sample generator training module 307, and a negative sample discriminator training module 308.
[0176] The graph convolutional encoder training module 305 is used to establish an initial graph convolutional encoder and iteratively train the initial graph convolutional encoder to obtain a pre-trained graph convolutional encoder.
[0177] The mutual information discriminator training module 306 is used to establish an initial mutual information discriminator and iteratively train the initial mutual information discriminator to obtain a pre-trained mutual information discriminator.
[0178] The negative sample generator training module 307 is used to establish an initial negative sample generator and iteratively train the initial negative sample generator to obtain a pre-trained negative sample generator.
[0179] The negative sample discriminator training module 308 is used to establish an initial negative sample discriminator and iteratively train the initial negative sample discriminator to obtain a pre-trained negative sample discriminator.
[0180] Optionally, in the method described above, the graph convolutional encoder training module 305 is specifically used to: establish an initial graph convolutional encoder, wherein the initial graph convolutional encoder includes encoder parameters; acquire a preset number of training sample graph information; iteratively train the initial graph convolutional encoder according to the preset number of training sample graph information and the autoencoder loss function to obtain updated encoder parameters; wherein the autoencoder loss function is obtained by adding the reconstruction loss function and the mutual information discriminator loss function; and apply the updated encoder parameters to the initial graph convolutional encoder to obtain a pre-trained graph convolutional encoder.
[0181] Optionally, in the method described above, the mutual information discriminator training module 306 is specifically used to: establish an initial mutual information discriminator, wherein the initial mutual information discriminator includes mutual information discriminator parameters; obtain the mutual information result of feature data and graph embedding vectors as positive samples; obtain the mutual information result of node feature matrices and graph embedding vectors generated by the pre-trained negative sample generator as negative samples; iteratively train the initial mutual information discriminator according to the positive samples, negative samples, and the loss function of the mutual information discriminator to obtain updated mutual information discriminator parameters; and apply the updated mutual information discriminator parameters to the initial mutual information discriminator to obtain a pre-trained mutual information discriminator.
[0182] Optionally, in the method described above, the negative sample generator training module 307 is specifically used to: establish an initial negative sample generator, wherein the initial negative sample generator includes negative sample generator parameters; obtain the generated node feature matrix, wherein the generated node feature matrix refers to the vector obtained after sampling random vectors from the prior distribution and passing them through the negative sample generator; iteratively train the initial negative sample generator according to the generated node feature matrix and the negative sample generator loss function to obtain updated negative sample generator parameters; and apply the updated negative sample generator parameters to the initial negative sample generator to obtain a pre-trained negative sample generator.
[0183] Optionally, in the method described above, the negative sample discriminator training module 308 is specifically used to: establish an initial negative sample discriminator, wherein the initial negative sample discriminator includes negative sample discriminator parameters; obtain a generated node feature matrix, wherein the generated node feature matrix refers to the vector obtained after sampling random vectors from the prior distribution and passing them through the negative sample generator; iteratively train the initial negative sample discriminator according to the generated node feature matrix and the negative sample discriminator loss function to obtain updated negative sample discriminator parameters; and apply the updated negative sample discriminator parameters to the initial negative sample discriminator to obtain a pre-trained negative sample discriminator.
[0184] Optionally, in the method described above, the graph embedding processing apparatus further includes an additional update module 309.
[0185] Additional update module 309 is used to perform additional updates on the updated negative sample discriminator parameters using the new negative sample discriminator loss function.
[0186] The apparatus provided in this embodiment can be used to execute the technical solutions of the above method embodiments. Its implementation principle and technical effects are similar, and will not be described again here.
[0187] Figure 4 This is a schematic diagram of the hardware structure of a computer device provided in one embodiment of this application. Figure 4 As shown, the computer device of this embodiment includes: at least one processor 401 and a memory 402; the memory stores computer execution instructions; the at least one processor executes the computer execution instructions stored in the memory, causing the at least one processor to perform the graph embedding processing method as described above.
[0188] Alternatively, the memory 402 can be either standalone or integrated with the processor 401.
[0189] When the memory 402 is set up independently, the service device also includes a bus 403 for connecting the memory 402 and the processor 401.
[0190] This application also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the graph embedding processing method described above.
[0191] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the graph embedding processing method described above.
[0192] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily essential to this application.
[0193] It should be further noted that although the steps in the flowchart are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowchart may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.
[0194] It should be understood that the above-described device embodiments are merely illustrative, and the device of this application can also be implemented in other ways. For example, the division of units / modules in the above embodiments is only a logical functional division, and there may be other division methods in actual implementation. For example, multiple units, modules, or components may be combined, or integrated into another system, or some features may be ignored or not executed.
[0195] Furthermore, unless otherwise specified, the functional units / modules in the various embodiments of this application can be integrated into one unit / module, or each unit / module can exist physically separately, or two or more units / modules can be integrated together. The integrated units / modules described above can be implemented in hardware or as software program modules.
[0196] When integrated units / modules are implemented in hardware, the hardware can be digital circuits, analog circuits, etc. The physical implementation of the hardware structure includes, but is not limited to, transistors, memristors, etc. Unless otherwise specified, the processor can be any suitable hardware processor, such as a CPU, GPU, FPGA, DSP, and ASIC, etc. Unless otherwise specified, the storage unit can be any suitable magnetic or magneto-optical storage medium, such as Resistive Random Access Memory (RRAM), Dynamic Random Access Memory (DRAM), Static Random Access Memory (SRAM), Enhanced Dynamic Random Access Memory (EDRAM), High-Bandwidth Memory (HBM), Hybrid Memory Cube (HMC), etc.
[0197] If the integrated unit / module is implemented as a software program module and sold or used as an independent product, it can be stored in a computer-readable storage device (CMD). Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned memory includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.
[0198] In the above embodiments, the descriptions of each embodiment have their own emphasis. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments. The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as the combination of these technical features does not contradict each other, it should be considered within the scope of this specification.
[0199] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the following claims.
[0200] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.
Claims
1. A graph embedding processing method, characterized in that, The method is applied to a computer device with a graph embedding model deployed thereon, the graph embedding model including an autoencoder module and a mutual information discriminator module; wherein the autoencoder module includes a pre-trained graph convolutional encoder, and the mutual information discriminator module includes a pre-trained mutual information discriminator. The method includes: Obtain the graph information to be processed, and obtain all node features and all edge features in the graph information; Determine the feature matrix based on the characteristics of all nodes; Determine the adjacency matrix based on all the edge features; The adjacency matrix and the feature matrix are input into the pre-trained graph convolutional encoder to obtain the graph embedding vector corresponding to the graph information; The graph embedding vector and the feature matrix are input into the pre-trained mutual information discriminator to obtain the mutual information discrimination result corresponding to the graph information. The mutual information discrimination result is used to indicate the information correlation between the graph embedding vector and the feature matrix of the graph information before and after processing by the pre-trained graph convolutional encoder. The information correlation is used to indicate the graph embedding processing effect of the pre-trained graph convolutional encoder and to determine whether it is necessary to continue training the graph convolutional encoder.
2. The method according to claim 1, characterized in that, The graph embedding model also includes a negative sample generator module, wherein the negative sample generator module includes a pre-trained negative sample generator and a pre-trained negative sample discriminator. Accordingly, the training process of the graph embedding model includes: An initial graph convolutional encoder is established, and the initial graph convolutional encoder is iteratively trained to obtain the pre-trained graph convolutional encoder. An initial mutual information discriminator is established, and the initial mutual information discriminator is iteratively trained to obtain the pre-trained mutual information discriminator; An initial negative sample generator is established, and the initial negative sample generator is iteratively trained to obtain a pre-trained negative sample generator. An initial negative sample discriminator is established, and the initial negative sample discriminator is iteratively trained to obtain a pre-trained negative sample discriminator.
3. The method according to claim 2, characterized in that, The step of establishing an initial graph convolutional encoder and iteratively training the initial graph convolutional encoder to obtain the pre-trained graph convolutional encoder includes: Establish the initial graph convolutional encoder, wherein the initial graph convolutional encoder includes encoder parameters; Obtain a preset number of training sample image information; Based on the preset number of training sample graph information and the autoencoder loss function, the initial graph convolutional encoder is iteratively trained to obtain updated encoder parameters; wherein, the autoencoder loss function is obtained by adding the reconstruction loss function and the mutual information discriminator loss function; The updated encoder parameters are applied to the initial graph convolutional encoder to obtain the pre-trained graph convolutional encoder.
4. The method according to claim 3, characterized in that, The reconstruction loss function is: In the formula, L REC Z is the reconstruction loss value; Z is the graph embedding vector. To reconstruct the matrix; A i,j It is the value in the i-th row and j-th column of the adjacency matrix; It is the value in the i-th row and j-th column of the reconstructed matrix; The loss function of the mutual information discriminator is: In the formula, It is the loss function value of the mutual information discriminator; A is the adjacency matrix; X is the feature matrix; E(A,X) is the result of the adjacency matrix and the feature matrix being computed by the pre-trained graph convolutional encoder; D MI (E(A,X)) is the value obtained by the pre-trained mutual information discriminator through the result calculated by the pre-trained graph convolutional encoder.
5. The method according to claim 2, characterized in that, The process of establishing an initial mutual information discriminator and iteratively training the initial mutual information discriminator to obtain the pre-trained mutual information discriminator includes: Establish the initial mutual information discriminator, wherein the initial mutual information discriminator includes mutual information discriminator parameters; The mutual information result between the feature matrix and the graph embedding vector is used as a positive sample; The mutual information of the node feature matrix and the graph embedding vector generated by the pre-trained negative sample generator is obtained as the negative sample. Based on the positive samples, the negative samples, and the loss function of the mutual information discriminator, the initial mutual information discriminator is iteratively trained to obtain the updated mutual information discriminator parameters; The updated mutual information discriminator parameters are applied to the initial mutual information discriminator to obtain the pre-trained mutual information discriminator.
6. The method according to claim 5, characterized in that, The loss function of the mutual information discriminator is: In the formula, y is the label value predicted based on the pre-trained mutual information discriminator; The actual label value; D MI (MI(X,Z)) is the first predicted label value calculated after the positive sample passes through the pre-trained mutual information discriminator; D MI (MI(X ′ Z ′ )) is the second predicted label value calculated after the negative sample is processed by the pre-trained mutual information discriminator; y~D MI (MI(X,Z)) represents that the actual predicted label value can be regarded as the data sampled from the first predicted label value; y~D MI (MI(X ′ Z ′ )) indicates that the actual predicted label value can be considered as data sampled from the second predicted label value; L MI The loss function is constructed based on the predicted label value and the true label value.
7. The method according to claim 2, characterized in that, The process of establishing an initial negative sample discriminator and iteratively training the initial negative sample discriminator to obtain a pre-trained negative sample discriminator includes: Establish the initial negative sample discriminator, wherein the initial negative sample discriminator includes negative sample discriminator parameters; Obtain the generated node feature matrix, wherein the generated node feature matrix refers to the vector obtained after sampling random vectors from the prior distribution and passing them through the negative sample generator; Based on the generated node feature matrix and the negative sample discriminator loss function, the initial negative sample discriminator is iteratively trained to obtain the updated negative sample discriminator parameters; The updated negative sample discriminator parameters are applied to the initial negative sample discriminator to obtain the pre-trained negative sample discriminator.
8. The method according to claim 7, characterized in that, The loss function of the negative sample discriminator is: In the formula, Let x be the loss function of the constructed negative sample discriminator; P data (x) represents x as a subset of the true data distribution P. data (x) The sampled data, which is the feature matrix; z′~P z′ (z′) indicates that z′ is the data sampled from the distribution of the generated data, which is the generated graph embedding vector; D NSG (x) is the negative sample discriminator, used to determine whether x is the feature matrix or the generated graph embedding vector; G NSG (z ′ ) represents the generated graph embedding vector z ′ The node feature matrix is generated by the negative sample generator.
9. The method according to claim 2, characterized in that, The process of establishing an initial negative sample generator and iteratively training the initial negative sample generator to obtain a pre-trained negative sample generator includes: Establish the initial negative sample generator, wherein the initial negative sample generator includes negative sample generator parameters; Obtain the generated node feature matrix, wherein the generated node feature matrix refers to the vector obtained after sampling random vectors from the prior distribution and passing them through the negative sample generator; Based on the generated node feature matrix and the negative sample generator loss function, the initial negative sample generator is iteratively trained to obtain the updated negative sample generator parameters. The updated negative sample generator parameters are applied to the initial negative sample generator to obtain the pre-trained negative sample generator.
10. The method according to claim 9, characterized in that, The loss function of the negative sample generator is: L p =-log(D NSG (X p′ )) In the formula, X′ is the generated node feature matrix; The generated node feature matrix X′ is processed by the pre-trained negative sample discriminator D. NSG The gradient of the loss function with respect to the input X′ is obtained; α is the pessimism, which ranges from [0,1]; X p′ The node feature matrix after the generated node feature matrix has been updated; L p The updated node feature matrix is then processed again by the negative sample discriminator to obtain the loss function.
11. The method according to claim 9, characterized in that, After applying the updated negative sample generator parameters to the initial negative sample generator to obtain the pre-trained negative sample generator, the process further includes: The updated negative sample discriminator parameters are further updated using the new negative sample discriminator loss function; The loss function of the new negative sample discriminator is: X′=G NSG (Z′) In the formula, X′ represents the node feature matrix generated by the generated random vector Z′ through the pre-trained negative sample generator; D NSG (X) represents the predicted label value obtained by the updated negative sample discriminator from the feature matrix; D NSG (X′) represents the predicted label value obtained by the generated node feature matrix through the updated negative sample discriminator; D NSG (1|X) represents the probability that the updated negative sample discriminator predicts the feature matrix to be 1; This represents the probability that the negative sample discriminator predicts the feature matrix to be 1 before the update; D NSG (0|X′) represents the probability that the updated negative sample discriminator predicts the generated node feature matrix to be 0; This indicates the probability that the generated node feature matrix predicted by the negative sample discriminator before the update is 0; β is a parameter value used to control the KL loss, typically taken as (0,1); D NSG (·|(X,X ′ )) represents the predicted label value of the updated negative sample discriminator for all data, including the feature matrix and the generated node feature matrix; This represents the predicted label value of the negative sample discriminator for all data, including the feature matrix and the generated node feature matrix, before the update. The KL divergence represents the predicted label values of the negative sample discriminator for all the data before and after the update, used to measure the difference in their distributions; L po This is the total loss function.
12. An image embedding processing apparatus, characterized in that, include: The feature acquisition module is used to acquire graph information to be processed and to acquire all node features in the graph information; The matrix determination module is used to determine the adjacency matrix and the feature matrix based on the characteristics of all nodes. The autoencoder module is used to input the adjacency matrix and the feature matrix into a pre-trained graph convolutional encoder to obtain the graph embedding vector corresponding to the graph information; The mutual information discrimination module is used to input the graph embedding vector and the feature matrix into a pre-trained mutual information discriminator to obtain the mutual information discrimination result corresponding to the graph information. The mutual information discrimination result is used to indicate the information correlation between the graph embedding vector and the feature matrix of the graph information before and after processing by the pre-trained graph convolutional encoder. The information correlation is used to indicate the graph embedding processing effect of the pre-trained graph convolutional encoder and to determine whether it is necessary to continue training the graph convolutional encoder.
13. A computer device, characterized in that, include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory to implement the method as described in any one of claims 1 to 11.
14. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1 to 11.
Citation Information
Patent Citations
Recommendation method based on graph twin network
CN111881342A
Graph classification method and device based on multi-granularity mutual information maximization
CN113449802A