Knowledge graph completion method based on DeepPath-CompGCN
By introducing the DeepPath-CompGCN model into the knowledge graph completion method, combining the embedding representation of CompGCN and the path reasoning of DeepPath, the problem of missing entity relationships in the knowledge graph is solved, and the accuracy and interpretability of reasoning are improved.
Patent Information
- Application Number
- CN202411846615.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-16
- Publication Date
- 2025-04-04
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing knowledge graph completion method is difficult to effectively solve the problem of missing entity relationships in the knowledge graph, especially in terms of inference accuracy and interpretability in complex data sets.
The knowledge graph completion method based on DeepPath-CompGCN is adopted, and the entities and relationships in the knowledge graph are embedded in the representation through the CompGCN convolution layer, and path inference is performed in combination with the DeepPath model to obtain the optimal inference path to complete the knowledge graph.
It improves the inference accuracy and interpretability of the model, effectively solves the problem of missing entity relationships in complex data sets, and enhances the ability to complete the knowledge graph.
Smart Images

Figure CN119761477A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of knowledge reasoning technology, and more specifically to a knowledge graph completion method based on DeepPath-CompGCN. Background Art
[0002] Since its birth, knowledge graph has become a research hotspot in the field of artificial intelligence. It represents and stores complex entities and their relationships in a structured way, enabling machines to understand and reason about knowledge like humans. In recent years, knowledge graphs have been widely used in many fields such as search engines, recommendation systems, and intelligent question answering, resulting in a series of large-scale knowledge graphs, such as Google Knowledge Graph, DBpedia, and YAGO. These knowledge graphs cover many fields such as medicine, education, and business. However, despite their large scale and rich information, they still face a lot of information missing problems, such as incomplete relationships between entities and missing attributes of certain entities. This lack of knowledge severely limits downstream tasks based on knowledge graphs and fails to give full play to their potential reasoning and application value.
[0003] To solve these problems, researchers have proposed different methods to complete the knowledge graph task. Knowledge graph completion technology aims to mine unknown triple information from known knowledge through algorithms to complete the existing knowledge graph. At present, the mainstream knowledge graph completion methods are mainly divided into two categories: reasoning methods based on symbolic logic and embedding methods based on machine learning. The former relies on logical rules and known knowledge for deductive reasoning. Although the reasoning accuracy is high and the reasoning process is rigorous, it faces the problems of poor scalability and complex rule definition; the latter embeds entities and relationships into low-dimensional vector space and uses mathematical operations to infer possible relationships. In recent years, with the continuous advancement of machine learning technology, knowledge reasoning methods that embed machine learning have become mainstream. For example, scholars at home and abroad have proposed a series of Trans series models for knowledge graph completion. These models model the relationship between entities in low-dimensional vector space through migration characteristics. Such methods are easy to operate and have strong scalability, but they are not effective in modeling complex relationships.
[0004] In addition, many knowledge graph completion models based on deep neural networks, such as Convolutional Neural Networks (CNN), Recurrent Neural Networks (RNN) and Graph Neural Networks (GNN), can mine the expression features of complex relationships, but only learn the information of triples, ignoring the rich semantic information contained in the entity relationships in the knowledge graph, and thus cannot effectively solve the sparsity and incompleteness problems of the knowledge graph. To this end, Kipf proposed a model based on Graph Convolutional Network (GCN), which aims to mine the graph structure information of the knowledge graph. However, the GCN model regards the knowledge graph as an undirected single relationship graph, ignoring the characteristics and local information of multiple relationships in the knowledge graph, and lacks interpretability.
[0005] DeepPath is a knowledge reasoning method based on reinforcement learning. By explicitly modeling the path reasoning process, the model can clearly track the steps and logic of reasoning, and has strong interpretability. Although DeepPath performs path reasoning through reinforcement learning and has good interpretability, its embedding method has certain limitations. DeepPath relies on fixed knowledge graph embedding, which usually fails to fully capture the feature expression of complex relationships and may cause information loss when the model handles complex reasoning tasks. In addition, the static nature of the embedding limits the generalization ability of the model in dynamic or incomplete knowledge graphs, making the reasoning results more sensitive to the quality of the embedding and difficult to adapt to diverse knowledge reasoning scenarios.
[0006] Therefore, how to better model the interdependencies between entities and relationships to address the problem of missing entity relationships in complex data sets and to help improve the reasoning accuracy and explainability of the model is an issue that technical personnel in this field urgently need to solve. Summary of the invention
[0007] In view of the above problems, the present invention provides a knowledge graph completion method based on DeepPath-CompGCN to at least solve some of the technical problems mentioned in the above background technology.
[0008] In order to achieve the above object, the present invention adopts the following technical solution:
[0009] The present invention provides a knowledge graph completion method based on DeepPath-CompGCN, comprising the following steps:
[0010] The entities and relations in the knowledge graph are embedded through the CompGCN convolutional layer to obtain a composite embedding matrix containing the entity embedding matrix and the relationship embedding matrix;
[0011] The entity embedding matrix is used as the state space, and the relationship embedding matrix is used as the action space, and input into the DeepPath model for path reasoning to obtain the optimal reasoning path;
[0012] The knowledge graph is completed according to the optimal reasoning path.
[0013] Furthermore, the entities and relations in the knowledge graph are embedded and represented by the CompGCN convolutional layer to obtain a composite embedding matrix including an entity embedding matrix and a relationship embedding matrix, which specifically includes:
[0014] Extract all entities and the corresponding relationships between entities from the knowledge graph, and initialize the entity embedding matrix and the relationship embedding matrix;
[0015] Constructing an adjacency matrix of the knowledge graph;
[0016] Input the initialized entity embedding matrix and relationship embedding matrix, as well as the adjacency matrix, into the CompGCN convolutional layer, and perform embedding update through the activation function;
[0017] After each round of embedding update is completed, the loss function is calculated to optimize the CompGCN convolutional layer until convergence, and a composite embedding matrix containing an entity embedding matrix and a relationship embedding matrix is obtained.
[0018] Further, the composite embedding matrix is expressed as:
[0019]
[0020] Among them, σ represents the activation function; R h Represents all relations related to the head entity h; represents the set of all neighbor entities connected to the head entity h through the relationship r; t represents the tail entity; Indicates the head entity containing relation information in layer L-1; represents the tail entity containing relation information in the L-1th layer; f r (·) represents the combinatorial function of relation r; Represents the learnable weight matrix of the L-1th layer correspondence r.
[0021] Furthermore, the entity embedding matrix includes a head entity embedding matrix and a tail entity embedding matrix.
[0022] Furthermore, during the path reasoning process:
[0023] Obtaining a current state space, wherein the current state space includes a head entity embedding matrix and a tail entity embedding matrix in a current reasoning path, and a historical reasoning path;
[0024] Inputting the current state space into a gated recurrent unit to encode the historical reasoning path and generate an implicit representation of the current state space;
[0025] Based on the implicit representation of the current state space, the selection probability of each candidate relationship is calculated through the Softmax layer to obtain the relationship probability distribution;
[0026] According to the relation probability distribution, a relation is selected from the relation embedding and jumps from the current entity to the next entity through the relation.
[0027] Repeat the above process until the DeepPath model converges and obtains the optimal inference path.
[0028] Furthermore, during the path reasoning process, a reward function is set to evaluate the path reasoning effect; if the reasoning path is successfully connected and the relationship is correct, a positive reward is given, otherwise a negative reward is given.
[0029] Furthermore, the cumulative reward during path reasoning is expressed as:
[0030]
[0031] Among them, G k represents the cumulative reward up to time step k; K represents the total duration; γ represents the discount factor; R(π k' ) represents the immediate reward obtained in the k' step.
[0032] It can be seen from the above technical solution that, compared with the prior art, the present invention discloses a knowledge graph completion method based on DeepPath-CompGCN, which has the following beneficial effects:
[0033] This paper effectively models the interdependence between entities and relationships based on CompGCN, and introduces DeepPath on this basis, which effectively improves the accuracy and interpretability of model reasoning and solves the problem of missing entity relationships in complex data sets.
[0034] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0036] Figure 1 A schematic diagram of the graph structure provided for related prior art.
[0037] Figure 2 A schematic diagram of an adjacency matrix provided for related prior art.
[0038] Figure 3 A schematic diagram of the process flow of the knowledge graph completion method based on DeepPath-CompGCN provided in an embodiment of the present invention.
[0039] Figure 4 A schematic diagram of the DP-CompGCN model framework provided in an embodiment of the present invention.
[0040] Figure 5 A schematic diagram of the embedding principle provided by an embodiment of the present invention.
[0041] Figure 6 A schematic diagram of the path reasoning principle provided by an embodiment of the present invention.
[0042] Figure 7 A schematic diagram of the performance of the FB15K-237 dataset provided in an embodiment of the present invention.
[0043] Figure 8 A schematic diagram of the performance of the NELL-995 dataset provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0044] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0045] An embodiment of the present invention discloses a knowledge graph completion method based on DeepPath-CompGCN, comprising: embedding entities and relationships in a knowledge graph through a CompGCN convolutional layer to obtain a composite embedding matrix including an entity embedding matrix and a relationship embedding matrix; using the entity embedding matrix as a state space and the relationship embedding matrix as an action space, inputting them into a DeepPath model for path reasoning to obtain an optimal reasoning path; and completing the knowledge graph according to the optimal reasoning path.
[0046] This method considers the categories and directions of relations in the knowledge graph through the Composition-Based Multi-Relational Graph Convolutional Networks (CompGCN), better models the interdependence between entities and relations, and introduces DeepPath on this basis, which effectively improves the model reasoning accuracy and interpretability. The above content is explained in detail below.
[0047] First, the relevant algorithms involved in this invention are briefly described:
[0048] 1. Knowledge graph embedding method based on graph neural network
[0049] High-quality embedding is an effective guarantee for the accuracy of knowledge reasoning. Graph neural networks have become a commonly used embedding method in deep learning models based on the information transmission and aggregation mechanism between their nodes. In the DeepPath algorithm, entity relationship embedding representation is an important part of it, and better reasoning effect can be obtained by combining graph embedding.
[0050] 1.1 GCN Algorithm Principle
[0051] The GCN algorithm is a deep learning model suitable for graph structure data, which is used to capture the relationship between nodes and their neighbors in the graph. The graph structure consists of "nodes" and "edges". The representation is shown in formula (1):
[0052] G=(V,E) (1)
[0053] In formula (1), G represents a graph; V represents the set of nodes in the graph, each node can represent an entity; E represents the set of edges, an edge is the relationship between two entities, and in the graph it represents the relationship between two nodes. Depending on the nature of the connection, the edge can be directed or undirected. The graph can also be represented by an adjacency matrix A, Figure 1 is a diagram of the graph structure, where X1 to X5 represent entities, R1 to R6 represent the relationship between entities, and its adjacency matrix is as follows Figure 2 shown.
[0054] from Figure 1 It can be seen that the adjacency matrix can be used to mathematically express the graph according to whether each entity has a relationship with other entities, as shown in formula (2):
[0055]
[0056] Among them, A ij =1 means that there is an edge connecting nodes i and j, that is, there is a relationship between the two entities. ij =0 means there is no edge between the two nodes.
[0057] The key step of GCN is the aggregation process of node features, that is, each node receives information from neighboring nodes and updates its own representation. In each layer of aggregation, the feature representation of node i is a weighted average of the features of itself and all neighboring nodes. The update formula of each layer of GCN is shown in formula (3):
[0058]
[0059] Among them, H (l) Represents the node feature matrix of the lth layer, and the feature of each node is a vector; W (l) represents the learnable weight matrix of layer l; It represents the adjacency matrix A plus the self-connected identity matrix I, which can be expressed as formula (4). This ensures that the nodes can retain their own characteristics in each layer; express The degree matrix of is used to normalize the adjacency matrix A to prevent imbalance in information aggregation caused by different node degrees. σ(·) represents the activation function.
[0060]
[0061] When information is aggregated, the adjacency matrix A is normalized, that is, This can avoid the problem of excessive or insufficient information dissemination during the aggregation process and ensure the stability of feature updates.
[0062] Therefore, the core idea of GCN is to learn effective node embedding in the graph by aggregating the information of nodes and their neighboring nodes and updating the representation of nodes layer by layer. It is precisely because of its ability to efficiently aggregate information and capture complex relationships in the graph that it is applied to tasks such as node classification, edge prediction, and graph classification.
[0063] 1.2 CompGCN Algorithm Principle
[0064] The GCN algorithm only considers the features of nodes, ignoring the relationships between nodes and the types and directions of relationships. Therefore, Vashishth et al. proposed using Composition-Based Multi-Relational Graph Convolutional Networks (CompGCN) to obtain the embedding method of neighbor entities and relationships in the knowledge graph. CompGCN combines the traditional GCN with the representation method of complex relationships in the knowledge graph. It is a graph convolutional network designed for knowledge graph completion and link prediction tasks, which can better handle the complex relationships between entities and relationships in the knowledge graph. CompGCN not only updates the features of the nodes, but also considers the relationship types between the nodes. In the knowledge graph, nodes represent entities and edges represent the relationships between entities. Therefore, the modeling of relationships during the convolution process is an important difference between CompGCN and GCN.
[0065] The knowledge graph can also be represented as G = (V, E), where V represents the set of nodes, that is, the set of entities; E represents the set of edges. However, each edge consists of a triple (h, r, t), where h represents the head entity, t represents the tail entity, and r represents the relationship between the head entity h and the tail entity t.
[0066] If each node is represented by a feature vector, h represents the head entity feature vector, t represents the tail entity feature vector, and r represents the relationship feature vector. In CompGCN, relationships are not simply connected, but modeled through combination operations. Common combination operations include basic operations, complex number mapping, etc.
[0067] In GCN, the update of nodes is performed by aggregating the features of neighboring nodes. In CompGCN, the update of nodes needs to be combined with relationship information. The update formula of the entity is shown in formula (5):
[0068]
[0069] Among them, R h Represents all relations related to the head entity h; represents the set of all neighbor entities connected to the head entity h through relations r; h (l) Indicates the header entity of layer l; t (l) represents the tail entity of the lth layer; f r (h (l) ,t (l) ,r) represents the combination function of relation r, which combines the node features and relation features of the first two layers. represents the learnable weight matrix of the corresponding relation r of the lth layer, and σ represents the activation function.
[0070] To ensure that entities retain their own features during the convolution process, CompGCN allows nodes to be connected to themselves. At the same time, in order to capture bidirectional relationships, inverse relationships are considered, such as (t,r -1 ,h). CompGCN also has a multi-layer propagation mechanism that can obtain information from more distant nodes
[0071] Next, the knowledge graph completion method based on DeepPath-CompGCN provided by the present invention is specifically described:
[0072] 2. DeepPath-CompGCN Model
[0073] CompGCN uses a composite representation of entities and relationships to simultaneously process the interactions of entities and relationships, thereby generating a richer knowledge graph embedding. This embedding representation provides a high-dimensional vector representation of entities and relationships, which can accurately capture their semantic relationships. Combined with the DeepPath algorithm, it improves the accuracy of reasoning and increases interpretability. The schematic diagram of the knowledge graph completion method based on DeepPath-CompGCN (hereinafter referred to as DP-CompGCN) is shown below. Figure 3 shown.
[0074] 2.1 Model Framework
[0075] The workflow of the DP-CompGCN model can be divided into two stages: embedding generation and path reasoning. DeepPath is a knowledge reasoning algorithm based on reinforcement learning, so the reasoning process can be regarded as a Markov decision process (MDP). Define a tuple<S,Act,P,R> Denotes MDP, S denotes state space, Act denotes a set of actions, P denotes a transition probability matrix, and R denotes a reward function. In the knowledge reasoning task, the knowledge graph is regarded as the state space of the MDP, and the relationship is regarded as an action set. By defining the policy network and reward function of the reinforcement learning agent, the reasoning task can be converted into a reinforcement learning task.
[0076] The DP-CompGCN model framework is as follows Figure 4 As shown. First, the entities and relations of the knowledge graph are fused through CompGCN to obtain a composite embedding matrix containing the entity embedding matrix and the relationship embedding matrix. The entity embedding matrix is used as the state space and the relationship embedding matrix is used as the action space, which are input into the DeepPath model for learning. During the reasoning process, the state space corresponds to the entity embedding matrix in the current reasoning path, while the action space consists of the potentially selectable relationship embedding matrix. The DeepPath model uses the policy network to reason and select the next action in the path.
[0077] 2.2 Embedding process
[0078] In CompGCN, the embedding process aims to map entities and relations into a high-dimensional space for subsequent knowledge graph reasoning. Figure 5 As shown, the process can be divided into the following steps
[0079] (1) Extract all entities and the corresponding relationships between entities from the knowledge graph and initialize the entity embedding matrix and the relation embedding matrix Among them, |V E | represents an entity set, |V R | represents a relationship set; d represents the embedding dimension.
[0080] (2) Constructing the adjacency matrix of the knowledge graph Its element a ij Represents entity e i and entity e j Is there a relationship between them? If so, then a ij =1, otherwise a ij =0.
[0081] (3) Input the initialized entity embedding matrix, relationship embedding matrix, and adjacency matrix into the CompGCN convolutional layer and perform embedding update through activation function;
[0082] (4) After each round of embedding update is completed, the loss function is calculated to optimize the CompGCN convolutional layer until convergence, and a composite embedding matrix containing the entity embedding matrix and the relationship embedding matrix is obtained;
[0083] The composite embedding matrix is expressed as:
[0084]
[0085] Among them, σ represents the activation function; R h Represents all relations related to the head entity h; represents the set of all neighbor entities connected to the head entity h through the relationship r; t represents the tail entity; Indicates the head entity containing relation information in layer L-1; represents the tail entity containing relation information in the L-1th layer; f r (·) represents the combinatorial function of relation r; Represents the learnable weight matrix of the L-1th layer correspondence r.
[0086] Through the above calculation process, the composite embedding matrix E final It can be divided into a high-dimensional head entity embedding matrix E Hfinal and the high-dimensional tail entity embedding matrix E I final These embedding matrices not only contain the information of the entity itself, but also combine the information of its neighboring entities, which can more comprehensively capture the semantic relationship between entities and provide rich contextual information for the subsequent reasoning process, enabling the DeepPath algorithm to effectively perform path reasoning and relationship selection.
[0087] 2.3 Policy Network
[0088] In the DP-CompGCN model, DeepPath’s policy network is the core component used to guide path reasoning. Figure 6 As shown in Figure 2, it selects the optimal reasoning path through reinforcement learning, gradually building on the knowledge graph from the source entity e s Reasoning to the target entity e t The target entity is another entity that is directly or indirectly connected to the source entity through a relationship. The input of the DeepPath model is the current state space, that is, the entity and relationship embeddings generated by CompGCN, and the context information of the historical reasoning path. Through the policy network, the model can select the next step of the relationship in each step of reasoning until the target entity is reached.
[0089] 2.3.1 Network Structure
[0090] The policy network uses a recurrent neural network structure. Specifically, it uses a gated recurrent unit (GRU) to encode the historical information of the reasoning path. GRU can effectively capture the dependencies between each step in the reasoning process and adjust the next step selection based on the reasoning history. The input of the policy network is the current spatial state s k , which includes the head entity embedding matrix h in the current reasoning path s (i.e., the source entity embedding matrix) and the tail entity embedding matrix h t (i.e., the target entity embedding matrix), and the historical reasoning path π k , this information is input into GRU to encode the historical reasoning path and generate the implicit representation of the current state space
[0091] Implicit representation based on the current state space The selection probability of each candidate relationship is calculated through the Softmax layer to obtain the relationship probability distribution; it is expressed as:
[0092]
[0093] Among them, a k represents the action selected at time step k; Wo Represents the trainable weight matrix of the output layer.
[0094] 2.3.2 Action Selection
[0095] The action selection is based on the probability distribution of the policy network output. The model selects a relation from the relation embedding according to the relation probability distribution and jumps from the current entity to the next entity through the relation. Assume that the current state space s k It is entity e k , then action a k will select a relation r and jump to the relation e through it k The next entity connected to k+1 This probability-based selection not only prevents the model from falling into the local optimum, but also increases the model's ability to explore different paths.
[0096] Repeat the above process until the DeepPath model converges and obtains the optimal inference path.
[0097] 2.4 Reward Function
[0098] The reward function is an important component used to guide the reinforcement learning process in the DP-CompGCN model. Its main function is to help the model learn a better path selection strategy by providing feedback on the path reasoning results. In the path reasoning task, the reward function is π = (p1, p2, p3, ..., p k ) provides reward feedback to promote the gradual optimization of the strategy network.
[0099] In the DeepPath policy network of DP-CompGCN, in order to evaluate the effect of path reasoning, the reward function is designed to give positive rewards if the reasoning path connection is successful and the relationship is correct, otherwise negative rewards are given. The reward function is expressed as:
[0100]
[0101] In the reinforcement learning framework, the model not only considers the immediate reward, but also evaluates the cumulative reward in the entire reasoning path. For each step of reasoning, the policy network will calculate the reward based on the current state and the selected action a. t To update the model's strategy. The present invention uses the policy gradient method for training, that is, adjusting the parameters of the policy network by accumulating rewards in the path. The cumulative reward in the path reasoning process is expressed as:
[0102]
[0103] Among them, G krepresents the cumulative reward at time step k; K represents the total duration; γ represents the discount factor, γ∈[0,1], which is used to indicate the influence of future rewards on the current strategy; R(π k' ) represents the immediate reward obtained in the k' step. By calculating the cumulative reward of each reasoning path, the model can evaluate different paths and adjust the strategy according to the overall effect of the path. The introduction of the discount factor ensures that the model not only focuses on the immediate reward during the reasoning process, but also balances the current and future benefits, thereby avoiding short-sighted decision-making.
[0104] 2.5 Combining Embedding and Reasoning
[0105] In the DP-CompGCN model, the generated entity and relation embeddings are the basis for reasoning. Through CompGCN, the embedding representations of the head entity and the tail entity are obtained, denoted as E H final and E I final , these embedding matrices can effectively capture the semantic relationship between entities. At the same time, the relation embedding matrix R H It is also learned for use during inference.
[0106] In the path reasoning stage, the state space S and action space Act are defined as a set of embedding matrices. The state space representation is shown in formula (10):
[0107] s k =(h s ,h t ) (10)
[0108] Among them, h s represents the embedding matrix of the head entity (i.e., the embedding matrix of the source entity); h t represents the tail entity embedding matrix (i.e., the target entity embedding matrix);
[0109] The action space consists of possible relation embeddings, denoted as R H ={r1,r2,...,r n}.
[0110] The DeepPath model selects the next action in each step of reasoning through the policy network. t , the probability distribution of the policy network output is calculated through the Softmax layer, as shown in Equation (7). The action a selected during the reasoning process k Random selection is performed according to the probability distribution, which is specifically expressed as shown in formula (11):
[0111] e k+1 =f(e k ,r) (11)
[0112] Where f represents the relationship from the current entity e through the current relationship r k Jump to the next entity e k+1 This process allows the model to explore different possibilities in the reasoning path.
[0113] 3. Experiment and result analysis
[0114] In order to evaluate the performance of the method proposed in this article in knowledge graph completion, this embodiment of the present invention selects a data set and builds an experimental environment for verification, and evaluates the accuracy of the model and the effect of multi-hop reasoning.
[0115] 3.1 Experimental data and evaluation indicators
[0116] In order to verify the method proposed in this invention, link prediction experiments were conducted on the FB15K-237 dataset provided by the document "Observed versus latent features for knowledge base and text inference" and the NELL-995 dataset provided by the document "Reinforcement learning-based knowledge graph reasoning for explainable fact-checking". FB15K-237 is a subset of FB15K. After deduplication and cleaning, some redundant information is eliminated, making the data more suitable for training and evaluating machine learning models. NELL-995 is a subset of the NELL (Never-Ending Language Learner) project, which contains entities and relations automatically extracted from the Internet. These data are mainly used for tasks such as knowledge graph construction, relationship learning and entity recognition. The detailed information of the dataset is shown in Table 1:
[0117] Table 1 Dataset statistics
[0118] Dataset Number of entities Number of relationships Training set Test Set FB15K-237 14541 237 272115 20466 NELL-995 75492 200 154213 3992
[0119] In link prediction, commonly used evaluation indicators include mean singular ranking (MRR) and inference result hit rate (Hits@k).
[0120] Hits@k is a measure of whether the previous recommendation contains the correct answer. Specifically, if the correct answer exists in the previous result, the query is considered a "hit".
[0121] MRR is often used in scenarios where the ranking order needs to be taken into account, while Hits@k is often used in recommendation systems and information retrieval tasks to evaluate whether the recommendation results contain the correct items. Both indicators can effectively measure the performance of the model.
[0122] 3.2 Parameter settings
[0123] In the implementation of DeepPath-CompGCN of the present invention, the embedding dimensions of entities and relations are set to 200. For the CompGCN part, the hidden state size of the graph convolution layer is also set to 200. In addition, this paper uses dropout during model training, set to 0.3, to prevent overfitting. The optimizer uses Adam, and the learning rate is set to 0.0005. ReLU is used as the activation function of all graph convolutional layers. For the hyperparameters in the training process, the batch size is set to 64. For the NELL-995 and FB15K-237 datasets, experiments were conducted on a 2-layer graph convolutional network, and the performance of the model on the link prediction task was finally evaluated. The experiments were trained and verified on the NVIDIA 4060Laptop GPU using the PyTorch framework.
[0124] 3.3 Results and Analysis
[0125] To verify the effectiveness of the model proposed in this paper, link prediction experiments were conducted on the TransE, ComplEx, MultiHop, CompGCN, DeepPath models and the model in this paper on the above two data sets, and the experimental results were taken as the average of 5 experiments. The experimental results are shown in Table 2:
[0126] Table 2 Comparison of inference model performance
[0127]
[0128]
[0129] According to the experimental results in Table 2, the DP-CompGCN model has certain advantages in both FB15K-237 and NELL-995 datasets, especially in the more complex NELL-995 dataset.
[0130] FB15K-237 performance diagram can be found in Figure 7 The NELL-995 performance diagram can be found in Figure 8 shown.
[0131] Depend on Figure 7It can be seen that on the FB15K-237 dataset, DP-CompGCN's Hits@1, Hits@3, and Hits@10 reached 0.276, 0.392, and 0.474, respectively, which is better than other models. Although its MRR value (0.298) is slightly lower than DeepPath (0.325), the improvement in the hit rate indicator shows that DP-CompGCN can accurately predict relationships at higher ranking positions. This is because DP-CompGCN combines the advantages of CompGCN and DeepPath. After using CompGCN to capture graph structure information, DeepPath achieves more accurate path reasoning, thereby achieving better results in the prediction task of specific relationships. Figure 8 It can be seen that on the NELL-995 dataset, the advantage of DP-CompGCN is more obvious. Its MRR reaches 0.694, and Hits@1, Hits@3 and Hits@10 are 0.628, 0.716 and 0.819 respectively, which are better than other models, especially Hits@10, indicating that the model has stronger reasoning and generalization capabilities on more complex and large-scale datasets. Compared with other models, the significant advantage of DP-CompGCN on the NELL-995 dataset may be due to the fact that the model retains more information in high-dimensional embeddings, enhances the selection of reasoning paths, and thus improves the reasoning effect in complex knowledge graphs.
[0132] In the above comparative experiments, CompGCN, DeepPath and DP-CompGCN form ablation experiments. Through comparison, it can be seen that there are certain limitations when using CompGCN alone to generate embeddings or DeepPath alone for path reasoning. CompGCN is effective in generating high-dimensional embeddings, but its effect is limited when used alone for reasoning; while DeepPath is good at path reasoning, but its initial ranking accuracy is low in the absence of embedding assistance. DP-CompGCN has achieved good results on both datasets by integrating the advantages of CompGCN and DeepPath. The results of the ablation experiment show that the design of DP-CompGCN can effectively improve the overall performance of the model in knowledge graph reasoning tasks in the combination of embedding generation and path reasoning.
[0133] 4. Case Analysis
[0134] The superiority of the knowledge reasoning model combining CompGCN and DeepPath can be seen through the analysis of experimental results. In order to verify the ability of DP-CompGCN to handle complex relationships on the NELL-995 dataset, the embodiment of the present invention selects the "location of the organization's headquarters" task for case analysis. This task involves the relationship between "organization and headquarters location" and is suitable for examining the reasoning effect of the model on multi-hop paths. Through this task, DP-CompGCN will be tested for its reasoning ability on implicit relationship paths.
[0135] In the "organization headquarters location" task, the embodiment of the present invention will focus on analyzing the relationship between some sample organizations and the cities where their headquarters are located. Table 3 shows some sample data and the reasoning results in the knowledge graph completion task.
[0136] Table 3 Sample data inference results
[0137]
[0138]
[0139] Table 3 shows some sample data from the "organization headquarters location" task. For each organization and its headquarters city, the table lists the true relationship path and the model-inferred path. Table 3 shows that DP-CompGCN is able to identify multiple jump nodes and indirectly infer the headquarters location through geographical concepts or industry concepts by combining CompGCN's graph structure learning ability and DeepPath's path reasoning advantage. For example, for Microsoft and Redmond, the model successfully predicts the headquarters location through the intermediate relationship of "technology company" or "enterprise". This multi-hop reasoning ability shows that DP-CompGCN is suitable for handling more complex path reasoning tasks. At the same time, the prediction rankings in Table 3 reflect DP-CompGCN's ability to predict the correct headquarters location at a higher ranking position. In the vast majority of examples, the correct headquarters location ranks in the top 1 to 2, which shows that DP-CompGCN has strong prediction accuracy in path reasoning tasks, especially when indirect paths are identified. The case shows that DP-CompGCN effectively retains the association information between the organization and its geographical location when generating embeddings, and through the learning of high-dimensional features, the model can focus on reasonable intermediate relationship paths when reasoning about paths.
[0140] In summary, the embodiment of the present invention provides a knowledge graph completion method based on DeepPath-CompGCN. The entity relationship embedding of the knowledge graph is obtained through CompGCN, which not only extracts the global structural features, but also has strong adaptability. The global structural features are helpful to improve the downstream DeepPath reasoning tasks. At the same time, the adaptability of CompGCN also determines its compatibility with the DeepPath algorithm, so that the model constructed by the embodiment of the present invention focuses on the reasoning tasks of the knowledge graph. The knowledge graph completion experiment was carried out on two public knowledge graph data. The results show that although a certain degree of information loss will be caused due to information embedding, the DP-CompGCN model is superior to the traditional completion model in multiple evaluation indicators. The model has strong generalization ability and better reasoning ability when processing complex data. At the same time, the interpretability of DeepPath itself is also inherited. The ablation experiment comparison proves the effectiveness of the combination of the two in improving the reasoning performance. The verification analysis on the NELL-995 data also proves that DP-CompGCN is suitable for the knowledge graph completion task of complex relationships.
[0141] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0142] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A knowledge graph completion method based on DeepPath-CompGCN, characterized in that: The steps include: The entities and relations in the knowledge graph are embedded through the CompGCN convolutional layer to obtain a composite embedding matrix containing the entity embedding matrix and the relationship embedding matrix; The entity embedding matrix is used as the state space, and the relationship embedding matrix is used as the action space, and input into the DeepPath model for path reasoning to obtain the optimal reasoning path; The knowledge graph is completed according to the optimal reasoning path.
2. According to the DeepPath-CompGCN-based knowledge graph completion method of claim 1, it is characterized in that: The entities and relations in the knowledge graph are embedded and represented by the CompGCN convolution layer to obtain a composite embedding matrix including an entity embedding matrix and a relationship embedding matrix, which specifically includes: Extract all entities and the corresponding relationships between entities from the knowledge graph, and initialize the entity embedding matrix and the relationship embedding matrix; Constructing an adjacency matrix of the knowledge graph; Input the initialized entity embedding matrix and relationship embedding matrix, as well as the adjacency matrix, into the CompGCN convolutional layer, and perform embedding update through the activation function; After each round of embedding update is completed, the loss function is calculated to optimize the CompGCN convolutional layer until convergence, and a composite embedding matrix containing an entity embedding matrix and a relationship embedding matrix is obtained.
3. The knowledge graph completion method based on DeepPath-CompGCN according to claim 1, characterized in that: The composite embedding matrix is expressed as: Among them, σ represents the activation function; R h Represents all relations related to the head entity h; represents the set of all neighbor entities connected to the head entity h through the relationship r; t represents the tail entity; Indicates the head entity containing relation information in layer L-1; represents the tail entity containing relation information in the L-1th layer; f r (·) represents the combinatorial function of relation r; Represents the learnable weight matrix of the L-1th layer correspondence r.
4. The knowledge graph completion method based on DeepPath-CompGCN according to claim 1, characterized in that: The entity embedding matrix includes a head entity embedding matrix and a tail entity embedding matrix.
5. The method for completing a knowledge graph based on DeepPath-CompGCN according to claim 4, characterized in that: During path reasoning: Obtaining a current state space, wherein the current state space includes a head entity embedding matrix and a tail entity embedding matrix in a current reasoning path, and a historical reasoning path; Inputting the current state space into a gated recurrent unit to encode the historical reasoning path and generate an implicit representation of the current state space; Based on the implicit representation of the current state space, the selection probability of each candidate relationship is calculated through the Softmax layer to obtain the relationship probability distribution; According to the relationship probability distribution, select a relationship from the relationship embedding, and jump from the current entity to the next entity through the relationship; Repeat the above process until the DeepPath model converges and obtains the optimal inference path.
6. The method for completing a knowledge graph based on DeepPath-CompGCN according to claim 5, characterized in that: During the path reasoning process, a reward function is set to evaluate the path reasoning effect; if the reasoning path is successfully connected and the relationship is correct, a positive reward is given, otherwise a negative reward is given.
7. The method for completing a knowledge graph based on DeepPath-CompGCN according to claim 6, characterized in that: The cumulative reward during path reasoning is expressed as: Among them, G k represents the cumulative reward up to time step k; K represents the total duration; γ represents the discount factor; R(π k' ) represents the immediate reward obtained in the k' step.
Citation Information
Cited By
Drainage basin pollution discharge transaction knowledge reasoning method based on TransE and Compgcn
CN120409701A