Interpretable knowledge graph reasoning method and device based on tensor guide rule learning
By employing a tensor-guided rule learning approach, combined with tensor Tucker operators and deep neural networks, the interpretability and transparency issues in knowledge graph reasoning are addressed. This approach achieves high-precision knowledge graph reasoning results and provides explicit explanatory factors, making it suitable for fields with stringent transparency requirements, such as healthcare and defense.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- PUTIAN UNIV
- Filing Date
- 2026-01-23
- Publication Date
- 2026-05-12
AI Technical Summary
Existing knowledge graph reasoning technologies suffer from poor interpretability, strong dependence on logical rules, and opaque reasoning processes. In particular, in multi-hop reasoning scenarios, it is difficult to effectively characterize the structural dependencies within rules and the semantic relationships between rules, resulting in inaccurate reasoning results and a lack of clear causal explanations.
A tensor-guided rule learning approach is adopted. By obtaining triples from the knowledge graph, chain rules are extracted to generate a set of rule chains. The tensor Tucker operator is used for joint modeling, and deep neural networks are combined for staged training to generate chain-level explanatory factors and rule scores. These are then weighted and fused for knowledge graph reasoning.
It improves the reliability and accuracy of knowledge graph reasoning, adapts to the reasoning needs of complex domains, provides a transparent reasoning process and clear explanatory factors, and enhances users' trust in AI systems.
Smart Images

