Knowledge graph correction method and system based on graph embedding and logic rule driving
By introducing graph embedding and logical rules-driven correction methods into the knowledge graph, the accuracy and consistency problems of knowledge graphs in the expansion and correction process are solved, and efficient correction of the knowledge graphs of automobile maintenance cases is achieved.
Patent Information
- Application Number
- CN202411573755.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-06
- Publication Date
- 2025-02-25
AI Technical Summary
There are problems with accuracy and consistency in the process of expansion and correction of knowledge graphs, especially in car repair cases, when the integration of new knowledge and the correction of old information are difficult to effectively carry out.
Using the knowledge graph correction method driven by graph embedding and logic rules, the initial knowledge graph correction model is established, including logic mining unit, knowledge graph embedding unit, detection unit and repair unit, and the model is trained using multiple training samples, and the training is generated. The model corrects the knowledge graph for repair.
Improve the accuracy of knowledge graph correction, and can effectively detect and repair error triples in the knowledge graph, ensuring the timeliness and accuracy of the knowledge graph.
Smart Images

Figure CN119514670A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of knowledge graphs, and in particular to a knowledge graph correction method and system based on graph embedding and logical rule driving. Background Art
[0002] Knowledge graphs (KGs) are widely used in question-answering systems, recommendation systems, search systems, etc. The accuracy of knowledge graphs will directly affect the use effect. Since text information may have certain deviations, some errors may also occur in the process of data extraction and fusion. As the scale of knowledge graphs continues to grow, old information may also become outdated. Therefore, the accuracy and inconsistency of knowledge graphs have become unavoidable problems.
[0003] The current automobile maintenance case knowledge graph still has the following problems and shortcomings:
[0004] (1) Case expansion: With the progress of automobile after-sales maintenance services, automobile fault maintenance data is constantly increasing. In addition, with the launch of new models of automobiles and the continuous advancement of maintenance technology, the scale of the maintenance case knowledge base should also continue to expand to ensure that the latest maintenance knowledge can be included in the database in a timely manner, so as to provide maintenance personnel with the most cutting-edge solutions.
[0005] (2) Data correction problem: Due to certain deviations in text information extraction, the maintenance knowledge extracted from fault text data will inevitably have omissions or errors. As the case knowledge base continues to grow, more and more unverified information is introduced into it. Some early problem descriptions and solutions may no longer be applicable. The accuracy and inconsistency of information become unavoidable problems. Such cases should be corrected or deleted in a timely manner to avoid misleading maintenance personnel.
[0006] In general, in the maintenance case knowledge graph, maintenance knowledge changes dynamically over time. On the one hand, new knowledge needs to be continuously integrated, and on the other hand, problematic maintenance knowledge in the case knowledge base needs to be corrected.
[0007] Therefore, it is necessary to provide a knowledge graph correction method and system based on graph embedding and logical rule-driven to improve the accuracy of knowledge graph correction. Summary of the invention
[0008] The present invention provides a knowledge graph correction method based on graph embedding and logic rule driving, comprising: establishing an initial knowledge graph correction model, wherein the initial knowledge graph correction model at least includes a logic mining unit, a knowledge graph embedding unit, a knowledge graph detection unit and a knowledge graph repair unit, the logic mining unit is used to mine logic rules from the knowledge graph, the knowledge graph embedding unit is used to generate entity and relationship embedding representations based on the logic rules, the knowledge graph detection unit is used to identify the correctness of triples, and the knowledge graph repair unit is used to repair erroneous triples based on the logic rules; establishing multiple training samples, wherein the training samples include a sample reliability graph and a sample noise graph generated based on the sample reliability graph; training the initial knowledge graph correction model through the multiple training samples to generate a trained knowledge graph correction model; obtaining the knowledge graph to be repaired; and correcting the knowledge graph to be repaired through the trained knowledge graph correction model.
[0009] Furthermore, the logic mining unit mines logic rules from the knowledge graph, including: the logic mining unit mines logic rules from the knowledge graph; for each of the logic rules, calculates the partial integrity hypothesis confidence of the logic rule.
[0010] Furthermore, the knowledge graph embedding unit generates entity and relationship embedding representations based on the logical rules, including: performing triple modeling; for each of the logical rules, performing rule instance modeling according to the entities and relationships in the knowledge graph, generating rule instances of the logical rules, and evaluating the reliability scores of the rule instances; and optimizing triple modeling and rule instance modeling by minimizing the joint loss function.
[0011] Furthermore, the triple modeling includes: assigning an initial embedding vector to each entity and relationship in the knowledge graph; using a graph attention network to learn the neighborhood information of the entity, wherein the graph attention network uses two layers of graph attention layers for learning, and each layer of graph attention layer is used to calculate the attention weight; for each node of the knowledge graph, the embedding vectors of the neighboring nodes are weighted and aggregated according to the attention weight, and the embedding of the entity and relationship is optimized by minimizing the first loss function, thereby optimizing the embedding vector of the node; and performing triple modeling based on the updated embedding vector of each node through the TransE algorithm.
[0012] Furthermore, the evaluating the reliability score of the rule instance includes: evaluating the reliability score of the rule instance by means of logical implication.
[0013] Furthermore, the knowledge graph detection unit identifies the correctness of the triple, including: predicting the positive probability and negative probability of the triple according to the embedding vector of each triple through a binary classifier based on TextCNN; calculating the positive score and negative score of the triple based on the positive probability and negative probability of the triple and the reliability score of the triple; when the positive score and negative score of the triple meet preset conditions, determining that the triple is a correct triple.
[0014] Furthermore, the preset condition is: S(y=1|(e h , r i , e t ))>S(y=0|(e h , e i , e t )), where S(y=1|(e h , r i , e t )) is the positive score of the triple, S(y=1|(e h , r i , e t )) is the negative score of the triplet.
[0015] Furthermore, the knowledge graph repair unit repairs erroneous triples based on the logical rules, including: for each erroneous triple, generating multiple candidate repair triples of the erroneous triple, calculating the confidence of each candidate repair triple, and selecting the candidate repair triple with the largest confidence as the repair of the erroneous triple.
[0016] Further, calculating the confidence of each candidate repair triplet includes: calculating the confidence of each candidate repair triplet based on a neighborhood factor and a logic rule factor.
[0017] The present invention provides a knowledge graph correction system based on graph embedding and logic rule driving, which applies the above-mentioned knowledge graph correction method based on graph embedding and logic rule driving, including: a model building module, used to establish an initial knowledge graph correction model, wherein the initial knowledge graph correction model at least includes a logic mining unit, a knowledge graph embedding unit, a knowledge graph detection unit and a knowledge graph repair unit, the logic mining unit is used to mine logic rules from the knowledge graph, the knowledge graph embedding unit is used to generate entity and relationship embedding representations based on the logic rules, the knowledge graph detection unit is used to identify the correctness of triples, and the knowledge graph repair unit is used to repair erroneous triples based on the logic rules; a sample generation module, used to establish multiple training samples, wherein the training samples include sample reliability graphs and sample noise graphs generated based on the sample reliability graphs; a model training module, used to train the initial knowledge graph correction model through the multiple training samples to generate a trained knowledge graph correction model; a graph correction module, used to obtain the knowledge graph to be repaired, and correct the knowledge graph to be repaired through the trained knowledge graph correction model.
[0018] Compared with the prior art, the knowledge graph correction method and system based on graph embedding and logic rule driving provided by the present invention have at least the following beneficial effects:
[0019] It integrates graph embedding technology, knowledge graph correction technology, and knowledge graph rule mining technology to achieve error detection and error repair of triples, and embeds triples into the knowledge graph, which can effectively correct the knowledge graph. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] This specification will be further described in the form of exemplary embodiments, which will be described in detail by the accompanying drawings. These embodiments are not restrictive, and in these embodiments, the same number represents the same structure, wherein:
[0021] Figure 1 It is a flowchart of a knowledge graph correction method based on graph embedding and logic rule driving according to some embodiments of this specification;
[0022] Figure 2 It is a schematic diagram of the structure of the knowledge graph correction model shown in some embodiments of this specification;
[0023] Figure 3 is a schematic diagram of error detection results at different error rates according to some embodiments of this specification;
[0024] Figure 4 is a schematic diagram of TN-Accuracy under different error rates according to some embodiments of this specification;
[0025] Figure 5a is a schematic diagram of F1-score under different error rates according to some embodiments of this specification;
[0026] Figure 5b is a schematic diagram of FN-Precision under different error rates according to some embodiments of this specification;
[0027] Figure 6 It is a module diagram of a knowledge graph correction system based on graph embedding and logic rule driving as shown in some embodiments of this specification. DETAILED DESCRIPTION
[0028] In order to more clearly illustrate the technical solutions of the embodiments of this specification, the following is a brief introduction to the drawings required for the description of the embodiments. Obviously, the drawings described below are only some examples or embodiments of this specification. For ordinary technicians in this field, this specification can also be applied to other similar scenarios based on these drawings without creative work. Unless it is obvious from the language environment or otherwise explained, the same reference numerals in the figures represent the same structure or operation.
[0029] Figure 1 is a flowchart of a knowledge graph correction method based on graph embedding and logic rule driving according to some embodiments of this specification, such as Figure 1 As shown, the knowledge graph correction method based on graph embedding and logical rule driving may include the following steps.
[0030] Step 110, establishing an initial knowledge graph correction model.
[0031] in, Figure 2 is a schematic diagram of the structure of the knowledge graph correction model shown in some embodiments of this specification, such as Figure 2 As shown, the initial knowledge graph correction model includes at least a logic mining unit, a knowledge graph embedding unit, a knowledge graph detection unit and a knowledge graph repair unit. The logic mining unit is used to mine logic rules from the knowledge graph, the knowledge graph embedding unit is used to generate entity and relationship embedding representations based on logic rules, the knowledge graph detection unit is used to identify the correctness of triples, and the knowledge graph repair unit is used to repair erroneous triples based on logic rules.
[0032] Specifically, first of all, the knowledge graph correction task relies on reliable embedding representation. By integrating logical rules into the embedding process, better entity and relationship embeddings can be obtained. The global loss is minimized through a unified modeling method to ensure that the learned embedding is compatible with both triples and logical rules. The knowledge graph detection unit builds a binary classifier to identify correct and incorrect triples. The knowledge graph repair unit calculates the confidence of each candidate repair triple, and selects the best repair solution for the incorrect triple based on the confidence of each candidate repair triple and the consistency of the inherent relations in the knowledge graph. The knowledge graph repair unit considers both neighborhood information and logical rules, both of which are key factors in the repair process. In addition, the knowledge graph repair unit also uses iterative learning to automatically obtain sufficient training data and logical rule information, and generates unlabeled triples that are not directly observed from the graph but can be logically deduced through logical rules. These triples and repair triples carry more repair knowledge, which can further optimize the embedding representation learning for the repair task.
[0033] Preferably, the logic mining unit mines logic rules from the knowledge graph, including:
[0034] The logic mining unit mines logic rules from the knowledge graph;
[0035] For each logic rule, the confidence of the partial completeness assumption of the logic rule is calculated.
[0036] Specifically, AMIE (Association Mining with Inductive logic programming Enhanced) is used to automatically mine logical rules from knowledge graphs. AMIE3, as its latest iteration, has made many improvements on the original basis, mainly focusing on improving efficiency and rule quality. The logic mining unit uses AMIE3 to mine logical rules. Standard confidence and partial integrity assumption confidence are the two main rule quality evaluation criteria. Among them, standard confidence is a commonly used method to evaluate the reliability of rules. Its calculation formula is the number of correct conclusions derived by the rule divided by the total number of times the rule body appears. However, this method assumes that all triples that do not appear in the knowledge graph are incorrect, which violates the open world assumption of the knowledge graph. The partial integrity assumption confidence makes up for the shortcomings of the standard confidence.
[0037] The calculation formula for the confidence of the partial completeness assumption (PCA) is:
[0038]
[0039] in, It's a rule Confidence under the partial integrity assumption. It is the number of correct predictions of the rule in the knowledge base (i.e. support). It is a rule body The number of occurrences in the knowledge base. fun(r) is the functionality of relation r, i.e., for each subject, the proportion of relation r that has unique objects.
[0040] The confidence of the partial completeness assumption usually gives higher scores to entity relationships that may not be fully recorded under the open world assumption, providing more prediction opportunities for the knowledge graph. In practical applications, in order to control the complexity and computational cost of the rule mining process, the rule body is restricted. As a preference, the rule body is selected with less than 3 rules. This strategy helps to avoid generating too large a set of rules while ensuring the understandability and operability of the rules. A rule usually consists of two parts: a rule header and a rule body. The rule header describes the result or conclusion of the rule, while the rule body lists the conditions or prerequisites that need to be met to trigger the result. In some cases, the rule body may contain multiple conditions, which are combined with logical conjunctions (such as "and" and "or") to constitute sufficient conditions for the triggering of the rule. The rule body with less than 3 rules means that the number of elements (such as conditions, attributes, parameters, etc.) that meet the rule triggering conditions in the rule body is less than 3. This means that in order to trigger the result of the rule, only fewer conditions or prerequisites need to be met.
[0041] Preferably, the knowledge graph embedding unit generates entity and relationship embedding representations based on logical rules, including:
[0042] Perform triple modeling;
[0043] For each logical rule, the rule instance is modeled according to the entities and relations in the knowledge graph, the rule instance of the logical rule is generated, and the reliability score of the rule instance is evaluated;
[0044] Triple modeling and rule instance modeling are optimized by minimizing a joint loss function consisting of the weighted reliability scores of the two predicate logic rules.
[0045] Preferably, triple modeling is performed, including:
[0046] Assign initial embedding vectors to each entity and relation in the knowledge graph;
[0047] Use graph attention network to learn the neighborhood information of entities. Graph attention network uses two layers of graph attention layers for learning. Each layer of graph attention layer is used to calculate attention weights. Graph attention network can weight the neighboring entities of entities so that the knowledge graph embedding unit can focus on more important neighbors. The attention weight reflects the importance of each neighbor node to the current node embedding.
[0048] For each node in the knowledge graph, the embedding vectors of neighboring nodes are weighted and aggregated according to the attention weights, and the embedding of entities and relations is optimized by minimizing the joint loss function to optimize the embedding vector of the node;
[0049] The TransE (Translating Embedding) algorithm is used to perform triple modeling based on the updated embedding vector of each node. For a given triple (e h ,r k ,e t ), the embedding representation of the two entities can be obtained through the relationship vector r k The head entity vector plus the relationship vector should be as close as possible to the tail entity vector, i.e., e h +r k ≈e t .
[0050] Specifically, for each mined logical rule, a specific rule instance is generated based on the entities and relationships in the knowledge graph, that is, the abstract categories in the rule need to be replaced with specific entity instances. Each rule instance inherits the confidence of its corresponding logical rule, which reflects the reliability of the rule based on its performance in the training data. Using entity relationship embedding to calculate the probability that the triple guided by the rule instance is true is the core of combining logical rules with entity relationship embedding. Finally, the knowledge graph embedding unit optimizes triple modeling and rule instance modeling by minimizing the joint loss function.
[0051] Preferably, evaluating the reliability score of the rule instance includes:
[0052] The reliability scores of rule instances are evaluated by means of logical implications.
[0053] Logical rules usually consist of basic triples and logical connectives (such as logical AND "∧" and logical implication). ). When applying these rules, the reliability score of the rule instance can be evaluated by logical implication, which is mainly based on the reliability scores of the triples that make up the rule. Logical rules can be roughly divided into two categories, and the reliability score of each logical rule is calculated as follows:
[0054] The first predicate logic rule format is: Representation for all head entities e h and tail entity e t , if there is a relationship r between them i , we can infer that there may be a relationship between them. j , and its reliability score calculation formula is as follows:
[0055]
[0056] Among them, R(f) represents the reliability score calculation function of the logic rule, Representation logic rules The reliability score, Represents logical negation, ∨ respectively logical or, R(e h ,r i ,e t ) and R(e h ,r j ,e t ) represents the head entity e h With the tail entity e t Through the relationship r i and r j The reliability score of the connection.
[0057] The second predicate logic rule format is: Representation for all head entities e h 、Intermediate entity e t and tail entity e k , if there is a relationship r between them i and r n (ie (e h ,r i ,e t ) and (e t ,r n ,e k ) are all true), then we can infer the head entity e h and tail entity e k There may also be a relationship between s (ie (e h ,r s ,e k ) may be true), and the reliability score calculation formula is as follows:
[0058]
[0059] in, Logical rules The reliability score, R(e h ,r i ,e t )、R(et ,r n ,e k ) and R(e h ,r s ,e k ) represents the head entity e h With the tail entity e k The reliability scores of the intermediate entities connected by the relationship t With the tail entity e k The reliability scores of the relationships connected between them, and the head entity e h With the intermediate entity e t The reliability scores of the connections between them.
[0060] In general, triples are relative to the generated negative logic rule instances, indicating that there are no triples that conform to the negative logic rule in the knowledge graph. The embeddings of entities and relations are compatible not only with the observed positive triples, but also with the logic rule instances inferred from the knowledge graph, because the loss function forces positive triples and logic rule instances to have higher reliability scores than negative triples. This can help the model generalize better to unseen data and improve its reasoning ability.
[0061] The following uses the automobile maintenance case knowledge graph as an example to illustrate the workflow of the knowledge graph embedding unit:
[0062] S11. Initial embedding vector allocation:
[0063] In the automobile maintenance case knowledge graph, we first need to assign initial embedding vectors to each entity (such as "engine", "tire", "brake system", etc.) and relationship (such as "fault", "repair", "replacement", etc.). These vectors can be randomly generated or initialized based on some prior knowledge (such as entity type, relationship type, etc.).
[0064] S12. Graph Attention Network Learning:
[0065] Use graph attention networks to learn the neighborhood information of entities. For example, in the case of car repair, the neighbors of an entity may be other parts or repair operations associated with it. The graph attention network weights and aggregates the information of these neighbors through two layers of graph attention layers. In each layer, the graph attention network calculates the attention weights between the current node and the neighbor nodes. These weights reflect the importance of the neighbor nodes to the embedding of the current node. For example, the neighbors of "engine" may include "oil", "spark plug", etc. If the "fault" relationship between "oil" and "engine" appears frequently, the weight of "oil" will be higher.
[0066] S13. Optimized embedding:
[0067] The embedding vectors of entities and relations are optimized by minimizing a loss function. Preferably, this loss function takes into account the distance and similarity between the embedding vectors and whether they can accurately represent the structure and semantic information in the knowledge graph.
[0068] S14, TransE modeling:
[0069] After obtaining the optimized embedding vector, the TransE model can be used to model the triples. For example, for the triple (engine, fault, oil), we expect the embedding vector of "engine" plus the relation vector of "fault" to be as close as possible to the embedding vector of "oil". In this way, the TransE model can learn the semantic connection between entities and relations.
[0070] S15. Rule mining and instance generation:
[0071] Logical rules are mined from the automobile maintenance case knowledge graph or related data sources, such as "If part A often fails, part B may need to be repaired." Then, specific rule instances are generated based on the entities and relationships in the knowledge graph, such as "If the engine often fails, the oil system may need to be repaired." Here, the abstract categories (A, B) in the rule are replaced with specific entity instances (engine, oil system).
[0072] S16, Confidence inheritance:
[0073] Each rule instance inherits the confidence of its corresponding logic rule. This confidence reflects the reliability or accuracy of the rule in the training data. For example, if the rule "If part A often fails, part B may need to be repaired" performs well in the training data, then the rule instances generated by it (such as "If the engine often fails, the oil system may need to be repaired") will also have a high confidence.
[0074] S17. Calculate the probability of a triple being established:
[0075] Entity relationship embedding is used to calculate the probability of a triple guided by a rule instance. For example, under the guidance of the rule instance "If the engine often fails, the oil system may need to be repaired", the probability of the triple (engine, failure, oil system repair) being true can be calculated. Preferably, this can be achieved by calculating the similarity or distance between embedding vectors.
[0076] S18. Joint Optimization:
[0077] Finally, the model optimizes both triple modeling and rule instance modeling by minimizing a joint loss function. This joint loss function takes into account the accuracy of triple embeddings, the prediction accuracy of rule instances, and their mutual influence. Through the training process (such as gradient descent), the model continuously adjusts the weights of the embedding vectors and rule parameters to minimize this joint loss function, thereby optimizing the performance of the entire model.
[0078] Preferably, the knowledge graph detection unit identifies the correctness of the triple, including:
[0079] The positive and negative probabilities of triples are predicted based on the embedding vector of each triple through a binary classifier based on TextCNN. TextCNN is a convolutional neural network (CNN) model for text classification, which is used to distinguish positive and negative triples in knowledge graphs.
[0080] Calculate the positive score and negative score of the triple based on the positive probability and negative probability of the triple and the reliability score of the triple;
[0081] When the positive score and the negative score of the triplet meet the preset conditions, the triplet is determined to be a correct triplet.
[0082] Specifically, the calculation formula for the positive probability and negative probability of a triple is:
[0083]
[0084] Among them, P r (y=o|(e h , r i , e t )) is a triple (e h ,r i ,e t ), x is the vector transformed from the embedding matrix by the model, ω o The weight vector corresponding to the positive class (o=1) or the negative class (o=0), ω0 is the weight vector corresponding to the negative class, and ω1 is the weight vector corresponding to the positive class.
[0085] As a preferred embodiment, the preset conditions are:
[0086] S(y=1|(e h , r i , e t ))>S(y=0|(e h , r i , e t ))
[0087] Among them, S(y=1|(eh , r i , e t )) is the positive score of the triple, S(y=0|(e h , r i , e t )) is the negative score of the triple. If the triple meets the above preset conditions, the triple is classified as correct (denoted as T c ), otherwise it is considered an incorrect triple (denoted as T d ) needs to be repaired.
[0088] The calculation formula for the positive and negative scores of a triple is:
[0089] S(y=o|(e h , e t , e t ))=P r (y=o|(e h , r i , e t ))×R(e h , r i , e t )
[0090] Among them, S(y=o|(e h , r i , e t )) is a triple (e h ,r i ,e t )'s positive score (o=1) or negative score (o=0).
[0091] Preferably, the knowledge graph repair unit repairs the erroneous triples based on the logic rules, including:
[0092] For each erroneous triple, multiple candidate repair triples of the erroneous triple are generated, the confidence of each candidate repair triple is calculated, and the candidate repair triple with the largest confidence is selected as the repair of the erroneous triple. The head entity, tail entity or relationship in the erroneous triple can be replaced to form a new triple, namely the candidate repair triple.
[0093] Noise triplet (ie, wrong triplet) t d =(e h ,r i ,e t ), t d ∈T d , the repair process involves generating candidate repair triplets
[0094] Preferably, the confidence of each candidate repair triple is calculated, including:
[0095] Based on the neighborhood factor and the logical rule factor, the confidence of each candidate repair triple is calculated.
[0096] Specifically, we first consider its effect on neighbor nodes The impact of in Incoming node Neighbor node e in , N out Represented as outflow node e t Neighbor node e out By considering its neighbors flowing into or out of t c The probability of and the probability of simultaneous occurrence are used to obtain the score of the neighborhood factor, which is calculated as follows:
[0097]
[0098] in, is the score of the neighborhood factor, p(e in , t c ) indicates that at time t c , flows into node e in With node e t There is a relationship between i The probability of is given by the relationship r i Next, node e in With node e t The probability that there is a connection between them, R(e in , r {in,i} , e t ) indicates that at time t c , node e in Through the relationship {in,i} Connect to node e t The reliability score, r in Refers to e in To e t The relationship between {in,k} Represents an embedded representation as r in +r i Two-hop relationship.
[0099] Logical rule factor evaluates candidate repair triples based on the identified logical rules Whether it conforms to the logical consistency in the knowledge graph. Because a specific conclusion triple t c It may be derived from multiple logical rules, and the confidence score of each rule may be different. Therefore, the logical rule instance with the highest probability of being true is selected as t c The logical rule factor of is calculated as:
[0100]
[0101] in, is the score of the logic rule factor, is the conclusion triple, represents the premise triple, R(f + ) represents the reliability score, θ f is the weight coefficient. Finally, the credibility score of the candidate repair triple is calculated
[0102]
[0103] Step 120: Create multiple training samples.
[0104] The training samples include sample reliability graphs and sample noise graphs generated based on the sample reliability graphs. c Consists of correct triplets; noise graph G d It consists of erroneous triples containing erroneous entities or relations; at the same time, logical rules are applied to verify whether these triples meet specific conditions to enhance the quality and availability of data.
[0105] Step 130: train the initial knowledge graph correction model using multiple training samples to generate a trained knowledge graph correction model.
[0106] Step 140, obtaining the knowledge graph to be repaired.
[0107] Step 150, correct the knowledge graph to be repaired using the trained knowledge graph correction model.
[0108] Specifically, the new data is matched with the knowledge graph. According to the matching results, some information in the new data is not completely consistent with the existing information in the knowledge graph. Therefore, the trained knowledge graph correction model is used to detect the matched maintenance knowledge to determine whether it needs to be corrected. Because it involves modifying the original maintenance knowledge in the maintenance case knowledge base, the system should meet the needs of enterprise users to confirm the maintenance knowledge to be corrected. The system provides an intuitive interface to display the results of the maintenance knowledge detection of the model for users to review. Users can verify the relevant information according to the actual situation and confirm whether it needs to be corrected to ensure the timeliness and accuracy of the maintenance knowledge.
[0109] The following experiments illustrate the beneficial effects of the knowledge graph correction method based on graph embedding and logical rule driving.
[0110] The dataset used in the experiment stores a series of fault repair cases generated during the maintenance service process of the car, including 53,681 triples, including 2,024 entities and 9 relations. The data is divided into training set, test set and validation set. The triples in the training set are regarded as positive triples. Negative triples are generated by randomly replacing the head, tail entity or relationship to ensure that these negative triples are not in the original dataset. In the knowledge graph embedding unit, the positive triples in the training set are generated into negative triples at a ratio of 1:3. In order to test the robustness of the knowledge graph correction model under different conditions, the knowledge graph detection unit sets different error rates, which helps to evaluate the effectiveness of the knowledge graph correction model when processing different degrees of noise data. The confidence of the partial integrity assumption is used as the confidence of the logical rule, and the predicate logic rules with confidence are extracted from the training set. The confidence and threshold ε of the partial integrity assumption are both set to 0.8. Under this setting, 21 logical rules are extracted from the dataset.
[0111] For the knowledge graph embedding unit, four representative knowledge graph embedding models were selected for comparative experiments, namely TransE, DistMult (Distributional Multiplication), ComplEx (ComplexEmbedding) and ConvE (Convolutional 2D Knowledge Graph Embeddings) models. For the knowledge graph detection unit and the knowledge graph repair unit, comparison is made with KGClean (An Embedding Powered Knowledge Graph Cleaning Framework), which is a cleaning framework powered by KGs embedding for detecting and repairing heterogeneous dirty data. According to the knowledge graph correction model (KG-GELD) described in this specification, two variants for experiments are generated: Ours-base and Ours-iter. Ours-base uses a method that combines one-time embedding and logical rules to perform knowledge repair. In this process, the model simultaneously learns triples and logical rules in the training set. In the repair phase, Ours-base combines the neighbor information of candidate triples with logical rules to correct erroneous triples. Compared with Ours-base, Ours-iter adopts an iterative embedding and rule-based method, which enables it to more effectively identify and correct errors in complex knowledge graphs.
[0112] For the knowledge graph embedding unit, the following indicators are mainly used for evaluation, namely MRR (Mean Reciprocal Rank), MR (Mean Rank), Hits@1 (Hits at 1), Hits@3 (Hits at 3), and Hits@10 (Hits at 10).
[0113] In order to evaluate the quality of the obtained embedding representation, the link prediction task is performed, and the experimental results are shown in Table 1. It can be seen that the method of combining graph embedding and logical rules in this paper has a significant improvement over the method of simply using KGs embedding. The advantage lies in that the model can iteratively learn more potential semantic information and repair information using logical rules.
[0114] Table 1
[0115]
[0116]
[0117] For the error detection task, the following indicators are used to measure: True Positive (TP), False Positive (FP), True Negative (TN), and False Negative (FN). TP and FP refer to the number of correct triplets that are truly detected and the number of incorrect triplets that are classified as correct, respectively. TN and FN refer to the number of noise triplets detected and the number of correct triplets classified as incorrect triplets, respectively. In addition to the above indicators, an indicator representing the percentage of truly detected incorrect triplets to the total number of errors (TN-Accuracy) is also used.
[0118] Figure 3 and Figure 4 The detection results of the model at different error rates are shown. Compared with KGClean, the Ours-iter model shows obvious advantages in practical applications, especially in terms of increasing the number of true positives and reducing the number of false positives. The main reason for this performance improvement is that Ours-iter learns the rich semantic information embedded, which improves the model's sensitivity to true negatives (TNs) and can correctly classify most of the erroneous triplets. TN-Accuracy remains stable overall, indicating that Ours-iter has stronger generalization performance in identifying erroneous triplets, enabling it to maintain a high accuracy rate in the dataset.
[0119] Finally, the F1-score is used to study the impact of different error rates on the error repair results and verify the performance of the model in error repair. Figure 5(a) shows the F1-score at different error rates. The results show that the effect of repairing dirty data with Ours-base is better than KGClean. At the same time, Ours-iter based on iterative adjustment can further improve the accuracy of repair triplets and improve the performance stability under different error rates, making it more suitable for repair tasks.
[0120] False negatives are a key issue in the process of error detection and repair, especially in named entity recognition and knowledge graph applications. False negatives refer to situations where a triple is classified as incorrect but is actually correct. The FN-Precision metric refers to the proportion of correctly corrected triplets among all false negative triplets. The experiment gradually adjusted the false negative rate from 10% to 100%, and the results are shown in Figure 5(b). From the experimental results, it can be seen that FN-Precision fluctuates within a certain range, but remains stable overall, which shows that error repair is insensitive to the number of false negatives. The reason is that the reliable embedding learned in the graph embedding stage enables the repair mechanism to avoid using other incorrect candidate triplets for repair when dealing with false negatives. Therefore, even if the false negative rate increases, the repair quality can remain unaffected.
[0121] Figure 6 is a schematic diagram of a module of a knowledge graph correction system based on graph embedding and logic rule driving according to some embodiments of this specification, such as Figure 6 As shown, the knowledge graph correction system based on graph embedding and logical rule driving may include a model building module, a sample generation module, a model training module and a graph correction module.
[0122] The model building module can be used to establish an initial knowledge graph correction model, wherein the initial knowledge graph correction model includes at least a logic mining unit, a knowledge graph embedding unit, a knowledge graph detection unit and a knowledge graph repair unit, the logic mining unit is used to mine logical rules from the knowledge graph, the knowledge graph embedding unit is used to generate entity and relationship embedding representations based on logical rules, the knowledge graph detection unit is used to identify the correctness of triples, and the knowledge graph repair unit is used to repair erroneous triples based on logical rules.
[0123] The sample generation module can be used to establish a plurality of training samples, wherein the training samples include a sample reliability map and a sample noise map generated based on the sample reliability map.
[0124] The model training module can be used to train the initial knowledge graph correction model through multiple training samples to generate a trained knowledge graph correction model.
[0125] The graph correction module can be used to obtain the knowledge graph to be repaired, and correct the knowledge graph to be repaired through the trained knowledge graph correction model.
[0126] The knowledge graph correction system based on graph embedding and logical rule driving can apply the knowledge graph correction method based on graph embedding and logical rule driving. For more descriptions of the knowledge graph correction system based on graph embedding and logical rule driving, please refer to the relevant descriptions of the knowledge graph correction method based on graph embedding and logical rule driving, which will not be repeated here.
[0127] Finally, it should be understood that the embodiments described in this specification are only used to illustrate the principles of the embodiments of this specification. Other variations may also fall within the scope of this specification. Therefore, as an example and not a limitation, alternative configurations of the embodiments of this specification may be considered consistent with the teachings of this specification. Accordingly, the embodiments of this specification are not limited to the embodiments explicitly introduced and described in this specification.
Claims
1. A knowledge graph correction method based on graph embedding and logic rule driving, characterized in that: include: Establishing an initial knowledge graph correction model, wherein the initial knowledge graph correction model at least includes a logic mining unit, a knowledge graph embedding unit, a knowledge graph detection unit and a knowledge graph repair unit, wherein the logic mining unit is used to mine logic rules from the knowledge graph, the knowledge graph embedding unit is used to generate entity and relationship embedding representations based on the logic rules, the knowledge graph detection unit is used to identify the correctness of triples, and the knowledge graph repair unit is used to repair erroneous triples based on the logic rules; Establishing a plurality of training samples, wherein the training samples include a sample reliability map and a sample noise map generated based on the sample reliability map; Training the initial knowledge graph correction model through the multiple training samples to generate a trained knowledge graph correction model; Obtain the knowledge graph to be repaired; The knowledge graph to be repaired is corrected using the trained knowledge graph correction model.
2. The knowledge graph correction method based on graph embedding and logic rule driving according to claim 1 is characterized in that: The logic mining unit mines logic rules from the knowledge graph, including: The logic mining unit mines logic rules from the knowledge graph; For each of the logic rules, a confidence level of the partial integrity hypothesis of the logic rule is calculated.
3. The knowledge graph correction method based on graph embedding and logical rule driving according to claim 1 is characterized in that: The knowledge graph embedding unit generates entity and relationship embedding representations based on the logical rules, including: Perform triple modeling; For each of the logic rules, rule instance modeling is performed according to entities and relationships in the knowledge graph, a rule instance of the logic rule is generated, and a reliability score of the rule instance is evaluated; Triplet modeling and rule instance modeling are optimized by minimizing the joint loss function.
4. The knowledge graph correction method based on graph embedding and logic rule driving according to claim 3 is characterized in that: The triple modeling comprises: Assign initial embedding vectors to each entity and relation in the knowledge graph; Using a graph attention network to learn neighborhood information of an entity, wherein the graph attention network uses two graph attention layers for learning, and each graph attention layer is used to calculate an attention weight; For each node of the knowledge graph, weight the embedding vectors of the neighboring nodes according to the attention weight, optimize the embedding of entities and relationships by minimizing the first loss function, and optimize the embedding vector of the node; Triplet modeling is performed based on the updated embedding vector of each node through the TransE algorithm.
5. The knowledge graph correction method based on graph embedding and logic rule driving according to claim 3 is characterized in that: The reliability score of the evaluation rule instance includes: The reliability scores of rule instances are evaluated by means of logical implications.
6. The knowledge graph correction method based on graph embedding and logic rule driving according to any one of claims 1 to 5, characterized in that: The knowledge graph detection unit identifies the correctness of the triple, including: Predict the positive probability and negative probability of each triplet according to the embedding vector of each triplet through a binary classifier based on TextCNN; Calculating a positive score and a negative score of the triplet based on the positive probability and the negative probability of the triplet and the reliability score of the triplet; When the positive score and the negative score of the triplet meet a preset condition, the triplet is determined to be a correct triplet.
7. The knowledge graph correction method based on graph embedding and logic rule driving according to claim 6 is characterized in that: The preset conditions are: S(y=1|(e h ,r i ,e t ))>S(y=0|(e h ,r i ,e t )) Among them, S(y=1|(e h , r i , e t )) is the positive score of the triple, S(y=0|(e h , r i , e t )) is the negative score of the triplet.
8. The knowledge graph correction method based on graph embedding and logic rule driving according to any one of claims 1 to 5, characterized in that: The knowledge graph repairing unit repairs the erroneous triples based on the logic rules, including: For each erroneous triple, multiple candidate repair triples of the erroneous triple are generated, the confidence of each candidate repair triple is calculated, and the candidate repair triple with the largest confidence is selected as the repair of the erroneous triple.
9. The knowledge graph correction method based on graph embedding and logic rule driving according to claim 8 is characterized in that: Calculate the confidence of each candidate repair triplet, including: Based on the neighborhood factor and the logical rule factor, the confidence of each candidate repair triple is calculated.
10. A knowledge graph correction system based on graph embedding and logic rule driving, characterized by: The method for modifying a knowledge graph based on graph embedding and driven by logical rules as described in any one of claims 1 to 9 comprises: A model building module, used to build an initial knowledge graph correction model, wherein the initial knowledge graph correction model at least includes a logic mining unit, a knowledge graph embedding unit, a knowledge graph detection unit and a knowledge graph repair unit, the logic mining unit is used to mine logic rules from the knowledge graph, the knowledge graph embedding unit is used to generate entity and relationship embedding representations based on the logic rules, the knowledge graph detection unit is used to identify the correctness of triples, and the knowledge graph repair unit is used to repair erroneous triples based on the logic rules; A sample generation module, used to establish a plurality of training samples, wherein the training samples include a sample reliability map and a sample noise map generated based on the sample reliability map; A model training module, used to train the initial knowledge graph correction model through the multiple training samples to generate a trained knowledge graph correction model; The graph correction module is used to obtain the knowledge graph to be repaired, and correct the knowledge graph to be repaired by using the trained knowledge graph correction model.