Knowledge graph similarity evaluation method based on graph neural network
By introducing node-type attention mechanism and information cross-exchange mechanism into graph neural networks, the problem of knowledge graph similarity evaluation is solved, and fast and efficient similarity evaluation is achieved, improving the robustness and efficiency of evaluation.
Patent Information
- Application Number
- CN202410982646.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-22
- Publication Date
- 2024-11-15
AI Technical Summary
Existing graph neural networks have not yet effectively solved the problem of graph structure similarity assessment in knowledge graph similarity assessment, and lack effective methods to evaluate similarity between knowledge graphs.
Using a graph neural network-based method, the node type attention mechanism and information cross-exchange mechanism are used to gather node information and exchange information between graph structures, update node information, and finally use graph feature vectors to evaluate the similarity of knowledge graphs. .
It realizes rapid and efficient evaluation of knowledge graph similarity evaluation, reduces the aggregation of redundant information, ensures the robustness of evaluation, and improves the efficiency and ability of knowledge graph similarity search.
Smart Images

Figure CN118965017A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of deep learning, and specifically relates to a knowledge graph similarity evaluation method based on graph neural network. Background Art
[0002] Graphs are natural representations of encoded relational structures. Social networks, knowledge graphs, and chemical expressions can all be represented by graph structure data. With the development of deep learning, graph neural networks (GNNs) have begun to emerge in the supervised prediction problem of graph structures. GNNs maintain the invariance of graph node ordering by designing and calculating the representation of graph nodes. Subsequently, node representations can be directly applied to node classification tasks, or node representations can be merged into graph representations and applied to supervised classification or regression tasks of graph representations.
[0003] Computations defined on graph structures are also very useful for tasks such as similarity search of knowledge graphs and recommendation systems, many of which involve similarity evaluation of graph structures. However, methods for solving the problem of graph similarity evaluation using graph neural networks are still under development. The present invention proposes a graph structure similarity evaluation method based on graph neural networks for evaluating the similarity between knowledge graphs. Summary of the invention
[0004] The purpose of the present invention is to provide a knowledge graph similarity evaluation method based on graph neural network, aiming to evaluate the similarity between knowledge graphs.
[0005] The present invention is mainly achieved through the following technical solutions:
[0006] A knowledge graph similarity evaluation method based on graph neural network includes the following steps:
[0007] Step S10, initializing vector features of nodes, node types, and edge types in the knowledge graph;
[0008] Step S20, performing node information aggregation for the node type, aggregating the node information from neighboring nodes, and obtaining a neighboring node information vector;
[0009] Step S30, performing cross-node information aggregation on the node information between the graph structures, exchanging the information of the related nodes between the graph pairs, and obtaining a cross-graph information vector;
[0010] Step S40, based on the neighbor information of the node in step S200 and the cross node information in step S300, the node information is updated using a graph recurrent neural network;
[0011] Step S50, performing graph information aggregation based on node types, aggregating information of all nodes in the graph, and obtaining a graph feature vector;
[0012] Step S60, using the graph feature vector to perform similarity evaluation on the knowledge graph.
[0013] In order to better implement the present invention, further, step S10 includes the following steps:
[0014] S11, the entities in the knowledge graph that exist in the real world are represented as nodes v in G, and all entities constitute the node set V in G = {v1, v2, ..., v n}, and any node v∈V is accompanied by the corresponding initial node feature vector where d v Represents x v The initial vector dimension of ;
[0015] S12, the relationship between entities in the knowledge graph is represented as an edge e in G, and all edges constitute the edge set E{e wv =(w,v)|w,v∈V}, and any edge e wv ∈E is accompanied by the corresponding initial node feature vector where d e express The initial vector dimension of ;
[0016] S13, the entity type in the knowledge graph is represented as the node feature r of the node v in G v , all node types constitute the node type set in G And any node feature are accompanied by the corresponding initial node eigenvector where d r express The initial vector dimension of ;
[0017] S14, through the function F v 、F e and F r x v , as well as Mapped to the initial state vector h v (0) , edge state vector h e and the node type state vector h r , the formula is as follows,
[0018]
[0019] in, as well as in as well as They are the vector dimensions of the node state vector, edge state vector, and node type state vector respectively.
[0020] In order to better implement the present invention, further, the step S20 adopts an attention mechanism based on node type to aggregate information of any node v∈V from its neighboring nodes, including the following steps:
[0021] S21, in the kth iteration, k = 1, 2, ..., K, through the information aggregation function F n (k) Aggregate v from any of its neighboring nodes Information Represents the set of neighbor nodes of v, and the formula is:
[0022]
[0023] Where: h v (k-1) and h w (k-1) Represent the current node state vectors of nodes v and w respectively;
[0024] Represents the connecting edge e between nodes v and w wv The state vector of
[0025] F n (k) The specific implementation is a two-layer multi-layer perceptron:
[0026]
[0027] in:
[0028] is the learnable parameter matrix in the kth iteration;
[0029] and is the learnable bias vector in the kth iteration;
[0030] ReLU is the rectified linear unit:
[0031]
[0032] S22, design an attention mechanism based on node type, for node v any different type of neighbor nodes Determine its weight a'w in the information aggregation, the formula is:
[0033]
[0034] in:
[0035] are the node type state vectors of nodes v and w respectively;
[0036] is a learnable attention vector;
[0037] is a learnable shared parameter matrix that performs a linear transformation on the node type vector;
[0038] S23, gather node v’s information from all neighboring nodes The formula is:
[0039]
[0040] In order to better implement the present invention, further, the step S30 of aggregating the cross node information of the node v∈V includes the following steps:
[0041] S31, in the knowledge graph similarity evaluation task, determine another graph S(v) contains all nodes in G that are identical to v∈V in G, and S(v) contains nodes v'∈V' in G' that are identical to v;
[0042] S32, through the cosine similarity function F s Calculate the similarity between node v and any identical node v'∈V', and based on this, aggregate the cross-node information of node v from any identical node v' The formula is:
[0043]
[0044] Among them, F s The specific implementation is:
[0045]
[0046] Among them, ⊙ is the Hadamard product;
[0047] ||·||2 represents the second normal form of a vector;
[0048] S33, in the kth iteration, through the gating function F gate Calculate the gate weight g of the cross node information v , the formula is:
[0049]
[0050] Among them, σ is the sigmoid function, specifically,
[0051]
[0052] in, is the learnable parameter matrix in the kth iteration;
[0053] S34, gather all cross-node information of node v The formula is:
[0054]
[0055] In order to better implement the present invention, further, step S400 includes the following steps:
[0056] S41, in the kth iteration, using the neighbor node information and cross node information and the current state vector of node v Calculate the input gate of v The formula is:
[0057]
[0058] in, is the learnable parameter matrix in the kth iteration;
[0059] is the learnable bias vector in the kth iteration;
[0060] S42, in the kth iteration, using the neighbor node information Cross-node information and the current state vector of node v Compute the reset gate of v The formula is:
[0061]
[0062] in, is the learnable bias vector in the kth iteration;
[0063] S43, in the kth iteration, using the neighbor node information Cross-node information Reset Gate and the current state vector of node v Memory cell for computing v The formula is:
[0064]
[0065] Among them, tanh is the hyperbolic tangent function, and the formula is:
[0066]
[0067] S44 uses the input gate in the kth iteration Memory Unit and the current state vector of node v Update v's next state vector The formula is:
[0068]
[0069] In order to better implement the present invention, further, in step S500, the state vectors of all nodes in the graph are taken as input and the graph vector h is finally output. G The steps include:
[0070] S51, after the Kth iteration, through the gating function F' gate Calculate the weight g′ of node v in the graph aggregation v , the formula is:
[0071]
[0072] Among them, F' gate The specific implementation is:
[0073]
[0074] S52, for any node v∈V in graph G, the node state vector Perform a linear transformation to obtain h′ v , the formula is:
[0075]
[0076] In formula (23), is a learnable parameter matrix; is the learnable bias vector;
[0077] S53, using the graph aggregation function F G , based on the weight g ate , the linear transformation information h′ of the nodes in graph G v Perform weighted aggregation to obtain the graph vector h G , the formula is:
[0078] h G =F G (∑ v∈V g′ v ☉h′ v ) (twenty four)
[0079] In formula (24), F G The specific implementation is:
[0080] F G (∑v∈V g′ v ⊙h′ v )=ReLU(W G (∑ v∈V g′ v ☉h′ v +b G ) (25)
[0081] in, is a learnable parameter matrix; is the learnable bias vector.
[0082] In order to better implement the present invention, further, step S60 includes the following steps:
[0083] S61, the graph vector h corresponding to the two knowledge graphs G1 and h G2 Perform vector splicing to obtain the splicing vector h concat , the formula is:
[0084]
[0085] S62, using the prediction function F pred The similarity score of two knowledge graphs Z = [Z1, Z2] T To evaluate, the formula is:
[0086] z=F pred (h concat ) (27)
[0087] in, The corresponding elements z1 and z2 in the graph represent the scores of the two knowledge graphs in the categories of whether they are related or not. The specific implementation is:
[0088] F pred (h concat )=W2(ReLU(W1(h concat )+b1))+b2 (28)
[0089] In formula (28), are different learnable parameter matrices; are different learnable bias vectors;
[0090] S63, normalize the similarity score z to obtain the similarity probability in the interval [0,1] The formula is:
[0091]
[0092] In formula (29), For the corresponding z iThe normalized value of , i = {1,2}.
[0093] The beneficial effects of the present invention are as follows:
[0094] (1) The present invention uses a node-type attention mechanism to enable graph neural networks to aggregate information with different weights and reduce the aggregation of redundant information;
[0095] (2) The information cross-exchange mechanism designed by the present invention enables the graph neural network to dynamically exchange node information between corresponding graphs, thus ensuring the robustness of correlation evaluation;
[0096] (3) The present invention encodes the feature vectors of the knowledge graph through the designed graph neural network model, which can quickly evaluate the similarity of the knowledge graph and improve the efficiency and ability of the knowledge graph similarity search. BRIEF DESCRIPTION OF THE DRAWINGS
[0097] Figure 1 It is the overall flow chart of the present invention;
[0098] Figure 2 Flowchart for neighbor node information aggregation;
[0099] Figure 3 A flow chart for cross-node information aggregation;
[0100] Figure 4 Flowchart for updating node state vector;
[0101] Figure 5 A flowchart for graph aggregation;
[0102] Figure 6 Flowchart for similarity assessment. DETAILED DESCRIPTION
[0103] Embodiment 1:
[0104] A knowledge graph similarity evaluation method based on graph neural network, such as Figure 1 As shown, the following steps are included:
[0105] S1, initialize the features of nodes, node types, and edge types in the knowledge graph to obtain node state vectors, edge state vectors, and node type state vectors;
[0106] S2, design an attention mechanism based on node type to aggregate node information and aggregate node information from neighboring nodes;
[0107] S3, design the node information exchange mechanism between graph structures, perform cross-node information aggregation, exchange the information of related nodes between graph pairs, and obtain the neighbor node information vector;
[0108] S4, based on the node's neighbor information and cross-node information, update the node information by using a graph recurrent neural network to obtain a cross-graph information vector;
[0109] S5, design a gating mechanism based on node type to aggregate graph information, aggregate the information of all nodes in the graph, and obtain the graph vector;
[0110] S6, use graph vectors to evaluate the similarity of knowledge graphs.
[0111] Preferably, if Figure 2 As shown, the step S2 is provided with a first branch and a second branch, the node state vector, the edge state vector and the node type state vector are respectively input into the first branch for processing, and the first branch is provided with a fully connected layer (FC Layer), a rectified linear unit (Rectified Linear Unit, ReLU), a fully connected layer (FC Layer), and a rectified linear unit (Rectified Linear Unit, ReLU) from front to back. The node type state vector is input into the second branch for processing, and the second branch is provided with a fully connected layer, a fully connected layer, and a softmax function from front to back. The output ends of the first branch and the second branch are respectively processed by the multiplication layer to obtain the neighbor node information vector.
[0112] Preferably, if Figure 3 As shown, the step S3 is provided with a first branch and a second branch, the first branch is provided with a fully connected layer (FC Layer) and a sigmoid function from front to back, and the v-node type state vector is input into the first branch for processing. The second branch is provided with a cosine similarity function and a multiplication layer from front to back, the v-node state vector is input into the cosine similarity function, and the v' node identical to the v-node in another graph is respectively input into the cosine similarity function and the multiplication layer. The output ends of the first branch and the second branch are respectively processed by the Hadamard product to obtain the cross-graph information vector.
[0113] Preferably, if Figure 4 As shown, in step S4, the state vector of node v is updated by using a graph recurrent neural network. The graph recurrent neural network includes a first branch, a second branch, and a third branch, wherein the first branch, the second branch, and the third branch are respectively used to calculate the reset gate of v. Input Gate Memory Unit Then update the next state vector of v
[0114]
[0115] Preferably, if Figure 5 As shown, the step S5 is provided with a first branch and a second branch, and the first branch is provided with a fully connected layer (FC Layer), a rectified linear unit (Rectified Linear Unit, ReLU), a fully connected layer (FC Layer), and a rectified linear unit (Rectified Linear Unit, ReLU) from front to back. A fully connected layer (FC Layer) is provided on the second branch. The node type state vector is input to the first branch, and the node state vector is input to the second branch. The first branch and the second branch are respectively output to the Hadamard product, the fully connected layer (FC Layer), and the rectified linear unit (Rectified Linear Unit, ReLU) from front to back, and finally processed to obtain a graph vector.
[0116] Preferably, if Figure 6 As shown, in step S6, the graph vector corresponding to the knowledge graph is used to perform similarity evaluation. The graph vectors in the two graphs are concatenated to obtain a concatenated vector, which is then processed by the fully connected layer (FC Layer), the rectified linear unit (ReLU), the fully connected layer (FC Layer), and the softmax function to obtain the similarity score of the two graphs.
[0117] The present invention is based on the attention mechanism of node types, which enables the graph neural network to aggregate information with different weights and reduce the aggregation of redundant information. The information cross-exchange mechanism designed by the present invention can enable the graph neural network to dynamically exchange node information between corresponding graphs, ensuring the robustness of correlation evaluation; the present invention can quickly evaluate the similarity of knowledge graphs by encoding the feature vectors of knowledge graphs through the designed graph neural network model, thereby improving the efficiency and ability of knowledge graph similarity search.
[0118] Embodiment 2:
[0119] A knowledge graph similarity evaluation method based on graph neural network, such as Figure 1 As shown, the following steps are included:
[0120] S1, initialize the vector features of nodes, node types, and edge types in the knowledge graph;
[0121] S2, design an attention mechanism based on node type and aggregate the information of the node from neighboring nodes;
[0122] S3, design the node information exchange mechanism between graph structures, and exchange the information of related nodes between graph pairs;
[0123] S4, based on the node’s neighbor information and cross-node information, the graph recurrent neural network model is used to update the node information;
[0124] S5, design a gating mechanism based on node type and aggregate the information of all nodes in the graph to obtain the graph feature vector;
[0125] S6, uses graph feature vectors to evaluate the similarity of knowledge graphs.
[0126] Preferably, the step S1 of initializing the vector features of the knowledge graph includes:
[0127] S11, the entities in the knowledge graph that exist in the real world are represented as nodes v in G, and all entities constitute the node set V in G = {v1, v2, ..., v n}, and any node v∈V is accompanied by the corresponding initial node feature vector where d v Represents x v The initial vector dimension, in this example, d v is the number of entities in the knowledge graph;
[0128] S12, the relationship between entities in the knowledge graph is represented as an edge e in G, and all edges constitute the edge set E{e wv =(w,v)|w,v∈V}, and any edge e wv ∈E is accompanied by the corresponding initial node feature vector where d e express The initial vector dimension of ;
[0129] S13, the entity type in the knowledge graph is represented as the node feature r of the node v in G v , all node types constitute the node type set in G And any node feature are accompanied by the corresponding initial node eigenvector where d r express The initial vector dimension of ;
[0130] S14, through the function F v 、F e and F r x v , as well as Mapped to the initial state vector h v (0) , edge state vector h e and the node type state vector h r , the formula is as follows,
[0131]
[0132] In formulas (1)-(3), as well as in as well as They are the vector dimensions of the node state vector, edge state vector, and node type state vector respectively.
[0133] Preferably, if Figure 2 As shown, step S2 gathers information of any node v∈V from its neighboring nodes through the node type-based attention mechanism, including:
[0134] S21, in the kth (k = 1, 2, ..., K) iteration, through the information aggregation function F n (k) Aggregate v from any of its neighboring nodes Information Represents the set of neighbor nodes of v, and the formula is:
[0135]
[0136] In formula (4), h v (k-1) and h w (k-1) Represent the current node state vectors of nodes v and w respectively;
[0137] [;] indicates the concatenation of vectors;
[0138] (w,v) represents the connecting edge between nodes v and w;
[0139] F n (k) The specific implementation is a two-layer multi-layer perceptron (MLP):
[0140]
[0141] In formula (5), is the learnable parameter matrix in the kth iteration; and is the learnable bias vector in the kth iteration; ReLU is the rectified linear unit (ReLU):
[0142]
[0143] In this example, K = 3;
[0144] S22, design an attention mechanism based on node type, for node v any different type of neighbor nodes Determine its weight a'w in the information aggregation, the formula is:
[0145]
[0146]
[0147] In formula (7), and are the node type state vectors of nodes v and w respectively; is a learnable attention vector; is a learnable shared parameter matrix that performs a linear transformation on the node type vector;
[0148] S23, gather node v’s information from all neighboring nodes The formula is:
[0149]
[0150] Preferably, if Figure 3 As shown, step S3 of aggregating cross-node information of node v∈V includes:
[0151] S31, in the knowledge graph similarity evaluation task, determine another graph S(v) contains all nodes in G that are identical to v∈V in G, and S(v) contains nodes v'∈V' in G' that are identical to v;
[0152] S32, through the cosine similarity function F s Calculate the similarity between node v and any identical node v'∈V', and based on this, aggregate the cross-node information of node v from any identical node v' The formula is:
[0153]
[0154] In formula (10), F s The specific implementation is:
[0155]
[0156] In formula (11), ⊙ is the Hadamard product; ||·||2 represents the second normal form of the vector.
[0157] S33, in the kth iteration, through the gating function F gate Calculate the gate weight g of the cross node information v , the formula is:
[0158]
[0159] In formula (9), σ is the sigmoid function. Specifically,
[0160]
[0161] In formula (13), is the learnable parameter matrix in the kth iteration.
[0162] S34, gather all cross-node information of node v The formula is:
[0163]
[0164] Preferably, if Figure 4 As shown, step S4 uses a graph recurrent neural network (GRN) to update the state vector of node v, including:
[0165] S41, in the kth iteration, using the neighbor node information and cross-node information and the current state vector of node v Calculate the input gate of v The formula is:
[0166]
[0167] In formula (16), is the learnable parameter matrix in the kth iteration; is the learnable bias vector in the kth iteration.
[0168] S42, in the kth iteration, using the neighbor node information Cross-node information and the current state vector of node v Compute the reset gate of v The formula is:
[0169]
[0170] In formula (17), is the learnable parameter matrix in the kth iteration; is the learnable bias vector in the kth iteration.
[0171] S43, in the kth iteration, using the neighbor node information Cross-node information Reset Gate and the current state vector of node v Memory cell for computing v The formula is:
[0172]
[0173] In formula (18), is the learnable parameter matrix in the kth iteration; is the learnable bias vector in the kth iteration; tanh is the hyperbolic tangent function, and the formula is:
[0174]
[0175] S44 uses the input gate in the kth iteration Memory Unit and the current state vector of node v Update v's next state vector The formula is:
[0176]
[0177] Preferably, if Figure 5 As shown, step S5 takes the state vectors of all nodes in the graph as input and finally outputs the graph vector h G The steps include:
[0178] S51, after the Kth iteration, through the gating function F' gate Calculate the weight g′ of node v in the graph aggregation v , the formula is:
[0179]
[0180] In formula (21), F' gate The specific implementation is:
[0181]
[0182] S52, for any node v∈V in graph G, the node state vector Perform a linear transformation to obtain h′ v , the formula is:
[0183]
[0184] In formula (23), is a learnable parameter matrix; is a learnable bias vector. S53, using the graph aggregation function F G , based on the weight g′ ate , the linear transformation information h′ of the nodes in graph G v Perform weighted aggregation to obtain the graph vector h G, the formula is:
[0185] h G =F G (∑ v∈V g′ v ☉h′ v ) (twenty four)
[0186] In formula (24), F G The specific implementation is:
[0187]
[0188] In formula (25), is a learnable parameter matrix; is the learnable bias vector.
[0189] Preferably, if Figure 6 As shown, step S6 uses the graph vector corresponding to the knowledge graph to perform similarity evaluation, including:
[0190] S61, the graph vector h corresponding to the two knowledge graphs G1 and h G2 Perform vector splicing to obtain the splicing vector h concat , the formula is:
[0191]
[0192] S62, using the prediction function F pred The similarity score of two knowledge graphs z = [z1, z2] T To evaluate, the formula is:
[0193] z=F pred (h concat ) (27)
[0194] In formula (27), The corresponding elements z1 and z2 in the graph represent the scores of the two knowledge graphs in the categories of whether they are related or not. The specific implementation is:
[0195] F pred (h concat )=W2(ReLU(W1(h concat )+b1))+b2 (28)
[0196] In formula (28), are different learnable parameter matrices; are different learnable bias vectors.
[0197] S63, normalize the similarity score z to obtain the similarity probability in the interval [0,1] The formula is:
[0198]
[0199] In formula (29), (i={1,2}) is the corresponding z i The normalized value of .
[0200] z1 is the similarity evaluation value of the two knowledge graphs. The larger z1 is, the more similar the structures of the knowledge graphs are.
[0201] The present invention adopts an attention mechanism based on node types, which enables the graph neural network to aggregate information with different weights and reduce the aggregation of redundant information; the information cross-exchange mechanism designed by the present invention enables the graph neural network to dynamically exchange node information between corresponding graphs, thereby ensuring the robustness of correlation evaluation; the present invention encodes the feature vectors of the knowledge graph through the designed graph neural network model, which can quickly evaluate the similarity of the knowledge graph and improve the efficiency and capability of similarity search of the knowledge graph.
[0202] The above description is only a preferred embodiment of the present invention and does not limit the present invention in any form. Any simple modification or equivalent change made to the above embodiment based on the technical essence of the present invention shall fall within the protection scope of the present invention.
Claims
1. A knowledge graph similarity evaluation method based on graph neural network, characterized in that: The following steps are involved: Step S10, initializing vector features of nodes, node types, and edge types in the knowledge graph; Step S20, performing node information aggregation for the node type, aggregating the node information from neighboring nodes, and obtaining a neighboring node information vector; Step S30, performing cross-node information aggregation on the node information between the graph structures, exchanging the information of the related nodes between the graph pairs, and obtaining a cross-graph information vector; Step S40, based on the neighbor information of the node in step S200 and the cross node information in step S300, the node information is updated using a graph recurrent neural network; Step S50, performing graph information aggregation based on node types, aggregating information of all nodes in the graph to obtain a graph feature vector; Step S60, using the graph feature vector to perform similarity evaluation on the knowledge graph.
2. According to claim 1, a knowledge graph similarity evaluation method based on graph neural network is characterized in that: The step S10 comprises the following steps: S11, the entities in the knowledge graph that exist in the real world are represented as nodes v in G, and all entities constitute the node set V in G = {v1, v2, ..., v n }, and any node v∈V is accompanied by the corresponding initial node feature vector where d v Represents x v The initial vector dimension of ; S12, the relationship between entities in the knowledge graph is represented as an edge e in G, and all edges constitute the edge set E in G = {e wv =(w,v)|w,v∈V}, and any edge e wv ∈E is accompanied by the corresponding initial node feature vector where d e express The initial vector dimension of ; S13, the entity type in the knowledge graph is represented as the node feature r of the node v in G v , all node types constitute the node type set in G And any node feature are accompanied by the corresponding initial node eigenvector where d r express The initial vector dimension of ; S14, through the function F v 、F e and F r Respectively as well as Mapped to the initial state vector h v (0) , edge state vector h e and the node type state vector h r , the formula is as follows, in, as well as in as well as They are the vector dimensions of the node state vector, edge state vector, and node type state vector respectively.
3. According to claim 2, a knowledge graph similarity evaluation method based on graph neural network is characterized in that: In step S20, an attention mechanism based on node type is adopted to aggregate information of any node v∈V from its neighboring nodes, including the following steps: S21, in the kth iteration, k = 1, 2, ..., K, through the information aggregation function F n (k) Aggregate v from any of its neighboring nodes Information Represents the set of neighbor nodes of v, and the formula is: Where: h v (k-1) and h w (k-1) Represent the current node state vectors of nodes v and w respectively; Represents the connecting edge e between nodes v and w wv The state vector of F n (k) The specific implementation is a two-layer multi-layer perceptron: in: is the learnable parameter matrix in the kth iteration; and is the learnable bias vector in the kth iteration; ReLU is the rectified linear unit: S22, design an attention mechanism based on node type, for node v any different type of neighbor nodes Determine its weight a' in the information aggregation w , the formula is: in: are the node type state vectors of nodes v and w respectively; is a learnable attention vector; is a learnable shared parameter matrix that performs a linear transformation on the node type vector; S23, gather node v’s information from all neighboring nodes The formula is:
4. According to claim 3, a knowledge graph similarity evaluation method based on graph neural network is characterized in that: Aggregating the cross-node information of the node v∈V in step S30 includes the following steps: S31, in the knowledge graph similarity evaluation task, determine another graph S(v) contains all nodes in G that are identical to v∈V in G, and S(v) contains nodes v'∈V' in G' that are identical to v; S32, through the cosine similarity function F s Calculate the similarity between node v and any identical node v'∈V', and based on this, aggregate the cross-node information of node v from any identical node v' The formula is: Among them, F s The specific implementation is: Among them, ⊙ is the Hadamard product; ||·||2 represents the second normal form of a vector; S33, in the kth iteration, through the gating function F gate Calculate the gate weight g of the cross node information v , the formula is: Among them, σ is the sigmoid function, specifically, in, is the learnable parameter matrix in the kth iteration; S34, gather all cross-node information of node v The formula is:
5. According to claim 4, a knowledge graph similarity evaluation method based on graph neural network is characterized in that: The step S400 includes the following steps S41, in the kth iteration, using the neighbor node information and cross-node information and the current state vector of node v Calculate the input gate of v The formula is: in, is the learnable parameter matrix in the kth iteration; is the learnable bias vector in the kth iteration; S42, in the kth iteration, using the neighbor node information Cross-node information and the current state vector of node v Compute the reset gate of v The formula is: in, is the learnable bias vector in the kth iteration; S43, in the kth iteration, using the neighbor node information Cross-node information Reset Gate and the current state vector of node v Memory cell for computing v The formula is: Among them, tanh is the hyperbolic tangent function, and the formula is: S44 uses the input gate in the kth iteration. Memory Unit and the current state vector of node v Update v's next state vector The formula is:
6. According to claim 5, a knowledge graph similarity evaluation method based on graph neural network is characterized in that: In step S500, the state vectors of all nodes in the graph are taken as input and the graph vector h is finally output. G The steps include: S51, after the Kth iteration, through the gating function F' gate Calculate the weight g′ of node v in the graph aggregation v , the formula is: Among them, F′ gate The specific implementation is: S52, for any node v∈V in graph G, the node state vector Perform a linear transformation to obtain h′ v , the formula is: In formula (23), is a learnable parameter matrix; is the learnable bias vector; S53, using the graph aggregation function F G , based on the weight g′ ate , the linear transformation information h′ of the nodes in graph G v Perform weighted aggregation to obtain the graph vector h G , the formula is: h G =F G (∑ v∈V g′ v ☉h′ v ) (24) In formula (24), F G The specific implementation is: F G (∑ v∈V g′ v ⊙h′ v )=ReLU(W G (∑ v∈V g′ v ☉h′ v +b G ) (25) in, is a learnable parameter matrix; is the learnable bias vector.
7. The method for evaluating knowledge graph similarity based on graph neural network according to claim 6, characterized in that: The step S60 comprises the following steps: S61, the graph vector h corresponding to the two knowledge graphs G1 and h G2 Perform vector splicing to obtain the splicing vector h concat , the formula is: S62, using the prediction function F pred The similarity score z of two knowledge graphs is [z1, z2] T To evaluate, the formula is: z=F pred (h concat ) (27) in, The corresponding elements z1 and z2 in the graph represent the scores of the two knowledge graphs in the categories of whether they are related or not. The specific implementation is: <h2 style=";text-align:left;direction:ltr">F<h2 style=";text-align:left;direction:ltr"> pred <h2 style=";text-align:left;direction:ltr"> (h<h2 style=";text-align:left;direction:ltr"> concat <h2 style=";text-align:left;direction:ltr"> )=W2(ReLU(W1(h<h2 style=";text-align:left;direction:ltr"> concat <h2 style=";text-align:left;direction:ltr"> )+b1))+b2 (28) In formula (28), are different learnable parameter matrices; are different learnable bias vectors; S63, normalize the similarity score z to obtain the similarity probability in the interval [0,1] The formula is: In formula (29), For the corresponding z i The normalized value of , i = {1,2}.
