Knowledge graph completion method based on double-pruning progressive relation graph neural network
Through dual pruning strategy and graph convolution network optimization knowledge graph completion method, the problem of difficult to deal with the dynamic and complexity of knowledge graphs in the existing technology is solved, and efficient and accurate knowledge graph completion is achieved to adapt to the knowledge graph. Real-time updates and extensions.
Patent Information
- Application Number
- CN202411404781.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-10
- Publication Date
- 2024-11-12
AI Technical Summary
The existing knowledge graph completion method is difficult to adapt to the dynamics and complexity of the knowledge graph, and cannot deeply explore deep semantic information, and there are redundant and invalid propagation paths, resulting in high computational complexity and low prediction accuracy.
Using the progressive relationship graph neural network method based on double pruning, the propagation process of graph neural network is optimized through pre-pruning and post-pruning strategies, redundant paths are removed, deep semantic information in the knowledge graph is deeply mined, and graph convolution is used. Network and gated loop units improve the generalization capability and efficiency of the model.
It significantly reduces the consumption of computing resources, improves the accuracy and efficiency of the model, enhances the adaptability to the dynamic and complexity of the knowledge graph, and improves the accuracy and robustness of the knowledge graph completion.
Smart Images

Figure CN118940831A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of computers, and in particular relates to a knowledge graph completion method based on a double-pruned progressive relational graph neural network. Background Art
[0002] Knowledge graph is a knowledge representation method that represents entities and their relationships in the form of a graph structure. It is widely used in recommendation systems, search engines, intelligent question and answer, and other fields. In order to perform cognitive tasks such as reasoning, induction, decision-making, and even creation, machines need to have a knowledge-rich "brain". Knowledge graph, as the current mainstream application form of knowledge base, compared with early knowledge systems, knowledge graphs expand from text to graphs in the representation dimension, effectively solving the problems of complexity of knowledge frameworks and poor text reasoning effects. Knowledge graphs use directed labeled graphs as the basic form of knowledge expression. In the Resource Description Framework (RDF), knowledge graphs use entities to represent things or concepts, and relationships to represent the connections between things or concepts. Therefore, the complex connections between everything in the world are decomposed and represented in the form of fact triples. Further, entities are abstracted as nodes, relationships are abstracted as edges, and all fact triples are connected to form a knowledge graph.
[0003] The knowledge graph contains a large number of entities, and the network of connections between these entities is complex and diverse. Although the knowledge graph is very powerful in terms of function and has provided strong data support for many works in the field of artificial intelligence, when analyzing its specific examples, we will find that some relationships between two entities do not exist in the knowledge graph. For example, the general encyclopedia knowledge graph built through Wikipedia, although it has advantages in scale, still has shortcomings in the integrity of personal information. The incompleteness of the knowledge graph will affect the effect of the applications it supports. Its incompleteness mainly comes from two aspects: first, the data of the knowledge graph comes from a large amount of web page information, which may be incomplete in itself; second, the algorithm for extracting entities and relationships from unstructured text information is not stable. In the process of constructing the knowledge graph, it is difficult to cover all entity relationships, which requires the knowledge graph to be completed. The completion task improves the knowledge base by supplementing external knowledge with the help of an external corpus. However, not every knowledge base can find a suitable external corpus for completion, and the implementation of this solution is more difficult. At present, the more common completion solution is to learn the structural information of the knowledge base itself, discover the missing information through similarity calculation, and achieve self-completion.
[0004] Existing knowledge graph completion methods face many challenges and limitations. Although traditional rule-based methods have certain advantages in logical reasoning and statistical analysis, they are often unable to cope with large-scale knowledge graphs because they are difficult to adapt to the dynamics and complexity of knowledge graphs. Transfer distance methods capture the structure of knowledge graphs by embedding vectors, providing a new approach for prediction and completion. However, the applicability of these methods is limited when knowledge graphs are updated and expanded in real time, as they may not be able to adapt to changes in the knowledge graph in a timely manner.
[0005] Neural network methods use the power of deep learning to learn and generalize relationships and paths in knowledge graphs, which improves the accuracy of completion to a certain extent. However, due to the inadequate construction of graph structure data, these methods may encounter bottlenecks when processing complex graph structures. In addition, some neural network methods may not be able to deeply explore deep semantic information during the propagation process, resulting in limited generalization ability and prediction accuracy of the model.
[0006] Graph neural network methods have shown their unique advantages in processing graph structure data by effectively modeling the topological structure and attribute characteristics of knowledge graphs. However, these methods also have some problems, such as the number of propagation layers is not deep enough to fully mine the deep semantic information in the knowledge graph, or a large number of invalid and redundant paths are involved in the propagation process, which not only increases the complexity of the calculation, but also affects the performance and efficiency of the model.
[0007] In order to solve these problems, it is necessary to develop more advanced knowledge graph completion methods that can adapt to the dynamic nature of knowledge graphs, deeply mine and utilize deep semantic information in knowledge graphs, and effectively avoid invalid and redundant propagation paths. By introducing more complex model architectures, optimizing propagation mechanisms, and adopting more efficient computing strategies, the accuracy and efficiency of knowledge graph completion can be further improved, thereby better serving application scenarios such as knowledge discovery, information retrieval, and intelligent recommendation. Summary of the invention
[0008] To solve the above problems, the present invention proposes a knowledge graph completion method based on a double pruned progressive relational graph neural network. A knowledge graph completion method based on double pruning progressive relational graph neural network includes the following steps: Step S1: construct a data set, which includes a knowledge graph, divide the data set into a training set, a validation set, and a test set, preprocess the training set and the validation set, and add reverse relations and reflexive relations; Step S2: construct a query triple and formalize the completion task; the query triple includes a query entity, a relation entity and a target entity; Build a knowledge graph completion model; The knowledge graph completion model imports the query entity as a propagation entity set into the knowledge graph in step S1 for query, obtains the neighborhood triple set containing the propagation entity set as the head entity as the candidate edge set, and in the subsequent iteration process, obtains the newly added propagation entity set in step S5 as the new propagation entity set; it is expressed as ; ; in, is the candidate edge set, The head entity in the knowledge graph triple contains The edge set of Indicates the further pruning and screening operations of the post-pruning module. Represents the newly added propagation entity set. Represents a propagation entity set; Step S3: The pre-pruning module of the knowledge graph completion model prunes and screens the candidate edge set of step S2 to obtain a pre-pruned candidate set; Step S4: The graph convolutional network of the knowledge graph completion model performs message transmission and message aggregation on the pre-pruned candidate set of step S3 to obtain the message entity embedding representation; Step S5: The post-pruning module of the knowledge graph completion model further prunes and filters the message entity embedding representation of step S4 to obtain the post-pruned entity embedding representation and the newly added propagation entity set; Step S6: Determine whether the maximum number of iterations has been reached. If so, obtain the corresponding post-pruning entity embedding representation and the corresponding propagation entity set. If not, continue with steps S2 to S5. During the training process, after reaching the maximum number of iterations, a subset entity of the propagation entity set corresponding to the scoring function is constructed for scoring evaluation to obtain the target entity, and a cross entropy loss function is further constructed to optimize the model by minimizing the cross entropy loss function.
[0009] Furthermore, step S2 constructs the query triples and formalizes the completion task, specifically: Given a knowledge graph ,in, It represents the entity set in the knowledge graph. It represents a set of relations. is a set of fact triples, namely , The triples represent the head entity, the relationship entity, and the tail entity respectively; On this basis, given the query triple ; in, is the query entity, To query the relationship and is the target entity, and For entity collection Entities in Belongs to a relation set ; Predict the target entity corresponding to the query entity in the knowledge graph.
[0010] Furthermore, step S3 is specifically as follows: In the process of propagation, in order to prevent redundancy of propagation, a pre-pruning strategy is performed on the edge set of the knowledge graph before propagation to remove the edges that are repeatedly propagated, thereby screening out the candidate edge set, which is expressed as: ; in, represents the set of candidate edges for pre-pruning, is the candidate edge set, represents a triple, i.e., a subset of the candidate edge set; is the distance function, calculating the triple The tail entity and query entity The distance between them is kept greater than or equal to The triples of are used as the edge set after the pre-pruning strategy , Indicates the preset distance parameter.
[0011] Further, step S4 includes: Graph convolutional neural networks are used to propagate local features of nodes through edge connections, thereby integrating more node information and improving the accuracy and generalization of reasoning. For candidate edge sets, the message passing function needs to be calculated, and the aggregation function is used to update the embedded representation of the propagated entity. Step S4 is specifically as follows: Step S41: Message passing: In order to capture the structural information of the graph, learn the connection relationship between entities, and integrate the relationship information of different entities into the representation of each entity; through the knowledge graph completion method of transfer distance, for the pre-pruned candidate edge set , use the RotatE message passing function for it; The RotatE message passing function is expressed as: ; in, represents the calculated message embedding representation, is the set of candidate edges for pre-pruning Head entity in The entity embedding representation in the previous layer, Represents the relation embedding representation, represents the Hadamard product operation; Step S42: Message aggregation: Integrate messages from different neighbors and aggregate them into a single entity. First, obtain the weights expressed as: ; in, represents the weight of the pre-pruning candidate edge set, represents the sigmoid function, , , is the learnable weight matrix, represents the inner product operation, is the activation function, Represents a query relationship Embedding representation of ; After calculating the weights, message aggregation is required. The specific aggregation process is expressed as follows: ; ; ; ; ; ; ; in, , , , , Respectively indicate that the edge set contains the tail entity The edge represents the mean, square mean, maximum, minimum, and standard deviation of each dimension with respect to the message embedding. Indicates that the edge set contains the tail entity The number of elements of ; Indicates that The minimum value limit is The function of represents the learnable weight matrix, represents the combination of a feature vector, Representing Entities The message entity embedding representation is: Represented as the propagation entity set of the previous layer and the set of its first-order neighbor entities, The message entity embedding representation that represents all tail entities in the message aggregation set is also called entity embedding representation.
[0012] Further, step S5 includes: Step S51: As the level of graph neural network propagation increases, the number of propagation entity sets will grow geometrically. In order to control the number of propagation entity sets involved in propagation and avoid excessive expansion, semantically related entities are selected from the newly added propagation entity sets while maintaining the local structural information of the graph; semantically related entities are selected according to the query relationship through sampling distribution, thereby improving the accuracy of reasoning; expressed as: ; ; ; in, represents the mapping function, represents a learnable parameter, Representing Entities The message entity embedding representation of Representing Entities Probability calculation function, Indicates the newly added propagation entity set; Represents a newly added subset of the propagation entity set; Represented as the propagation entity set of the previous layer and the set of its first-order neighbor entities, Represented as a difference set; Step S52: Calculate the probability distribution of these newly added propagation entity sets according to the mapping function in step S43; when the number of newly added propagation entity sets is greater than the hyperparameter entity increment , then we need to select the previous The newly added propagation entity sets are pruned to form a new entity embedding representation. The calculation process is expressed as: ; ; ; ; in, Represents the element index of the top K newly added propagation entity set in the probability distribution, It means to get the first K with higher probability from *. Indicates getting the value of the entity index; is a tag sequence that stores the element indexes of the first K newly added propagation entity sets and the element indexes of the propagation entity set of the previous layer. represents the subscript of the tag sequence, Represents the propagation entity set of the previous layer; Represents the propagation entity set, Represented as the propagation entity set of the previous layer and the set of its first-order neighbor entities, Indicates in the collection The corresponding elements of the tag sequence whose subscript is not 0 are retained. represents the initial entity embedding representation, Represents a message entity embedded in the representation; Step S53: The gated recurrent unit can integrate entity embedding information from different rounds into a single entity representation, so as to better learn the relationship between entities. The gated mechanism can adaptively learn features and adjust their weights according to changes in input data. The calculation process is expressed as: ; ; ; ; in, , , is the learnable weight matrix, represents the sigmoid function, is the tanh function, represents the Hadamard product operation, , , is the bias term, is the embedding representation of the previous layer, For the initial entity embedding representation, if the current layer is the first layer , the embedding representation of the previous layer is the zero vector, , , Represent the update gate, reset gate and candidate hidden state respectively, Embedding representation for post-pruned entities.
[0013] Furthermore, step S6 specifically includes: During the training process, after reaching the maximum number of iterations, a scoring function is constructed to score and evaluate the corresponding post-pruning entity embedding representation and further construct a cross-entropy loss function. The model is optimized by minimizing the cross-entropy loss function, specifically: Step S61: When When the entity embedding representation calculated by the above method is , the entity embedding of the last layer represents the corresponding propagation entity set as ; Step S62: By scoring the nodes, the possibility of a certain relationship between specific entities is predicted. The score reflects the credibility of completing some missing edges in the knowledge graph. By adjusting the model parameters, the score of the real relationship is higher than that of the false relationship, thereby optimizing the model performance. The calculation process is: ; ; in, is the scoring function, and calculates the propagation entity set Subset entity The final score, are learnable parameters, Subset Entity The embedding representation of Represents the dot product operation; Step S63: Use the binary cross entropy loss function to predict whether the triple is a true fact, as shown in the formula: ; ; in, is the indicator function, when the subset entity For the target entity hour, ,otherwise , Represents a logarithmic function.
[0014] The beneficial effects of the present invention are:
[0015] (1) The present invention uses a pre-pruning strategy to identify and eliminate redundant paths that may cause repeated calculations during the propagation of graph neural networks, thereby significantly reducing the consumption of computing resources. This optimization not only reduces unnecessary calculations, but also speeds up the inference speed of the model, enabling the model to process large-scale knowledge graph data faster.
[0016] (2) This paper focuses on removing entities with low relevance to the target node, which helps reduce noise interference. The post-pruning strategy enables the model to more accurately capture entities and relationships related to the target node. The implementation of this strategy improves the accuracy of the model in predicting and completing missing links in the knowledge graph, thereby improving the overall prediction accuracy.
[0017] (3) The method design of the present invention takes into account the dynamics and complexity of the knowledge graph and can adapt to the real-time update and expansion of the knowledge graph. At the same time, through the double pruning strategy, the model can exclude invalid and redundant paths and enhance the robustness to outliers and noise. This design enables the model to maintain efficient and stable performance in the face of a constantly changing knowledge graph, and has good scalability and robustness. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 This is a flowchart of the steps of the knowledge graph completion method based on double pruned progressive relational graph neural network of the present invention. DETAILED DESCRIPTION
[0019] The following describes the embodiments of the present invention through specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention is also implemented or applied through other different specific embodiments, and the details in this specification are also modified or changed based on different viewpoints and applications without departing from the spirit of the present invention.
[0020] Reference Figure 1 , a knowledge graph completion method based on double pruning progressive relational graph neural network, in one example, includes the following steps: Step S1: construct a data set, which includes a knowledge graph, divide the data set into a training set, a validation set, and a test set, preprocess the training set and the validation set, and add reverse relations and reflexive relations; Step S2: construct a query triple and formalize the completion task; the query triple includes a query entity, a relation entity and a target entity; Build a knowledge graph completion model; The knowledge graph completion model imports the query entity as a propagation entity set into the knowledge graph in step S1 for query, obtains the neighborhood triple set containing the propagation entity set as the head entity as the candidate edge set, and in the subsequent iteration process, obtains the newly added propagation entity set in step S5 as the new propagation entity set; it is expressed as ; ; in, is the candidate edge set, The head entity in the knowledge graph triple contains The edge set of Indicates the further pruning and screening operations of the post-pruning module. Represents the newly added propagation entity set. Represents a propagation entity set; Step S3: The pre-pruning module of the knowledge graph completion model prunes and screens the candidate edge set of step S2 to obtain a pre-pruned candidate set; Step S4: The graph convolutional network of the knowledge graph completion model performs message transmission and message aggregation on the pre-pruned candidate set of step S3 to obtain the message entity embedding representation; Step S5: The post-pruning module of the knowledge graph completion model further prunes and filters the message entity embedding representation of step S4 to obtain the post-pruned entity embedding representation and the newly added propagation entity set; Step S6: Determine whether the maximum number of iterations has been reached. If so, obtain the corresponding post-pruning entity embedding representation and the corresponding propagation entity set. If not, continue with steps S2 to S5. During the training process, after reaching the maximum number of iterations, a subset entity of the propagation entity set corresponding to the scoring function is constructed for scoring evaluation to obtain the target entity, and a cross entropy loss function is further constructed to optimize the model by minimizing the cross entropy loss function.
[0021] Furthermore, in one example, step S2 constructs the query triple and formalizes the completion task, specifically: Given a knowledge graph ,in, It represents the entity set in the knowledge graph. It represents a set of relations. is a set of fact triples, namely , The triples represent the head entity, the relationship entity, and the tail entity respectively; On this basis, given the query triple ; in, is the query entity, To query the relationship and is the target entity, and For entity collection Entities in Belongs to a relation set ; Predict the target entity corresponding to the query entity in the knowledge graph.
[0022] Furthermore, in one example, step S3 is specifically: In the process of propagation, in order to prevent redundancy of propagation, a pre-pruning strategy is performed on the edge set of the knowledge graph before propagation to remove the edges that are repeatedly propagated, thereby screening out the candidate edge set, which is expressed as: ; in, represents the set of candidate edges for pre-pruning, is the candidate edge set, represents a triple, i.e., a subset of the candidate edge set; is the distance function, calculating the triple The tail entity and query entity The distance between them is kept greater than or equal to The triples of are used as the edge set after the pre-pruning strategy , Indicates the preset distance parameter.
[0023] Further, step S4 includes: Graph convolutional neural networks are used to propagate local features of nodes through edge connections, thereby integrating more node information and improving the accuracy and generalization of reasoning. For candidate edge sets, the message passing function needs to be calculated, and the aggregation function is used to update the embedded representation of the propagated entity. Step S4 is specifically as follows: Step S41: Message passing: In order to capture the structural information of the graph, learn the connection relationship between entities, and integrate the relationship information of different entities into the representation of each entity; through the knowledge graph completion method of transfer distance, for the pre-pruned candidate edge set , use the RotatE message passing function for it; The RotatE message passing function is expressed as: ; in, represents the calculated message embedding representation, is the set of candidate edges for pre-pruning Head entity in The entity embedding representation in the previous layer, Represents the relation embedding representation, represents the Hadamard product operation; Step S42: Message aggregation: Integrate messages from different neighbors and aggregate them into a single entity. First, obtain the weights expressed as: ; in, represents the weight of the pre-pruning candidate edge set, represents the sigmoid function, , , is the learnable weight matrix, represents the inner product operation, is the activation function, Represents a query relationship Embedding representation of ; After calculating the weights, message aggregation is required. The specific aggregation process is expressed as follows: ; ; ; ; ; ; ; in, , , , , Respectively indicate that the edge set contains the tail entity The edge represents the mean, square mean, maximum, minimum, and standard deviation of each dimension with respect to the message embedding. Indicates that the edge set contains the tail entity The number of elements of ; Indicates that The minimum value limit is The function of represents the learnable weight matrix, represents the combination of a feature vector, Representing Entities The message entity embedding representation is: Represented as the propagation entity set of the previous layer and the set of its first-order neighbor entities, The message entity embedding representation that represents all tail entities in the message aggregation set is also called entity embedding representation.
[0024] Further, step S5 includes: Step S51: As the level of graph neural network propagation increases, the number of propagation entity sets will grow geometrically. In order to control the number of propagation entity sets involved in propagation and avoid excessive expansion, semantically related entities are selected from the newly added propagation entity sets while maintaining the local structural information of the graph; semantically related entities are selected according to the query relationship through sampling distribution, thereby improving the accuracy of reasoning; expressed as: ; ; ; in, represents the mapping function, represents a learnable parameter, Representing Entities The message entity embedding representation of Representing Entities Probability calculation function, Indicates the newly added propagation entity set; Represents a newly added subset of the propagation entity set; Represented as the propagation entity set of the previous layer and the set of its first-order neighbor entities, Represented as a difference set; Step S52: Calculate the probability distribution of these newly added propagation entity sets according to the mapping function in step S43; when the number of newly added propagation entity sets is greater than the hyperparameter entity increment , then we need to select the previous The newly added propagation entity sets are pruned to form a new entity embedding representation. The calculation process is expressed as: ; ; ; ; in, Represents the element index of the top K newly added propagation entity set in the probability distribution, It means to get the first K with higher probability from *. Indicates getting the value of the entity index; is a tag sequence that stores the element indexes of the first K newly added propagation entity sets and the element indexes of the propagation entity set of the previous layer. represents the subscript of the tag sequence, Represents the propagation entity set of the previous layer; Represents the propagation entity set, Represented as the propagation entity set of the previous layer and the set of its first-order neighbor entities, Indicates in the collection The corresponding elements of the tag sequence whose subscript is not 0 are retained. represents the initial entity embedding representation, Represents a message entity embedded in the representation; Step S53: The gated recurrent unit can integrate entity embedding information from different rounds into a single entity representation, so as to better learn the relationship between entities. The gated mechanism can adaptively learn features and adjust their weights according to changes in input data. The calculation process is expressed as: ; ; ; ; in, , , is the learnable weight matrix, represents the sigmoid function, is the tanh function, represents the Hadamard product operation, , , is the bias term, is the embedding representation of the previous layer, For the initial entity embedding representation, if the current layer is the first layer , the embedding representation of the previous layer is the zero vector, , , Represent the update gate, reset gate and candidate hidden state respectively, Embedding representation for post-pruned entities.
[0025] Furthermore, in one example, step S6 specifically includes: During the training process, after reaching the maximum number of iterations, a scoring function is constructed to score and evaluate the corresponding post-pruning entity embedding representation and further construct a cross-entropy loss function. The model is optimized by minimizing the cross-entropy loss function, specifically: Step S61: When When the entity embedding representation calculated by the above method is , the entity embedding of the last layer represents the corresponding propagation entity set as ; Step S62: By scoring the nodes, the possibility of a certain relationship between specific entities is predicted. The score reflects the credibility of completing some missing edges in the knowledge graph. By adjusting the model parameters, the score of the real relationship is higher than that of the false relationship, thereby optimizing the model performance. The calculation process is: ; ; in, is the scoring function, and calculates the propagation entity set Subset entity The final score, are learnable parameters, Subset Entity The embedding representation of Represents the dot product operation; Step S63: Use the binary cross entropy loss function to predict whether the triple is a true fact, as shown in the formula: ; ; in, is the indicator function, when the subset entity For the target entity hour, ,otherwise , Represents a logarithmic function.
[0026] The present invention is described in detail above in conjunction with the embodiments of the accompanying drawings. A person skilled in the art can make various variations of the present invention according to the above description. Therefore, some details in the embodiments should not be construed as limiting the present invention, and the present invention shall be protected by the scope defined by the attached claims.
Claims
1. A knowledge graph completion method based on double pruning progressive relational graph neural network, It is characterized in that The following steps are involved: Step S1: construct a data set, which includes a knowledge graph, divide the data set into a training set, a validation set, and a test set, preprocess the training set and the validation set, and add reverse relations and reflexive relations; Step S2: construct query triples and formalize the completion task; The query triple includes query entity, relation entity and target entity; Build a knowledge graph completion model; The knowledge graph completion model imports the query entity as a propagation entity set into the knowledge graph in step S1 for query, obtains the neighborhood triple set containing the propagation entity set as the head entity as the candidate edge set, and in the subsequent iteration process, obtains the newly added propagation entity set in step S5 as the new propagation entity set; it is expressed as: ; ; in, is the candidate edge set, The head entity in the knowledge graph triple contains The edge set of Indicates the further pruning and screening operations of the post-pruning module. Represents the newly added propagation entity set. Represents a propagation entity set; Step S3: The pre-pruning module of the knowledge graph completion model prunes and screens the candidate edge set of step S2 to obtain a pre-pruned candidate set; Step S4: The graph convolutional network of the knowledge graph completion model performs message transmission and message aggregation on the pre-pruned candidate set of step S3 to obtain the message entity embedding representation; Step S5: The post-pruning module of the knowledge graph completion model further prunes and filters the message entity embedding representation of step S4 to obtain the post-pruned entity embedding representation and the newly added propagation entity set; Step S6: Determine whether the maximum number of iterations has been reached. If so, obtain the corresponding post-pruning entity embedding representation and the corresponding propagation entity set. If not, continue with steps S2 to S5. During the training process, after reaching the maximum number of iterations, a subset entity of the propagation entity set corresponding to the scoring function is constructed for scoring evaluation to obtain the target entity, and a cross entropy loss function is further constructed to optimize the model by minimizing the cross entropy loss function.
2. A knowledge graph completion method based on a double-pruned progressive relational graph neural network as claimed in claim 1, It is characterized in that Step S2 constructs the query triple and formalizes the completion task, specifically: Given a knowledge graph ,in, It represents the entity set in the knowledge graph. It represents a set of relations. is a set of fact triples, namely , The triples represent the head entity, the relationship entity, and the tail entity respectively; On this basis, given the query triple ; in, is the query entity, To query the relationship and is the target entity, and For entity collection Entities in Belongs to a relation set ; Predict the target entity corresponding to the query entity in the knowledge graph.
3. A knowledge graph completion method based on a double-pruned progressive relational graph neural network as claimed in claim 2, It is characterized in that Step S3 is specifically as follows: In the process of propagation, in order to prevent redundancy of propagation, a pre-pruning strategy is performed on the edge set of the knowledge graph before propagation to remove the edges that are repeatedly propagated, thereby screening out the candidate edge set, which is expressed as: ; in, represents the set of candidate edges for pre-pruning, is the candidate edge set, represents a triple, i.e., a subset of the candidate edge set; is the distance function, calculating the triple The tail entity and query entity The distance between them is kept greater than or equal to The triples of are used as the edge set after the pre-pruning strategy , Indicates the preset distance parameter.
4. A knowledge graph completion method based on a double-pruned progressive relational graph neural network as claimed in claim 3, It is characterized in that Step S4 includes: Graph convolutional neural networks are used to propagate local features of nodes through edge connections, thereby integrating more node information and improving the accuracy and generalization of reasoning. For candidate edge sets, the message passing function needs to be calculated, and the aggregation function is used to update the embedded representation of the propagated entity. Step S4 is specifically as follows: Step S41: Message passing: In order to capture the structural information of the graph, learn the connection relationship between entities, and integrate the relationship information of different entities into the representation of each entity; through the knowledge graph completion method of transfer distance, for the pre-pruned candidate edge set , use the RotatE message passing function for it; The RotatE message passing function is expressed as: ; in, represents the calculated message embedding representation, is the set of candidate edges for pre-pruning Head entity in The entity embedding representation in the previous layer, Represents the relation embedding representation, represents the Hadamard product operation; Step S42: Message aggregation: Integrate messages from different neighbors and aggregate them into a single entity. First, obtain the weights expressed as: ; in, represents the weight of the pre-pruning candidate edge set, represents the sigmoid function, , , is the learnable weight matrix, represents the inner product operation, is the activation function, Represents a query relationship Embedded representation of ; After calculating the weights, message aggregation is required. The specific aggregation process is as follows: ; ; ; ; ; ; ; in, , , , , Respectively indicate that the edge set contains the tail entity The edge represents the mean, square mean, maximum, minimum, and standard deviation of each dimension with respect to the message embedding. Indicates that the edge set contains the tail entity The number of elements of ; Indicates that The minimum value limit is The function of represents the learnable weight matrix, represents the combination of a feature vector, Representing Entities The message entity embedding representation is: Represented as the propagation entity set of the previous layer and the set of its first-order neighbor entities, The message entity embedding representation that represents all tail entities in the message aggregation set is also called entity embedding representation.
5. A knowledge graph completion method based on double pruning progressive relational graph neural network as claimed in claim 4, It is characterized in that Step S5 includes: Step S51: As the level of graph neural network propagation increases, the number of propagation entity sets will grow geometrically. In order to control the number of propagation entity sets involved in propagation and avoid excessive expansion, semantically related entities are selected from the newly added propagation entity sets while maintaining the local structural information of the graph; semantically related entities are selected according to the query relationship through sampling distribution, thereby improving the accuracy of reasoning; expressed as: ; ; ; in, represents the mapping function, represents a learnable parameter, Representing Entities The message entity embedding representation of Representing Entities Probability calculation function, Indicates the newly added propagation entity set; Represents a newly added subset of the propagation entity set; Represented as the propagation entity set of the previous layer and the set of its first-order neighbor entities, Represented as a difference set; Step S52: Calculate the probability distribution of these newly added propagation entity sets according to the mapping function in step S51; when the number of newly added propagation entity sets is greater than the hyperparameter entity increment , then we need to select the previous The newly added propagation entity sets are pruned to form a new entity embedding representation. The calculation process is expressed as: ; ; ; ; in, Represents the element index of the top K newly added propagation entity set in the probability distribution, It means to get the first K with higher probability from *. Indicates getting the value of the entity index; is a tag sequence that stores the element indexes of the first K newly added propagation entity sets and the element indexes of the propagation entity set of the previous layer. represents the subscript of the tag sequence, Represents the propagation entity set of the previous layer; Represents the propagation entity set, Represented as the propagation entity set of the previous layer and the set of its first-order neighbor entities, Indicates in the collection The corresponding elements whose subscripts of the tag sequence are not 0 are retained. represents the initial entity embedding representation, Represents a message entity embedded in the representation; Step S53: The gated recurrent unit can integrate entity embedding information from different rounds into a single entity representation, so as to better learn the relationship between entities. The gated mechanism can adaptively learn features and adjust their weights according to changes in input data. The calculation process is expressed as: ; ; ; ; in, , , is the learnable weight matrix, represents the sigmoid function, is the tanh function, represents the Hadamard product operation, , , is the bias term, is the embedding representation of the previous layer, For the initial entity embedding representation, if the current layer is the first layer , the embedding representation of the previous layer is the zero vector, , , Represent the update gate, reset gate and candidate hidden state respectively, Embedding representation for post-pruned entities.
6. A knowledge graph completion method based on double pruning progressive relational graph neural network as claimed in claim 5, It is characterized in that Step S6 specifically includes: During the training process, after reaching the maximum number of iterations, a scoring function is constructed to score and evaluate the corresponding post-pruning entity embedding representation and further construct a cross-entropy loss function. The model is optimized by minimizing the cross-entropy loss function, specifically: Step S61: When When the entity embedding representation calculated by the above method is , the entity embedding of the last layer represents the corresponding propagation entity set as ; Step S62: By scoring the nodes, the possibility of a certain relationship between specific entities is predicted. The score reflects the credibility of completing some missing edges in the knowledge graph. By adjusting the model parameters, the score of the real relationship is higher than that of the false relationship, thereby optimizing the model performance. The calculation process is: ; ; in, For the scoring function, calculate the propagation entity set Subset entity The final score, are learnable parameters, Subset Entity The embedding representation of Represents the dot product operation; Step S63: Use the binary cross entropy loss function to predict whether the triple is a true fact, as shown in the formula: ; ; in, is the indicator function, when the subset entity For the target entity hour, ,otherwise , Represents a logarithmic function.
Citation Information
Cited By
Coal rock knowledge graph-oriented relation perception gating neural network link prediction method
CN120781945A
Relationship-aware gated neural network link prediction method for coal and rock knowledge graph
CN120781945B