Figure CN122019716A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of knowledge graph reasoning and artificial intelligence technology, and more specifically, to an interpretable knowledge graph reasoning method and apparatus based on tensor-guided rule learning. Background Technology
[0002] Knowledge graphs, as a core technology for structured knowledge representation, have been widely applied in various fields such as finance, e-commerce, healthcare, and government affairs due to their powerful ability to integrate multi-source heterogeneous data and their potential for intelligent reasoning. They have become a key support for promoting the development of intelligent systems in the cyber-physical society. Typical knowledge graphs, such as Google Knowledge Graph, Wikipedia, and Baidu Encyclopedia, organize massive amounts of knowledge in the form of entity-relation triples, providing a semantic foundation for intelligent decision-making in complex scenarios. However, in the actual construction and application process, knowledge graphs generally suffer from data sparsity and information gaps, which seriously restrict the completeness and reliability of their reasoning.
[0003] To address this challenge, three main categories of knowledge reasoning methods have been developed: logical rule-based reasoning, embedded reasoning based on distributed representations, and deep reasoning models incorporating neural networks. Logical rule-based methods achieve interpretable multi-hop reasoning by inducing first-order predicate logic rules (such as path rules), but their generalization ability is limited by rule coverage. Embedded methods (such as TransE, RotatE, and TuckER) effectively model the semantic space of entities and relations, but lack transparency in the reasoning process due to their use of black-box vector operations. Recently emerging neural symbolic hybrid methods (such as RNNLogic and RulE) attempt to combine the interpretability of rules with the expressive power of embeddings, but still have shortcomings in deep integration of rules and triples, modeling interactions between rules, and constructing global explanatory factors. Especially in multi-hop reasoning scenarios, existing methods struggle to effectively characterize the structural dependencies within rules and the semantic relationships between rules, resulting in inaccurate reasoning results and a lack of clear causal explanations. Furthermore, most models are highly sensitive to the number of rules, exhibiting significant performance degradation and insufficient robustness when rules are sparse.
[0004] In view of the above, this application is hereby submitted. Summary of the Invention
[0005] The present invention aims to provide an interpretable knowledge graph reasoning method and apparatus based on tensor-guided rule learning, in order to solve the problems of poor interpretability, strong dependence on logical rules, and opaque reasoning process in existing knowledge graph reasoning technologies.
[0006] To solve the above-mentioned technical problems, the present invention is achieved through the following technical solution: An interpretable knowledge graph reasoning method based on tensor-guided rule learning includes: S1, obtain the input knowledge graph and represent it using triples containing entities and relations; S2, extract chain rules from the knowledge graph to generate a rule chain set, and filter out activation rules with non-zero support through instantiation verification to obtain a subset of activation rules; S3 introduces the tensor Tucker operator to jointly model the triples and rule chains in the activation rule subset, so as to integrate the embedding representations of entities, relations and rule chains and calculate the knowledge graph embedding score. S4. Based on the subset of activation rules, a phased joint training strategy is adopted for training: first, by aggregating intra-chain rule information, the tensor Tucker operator is used to mine the multi-hop semantic dependencies within the rule chain to generate chain-level explanatory factors; then, based on the chain-level explanatory factors, a deep neural network is used to capture the interaction relationship between different rules by aggregating inter-chain rule information to output the rule score. S5. A comprehensive score is obtained by weighted fusion of the knowledge graph embedding score and the rule score, which is used to determine the result of knowledge graph reasoning.
[0007] Preferably, S2 specifically comprises: When extracting chain rules from the knowledge graph, the expectation-maximization algorithm is used to summarize all candidate rule chains that conform to the logical rules from the triples, forming a rule chain set; The logical rules are represented using first-order logic and formally conform to the structure of a rule body and a rule header; the rule body consists of multiple relations connected by logical conjunction; and the rule header is a single relation conclusion. The expectation-maximization algorithm calculates the support of each candidate rule chain, filters out rules with non-zero support to retain high-quality logical rules, and continues until the rule quality converges to obtain a set of rule chains. When filtering activation rules, the entity variables in the rule chain set are replaced with real entities in the knowledge graph to generate rule instances; Based on the rule instance, check whether all the rule body triples of the instance exist in the knowledge graph. If so, the rule chain itself is an activation rule, and a subset of activation rules is obtained.
[0008] Preferably, S3 specifically comprises: First, based on the triples, entities and relations are mapped to polar coordinate space, and divided into modal features and stage features; wherein, the modal features are used for entity representation at different levels; and the stage features are used for entity representation at the same level. Next, based on the aforementioned subset of activation rules, the tensor Tucker operator is introduced to interactively fuse the feature embeddings of entities and relations with the activation rule chain embeddings, and to perform joint modeling of triples and rule chains. Then, the entity relationship distances for the modal features and the stage features are calculated separately, using the following formula: ; ; in, The entity relation distance of the modal feature; These are the head entity embedding, relation embedding, and tail entity embedding of the modal features, respectively. For Hadamah accumulation; It is an L2 norm; The entity relationship distance is the characteristic of the stage. These are the head entity embedding, relation embedding, and tail entity embedding of the stage features, respectively. It is an L1 norm; The entity relationship distance is fused with two types of features to construct a triplet comprehensive distance, as shown in the formula: ; in, This is the combined distance of the triplet; These are learnable weight parameters; The triplet score is calculated based on the triplet composite distance, using the following formula: ; in, The score is the score for the triple, which is the knowledge graph embedding score; These are the boundary parameters for the triplet, used to constrain the score within a reasonable range.
[0009] Preferably, the tensor Tucker operator is introduced to interactively fuse the feature embeddings of entities and relations with the activation rule chain embeddings, performing joint modeling of triples and rule chains, specifically: Based on the aforementioned subset of activation rules, the activation rule chain is embedded. Embedded with each relation in the rule body of the activation rule chain By concatenating the sequences, we obtain the feature sequence. The input is an RNN to generate a prediction rule head. The difference between the prediction rule head and the actual rule head is constrained by a distance function, wherein the formula for the distance function is: ; in, It is a distance function; For the first Embedded representation of a chain of activation rules; For the first The first rule in the activation rule chain A relational embedding; For the first The actual rule header relationship of the activation rule chain is embedded; It is a recurrent neural network used to capture the order dependencies of relations in the rule body; Let be the norm of the vector; Based on the distance function, a score function for the rule chain is calculated to quantify the semantic consistency of the rule chain, as shown in the formula: ; in, To activate the rule chain The higher the score, the more reliable the logic of the rule chain; These are rule boundary parameters used to constrain the score range of the rule chain; Construct a joint loss function to constrain the embedding representation of triples and rule chains, as shown in the formula: ; ; in, For the joint loss function; It is a set of triples; The triplet loss is constructed based on the knowledge graph embedding score; This is a subset of the activation rules; To balance the weights; For rule chain loss; It is the sigmoid activation function; The set of negative samples for the rule chain; For negative samples of the rule chain; Embed the rule header relation corresponding to the negative sample of the rule chain.
[0010] Preferably, the step of aggregating intra-chain rule information and using the tensor Tucker operator to mine multi-hop semantic dependencies within the rule chain to generate chain-level explanatory factors specifically involves: The embedding matrix of the triples is extracted. Using the inverse tensor Tucker decomposition framework, the embedding matrix is operated on with the core tensor via forward tensor pattern product to generate the single-hop rule interpretation factor, as shown in the formula: ; in, This indicates that the rule chain is being activated. The triplet score under logical constraints, i.e., the single-hop rule explanation factor; For tensor fusion functions; These are the head entity embedding matrix, relation embedding matrix, and tail entity embedding matrix, respectively. For tensor Tucker operators; For the core tensor; We use a low-rank core tensor to represent the parameter tensor, compressing the parameter size while preserving core semantic information, resulting in a compact single-hop explanatory factor, as shown in the formula: ; ; in, These are low-rank approximate hyperparameters; , , It is a low-rank decomposition vector; It is the tensor product; To activate the rule chain The embedding of rule header relationships; For compact single-hop explanatory factors; T is the transpose sign; Based on the compact single-hop explanatory factor, the slice information of each single-hop relationship is extracted, the knowledge of different paths of the activation rule chain is aggregated, and the chain-level explanatory factor of the activation rule chain is obtained after Softmax normalization. The formula is: ; in, For the first Chain-level explanation factors for activation rule chains; It is a normalized exponential function; This represents the product operator; For the first Activation rule chain Length; For head entities; It is a tail entity; For relationship; Indicates the first Activation rule chain The triplet score of all single jump relationships, i.e. The slice format.
[0011] Preferably, a deep neural network is used to capture the interaction relationships between different rules by aggregating inter-chain rule information, and outputs rule scores, specifically: A breadth-first search strategy is adopted, starting from the head entity, traversing all feasible paths in the knowledge graph that match the rule head relationship of each rule chain in the activation rule subset, filtering out the candidate tail entities corresponding to the effective paths, and generating a set of candidate tail entities; For each candidate tail entity in the candidate tail entity set, its corresponding chain-level explanatory factor and embedding features are summarized, and the rule score of the candidate tail entity corresponding to the activation rule chain is calculated using a multilayer perceptron, as shown in the formula: ; in, For the first The activation rule chain corresponds to the candidate tail entity The rules score; For head entities; To activate the rule chain The embedding of rule header relationships; Candidate tail entity; It is a multilayer perceptron; For layer normalization; The total number of activated rule chains participating in the matching of the current candidate entities; For the first Chain-level explanation factors for activation rule chains; for semantic embedding vector; for semantic embedding vector; This is the global semantic embedding vector for the rule chain; This indicates a feature splicing operation.
[0012] Preferably, the formula for the comprehensive score is: ; in, The overall score; Candidate tail entity; Scoring is embedded in the knowledge graph; Score points for the rules; This represents the score weight.
[0013] Preferably, when determining the result of knowledge graph reasoning based on the comprehensive score: First, the comprehensive score is converted into the true probability of the candidate entity using the softmax function, as shown in the formula: ; in, The true probability of the candidate tail entity; It is a normalized exponential function; Then select the candidate tail entity with the highest probability. As a result of reasoning, the knowledge graph link prediction reasoning task is completed.
[0014] This invention also provides an interpretable knowledge graph reasoning device based on tensor-guided rule learning, comprising: The acquisition unit is used to acquire the input knowledge graph and represent it using triples containing entities and relations; The chain rule mining unit is used to extract chain rules from the knowledge graph to generate a set of rule chains, and to filter out activation rules with non-zero support through instantiation verification to obtain a subset of activation rules. The joint modeling unit is used to introduce the tensor Tucker operator to jointly model the rule chains in the triples and activation rule subsets, so as to integrate the embedding representations of entities, relations and rule chains and calculate the knowledge graph embedding score. The phased joint training unit is used to train based on the subset of activation rules using a phased joint training strategy: first, by aggregating intra-chain rule information, the tensor Tucker operator is used to mine multi-hop semantic dependencies within the rule chain to generate chain-level explanatory factors; then, based on the chain-level explanatory factors, a deep neural network is used to capture the interaction relationships between different rules by aggregating inter-chain rule information to output rule scores. The reasoning unit is used to obtain a comprehensive score by weighted fusion of the knowledge graph embedding score and the rule score, and is used to determine the result of knowledge graph reasoning.
[0015] The present invention also provides an interpretable knowledge graph reasoning device based on tensor-guided rule learning, including a processor and a memory. The memory stores a computer program that can be executed by the processor to realize the interpretable knowledge graph reasoning method based on tensor-guided rule learning as described above.
[0016] The present invention also provides a computer-readable storage medium storing computer-readable instructions, which, when executed by a processor of the device in which the computer-readable storage medium is located, implement an interpretable knowledge graph reasoning method based on tensor-guided rule learning as described above.
[0017] In summary, compared with the prior art, the present invention has the following beneficial effects: This invention successfully combines the strong expressive power of tensor operations with the interpretability of logical rules. Through joint modeling using tensor Tucker operators, it deeply integrates the semantic embedding of entity-relationships with the logical constraints of rule chains, solving the problems of "semantic disconnect from logic" in traditional knowledge graph embedding and "ignoring semantic similarity" in pure rule-based reasoning. Furthermore, by using dual-score weighted fusion, it further integrates semantic matching and rule support, significantly improving the reliability and accuracy of reasoning results and adapting to the reasoning needs of complex domain knowledge graphs.
[0018] This invention generates chain-level explanation factors through intra-chain aggregation, which can directly trace the logical contribution of a single rule chain. The rule scores from inter-chain aggregation clearly define the rule support basis for candidate entities. Finally, the inference result can simultaneously output "semantic matching score + rule logic score" and the corresponding rule chain, solving the pain point of poor interpretability of traditional deep learning inference models. It can be adapted to fields such as medical care and national defense that have strict requirements for inference transparency.
[0019] This invention decomposes the core tensor into a combination of low-dimensional vectors through low-rank approximation, reducing the time and space complexity of tensor operations; by filtering the subset of activation rules to exclude invalid rules, BFS accurately traverses the path of matching rule heads, reducing redundant calculations, enabling the model to efficiently adapt to large-scale knowledge graphs containing massive entities and relationships, balancing accuracy and engineering feasibility.
[0020] This invention employs polar coordinate space dual-feature embedding to flexibly characterize the semantic differences between entities at different levels and at the same level, adapting to the entity relationship characteristics of multi-domain knowledge graphs; the joint loss function simultaneously constrains triples and rule chain embedding, enabling the model to maintain stable performance in knowledge graphs with small samples and sparse rules, and its generalization ability is superior to single semantic embedding or pure rule reasoning models.
[0021] The activation rule selection and joint modeling process of this invention can dynamically respond to the update of the knowledge graph without retraining the overall model. It only needs to iteratively update the rule chain set, activation rule subset and corresponding embedding, thereby reducing the model maintenance cost after the knowledge graph is iterated.
[0022] This invention not only achieves inference performance comparable to or better than existing state-of-the-art methods on multiple standard datasets, but also, through the constructed explanatory factors, makes the entire inference process no longer a black box, greatly enhancing users' trust in the AI system. Attached Figure Description
[0023] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained from these drawings without creative effort.
[0024] Figure 1 This is a flowchart illustrating an interpretable knowledge graph reasoning method based on tensor-guided rule learning, as provided in Example 1.
[0025] Figure 2 This is a schematic diagram of the framework of an interpretable knowledge graph reasoning method based on tensor-guided rule learning, as provided in Example 1.
[0026] Figure 3 This is a schematic diagram of an interpretable knowledge graph reasoning device based on tensor-guided rule learning, provided in Embodiment 2.
[0027] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. Detailed Implementation
[0028] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention. Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely represents selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.
[0029] Example 1 Embodiment 1 of the present invention provides an interpretable knowledge graph reasoning method based on tensor-guided rule learning, which can be implemented by an interpretable knowledge graph reasoning device based on tensor-guided rule learning (hereinafter referred to as the reasoning device), specifically, executed by one or more processors within the reasoning device.
[0030] In this embodiment, the inference device may be an electronic device equipped with a processor, which carries a computer program for the interpretable knowledge graph inference method based on tensor guided rule learning and the computer program can be executed, such as a computer, smartphone, smart tablet, workstation, etc., without limitation.
[0031] Current mainstream knowledge graph embedding models map entities and relations to a continuous vector space and then use black-box neural networks or distance metrics for reasoning. Their decision-making process lacks explicit logical basis. While traditional logic rule-based methods are interpretable, they usually rely on predefined or highly supported rules, which limits their generalization ability on sparse knowledge graphs and makes it difficult to model the complex semantic interactions within the rules.
[0032] This invention constructs a unified joint modeling framework that deeply integrates distributed triple representation with explicit logical rules, and uses tensor operations to efficiently aggregate and interact information within rules (intra-chain) and between rules (inter-chain), thereby generating traceable and quantifiable explanatory factors for each inference result while ensuring high inference accuracy.
[0033] like Figures 1-2 As shown, an interpretable knowledge graph reasoning method based on tensor-guided rule learning includes steps S1 to S5.
[0034] S1: Obtain the input knowledge graph and represent it using triples containing entities and relations.
[0035] This step provides a standardized and structured data foundation for the entire reasoning methodology. Knowledge graph raw data is mostly unstructured / semi-structured information, which needs to be transformed into a unified format to support subsequent quantitative operations such as rule mining and embedding modeling. The core is to extract entities, relationships, and associations, clarifying the basic data units for reasoning.
[0036] First, obtain the knowledge graph of the target domain (such as medical, financial, or general domains), and extract all entities, relationships, and connections between entities.
[0037] Then, the knowledge graph is formalized into a set of triples. ,in, For the head entity, For the relationship, This serves as the tail entity, providing a standardized data foundation for subsequent rule mining and modeling.
[0038] S2, extract chain rules from the knowledge graph to generate a rule chain set, and filter out activation rules with non-zero support through instantiation verification to obtain a subset of activation rules.
[0039] This step aims to extract implicit logical rules from the knowledge graph, select activation rules that are supported by examples and are logically reliable, provide "logical constraints" for subsequent joint modeling, eliminate invalid rules to reduce modeling redundancy, and ensure rule quality.
[0040] Specifically, when extracting chain rules from the knowledge graph, the expectation-maximization (EM) algorithm is used to summarize all candidate rule chains that conform to the logical rules from the triples, forming a rule chain set.
[0041] The logical rules are represented using first-order logic and formally conform to the structure of a rule body and a rule head; the rule body consists of multiple relations joined together logically. (Connection); the rule header is a single relation conclusion.
[0042] For example, the rule chain form is ; in, For the first Embedding of rule chains; As a rule body, by These relations are connected by logical conjunction; Embedded as a rule header.
[0043] The expectation-maximization algorithm calculates the support of each candidate rule chain (i.e., the proportion of instances in the knowledge graph where the rule body triple exists), filters out rules with non-zero support, retains high-quality logical rules, and continues until the rule quality converges (score fluctuation is less than the threshold), thus obtaining the optimized set of rule chains.
[0044] When filtering activation rules, the entity variables in the rule chain set are replaced with real entities in the knowledge graph to generate rule instances; Based on the rule instance, check whether all the rule body triples of the instance exist in the knowledge graph. If so, the rule chain itself is an active rule (indicating that the logic is reliable and supported by a knowledge graph instance). Obtain the active rule subset as the core object for subsequent joint modeling and rule aggregation, and eliminate invalid rule chains to reduce modeling redundancy.
[0045] This step uses the EM algorithm to summarize a set of rule chains that conform to first-order logic, capturing the implicit logic of "multiple relation conjunction → conclusion" in the knowledge graph (such as "disease-accompanying symptoms → recommended drugs" in the medical scenario), making up for the lack of logical constraints in pure semantic embedding. After support calculation and instantiation verification, a subset of activation rules is selected, retaining only valid rules that "the rule body triple exists in the knowledge graph" to avoid invalid rules interfering with the modeling accuracy. At the same time, it limits the core objects for S3 joint modeling and S4 rule aggregation, improving computational efficiency. The subset of activation rules becomes the core basis for subsequent interpretable reasoning, providing support for S4 to generate chain-level explanatory factors and S5 to trace the reasoning basis.
[0046] S3 introduces the Tensor Tucker operator to jointly model the rule chains in the triplet and activation rule subset, so as to integrate the embedding representations of entities, relations and rule chains and calculate the knowledge graph embedding score.
[0047] To bridge the gap between "semantic embedding" and "rule logic," this step uses the Tensor Tucker operator to achieve deep integration of entity, relation, and rule chain embeddings. At the same time, it calculates the Knowledge Graph Embedding (KGE) score to provide "semantic matching dimension" support for subsequent reasoning and simultaneously optimizes the consistency of the embedding representation.
[0048] Specifically, firstly, based on the triples, entities and relations are mapped to polar coordinate space, and divided into modal features and stage features; wherein, the modal features are used for entity representation at different levels; and the stage features are used for entity representation at the same level. Simultaneously, the activation rule chain of the activation rule subset is also mapped to polar coordinate space to generate an activation rule chain embedding, which carries the overall logical semantics of the rule chain.
[0049] Next, based on the aforementioned subset of activation rules, the tensor Tucker operator is introduced to interactively fuse the feature embeddings of entities and relations with the activation rule chain embeddings, and to jointly model triples and rule chains, thereby achieving semantic alignment between triples and rule chains and providing fused features for subsequent score calculation.
[0050] Then, the entity relationship distances for the modal features and the stage features are calculated separately, using the following formula: ; ; in, The entity relation distance of the modal feature; These are the head entity embedding, relation embedding, and tail entity embedding of the modal features, respectively. For Hadamah accumulation; It is an L2 norm; The entity relationship distance is the characteristic of the stage. These are the head entity embedding, relation embedding, and tail entity embedding of the stage features, respectively. It is an L1 norm; It is a sine transform function.
[0051] The entity relationship distance is fused with two types of features to construct a triplet comprehensive distance, as shown in the formula: ; in, This is the combined distance of the triplet; These are learnable weight parameters; The triplet score (KGE score) is calculated based on the triplet comprehensive distance, using the following formula: ; in, The triple score is the knowledge graph embedding score. A higher score indicates stronger semantic consistency of the triple. These are the boundary parameters for the triplet, used to constrain the score within a reasonable range.
[0052] The Tensor Tucker operator is introduced to interactively fuse feature embeddings of entities and relations with activation rule chain embeddings, enabling joint modeling of triples and rule chains. Specifically: Based on the aforementioned subset of activation rules, the activation rule chain is embedded. Embedded with each relation in the rule body of the activation rule chain By concatenating the sequences, we obtain the feature sequence. The input RNN captures the order dependencies of relationships, generates predicted rule heads, and constrains the difference between the predicted rule heads and the actual rule heads using a distance function. The formula for the distance function is: ; in, It is a distance function; For the first Embedded representation of a chain of activation rules; For the first The first rule in the activation rule chain A relational embedding; For the first The actual rule header relationship of the activation rule chain is embedded; It is a recurrent neural network used to capture the order dependencies of relations in the rule body; Let be the norm of the vector.
[0053] Based on the distance function, a score function for the rule chain is calculated to quantify the semantic consistency of the rule chain, as shown in the formula: ; in, To activate the rule chain The higher the score, the more reliable the logic of the rule chain; These are rule boundary parameters used to constrain the score range of the rule chain; Construct a joint loss function to constrain the embedding representation of triples and rule chains, as shown in the formula: ; ; in, For the joint loss function; It is a set of triples; The triplet loss is constructed based on the knowledge graph embedding score (e.g., using cross-entropy loss). This is a subset of the activation rules; To balance the weights; For rule chain loss; It is the sigmoid activation function; The set of negative samples for the rule chain; For negative samples of the rule chain; For the first The first negative sample in the rule chain A relational embedding; Embed the rule header relation corresponding to the negative sample of the rule chain.
[0054] S4. Based on the subset of activation rules, a phased joint training strategy is adopted for training: first, by aggregating intra-chain rule information, the tensor Tucker operator is used to mine the multi-hop semantic dependencies within the rule chain to generate chain-level explanatory factors; then, based on the chain-level explanatory factors, a deep neural network is used to capture the interaction relationships between different rules through inter-chain rule information aggregation, and output the rule scores.
[0055] This step mines the semantic dependencies and interactions of rules in stages: intra-chain aggregation focuses on multi-hop semantics within a single rule chain to generate interpretable factors; inter-chain aggregation captures cross-rule interactions, outputs rule scores, provides "logical constraint dimensions" to support reasoning, and enhances interpretability.
[0056] Specifically, the process of aggregating intra-chain rule information and using the tensor Tucker operator to mine multi-hop semantic dependencies within the rule chain to generate chain-level explanatory factors involves: The embedding matrices of the triples (i.e., the head entity embedding matrix, relation embedding matrix, and tail entity embedding matrix after joint training and optimization) are extracted. Using the inverse tensor Tucker decomposition framework, the embedding matrices are operated on with the core tensor through forward tensor pattern product operations to generate the single-hop rule interpretation factor, as shown in the formula: ; in, This indicates that the rule chain is being activated. The triplet score under logical constraints, i.e., the single-hop rule explanation factor; For tensor fusion functions; These are the head entity embedding matrix, relation embedding matrix, and tail entity embedding matrix, respectively. For tensor Tucker operators; For the core tensor; The parameter tensor is represented by a low-rank core tensor. While preserving the core semantic information, the parameter size is compressed through masking to obtain a compact single-hop interpretation factor, as shown in the formula: ; ; in, These are low-rank approximate hyperparameters; , , It is a low-rank decomposition vector; It is the tensor product; To activate the rule chain The embedding of rule header relationships; is a compact single-hop explanatory factor; T is the transpose symbol.
[0057] like Figure 2As shown, the mask is an auxiliary feature selection tool used to locate valid relation regions in the activation rule chain (such as distinguishing the relationship between the rule body and the rule head), filter invalid features, and allow the RNN to encode only the valid multi-hop relationships of the rule body. It is a binary or weight matrix generated based on the structure of the rule chain.
[0058] The activation rule chain and mask are input into the RNN to capture the sequential dependencies of relations in the rule body. Then, tensor Tucker decomposition is performed to generate compact single-hop explanatory factors and associated adjacency tensors.
[0059] Based on the compact single-hop explanatory factor, the slice information of each single-hop relationship is extracted, the knowledge of different paths of the activation rule chain is aggregated, and the chain-level explanatory factor of the activation rule chain is obtained after Softmax normalization. The formula is: ; in, For the first A chain-level interpretation factor for the activation rule chain, used to support interpretability; It is a normalized exponential function; This represents the product operator; For the first Activation rule chain Length; For head entities; It is a tail entity; For relationship; Indicates the first Activation rule chain The triplet score of all single jump relationships, i.e. The slice format.
[0060] A compact single-hop explanatory factor and adjacency tensor perform element-wise operations on basic entity embeddings (such as entity embeddings, relation embeddings, and activation rule chain embeddings), aggregating multi-hop semantics within the rule chain and mapping them to the entity embedding space to obtain rule-enhanced entity embeddings, i.e., semantic embedding vectors. These semantic embedding vectors retain the original semantics of the entities while injecting the multi-hop logical constraints of the rule chain, providing richer semantic input for subsequent inter-chain aggregation.
[0061] For example, the head entity of a knowledge graph After rule-based augmentation, the semantic embedding vector of the head entity is obtained. .
[0062] Activate the rule chain Activate the rule chain Embedding of rule header relationships After rule enhancement, the global semantic embedding vectors of the rule chains are obtained respectively. , semantic embedding vector .
[0063] , , Used to calculate rule scores.
[0064] A deep neural network is used to capture the interaction relationships between different rules by aggregating inter-chain rule information, and output rule scores, specifically: A breadth-first search (BFS) strategy is adopted. Starting from the head entity, all feasible paths in the knowledge graph that match the rule head relationship of each rule chain in the activation rule subset are traversed. Candidate tail entities corresponding to the effective paths are selected to generate a set of candidate tail entities. For each candidate tail entity in the candidate tail entity set, its corresponding chain-level explanatory factor and embedding features are summarized, and the rule score of the candidate tail entity corresponding to the activation rule chain is calculated using a multilayer perceptron, as shown in the formula: ; in, For the first The activation rule chain corresponds to the candidate tail entity The rules score; For head entities; To activate the rule chain The embedding of rule header relationships; Candidate tail entity; It is a multilayer perceptron; For layer normalization; The total number of activated rule chains participating in the matching of the current candidate entities; For the first Chain-level explanation factors for activation rule chains; for semantic embedding vector; for semantic embedding vector; This is the global semantic embedding vector for the rule chain; This indicates a feature splicing operation.
[0065] A higher rule score indicates that the candidate entity conforms more closely to the rule interaction logic.
[0066] In this step, intra-chain aggregation uses the Tensor Tucker operator and low-rank approximation to mine multi-hop semantic dependencies within rule chains, generating chain-level explanatory factors to quantify the logical contribution of a single rule chain. This supports interpretability (tracing the contribution ratio of a single rule chain) and reduces computational complexity through low-rank approximation, making it suitable for large-scale knowledge graphs. Inter-chain aggregation generates candidate entities through BFS path traversal, captures the interaction relationships between different rules using a DNN, and outputs rule scores to quantify the rule support of candidate entities. This compensates for the shortcomings of intra-chain aggregation, which only focuses on single rule chains and cannot model cross-rule associations. The generated rule scores, together with the KGE scores of S3, form a "semantic + logical" dual-dimensional scoring system, providing complete input for the weighted fusion of S5. At the same time, the chain-level explanatory factors and rule scores jointly enhance the interpretability of the reasoning.
[0067] S5. A comprehensive score is obtained by weighted fusion of the knowledge graph embedding score and the rule score, which is used to determine the result of knowledge graph reasoning.
[0068] This step aims to integrate semantic matching scores and rule logic scores, balance their contributions, and output accurate and interpretable reasoning results, completing the closed loop of "data → features → rules → reasoning," which is suitable for domain scenarios that require both accuracy and transparency.
[0069] Specifically, based on preset scoring weight parameters, the knowledge graph embedding score of S3 and the rule score of S4 are weighted and fused together. The formula for the comprehensive score is as follows: ; in, The overall score; Candidate tail entity; Scoring is embedded in the knowledge graph; Score points for the rules; This represents the score weight.
[0070] When determining the results of knowledge graph reasoning based on the comprehensive score: First, the comprehensive score is converted into the true probability of the candidate entity using the softmax function, as shown in the formula: ; in, The true probability of the candidate tail entity; It is a normalized exponential function; Then, the true probabilities of all candidate tail entities are sorted in descending order, and the candidate entity with the highest probability is taken as the final reasoning result to complete the knowledge graph link prediction reasoning task.
[0071] Finally, the inference results, along with the corresponding chain-level explanation factors and rule scores, can be output, enabling traceability of the inference basis.
[0072] In a specific medical diagnostic application scenario, this invention can be deployed in a hospital information system.
[0073] The core elements are as follows: Entity set: Diseases (influenza, pneumonia, hypertension), symptoms (fever, cough, headache, fatigue), medications (ibuprofen, acetaminophen, amoxicillin); Relationship set: accompanying symptoms ( Recommended medications ), symptomatic relief ( ), etiological association ( ); Triad set (partial examples): (influenza, accompanying symptoms, fever), (influenza, accompanying symptoms, headache), (influenza, recommended drug, ibuprofen), (pneumonia, accompanying symptoms, cough), (pneumonia, recommended drug, amoxicillin), (fever, symptomatic relief, acetaminophen), (influenza, accompanying symptoms, fatigue), (headache, symptomatic relief, ibuprofen).
[0074] The core reasoning objective is: given the head entity h = "influenza" and the relation r = "recommended drugs", reason about the candidate tail entities. (i.e., recommended drugs for influenza), and output the reasoning basis (interpretability core).
[0075] When a doctor inputs a patient's symptoms, such as "flu, recommended medication," the system first locates relevant entities in the medical knowledge graph and then activates rule chains through chain rule mining. During joint modeling, the Tensor Tucker model calculates the explanatory factor for each diagnostic path. After inter-chain aggregation and combining the KGE scores, the system provides a final diagnostic recommendation and a quantitative explanation of each possibility. For example, the overall score for ibuprofen recommendation is 0.80, and the overall score for acetaminophen recommendation is 0.50. Doctors not only receive highly accurate diagnostic recommendations but also clearly understand the logical basis of the AI's decision-making, thereby building trust in the system.
[0076] In another preferred embodiment, to evaluate the performance of the proposed tensor-integrated Tucker operator framework in link prediction tasks, a comprehensive evaluation was conducted using four widely recognized benchmark datasets: FB5k-237, WN18RR, UMLS, and Kinship. Through rigorous analysis, we thoroughly examined the effectiveness of introducing an explanatory factor model. The proposed model effectively captures complex relational features and rules, improving inference performance and providing interpretability.
[0077] Specifically, the FB15K-237 dataset is a subset extracted from the Freebase knowledge graph dataset, containing nearly 15,000 entities and 237 relation types. The relations in this dataset were selected from the original FB15k dataset (also a subset of Freebase), retaining only those containing at least 50 training triples. These relations cover multiple domains, including people, organizations, places, movies, books, and music, offering broader coverage than the original FB15k dataset. Compared to the original FB15k dataset, FB15k-237 is more stringent in evaluating relation prediction performance due to its smaller number of relations but larger number of triples, making it a more challenging dataset for evaluating knowledge graph embedding models.
[0078] WN18RR is a knowledge graph dataset based on WordNet that describes the associations between English words. This database defines words by associating them with synonyms through semantic relationships. WN18RR retains more symmetric, asymmetric, and combinatorial relationships from the original dataset while removing inverse relationships.
[0079] UMLS, derived from the Unified Medical Language System, is a unified knowledge representation system that integrates numerous mature medical informatics terms, including a super dictionary, semantic network, specialized dictionaries, and vocabulary processing tools. The Kinship Graph is a network knowledge graph used to depict the complex relationships among family members, aiding in understanding and inferring kinship. This graph comprehensively covers various kinship relationships, including but not limited to wife, husband, mother, father, daughter, son, sister, brother, aunt, and uncle. Detailed information about the datasets includes the number of entities, relationship types, number of rules, and rule lengths for each dataset.
[0080] The comparative methods employed include: embedding-based strategies such as TransE, DistMult, ComplEx, and TuckER; relation-based methods such as RotatE and HAKE; and logic rule-based and path reasoning-based methods such as PathRank and MLN; as well as hybrid methods of logic rules and neural networks, including Neural-LP, DR-UM, RNNLogic, and RulE.
[0081] During model training, the learning rate of the Adam optimizer was set to 0.00005. To balance the algorithm's expressive power and computational efficiency, the number of low-rank tensor approximations was set to 60. All experiments were conducted on a server equipped with an NVIDIA GeForce RTX 3090 graphics card. The main framework used was PyTorch 1.11.0, with the scat-ter 2.0.9 library integrated to complete the link prediction task.
[0082] This embodiment was tested on two smaller datasets, Kinship and UMLS, and two larger datasets, FB15K-237 and WN18RR. The proposed method was compared with several other methods, including four embedding-based methods: TransE, Di-stMult, ComplEx, and TuckER; two relation-based methods: RotatE and HAKE; and two methods based on logical rules and path reasoning: PathRank and MLN. Finally, four hybrid methods combining logical rules and neural networks were examined: Neural-LP, DRUM, RNNLogic, and RulE.
[0083] This embodiment employs four evaluation metrics, including MRR and Hits@N (N=1,3,10). MRR represents the average of the inverse ranks of the test triples, reflecting the average efficiency of the model in finding the first correct entity. A higher value indicates stronger model reasoning ability. Hits@N represents the probability of finding the correct entity among the first N predictions. This metric primarily evaluates the model's efficiency in quickly identifying accurate answers within a limited search space; a higher value indicates better performance.
[0084] Table 1 shows the performance of all comparison methods on the four datasets. For the RNNLogic method, the results are presented based on the rule (+rule) and combinations of embeddings and rules (+emb+rule); similarly, the RulE method also uses methods based on embeddings (+rule), rules (+rule), and combinations of embeddings and rules (+emb+rule) to present the results. The best performance results are indicated in bold red, and the second-best performance results are indicated in bold blue.
[0085] Table 1. Performance comparison of the present invention with other methods and models on four datasets.
[0086] Our proposed method (i.e., the method of this invention) consistently maintains leading performance across all four evaluation metrics on the two smaller datasets, Kinship and UMLS. The improvement on the UMLS dataset is particularly significant: compared to the suboptimal results, the MRR metric for UMLS improves by 2.2 percentage points, while the Hits@1, Hits@3, and Hits@10 metrics improve by 4.4, 0.3, and 0.3 percentage points, respectively. Although the performance on the Kinship dataset is not as good as on the UMLS dataset, there is still significant progress—specifically, the MRR metric improves by 0.5 percentage points, and the accuracies for Hits@1, Hits@3, and Hits@10 improve by 0.6, 0.2, and 0.6 percentage points, respectively. However, the performance improvement on the two large and complex datasets, FB15k-237 and WN18RR, is relatively limited. This limitation mainly stems from the inherent sparse and complex relationships between entities in these datasets, which make link prediction more challenging, resulting in insufficient generalization ability of the model.
[0087] In summary, the experimental results demonstrate that introducing tensor mechanisms for rule-based reasoning not only enhances the global interaction between triples and rules but also enriches the interaction hierarchy between internal features and rules. This method exhibits excellent adaptability and significant potential. In particular, our method performs exceptionally well when handling the UMLS dataset, which contains a large number of relation categories. This further validates its ability to effectively capture and express complex relation features when dealing with diverse relation tasks. This not only improves the model's performance in link prediction tasks but also makes the reasoning process more interpretable.
[0088] In this embodiment, TransE is a model that embeds entities and relations into a low-dimensional vector space. This model represents relations through a translation operation of the entity embedding vectors: when the condition is met... At that time, the tail entity The embedding vector should be close to the head entity. Embedding vectors and relations The sum of the embedding vectors. TransE learns these embedding vectors within an energy framework by minimizing the interval-based ranking criterion.
[0089] DistMult is a neural embedding model that represents entities as vectors and relations as diagonal matrices. The model calculates scores for entity pairs by the bilinear product of entity embedding vectors and relation matrices, and optimizes these embedding vectors by minimizing a margin-based ranking loss.
[0090] ComplEx is a neural embedding model that represents entities and relations using complex numerical vectors. This model introduces complex numbers on top of bilinear multiplication, capturing both the symmetry and antisymmetry of relations. The model optimizes the embedding vectors by minimizing the negative log-likelihood loss, fully utilizing the unique properties of complex numbers to distinguish relation types.
[0091] TuckER is a linear knowledge graph completion model based on Tucker decomposition. This model represents entities and relations as embedding vectors and uses a core tensor to model their interactions. The model transforms the knowledge graph triple tensor into a core tensor by decomposing binary representations and multiplies it with the entity and relation embedding matrices. Cross-relation parameter sharing is achieved through the core tensor, thereby promoting multi-task learning and optimizing knowledge representation efficiency.
[0092] RotatE is a knowledge graph embedding model that constructs knowledge graphs by representing entities as complex vectors and relations as rotations in a complex vector space. This model can model and infer various relation patterns, including symmetric, antisymmetric, inverted, and combinatorial relations. RotatE defines each relation as a rotation from the source entity to the target entity, and the magnitude of the relation embedding is restricted to 1. Furthermore, the model incorporates self-adversarial negative sampling techniques for efficient model training.
[0093] HAKE is a knowledge graph embedding model that maps entities to a polar coordinate system. The model consists of a module part and a phase part: the module part models entities at different levels using module information, while the phase part distinguishes entities at the same level using phase information. The model is trained using a negative sampling loss function with self-adversarial training.
[0094] PathRank employs an innovative approach to rank nodes in heterogeneous graphs by mining the semantic features of different paths between nodes. This algorithm enhances the personalized PageRank algorithm through pathguides, which establish meaningful connections between different node and edge types. With the help of pathguides, PathRank can identify diverse relationship patterns and entity semantics embodied in each path in the graph. By adjusting the weight distribution of each pathguide, PathRank can simulate various recommendation semantics, including collaborative filtering, content-based filtering, and context-warning suggestions.
[0095] MLN combines first-order logic with probabilistic models for link prediction in knowledge graphs. This method captures link probabilities through a weighted logic formula, thereby improving prediction accuracy and interpretability. Furthermore, MLN excels at modeling complex relationships between entities, capable of inferring missing links based on existing entity relationships. Its probabilistic reasoning mechanism efficiently calculates link probabilities, making it particularly suitable for large-scale knowledge graph applications.
[0096] Neural-LP proposes a differentiable logical rule learning method specifically for knowledge base reasoning. This method derives rules from data using neural networks, focusing on rule structure and confidence scores. Neural-logic programming excels at capturing logical relationships between entities and effectively supports knowledge graph reasoning. Its differentiable nature supports gradient-based optimization, significantly improving the accuracy and interpretability of learned rules in knowledge base applications.
[0097] DRUM proposes an end-to-end differentiable rule mining method specifically designed for knowledge graphs. This method focuses on learning probabilistic logic rules, aiming to achieve inductive link prediction, especially for unseen entities. By employing a bidirectional recurrent neural network, DRUM efficiently achieves cross-task information sharing, thereby improving the quality of the learned rules. Furthermore, the method introduces a confidence tensor, significantly improving the accuracy and interpretability of the mined rules, particularly regarding entities and their interrelationships within the knowledge graph.
[0098] RNNLogic proposes a probabilistic model for knowledge graph reasoning by learning logical rules. This model combines a rule generator with an inference predictor, both trained synchronously for collaborative optimization. By generating latent logical rules and having the predictor evaluate link predictions, the model effectively handles entities and their relationships. This innovative approach not only improves reasoning accuracy but also enhances the interpretability of the results through the learned logical rules.
[0099] RulE proposes a neurosymbolic framework. By embedding entities, relations, and logical rules into a unified space, the RulE framework achieves rule embedding technology in knowledge graph reasoning. This framework effectively addresses the fragility of traditional logical methods by integrating the joint representations of entities, relations, and logical rules, enabling soft logic reasoning. By injecting pre-defined logical rule information, the framework not only enriches the embedding features of entities and relations but also significantly improves generalization ability. This innovative approach effectively enhances the interpretability and accuracy of knowledge graph reasoning, demonstrating outstanding performance, especially when handling complex relationships between entities.
[0100] In summary, compared with the prior art, the present invention has the following beneficial effects: (1) Improve reasoning accuracy and achieve semantic and logical dual-dimensional constraints.
[0101] This invention uses tensor Tucker operator joint modeling to deeply integrate the semantic embedding of entity-relationship with the logical constraints of rule chains, solving the problems of "semantic disconnect from logic" in traditional knowledge graph embedding and "ignoring semantic similarity" in pure rule reasoning. By further integrating semantic matching and rule support through dual-score weighted fusion, the reliability and accuracy of reasoning results are greatly improved, adapting to the reasoning needs of complex domain knowledge graphs.
[0102] (2) Achieve interpretable reasoning and break the limitations of the "black box" model.
[0103] This invention generates chain-level explanation factors through intra-chain aggregation, which can directly trace the logical contribution of a single rule chain. The rule scores from inter-chain aggregation clearly define the rule support basis for candidate entities. Finally, the inference result can simultaneously output "semantic matching score + rule logic score" and the corresponding rule chain, solving the pain point of poor interpretability of traditional deep learning inference models. It can be adapted to fields such as medical care and national defense that have strict requirements for inference transparency.
[0104] (3) Optimize computational efficiency to adapt to large-scale knowledge graphs.
[0105] This invention decomposes the core tensor into a combination of low-dimensional vectors through low-rank approximation, reducing the time and space complexity of tensor operations; by filtering the subset of activation rules to exclude invalid rules, BFS accurately traverses the path of matching rule heads, reducing redundant calculations, enabling the model to efficiently adapt to large-scale knowledge graphs containing massive entities and relationships, balancing accuracy and engineering feasibility.
[0106] (4) Enhance the model’s generalization ability to adapt to multiple domain scenarios.
[0107] This invention employs polar coordinate space dual-feature embedding (modal features + stage features) to flexibly characterize the semantic differences between entities at different levels and at the same level, adapting to the entity relationship characteristics of multi-domain knowledge graphs; the joint loss function simultaneously constrains the triplet and rule chain embedding, enabling the model to maintain stable performance in knowledge graphs with small samples and sparse rules, and its generalization ability is better than that of single semantic embedding or pure rule reasoning models.
[0108] (5) Rules and embedding are optimized in tandem to dynamically adapt to knowledge graph updates.
[0109] The activation rule filtering and joint modeling process of this invention can dynamically respond to updates to the knowledge graph (addition of entities, relations, and triples), without retraining the overall model. It only requires iterative updates to the rule chain set, activation rule subset, and corresponding embeddings, thereby reducing the model maintenance cost after knowledge graph iteration.
[0110] Example 2 like Figure 3As shown, the second embodiment of the present invention also provides an interpretable knowledge graph reasoning device based on tensor-guided rule learning, comprising: The acquisition unit is used to acquire the input knowledge graph and represent it using triples containing entities and relations; The chain rule mining unit is used to extract chain rules from the knowledge graph to generate a set of rule chains, and to filter out activation rules with non-zero support through instantiation verification to obtain a subset of activation rules. The joint modeling unit is used to introduce the tensor Tucker operator to jointly model the rule chains in the triples and activation rule subsets, so as to integrate the embedding representations of entities, relations and rule chains and calculate the knowledge graph embedding score. The phased joint training unit is used to train based on the subset of activation rules using a phased joint training strategy: first, by aggregating intra-chain rule information, the tensor Tucker operator is used to mine multi-hop semantic dependencies within the rule chain to generate chain-level explanatory factors; then, based on the chain-level explanatory factors, a deep neural network is used to capture the interaction relationships between different rules by aggregating inter-chain rule information to output rule scores. The reasoning unit is used to obtain a comprehensive score by weighted fusion of the knowledge graph embedding score and the rule score, and is used to determine the result of knowledge graph reasoning.
[0111] Example 3 The third embodiment of the present invention also provides an interpretable knowledge graph reasoning device based on tensor-guided rule learning, which includes a memory and a processor. The memory stores a computer program, which can be executed by the processor to realize the interpretable knowledge graph reasoning method based on tensor-guided rule learning as described above.
[0112] Example 4 The fourth embodiment of the present invention also provides a computer-readable storage medium storing computer-readable instructions. When the computer-readable instructions are executed by the processor of the device where the computer-readable storage medium is located, they implement the interpretable knowledge graph reasoning method based on tensor guided rule learning as described above.
[0113] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for interpretable knowledge graph reasoning based on tensor-guided rule learning, characterized in that, include: S1, obtain the input knowledge graph and represent it using triples containing entities and relations; S2, extract chain rules from the knowledge graph to generate a rule chain set, and filter out activation rules with non-zero support through instantiation verification to obtain a subset of activation rules; S3 introduces the tensor Tucker operator to jointly model the triples and rule chains in the activation rule subset, so as to integrate the embedding representations of entities, relations and rule chains and calculate the knowledge graph embedding score. S4. Based on the subset of activation rules, a phased joint training strategy is adopted for training: first, by aggregating intra-chain rule information, the tensor Tucker operator is used to mine the multi-hop semantic dependencies within the rule chain to generate chain-level explanatory factors; then, based on the chain-level explanatory factors, a deep neural network is used to capture the interaction relationship between different rules by aggregating inter-chain rule information to output the rule score. S5. A comprehensive score is obtained by weighted fusion of the knowledge graph embedding score and the rule score, which is used to determine the result of knowledge graph reasoning.
2. The interpretable knowledge graph reasoning method based on tensor-guided rule learning according to claim 1, characterized in that... S2 specifically refers to: When extracting chain rules from the knowledge graph, the expectation-maximization algorithm is used to summarize all candidate rule chains that conform to the logical rules from the triples, forming a rule chain set; The logical rules are represented using first-order logic and formally conform to the structure of a rule body and a rule header; the rule body consists of multiple relations connected by logical conjunction; and the rule header is a single relation conclusion. The expectation-maximization algorithm calculates the support of each candidate rule chain, filters out rules with non-zero support to retain high-quality logical rules, and continues until the rule quality converges to obtain a set of rule chains. When filtering activation rules, the entity variables in the rule chain set are replaced with real entities in the knowledge graph to generate rule instances; Based on the rule instance, check whether all the rule body triples of the instance exist in the knowledge graph. If so, the rule chain itself is an activation rule, and a subset of activation rules is obtained.
3. The interpretable knowledge graph reasoning method based on tensor-guided rule learning according to claim 2, characterized in that... S3 specifically refers to: First, based on the triples, entities and relations are mapped to polar coordinate space, and divided into modal features and stage features; wherein, the modal features are used for entity representation at different levels; and the stage features are used for entity representation at the same level. Next, based on the aforementioned subset of activation rules, the tensor Tucker operator is introduced to interactively fuse the feature embeddings of entities and relations with the activation rule chain embeddings, and to perform joint modeling of triples and rule chains. Then, the entity relationship distances for the modal features and the stage features are calculated separately, using the following formula: ; ; in, The entity relation distance of the modal feature; These are the head entity embedding, relation embedding, and tail entity embedding of the modal features, respectively. For Hadamah accumulation; It is an L2 norm; The entity relationship distance is the characteristic of the stage. These are the head entity embedding, relation embedding, and tail entity embedding of the stage features, respectively. It is an L1 norm; The entity relationship distance is fused with two types of features to construct a triplet comprehensive distance, as shown in the formula: ; in, This is the combined distance of the triplet; These are learnable weight parameters; The triplet score is calculated based on the triplet composite distance, using the following formula: ; in, The score is the score for the triple, which is the knowledge graph embedding score; These are the boundary parameters for the triplet, used to constrain the score within a reasonable range.
4. The interpretable knowledge graph reasoning method based on tensor-guided rule learning according to claim 3, characterized in that, The Tensor Tucker operator is introduced to interactively fuse feature embeddings of entities and relations with activation rule chain embeddings, enabling joint modeling of triples and rule chains. Specifically: Based on the aforementioned subset of activation rules, the activation rule chain is embedded. Embedded with each relation in the rule body of the activation rule chain By concatenating the sequences, we obtain the feature sequence. The input is an RNN to generate a prediction rule head. The difference between the prediction rule head and the actual rule head is constrained by a distance function, wherein the formula for the distance function is: ; in, It is a distance function; For the first Embedded representation of a chain of activation rules; For the first The first rule in the activation rule chain A relational embedding; For the first The actual rule header relationship of the activation rule chain is embedded; It is a recurrent neural network used to capture the order dependencies of relations in the rule body; Let be the norm of the vector; Based on the distance function, a score function for the rule chain is calculated to quantify the semantic consistency of the rule chain, as shown in the formula: ; in, To activate the rule chain The higher the score, the more reliable the logic of the rule chain; These are rule boundary parameters used to constrain the score range of the rule chain; Construct a joint loss function to constrain the embedding representation of triples and rule chains, as shown in the formula: ; ; in, For the joint loss function; It is a set of triples; The triplet loss is constructed based on the knowledge graph embedding score; This is a subset of the activation rules; To balance the weights; For rule chain loss; It is the sigmoid activation function; The set of negative samples for the rule chain; For negative samples of the rule chain; Embed the rule header relation corresponding to the negative sample of the rule chain.
5. The interpretable knowledge graph reasoning method based on tensor-guided rule learning according to claim 3, characterized in that, The process of aggregating intra-chain rule information and using the tensor Tucker operator to mine multi-hop semantic dependencies within the rule chain to generate chain-level explanatory factors is as follows: The embedding matrix of the triples is extracted. Using the inverse tensor Tucker decomposition framework, the embedding matrix is operated on with the core tensor via forward tensor pattern product to generate the single-hop rule interpretation factor, as shown in the formula: ; in, This indicates that the rule chain is being activated. The triplet score under logical constraints, i.e., the single-hop rule explanation factor; For tensor fusion functions; These are the head entity embedding matrix, relation embedding matrix, and tail entity embedding matrix, respectively. For tensor Tucker operators; For the core tensor; We use a low-rank core tensor to represent the parameter tensor, compressing the parameter size while preserving core semantic information, resulting in a compact single-hop explanatory factor, as shown in the formula: ; ; in, These are low-rank approximate hyperparameters; , , It is a low-rank decomposition vector; It is the tensor product; To activate the rule chain The embedding of rule header relationships; For compact single-hop explanatory factors; T is the transpose sign; Based on the compact single-hop explanatory factor, the slice information of each single-hop relationship is extracted, the knowledge of different paths of the activation rule chain is aggregated, and the chain-level explanatory factor of the activation rule chain is obtained after Softmax normalization. The formula is: ; in, For the first Chain-level explanation factors for activation rule chains; It is a normalized exponential function; This represents the product operator; For the first Activation rule chain Length; For head entities; It is a tail entity; For relationship; Indicates the first Activation rule chain The triplet score of all single jump relationships, i.e. The slice format.
6. The interpretable knowledge graph reasoning method based on tensor-guided rule learning according to claim 5, characterized in that, A deep neural network is used to capture the interaction relationships between different rules by aggregating inter-chain rule information, and output rule scores, specifically: A breadth-first search strategy is adopted, starting from the head entity, traversing all feasible paths in the knowledge graph that match the rule head relationship of each rule chain in the activation rule subset, filtering out the candidate tail entities corresponding to the effective paths, and generating a set of candidate tail entities; For each candidate tail entity in the candidate tail entity set, its corresponding chain-level explanatory factor and embedding features are summarized, and the rule score of the candidate tail entity corresponding to the activation rule chain is calculated using a multilayer perceptron, as shown in the formula: ; in, For the first Each activation rule chain corresponds to a candidate tail entity The rules score; For head entities; To activate the rule chain The embedding of rule header relationships; Candidate tail entity; It is a multilayer perceptron; For layer normalization; The total number of activated rule chains participating in the matching of the current candidate entities; For the first Chain-level explanation factors for activation rule chains; for semantic embedding vector; for semantic embedding vector; This is the global semantic embedding vector for the rule chain; This indicates a feature splicing operation.
7. The interpretable knowledge graph reasoning method based on tensor-guided rule learning according to claim 6, characterized in that, The formula for the comprehensive score is: ; in, The overall score; Candidate tail entity; Scoring is embedded in the knowledge graph; Score points for the rules; This represents the score weight.
8. The interpretable knowledge graph reasoning method based on tensor-guided rule learning according to claim 7, characterized in that, When determining the results of knowledge graph reasoning based on the comprehensive score: First, the comprehensive score is converted into the true probability of the candidate entity using the softmax function, as shown in the formula: ; in, The true probability of the candidate tail entity; It is a normalized exponential function; Then select the candidate tail entity with the highest probability. As a result of reasoning, the knowledge graph link prediction reasoning task is completed.
9. An interpretable knowledge graph reasoning device based on tensor-guided rule learning, to implement the interpretable knowledge graph reasoning method based on tensor-guided rule learning as described in any one of claims 1-8, characterized in that, include: The acquisition unit is used to acquire the input knowledge graph and represent it using triples containing entities and relations; The chain rule mining unit is used to extract chain rules from the knowledge graph to generate a set of rule chains, and to filter out activation rules with non-zero support through instantiation verification to obtain a subset of activation rules. The joint modeling unit is used to introduce the tensor Tucker operator to jointly model the rule chains in the triples and activation rule subsets, so as to integrate the embedding representations of entities, relations and rule chains and calculate the knowledge graph embedding score. The phased joint training unit is used to train based on the subset of activation rules using a phased joint training strategy: first, by aggregating intra-chain rule information, the tensor Tucker operator is used to mine multi-hop semantic dependencies within the rule chain to generate chain-level explanatory factors; then, based on the chain-level explanatory factors, a deep neural network is used to capture the interaction relationships between different rules by aggregating inter-chain rule information to output rule scores. The reasoning unit is used to obtain a comprehensive score by weighted fusion of the knowledge graph embedding score and the rule score, and is used to determine the result of knowledge graph reasoning.