An embedded decision tree knowledge graph explainable reasoning method, system and device
By embedding decision trees into a relational graph convolutional network, the interpretability problem of neural network reasoning in equipment management business is solved, and the integrity and credibility of the equipment management knowledge graph are improved.
Patent Information
- Application Number
- CN202310539164.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-15
- Publication Date
- 2026-02-06
- Estimated Expiration
- 2043-05-15
AI Technical Summary
Existing neural network-based knowledge reasoning methods lack interpretability in equipment management operations, making it difficult to understand their reasoning process and results, resulting in insufficient integrity of the knowledge graph.
A relational graph convolutional network is trained using a training set, and its output layer is replaced with a decision tree. Combined with a relational graph convolutional network with embedded decision trees, an interpretable reasoning model is formed for the completion of the equipment management knowledge graph.
This enables interpretability of knowledge graph reasoning in equipment management operations, improves the completeness and credibility of the knowledge graph, and enhances the completeness and reliability of business knowledge.
Smart Images

Figure CN116796845B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of device management, in particular to a knowledge graph explainable reasoning method and system embedded with a decision tree and a device. BACKGROUND
[0002] Knowledge reasoning is an important means of knowledge graph completion and has been one of the research hotspots in the field of knowledge graph all the time. With the continuous development of neural networks, its application in knowledge reasoning has gradually been widely valued in recent years. The knowledge reasoning method based on neural networks has stronger reasoning and generalization capabilities, and has higher utilization rate of entity, relationship and other information in the knowledge base, and better reasoning effect.
[0003] However, neural networks have black box characteristics, and it is difficult for people to understand why a particular function selects certain parameters during training, to express the principles or reasons for the conclusions drawn by neural networks, or to represent the correlation in the training data when selecting features. Although researchers have invested a lot of effort in this field of explainability, the current progress still cannot meet the needs of developers and users in actual use, that is, the explainability problem of knowledge reasoning based on neural networks has not been effectively solved, and the current research on knowledge graph reasoning for device management business is scarce. SUMMARY
[0004] The purpose of the present application is to provide a knowledge graph explainable reasoning method and system embedded with a decision tree and a device, so that the reasoning of device management business has explainability, and the integrity of the knowledge graph is improved.
[0005] To achieve the above-mentioned purpose, the present application provides the following scheme:
[0006] The present application discloses a knowledge graph explainable reasoning method embedded with a decision tree, comprising:
[0007] The relationship graph convolution network is trained using the training set to obtain the trained relationship graph convolution network; the sample data in the training set includes input data and label data, the input data is two values in a triple in a sample knowledge graph, and the label data is a third value in the triple;
[0008] The full connection network before the output layer in the trained relationship graph convolution network is replaced by a decision tree, the output of the decision tree is multiplied by the output of the output layer as a prediction output, and a relationship graph convolution network embedded with a decision tree is obtained;
[0009] The relationship graph convolution network embedded with a decision tree is trained using the training set to obtain an explainable reasoning model;
[0010] According to the interpretable reasoning model and the to-be-completed device management knowledge graph, a completed device management knowledge graph is obtained.
[0011] Optionally, the output of each leaf node in the decision tree is an inner product of an input vector of the decision tree and a hidden vector of the leaf node.
[0012] Optionally, the output probability of each leaf node in the decision tree is represented as:
[0013] ;
[0014] ;
[0015] ;
[0016] wherein T represents a total type quantity, p i (z i ) represents a probability that the input vector x is of type i, z i represents an inner product of the input vector x and a hidden vector w i , z j represents an inner product of the input vector x and a hidden vector w j , w i represents a hidden vector of type i, w j represents a hidden vector of type j, w i1 represents a first element in w i , w i2 represents a second element in w i , w id represents a dth element in w i , w i ∈R d , R d represents d dimensions, x1 represents a first element in x, x2 represents a second element in x, and x d represents a dth element in x.
[0017] Optionally, a loss function in the relationship graph convolution network training process is denoted as a first loss function, and the first loss function is represented as:
[0018] ;
[0019] wherein, is the first loss function, Y represents a node set with labels, represents a predicted output of an i th node in a k th type, represents a real label of the i th node in the k th type, and the node is a node in an adjacency matrix corresponding to the sample knowledge graph.
[0020] Optionally, the loss function in the process of training the relation graph convolution network embedded with the decision tree is denoted as a second loss function, and the second loss function is expressed as:
[0021] L total =L original +L hard ;
[0022] ;
[0023] wherein L total denotes the second loss function, L hard denotes a cross-entropy loss function, T denotes a total number of types, y i denotes a real probability that input data is of type i, and p i denotes a predicted probability that the input data is of type i.
[0024] The application further discloses a knowledge graph explainable reasoning system embedded with a decision tree, comprising:
[0025] a relation graph convolution network training module, configured to train a relation graph convolution network by using a training set to obtain a trained relation graph convolution network; sample data in the training set comprises input data and label data, the input data is two values in a triple in a preset knowledge graph, and the label data is a third value in the triple;
[0026] a decision tree embedding module, configured to replace a full connection network before an output layer in the trained relation graph convolution network with a decision tree, multiply an output of the decision tree and an output of the output layer to obtain a predicted output, and obtain a relation graph convolution network embedded with the decision tree;
[0027] a relation graph convolution network training module embedded with the decision tree, configured to train a relation graph convolution network embedded with the decision tree by using the training set to obtain an explainable reasoning model;
[0028] a device management knowledge graph completion module, configured to obtain a completed device management knowledge graph according to the explainable reasoning model and a device management knowledge graph to be completed.
[0029] The application further discloses an electronic device comprising a memory and a processor, wherein the memory is used for storing a computer program, and the processor runs the computer program to enable the electronic device to execute the knowledge graph explainable reasoning method embedded with the decision tree.
[0030] According to the specific embodiments provided in the application, the following technical effects are achieved:
[0031] The present application firstly pre-trains the relation graph convolution network, and then re-trains the relation graph convolution network embedded with the decision tree to obtain an explainable inference model, so that the explainable inference model supplements and perfects the knowledge graph of the device management business, and makes the inference of the device management business explainable and the knowledge graph more complete. BRIEF DESCRIPTION OF DRAWINGS
[0032] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed in the embodiments. Obviously, the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can also be obtained from these drawings without creative labor.
[0033] Figure 1 A knowledge graph explainable inference method embedded with a decision tree is provided for the embodiments of the present application.
[0034] Figure 2 A relation graph convolution network structure embedded with a decision tree is provided for the embodiments of the present application.
[0035] Figure 3 A structure diagram for the explainable inference model of the embodiments of the present application to make predictions.
[0036] Figure 4 A knowledge graph diagram for the embodiments of the present application.
[0037] Figure 5 An explainable inference example embedded with a decision tree for the embodiments of the present application.
[0038] Figure 6 A knowledge graph explainable inference system structure embedded with a decision tree is provided for the embodiments of the present application. DETAILED DESCRIPTION
[0039] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the present application.
[0040] The purpose of the present application is to provide a knowledge graph explainable inference method, system and device embedded with a decision tree, so that the inference of the device management business is explainable.
[0041] In order to make the above-mentioned purposes, features and advantages of the present application more obvious and easy to understand, the present application will be further described in detail below with reference to the drawings and specific embodiments.
[0042] Embodiment 1
[0043] As Figure 1 shown, the embodiment discloses a knowledge graph explainable reasoning method embedded in a decision tree, which comprises the following steps.
[0044] Step 101: training a relation graph convolution network with a training set to obtain a trained relation graph convolution network; the sample data in the training set comprises input data and label data, the input data is two values in a triple in a sample knowledge graph, and the label data is a third value in the triple.
[0045] The triple in the sample knowledge graph is the basic unit of the sample knowledge graph, specifically a "entity-relation-entity" triple, wherein the entity is an entity in the equipment management business, and the relation is the relation between two entities.
[0046] The knowledge graph is a structured semantic knowledge base, and its basic unit is a "entity-relation-entity" triple. The reasoning task is essentially to infer the relation between entities given two entities in the triple, or to infer the corresponding entity given any one entity and its relation. For example, in the knowledge graph of the equipment management business, taking the relation reasoning as an example, the reasoning task is to find that a certain part is in a certain place, or to find that a certain person is responsible for a certain part, etc. The reasoning task is essentially the discovery and completion of new relations and new facts.
[0047] The entities in the equipment management business include personnel, locations and equipment parts.
[0048] The initial knowledge graph is represented as G=(V, E), wherein V represents a node set, E represents an edge set, each node in the node set represents an entity in the equipment management business; V∈R n , n represents the number of nodes, also representing the number of different entities, E∈R m , m represents the number of edges, also representing the number of different relation types, (v i , v j )∈V.
[0049] The triple is represented as <v i , r, v j >, and r is an edge, r∈E.
[0050] Based on the triples of the sample knowledge graph, an adjacency matrix A representing the structure of the graph is constructed, A∈R n×n×m .
[0051] The corresponding adjacency matrix of the sample knowledge graph is represented as:
[0052] (1);
[0053] where A ijk represents the relationship between the i-th node v i and the j-th node v j , e k is the edge between v i and v j .
[0054] The relational graph convolutional network (R-GCN) includes an input layer, a hidden layer, and an output layer.
[0055] The input layer uses an adjacency matrix as an input feature, and the parameter matrix B ∈ R m×n×d needs to be trained in the input layer of the model, where d represents the vector dimension of the node encoding after the graph convolutional network input layer.
[0056] The hidden layer uses a multi-layer graph convolutional model to simulate the transmission of information in the network structure, and each layer of the transmission framework is defined as follows:
[0057] (2);
[0058] where, represents the i-th node in the l+1 layer, represents the i-th node in the l layer, represents the representation of all neighbor nodes of the i-th node in the l hidden layer, represents the neighbor node with r type connection with the i-th node, is a normalization constant for a specific problem, which can be learned or pre-set (for example ). represents the parameter matrix corresponding to the r type relationship (r type connection), which linearly transforms the neighbor nodes of the same type edge, that is, the number of edge types is also the number of parameter matrices W r . W0 is also a parameter matrix, which refers to a feature weight matrix, and σ is a logistics sigmoid activation function.
[0059] (3);
[0060] The output layer predicts the probability of multi-classification results based on the softmax function, and the specific formula of the softmax function is as follows:
[0061] (4);
[0062] z i represents the i-th input vector of the output layer, zj Let represent the j-th input vector of the output layer, and T represent the number of classifications, i.e., the number of types of inference results. For example, if the inference task is to complete the relationship between two nodes, the classification results are the probabilities of each type of edge relationship.
[0063] The model is trained and evaluated based on minimizing the loss function. The loss function during the training process of the relational graph convolutional network is denoted as the first loss function, which is expressed as follows:
[0064] (5);
[0065] in, Let Y be the first loss function, and Y represent the set of nodes in the second adjacency matrix. This represents the predicted output of the i-th node at the k-th position (type). This represents the true label of the i-th node at the k-th position, where the node is a node in the adjacency matrix corresponding to the sample knowledge graph.
[0066] Step 102: Replace the fully connected network before the output layer in the trained relational graph convolutional network with a decision tree, and multiply the output of the decision tree with the output of the output layer to obtain the relational graph convolutional network with embedded decision tree.
[0067] The fully connected weights W∈R before the output layer T×d Where d represents the dimension of the encoded vector of the input layer node, T represents the number of categories, each node of the decision tree is composed of column vectors in the fully connected weights W, and the leaf nodes represent the final classification. When the output layer input vector x, the inner product of the input vector x and each node embedded in the decision tree is first calculated, and the calculation formula is as follows:
[0068] (6);
[0069] Where, x∈R d .
[0070] Then, based on the softmax function, the probability is predicted, and finally, the probability formula for the category of the i-th leaf node is as follows:
[0071] (7);
[0072] in, ;
[0073] T represents the total number of types of reasoning tasks, p i (z i ) represents the probability that the input vector x of a sample is of type i, and z i Represents the input vector x and the latent vector w i The inner product, zj represents the inner product of the input vector x and the hidden vector w j represents the hidden vector of type i, w i represents the first element in w i1 represents the second element in w i represents the dth element in w i2 represents the dth element in w i represents the dth element in w id represents the dth element in w i represents the dth element in w i ∈R d , R d represents d dimensions, x1 represents the first element in x, x2 represents the second element in x, x d represents the dth element in x.
[0074] The loss function in the relationship graph convolution network training process of the embedded decision tree is denoted as a second loss function, and the second loss function is expressed as:
[0075] L total =L original +L hard ;
[0076] L hard is calculated using cross-entropy, and the specific formula is as follows:
[0077] ;
[0078] wherein, L total represents the second loss function, L hard represents the cross-entropy loss function, T represents the total number of types, y i represents the real probability that the input data is type i, and p i represents the predicted probability that the input data is type i.
[0079] The embedded decision tree relationship graph convolution network is as shown in Figure 2 .
[0080] Step 103: training the embedded decision tree relationship graph convolution network using the training set to obtain an interpretable reasoning model.
[0081] When the embedded decision tree R-GCN model (interpretable reasoning model) is used for testing on a data set, assuming that the input data is a, the output of the interpretable reasoning model can be expressed as:
[0082] y=f(a;θ)·h(a;DT)·.
[0083] Wherein, f(a; theta) represents the trained relational graph convolution network, theta represents the parameters of the trained relational graph convolution network, h(a; DT) represents a function of classifying input data a according to a decision tree model DT, and DT represents the decision tree model. The overall structure of the relational graph convolution network embedded with the decision tree for completing inference prediction is as shown in Figure 3
[0084] Step 104: obtaining the completed device management knowledge graph according to the interpretable inference model and the device management knowledge graph to be completed.
[0085] According to the interpretable inference model and the device management knowledge graph to be completed, determining the information to be supplemented of the device management knowledge graph to be completed;
[0086] Based on the information to be supplemented, supplementing the device management knowledge graph to be completed to obtain the device management knowledge graph after the device management knowledge graph is completed.
[0087] The present application combines the relational graph convolution network and the decision tree, realizes the maintainability of the decision tree, and uses the relational graph convolution network for decision making. Facing the complex knowledge reasoning task in the knowledge graph, the present application guarantees the reasoning effect of the graph neural network, makes the interpretable reasoning have the explainability, and makes the knowledge graph more complete. The present application improves the original data quality problem, improves the business knowledge integrity requirement, and effectively supports the application of the later question answering, early warning and auxiliary decision making. In addition, the present application guarantees the reasoning of the device management business to have the explainability, and makes the knowledge graph analysis application more credible.
[0088] The following describes an interpretable reasoning method of a knowledge graph embedded with a decision tree based on the device management business of a certain unit.
[0089] 1. Constructing and obtaining the knowledge graph based on the device management business of a certain unit, as shown in Figure 4 Figure 4 The solid line relationship and the corresponding entity in the middle are the training data set, and the dashed line relationship is the test data set. Facing the knowledge graph reasoning task, the training set is constructed as shown in Table 1, and the test set is constructed as shown in Table 2.
[0090]
[0091] 2. Based on the training set, constructing the adjacent relationship representing the structure of the knowledge graph as shown in Table 3, and converting it into an adjacency matrix A.
[0092]
[0093] 3. Completing the teacher network training based on the R-GCN model based on the training set.
[0094] 1) input the adjacency matrix A, set the parameter d to represent the vector dimension of node encoding;
[0095] 2) construct the R-GCN network model according to formulas (2)-(5), and complete model training based on the training set.
[0096] 4, embed the decision tree into the R-GCN model, and re-complete the model training.
[0097] 1) based on the trained R-GCN network model, obtain the full connection weight W before the output layer, use each weight vector to construct a decision tree, and embed it into the R-GCN network model to replace the original full connection layer.
[0098] 2) complete the model training after embedding the decision tree according to formulas (6)-(9).
[0099] 5, use the trained network model (explainable inference model) to predict and evaluate the test set. The explainability of the model is completed by embedding the decision tree, as shown in Figure 5 . For example, for the inference task in the device management business, relationship 1, relationship 2, …, refers to the storage relationship, the relationship between the person in charge, etc.
[0100] Embodiment 2
[0101] In order to realize the functions and technical effects of the above-mentioned embodiment 1, the embodiment discloses a knowledge graph explainable inference system embedded with a decision tree, as shown in Figure 6 , the system comprises:
[0102] The relationship graph convolution network training module 201 is configured to train the relationship graph convolution network using the training set to obtain the trained relationship graph convolution network; the sample data in the training set comprises input data and label data, the input data is two values in a triple in a preset knowledge graph, and the label data is a third value in the triple.
[0103] The decision tree embedding module 202 is configured to replace the full connection network before the output layer in the trained relationship graph convolution network with a decision tree, multiply the output of the decision tree and the output of the output layer as a prediction output, and obtain the relationship graph convolution network embedded with the decision tree.
[0104] The relationship graph convolution network embedded with the decision tree training module 203 is configured to train the relationship graph convolution network embedded with the decision tree using the training set to obtain an explainable inference model.
[0105] The device management knowledge graph completion module 204 is configured to obtain a completed device management knowledge graph according to the explainable inference model and a device management knowledge graph to be completed.
[0106] Embodiment 3
[0107] The embodiment discloses an electronic device comprising a memory for storing a computer program and a processor for running the computer program to make the electronic device execute the knowledge graph explainable reasoning method embedding a decision tree as described in Embodiment 1.
[0108] In addition, the embodiment of the present application further provides a computer readable storage medium storing a computer program, which is executed by a processor to realize the knowledge graph explainable reasoning method embedding a decision tree as described in Embodiment 1.
[0109] In the specification, each embodiment is described in a progressive manner, and each embodiment focuses on the difference from other embodiments. The same or similar parts between each embodiment can be referred to each other. For the system disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple, and the relevant parts can be referred to the description of the method.
[0110] The principles and implementation manners of the present application are described by using specific examples in the present application. The above description of the embodiments is only used to help understand the method of the present application and its core idea. Meanwhile, for those skilled in the art, according to the idea of the present application, the specific implementation manner and application range can be changed. In conclusion, the content of the specification should not be understood as a limitation of the present application.
Claims
1. A knowledge graph explainable reasoning method embedded with a decision tree, characterized in that, The method comprises the following steps: constructing and obtaining a knowledge graph based on equipment management business of a certain unit, and constructing a training set for a knowledge graph reasoning task; triples in the knowledge graph are "entity-relation-entity" triples; entities in the equipment management business include personnel, locations, and equipment parts; training a relational graph convolution network using the training set to obtain a trained relational graph convolution network; sample data in the training set comprises input data and label data, the input data being two values in a triple in a sample knowledge graph, and the label data being a third value in the triple; replacing a full connection network before an output layer in the trained relational graph convolution network with a decision tree, multiplying an output of the decision tree and an output of the output layer to obtain a predicted output, and obtaining a relational graph convolution network embedded with the decision tree; training the relational graph convolution network embedded with the decision tree using the training set to obtain an interpretable reasoning model; obtaining a completed equipment management knowledge graph according to the interpretable reasoning model and the equipment management knowledge graph to be completed; an output of each leaf node in the decision tree is an inner product of an input vector of the decision tree and a hidden vector of the leaf node; an output probability of each leaf node in the decision tree is represented as: ; ; ; Where T represents the total number of types, p i (z i ) represents the input vector x The probability of type i, z i Represents the input vector x With latent vectors w i The inner product, z j Represents the input vector x With latent vectors w j The inner product, w i Represents the implicit vector of type i. w j w represents the implicit vector of type j. i1 Indicates w i The first element, w i2 Indicates w i The second element, w id Indicates w i The d-th element, w i ∈R d R d Representing d dimensions, x 1 represents x The first element, x 2 indicates x The second element in the middle, x d express x The d-th element.
2. The knowledge graph explainable reasoning method embedded with decision tree according to claim 1, characterized in that, a loss function in a training process of the relational graph convolution network is denoted as a first loss function, and the first loss function is represented as: ; wherein, is the first loss function, Y represents a set of nodes with labels, represents the predicted output of the i-th node in the k-th type, represents the true label of the i-th node in the k-th type, and the node is a node in an adjacency matrix corresponding to the sample knowledge graph.
3. The knowledge graph explainable reasoning method embedded with decision tree according to claim 2, characterized in that, a loss function in a training process of the relational graph convolution network embedded with the decision tree is denoted as a second loss function, and the second loss function is represented as: L total =L original +L hard ; ; wherein L total represents the second loss function, L hard represents a cross-entropy loss function, and T represents a total number of types, y i represents a true probability that the input data is of type i, p i represents a predicted probability that the input data is of type i.
4. A knowledge graph explainable reasoning system embedded with decision trees, characterized in that, The knowledge graph interpretable reasoning system embedded with the decision tree applies the knowledge graph interpretable reasoning method embedded with the decision tree according to claim 1, and comprises: a relational graph convolution network training module configured to train a relational graph convolution network using a training set to obtain a trained relational graph convolution network; sample data in the training set comprises input data and label data, the input data being two values in a triple in a preset knowledge graph, and the label data being a third value in the triple; a decision tree embedding module configured to replace a full connection network before an output layer in the trained relational graph convolution network with a decision tree, multiply an output of the decision tree and an output of the output layer to obtain a predicted output, and obtain a relational graph convolution network embedded with the decision tree; a relational graph convolution network embedded with the decision tree training module configured to train the relational graph convolution network embedded with the decision tree using the training set to obtain an interpretable reasoning model; an equipment management knowledge graph completion module configured to obtain a completed equipment management knowledge graph according to the interpretable reasoning model and the equipment management knowledge graph to be completed.
5. An electronic device, comprising: The electronic device comprises a memory and a processor, the memory is configured to store a computer program, and the processor is configured to run the computer program to enable the electronic device to perform the knowledge graph interpretable reasoning method embedded with the decision tree according to any one of claims 1 to 3.
Citation Information
Patent Citations
Interpretable graph neural network prediction method, system and device
CN112016620A
Knowledge representation reasoning method based on encoder and decoder architecture
CN113836312A