Reliability evaluation method, system, device and medium for knowledge graph triples
By conducting embedded vector training on the knowledge graph dataset, negative sample generation, type information and logical rule confidence calculation, as well as entity association and global path confidence analysis, a binary classification neural network is trained for triplet reliability evaluation, solving the problems of low efficiency and accuracy in the existing technology, and achieving more efficient and accurate knowledge graph triplet evaluation.
Patent Information
- Application Number
- CN202210879183.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-25
- Publication Date
- 2025-03-28
- Estimated Expiration
- 2042-07-25
AI Technical Summary
The existing knowledge graph triple reliability evaluation method has low efficiency and accuracy, ignoring the problem of missing maps and external type information.
By obtaining the knowledge graph dataset, using the preset embedding model to train the embedding vector, generate negative samples, calculate the type information and logical rule confidence, build a directed graph to calculate the entity association confidence, and use the path search strategy to calculate the global path confidence, and finally train a binary classification neural network for triple reliability evaluation.
The efficiency and accuracy of knowledge graph triad classification have been improved, and the noise detection capability has been significantly improved by using external type information and logical rule information to supplement and improve the graph.
Smart Images

Figure CN115238582B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present disclosure relate to the field of data processing technology, and in particular to a method, system, device and medium for evaluating the reliability of knowledge graph triples. Background Art
[0002] At present, with the advent of the Internet era, data has multivariate complexity. How to process massive data and quickly retrieve it has become a major difficulty in the field of artificial intelligence. In order to solve the above problems, Google launched the "Knowledge Graph" to convert world knowledge into a graph, with the aim of optimizing the results returned by the search engine and improving data processing capabilities. A typical knowledge graph usually contains a large number of knowledge triples in the following form: (head entity, relationship, tail entity) or (entity, attribute, attribute value). At present, knowledge graphs have been widely used in fields such as intelligent analysis, product recommendation and intelligent search. Since the construction of knowledge graphs comes from multiple channels, knowledge from different sources has different degrees of reliability; at the same time, with the discovery of new knowledge and the dynamic update and accumulation and evolution of the original knowledge graph, this will introduce certain noise or conflicts, reducing the reliability of knowledge in the knowledge graph. In order to improve the reliability of knowledge in the knowledge graph and thus improve the performance of knowledge-driven learning tasks, the concept of triple confidence is introduced. The confidence of the knowledge graph triple is used to characterize the possibility of the establishment of the knowledge triple. The confidence range of a triple is between [0,1]. The greater the confidence, the greater the possibility that the triple is true, and vice versa. Most of the existing knowledge graph triple reliability evaluation methods only consider the triple structure information in the graph. For example, the most popular and most accurate KGTtm (aknowledge graph triple trustworthiness measurement model) ignores the possible graph missing problem after the knowledge graph is constructed, and does not use the rich external type information.
[0003] It can be seen that there is an urgent need for a reliability assessment method for knowledge graph triples with high classification efficiency and accuracy. Summary of the invention
[0004] In view of this, the embodiments of the present disclosure provide a method, system, device and medium for evaluating the reliability of knowledge graph triples, which at least partially solve the problems of poor classification efficiency and accuracy in the prior art.
[0005] In a first aspect, an embodiment of the present disclosure provides a reliability assessment method for a knowledge graph triple, comprising:
[0006] Step 1: Obtain a dataset of knowledge graphs and use a preset embedding model to train the embedding vectors in the dataset.
[0007] Step 2: preprocess the data set, generate negative samples by randomly replacing the head entity, tail entity or relationship in some positive samples, label the positive samples and negative samples, and mix the positive samples and negative samples to generate a training set;
[0008] Step 3: Use the type information in the knowledge graph to constrain the type of each triple in the training set, and calculate the confidence of the type information accordingly;
[0009] Step 4: The logic rule confidence of each triple (h, r, t) in the training set is represented based on the logic rule information mined from the knowledge graph and the energy function calculation formula of the translation model and related models;
[0010] Step 5: construct a directed graph centered on each head entity in the knowledge graph, and use the trained embedding vector to calculate the entity association confidence;
[0011] Step 6, using the path search strategy and its embedding vector of the entity pair in each triplet in the training set, solve its global path confidence;
[0012] Step 7, training a binary classification neural network with the type confidence, logic rule confidence, entity association confidence, and global path confidence of each triple to obtain a target recognition network;
[0013] Step 8: Use the target recognition network to evaluate the reliability of the triplet to be evaluated.
[0014] According to a specific implementation of the embodiment of the present disclosure, step 3 specifically includes:
[0015] Step 3.1, obtain the type information of each entity and the type information of the relationship in the knowledge graph;
[0016] Step 3.2: Calculate the type confidence for each triple (h, r, t). The calculation formula is as follows:
[0017]
[0018]
[0019] Type(h,r,t)=p(r head ,h)*p(r tail ,t)
[0020] Among them, T h Represents the type set of the head entity h, T t represents the type set of the tail entity t, rhead represents the set of all head entities that exist in relation r, Represents r head The set of types of all entities in r tail represents the set of tail entities of all existence relations r, Represents r tail The set of types of all entities in p(r head ,h) represents the ratio of the intersection of the type of head entity h and all head entity types contained in the relationship type to all head entity types in all entity pairs with relationship r, p(r tail ,t) represents the ratio of the intersection of the type of tail entity t in all entity pairs with relationship r and all tail entity types contained in the relationship type to all tail entity types. The type information confidence Type(h,r,t) is the product of the above two, and the confidence range is [0,1].
[0021] According to a specific implementation of the embodiment of the present disclosure, step 4 specifically includes:
[0022] Step 4.1: Use the preset rule mining tool to mine high-confidence logical rules in the data set f l represents the lth logical rule, λ l represents the confidence of the lth logical rule, λ l ∈[0,1];
[0023] Step 4.2: Calculate f based on the energy function formula and the logic rule truth value calculation formula l The qth specific rule g derived from the rule l,q : The score is as follows:
[0024] Ψ(g l,q )=σ(h,r1,t)·σ(h,r2,t)-σ(h,r1,t)+1
[0025] Among them, l represents the lth rule, q represents the qth specific rule, σ(·) represents the energy function after sigmoid, and the calculation formula is:
[0026]
[0027] Among them, δ r It refers to the threshold variable related to the relation r, ||h+rt|| is the energy function calculation formula of TransE, h is the embedding vector of the head entity, r is the embedding vector of the relation, and t is the embedding vector of the tail entity;
[0028] Step 4.3, use the above formula to get the following confidence calculation formula for rule triples:
[0029]
[0030] Where C is the regularization coefficient, represents Ψ(g l,q ) with respect to the gradient of the triple (h,r,t), Make the calculated confidence range between [0,1];
[0031] Step 4.4: Integrate the above formulas to obtain the following rule confidence calculation formula:
[0032]
[0033] in, It is a set of rule triples derived from the existing triples and logical rules in the knowledge graph.
[0034] According to a specific implementation of the embodiment of the present disclosure, step 5 specifically includes:
[0035] Step 5.1, obtain all entities in the knowledge graph;
[0036] Step 5.2: construct a directed graph with each head entity h as the center, and construct a subgraph within the search depth K. The resources will be iteratively allocated to other nodes in the entire directed graph until the resources are stable, and the resource amount of each node can be obtained;
[0037] In step 5.3, the entity association confidence is obtained by combining the in-degree and out-degree of the head entity h and the tail entity t, the node depth and resource amount of the tail entity t.
[0038] According to a specific implementation of the embodiment of the present disclosure, step 6 specifically includes:
[0039] Step 6.1, search for all reachable paths between the head entity and the tail entity of each triple in the knowledge graph;
[0040] Step 6.2, calculating the path score of each reachable path according to a preset algorithm;
[0041] Step 6.3, select the top K reachable paths with the best path scores in each triple, send the embedding vectors of the top K reachable paths into the recurrent neural network, and calculate the global path confidence of the triple.
[0042] According to a specific implementation method of the embodiment of the present disclosure, the expression of the preset algorithm is:
[0043]
[0044] The first term in the formula represents the relationship r and the reachable path p i The semantic distance between all relations in the second term represents the tail entity t and the reachable path p i The semantic distance between all tail entities in the , the third term represents the head entity h and the reachable path p i The semantic distance between all head entities in , n is the reachable path p i Length.
[0045] In a second aspect, the present disclosure provides a knowledge graph triple reliability assessment system, including:
[0046] An acquisition module is used to obtain a dataset of the knowledge graph and train the embedding vectors in the dataset using a preset embedding model;
[0047] The preprocessing module is used to preprocess the data set, generate negative samples by randomly replacing the head entity, tail entity or relationship in some positive samples, label the positive samples and negative samples, and mix the positive samples and negative samples to generate a training set;
[0048] The first calculation module is used to use the type information in the knowledge graph to perform type constraints on each triple in the training set, and calculate the confidence of the type information accordingly;
[0049] The second calculation module is used to represent the logic rule confidence of each triple (h, r, t) in the training set based on the logic rule information mined from the knowledge graph and the energy function calculation formula of the translation model and related models;
[0050] The third computing module is used to construct a directed graph centered on each head entity in the knowledge graph and calculate the entity association confidence using the trained embedding vector;
[0051] The fourth computing module is used to solve the global path confidence by using the path search strategy and the embedding vector of the entity pair in each triple in the training set;
[0052] A training module is used to train a binary classification neural network with the type confidence, logic rule confidence, entity association confidence and global path confidence of each triple to obtain a target recognition network;
[0053] The recognition module is used to evaluate the reliability of the triplet to be evaluated by using the target recognition network.
[0054] In a third aspect, an embodiment of the present disclosure further provides an electronic device, the electronic device comprising:
[0055] at least one processor; and,
[0056] a memory communicatively connected to the at least one processor; wherein,
[0057] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the reliability assessment method of the knowledge graph triples in the aforementioned first aspect or any implementation of the first aspect.
[0058] In a fourth aspect, an embodiment of the present disclosure further provides a non-transitory computer-readable storage medium storing computer instructions for causing the computer to execute the reliability assessment method for knowledge graph triples in the aforementioned first aspect or any implementation of the first aspect.
[0059] In the fifth aspect, the embodiments of the present disclosure also provide a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer executes the reliability assessment method of the knowledge graph triples in the aforementioned first aspect or any implementation of the first aspect.
[0060] The reliability evaluation scheme of the knowledge graph triples in the embodiment of the present disclosure includes: step 1, obtaining a data set of the knowledge graph, and using a preset embedding model to train the embedding vectors in the data set; step 2, preprocessing the data set, generating negative samples by randomly replacing the head entity, tail entity or relationship in part of the positive samples, and labeling the positive samples and negative samples, and mixing the positive samples and negative samples to generate a training set; step 3, using the type information in the knowledge graph to perform type constraints on each triple in the training set, and calculating the type information confidence accordingly; step 4, characterizing each triple (h, r, t) in the training set according to the energy function calculation formula of the logical rule information mined in the knowledge graph and the translation model and related models logical rule confidence; step 5, construct a directed graph centered on each head entity in the knowledge graph, and use the trained embedding vector to calculate the entity association confidence; step 6, use the path search strategy and embedding vector of the entity pair in each triple in the training set to solve its global path confidence; step 7, train a binary classification neural network with the type confidence, logical rule confidence, entity association confidence and global path confidence of each triple to obtain a target recognition network; step 8, use the target recognition network to evaluate the reliability of the triple to be evaluated.
[0061] The beneficial effects of the embodiments of the present disclosure are as follows: through the scheme of the present disclosure, type information outside the knowledge graph is used to supplement the graph information, logical rules are used to complete and improve the knowledge graph to a certain extent, logical rule information, type information, entity association information and global path information are used to calculate the corresponding confidence, and then a binary classification neural network is trained based on this, and finally the trained network is used to perform reliability assessment on triples, thereby improving the efficiency and accuracy of triple classification. BRIEF DESCRIPTION OF THE DRAWINGS
[0062] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0063] Figure 1 A schematic diagram of a process for evaluating the reliability of a knowledge graph triple provided in an embodiment of the present disclosure;
[0064] Figure 2 A schematic diagram of a processing flow of another reliability assessment method for knowledge graph triples provided in an embodiment of the present disclosure;
[0065] Figure 3 A target recognition network framework involved in a reliability assessment method for a knowledge graph triple provided in an embodiment of the present disclosure;
[0066] Figure 4 A schematic diagram of the structure of a knowledge graph triple reliability assessment system provided in an embodiment of the present disclosure;
[0067] Figure 5 A schematic diagram of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0068] The embodiments of the present disclosure are described in detail below with reference to the accompanying drawings.
[0069] The following describes the embodiments of the present disclosure through specific examples, and those skilled in the art can easily understand other advantages and effects of the present disclosure from the contents disclosed in this specification. Obviously, the described embodiments are only a part of the embodiments of the present disclosure, rather than all of the embodiments. The present disclosure can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present disclosure. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present disclosure.
[0070] It should be noted that various aspects of the embodiments within the scope of the appended claims are described below. It should be apparent that the aspects described herein may be embodied in a wide variety of forms, and any specific structure and / or function described herein is merely illustrative. Based on the present disclosure, it should be understood by those skilled in the art that an aspect described herein may be implemented independently of any other aspect, and two or more of these aspects may be combined in various ways. For example, any number of aspects described herein may be used to implement the device and / or practice the method. In addition, other structures and / or functionalities other than one or more of the aspects described herein may be used to implement this device and / or practice this method.
[0071] It should also be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present disclosure. The drawings only show components related to the present disclosure rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.
[0072] Additionally, in the following description, specific details are provided to facilitate a thorough understanding of the examples. However, it will be understood by those skilled in the art that the aspects described may be practiced without these specific details.
[0073] The disclosed embodiment provides a method for evaluating the reliability of a knowledge graph triple, which can be applied to data processing and analysis in artificial intelligence scenarios.
[0074] See also Figure 1 , is a flow chart of a reliability evaluation method for a knowledge graph triple provided by an embodiment of the present disclosure. Figure 1 As shown, the method mainly comprises the following steps:
[0075] Step 1: Obtain a dataset of knowledge graphs and use a preset embedding model to train the embedding vectors in the dataset.
[0076] When implementing it, Figure 2 As shown, a data set of the knowledge graph is obtained, and an existing embedding model (such as TransE or PTransE models) is used to complete the training of the embedding vectors in the data set.
[0077] The data set of this embodiment takes FB15k, a subset of Freebase, an open source data set of a typical knowledge graph, as an example, and uses embedding models such as TransE to obtain entity embedding vectors and relationship embedding vectors in FB15k.
[0078] Step 2: preprocess the data set, generate negative samples by randomly replacing the head entity, tail entity or relationship in some positive samples, label the positive samples and negative samples, and mix the positive samples and negative samples to generate a training set;
[0079] For example, some positive samples can be selected from FB15k, and negative samples can be generated for each positive sample by randomly replacing the head entity or tail entity or relationship to form a dataset FN15kN containing 50% noise; three extended noise datasets (FB15k-N1, FB15k-N2, and FB15k-N3) obtained by negative sampling from the FB15k dataset have different noise ratios (10%, 20%, and 40%) relative to the FB15k training set, and in this implementation, the positive samples are labeled 1 and the negative samples are labeled -1. The datasets of this implementation are shown in Table 1;
[0080] Table 1
[0081]
[0082] Step 3: Use the type information in the knowledge graph to constrain the type of each triple in the training set, and calculate the confidence of the type information accordingly;
[0083] Furthermore, the step 3 specifically includes:
[0084] Step 3.1, obtain the type information of each entity and the type information of the relationship in the knowledge graph;
[0085] Step 3.2: Calculate the type confidence for each triple (h, r, t). The calculation formula is as follows:
[0086]
[0087]
[0088] Type(h,r,t)=p(r head ,h)*p(r tail ,t)
[0089] Among them, T h Represents the type set of the head entity h, T t represents the type set of the tail entity t, r head represents the set of all head entities that exist in relation r, Represents r head The set of types of all entities in r tail represents the set of tail entities of all existence relations r, Represents r tail The set of types of all entities in p(r head ,h) represents the ratio of the intersection of the type of head entity h and all head entity types contained in the relationship type to all head entity types in all entity pairs with relationship r, p(r tail ,t) represents the ratio of the intersection of the type of tail entity t in all entity pairs with relationship r and all tail entity types contained in the relationship type to all tail entity types. The type information confidence Type(h,r,t) is the product of the above two, and the confidence range is [0,1].
[0090] In specific implementation, the type information in the knowledge graph is used to constrain the type of each triple, and the confidence of the type information is calculated based on this as shown below:
[0091] Step 3.1: Get the type information of each entity and relationship in FB15k;
[0092] Step 3.2: Calculate the type confidence for each triple (h, r, t) using the following formula:
[0093]
[0094]
[0095] Type(h,r,t)=p(r head ,h)*p(r tail ,t)
[0096] Among them, T h Represents the type set of the head entity h, T t represents the type set of the tail entity t, r head represents the set of all head entities that exist in relation r, Represents r head The set of types of all entities in r tail represents the set of tail entities of all existence relations r, Represents r tail The set of types of all entities in p(r head ,h) represents the ratio of the intersection of the type of head entity h and all head entity types contained in the relationship type to all head entity types in all entity pairs with relationship r; p(r tail ,t) represents the ratio of the intersection of the type of tail entity t in all entity pairs with relation r and all tail entity types contained in the relation type to all tail entity types; the type information confidence Type(h,r,t) is the product of the above two, and the confidence range is [0,1]. The higher the confidence, the greater the possibility that the triple is established based on the type information, and vice versa.
[0097] Step 4: The logic rule confidence of each triple (h, r, t) in the training set is represented based on the logic rule information mined from the knowledge graph and the energy function calculation formula of the translation model and related models;
[0098] Based on the above embodiment, step 4 specifically includes:
[0099] Step 4.1: Use the preset rule mining tool to mine high-confidence logical rules in the data set f l represents the lth logical rule, λ l represents the confidence of the lth logical rule, λ l ∈[0,1];
[0100] Step 4.2: Calculate f according to the energy function formula and the logic rule truth value calculation formula l The qth specific rule g derived from the rule l,q : The score is as follows:
[0101] Ψ(g l,q )=σ(h,r1,t)·σ(h,r2,t)-σ(h,r1,t)+1
[0102] Among them, l represents the lth rule, q represents the qth specific rule, σ(·) represents the energy function after sigmoid, and the calculation formula is:
[0103]
[0104] Among them, δ r It refers to the threshold variable related to the relation r, ||h+rt|| is the energy function calculation formula of TransE, h is the embedding vector of the head entity, r is the embedding vector of the relation, and t is the embedding vector of the tail entity;
[0105] Step 4.3, use the above formula to get the following confidence calculation formula for rule triples:
[0106]
[0107] Where C is the regularization coefficient, represents Ψ(g l,q ) with respect to the gradient of the triple (h,r,t), Make the calculated confidence range between [0,1];
[0108] Step 4.4: Integrate the above formulas to obtain the following rule confidence calculation formula:
[0109]
[0110] in, It is a set of rule triples derived from the existing triples and logical rules in the knowledge graph.
[0111] In specific implementation, the steps of characterizing the confidence of a rule that a triple (h, r, t) is established based on the logical rule information mined from the known graph and the energy function calculation formula of the translation model and related models can be as follows:
[0112] Step 4.1: Use existing rule mining tools (such as AMIE software) to mine high-confidence logical rules in the data set f l represents the lth logical rule, λ l represents the confidence of the lth logical rule, λ l ∈[0,1];
[0113] Step 4.2: Calculate f based on the energy function formula and the logic rule truth value calculation formula l The qth specific rule g derived from the rule l,q : The score is as follows:
[0114] Ψ(g l,q )=σ(h,r1,t)·σ(h,r2,t)-σ(h,r1,t)+1
[0115] Among them, l represents the lth rule, q represents the qth specific rule, σ(·) represents the energy function after sigmoid, and the calculation formula is:
[0116]
[0117] Among them, δ rIt refers to the threshold variable related to the relation r, ||h+rt|| is the energy function calculation formula of TransE, h is the embedding vector of the head entity, r is the embedding vector of the relation, and t is the embedding vector of the tail entity;
[0118] Step 4.3, use the above formula to get the following confidence calculation formula for rule triples:
[0119]
[0120] Where C is the regularization coefficient, represents Ψ(g l,q ) with respect to the gradient of the triple (h,r,t), Make the calculated confidence range between [0,1];
[0121] Step 4.4: Integrate the above formulas to obtain the following rule confidence calculation formula:
[0122]
[0123] Among them, G is a set of regular triples derived from the existing triples and logical rules in the knowledge graph.
[0124] Step 5: construct a directed graph centered on each head entity in the knowledge graph, and use the trained embedding vector to calculate the entity association confidence;
[0125] Furthermore, the step 5 specifically includes:
[0126] Step 5.1, obtain all entities in the knowledge graph;
[0127] Step 5.2: construct a directed graph with each head entity h as the center, and construct a subgraph within the search depth K. The resources will be iteratively allocated to other nodes in the entire directed graph until the resources are stable, and the resource amount of each node can be obtained;
[0128] In step 5.3, the entity association confidence is obtained by combining the in-degree and out-degree of the head entity h and the tail entity t, the node depth and resource amount of the tail entity t.
[0129] In specific implementation, the steps of constructing a directed graph centered on each entity and calculating the entity association confidence using the existing embedding vector can be as follows:
[0130] Step 5.1: Get all entities in the FB15k dataset;
[0131] Step 5.2: Build a directed graph with each entity h (resource is 1) as the center, and build a subgraph within the search depth 3. The resources will be iteratively allocated to other nodes in the entire directed graph until the resources are stable. The resource amount of each node can be obtained; for example, the resource amount of entity t is:
[0132]
[0133] S t represents the set of all direct predecessor nodes of node t, O(e i ) represents node e i The out-degree, Represents the slave node e i The number of relationship paths to node t, Represents the slave node e i The amount of resources transferred to node t, the amount of resources of each node has a certain probability θ that can randomly jump to other nodes, and N represents the total number of nodes.
[0134] Step 5.3: The confidence of (h, t) can be obtained by combining the in-degree and out-degree of the head entity h and the tail entity t, the node depth and resource amount of the tail entity t.
[0135] Suppose vector V = [resource volume R(t|h), in-degree I(h) of head node h, out-degree O(h) of head node h, in-degree I(t) of tail node t, out-degree O(t) of tail node t, depth depth of the directed graph from head node h to tail node t]. After vector V passes through a three-layer neural network, we can get the confidence RR(h,t) of the entity pair (h,t):
[0136]
[0137] Among them, α is the nonlinear activation function sigmoid, β is the nonlinear activation function tanh, and W1, W2 and b1, b2 are adjustable parameter matrices in the training process. RR(h,t)∈[0,1], the closer the confidence is to 1, the more likely it is that there are some or multiple relationships between the head entity h and the tail entity t.
[0138] Step 6, using the path search strategy and its embedding vector of the entity pair in each triplet in the training set, solve its global path confidence;
[0139] Based on the above embodiment, step 6 specifically includes:
[0140] Step 6.1, search for all reachable paths between the head entity and the tail entity of each triple in the knowledge graph;
[0141] Step 6.2, calculating the path score of each reachable path according to a preset algorithm;
[0142] Step 6.3, select the top K reachable paths with the best path scores in each triple, send the embedding vectors of the top K reachable paths into the recurrent neural network, and calculate the global path confidence of the triple.
[0143] Optionally, the expression of the preset algorithm is
[0144]
[0145] The first term in the formula represents the relationship r and the reachable path p i The semantic distance between all relations in the second term represents the tail entity t and the reachable path p i The semantic distance between all tail entities in the , the third term represents the head entity h and the reachable path p i The semantic distance between all head entities in , n is the reachable path p i Length.
[0146] In specific implementation, the steps of solving the global path confidence by using the path search strategy of the entity pair in the triple and its embedding vector can be as follows:
[0147] Step 6.1: Search for all accessible paths between the head and tail entities of each triple in the knowledge graph dataset; for example, given a triple (h, r, t), search for a accessible path from h to t in the knowledge graph and store it in P (h,r,t) ={p1,…,p n}.
[0148] Step 6.2: Calculate the score of each path according to a specific algorithm; for each path p i = {(h,l1,e1),(e1,l2,e2),…,(e n-1 ,l n ,t)}, the semantic distance score is calculated using the following formula:
[0149]
[0150] The first term in the formula represents the relationship between r and p i The semantic distance between all relations in the second term represents the tail entity t and p i The semantic distance between all tail entities in the third term represents the semantic distance between the head entities h and p i The semantic distance between all head entities in path p i Length.
[0151] Step 6.3: Select the top K paths with the best path scores in each triple, feed the embedding vectors of the top K paths into a recurrent neural network (RNN), and calculate the global path confidence of the triple.
[0152] In this implementation, the embedding vectors of the first three paths are fed into a recurrent neural network (RNN) to obtain the corresponding output vectors h1,…,h K , and finally the global path confidence is processed by nonlinear sigmoid:
[0153] RP((h,r,t))=[α(W1h1+b1),…,α(W K h K +b K )]
[0154] Among them, α is the nonlinear activation function sigmoid, and W1,…,W k and b1,…,b K is an adjustable parameter matrix during training. RP((h,r,t))∈[0,1], the closer the confidence is to 1, the more the path can highlight the semantic information of the given triple (h,r,t).
[0155] Step 7, training a binary classification neural network with the type confidence, logic rule confidence, entity association confidence, and global path confidence of each triple to obtain a target recognition network;
[0156] In the specific implementation, the type confidence, logic rule confidence, entity association confidence and global path confidence of each triple in the FB15kN training set can be obtained first, and the above four features are used as the input of the neural network. After one hidden layer conversion, the confidence score of each triple can be output through the nonlinear activation function softmax. By learning the parameters in the network, the trained binary classification neural network can be obtained as the target recognition network. Figure 3 shown.
[0157] Step 8: Use the target recognition network to evaluate the reliability of the triplet to be evaluated.
[0158] In specific implementation, the test set of FB15kN, FB15k-N1, FB15k-N2 and FB15k-N3 data sets can be used to evaluate the binary classification neural network trained in step 7; the type confidence, logic rule confidence, entity association confidence and global path confidence of each triple in the data set are input into the neural network to obtain the confidence score of each triple. Table 2 is the evaluation of triple classification effect, and Table 3 is the noise detection result. It can be seen from Tables 2 and 3 that the triple classification effect of the present invention is better than the current baseline method, and it can significantly identify negative samples and has a strong noise detection ability.
[0159] Table 2
[0160]
[0161] Table 3
[0162]
[0163]
[0164] The reliability assessment method of the knowledge graph triples provided in this embodiment uses the type information (entity type and relationship type) outside the knowledge graph to supplement the graph information. Previous methods often ignore the rich semantic information outside the knowledge graph and only use the structural information inside the graph; logical rules are used to supplement and improve the knowledge graph to a certain extent. Considering that logical rules have powerful capabilities in knowledge acquisition and knowledge reasoning, the use of logical rule information can better perform graph reliability assessment; logical rule information, type information, entity association information and global path information are used to calculate the corresponding confidence, and then a binary classification neural network is trained based on this, and finally the trained network is used to perform reliability assessment on triples, thereby improving the accuracy of triple classification.
[0165] Corresponding to the above method embodiment, see Figure 4 The present disclosure also provides a knowledge graph triple reliability evaluation system 40, including:
[0166] An acquisition module 401 is used to acquire a data set of a knowledge graph and train an embedding vector in the data set using a preset embedding model;
[0167] A preprocessing module 402 is used to preprocess the data set, generate negative samples by randomly replacing the head entity, tail entity or relationship in some positive samples, label the positive samples and negative samples, and mix the positive samples and negative samples to generate a training set;
[0168] A first calculation module 403 is used to use the type information in the knowledge graph to perform type constraints on each triple in the training set, and calculate the type information confidence accordingly;
[0169] The second calculation module 404 is used to represent the logic rule confidence of each triple (h, r, t) in the training set according to the logic rule information mined from the knowledge graph and the energy function calculation formula of the translation model and related models;
[0170] The third calculation module 405 is used to construct a directed graph centered on each head entity in the knowledge graph, and calculate the entity association confidence using the trained embedding vector;
[0171] A fourth calculation module 406 is used to solve the global path confidence using the path search strategy and the embedding vector of the entity pair in each triple in the training set;
[0172] The training module 407 is used to train a binary classification neural network with the type confidence, logic rule confidence, entity association confidence and global path confidence of each triple to obtain a target recognition network;
[0173] The identification module 408 is used to evaluate the reliability of the triplet to be evaluated by using the target recognition network.
[0174] Figure 4 The system shown can correspondingly execute the contents of the above method embodiment. For the parts not described in detail in this embodiment, refer to the contents recorded in the above method embodiment and will not be repeated here.
[0175] See also Figure 5 The embodiment of the present disclosure further provides an electronic device 50, which includes: at least one processor and a memory connected to the at least one processor. The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the reliability evaluation method of the knowledge graph triple in the aforementioned method embodiment.
[0176] The embodiments of the present disclosure also provide a non-transitory computer-readable storage medium, which stores computer instructions, and the computer instructions are used to enable the computer to execute the reliability assessment method of the knowledge graph triples in the aforementioned method embodiment.
[0177] The present disclosure also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium. The computer program includes program instructions, which, when executed by a computer, enable the computer to execute the reliability assessment method for knowledge graph triples in the aforementioned method embodiment.
[0178] Reference below Figure 5 , which shows a schematic diagram of the structure of an electronic device 50 suitable for implementing the embodiment of the present disclosure. The electronic device in the embodiment of the present disclosure may include, but is not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 5 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0179] like Figure 5 As shown, the electronic device 50 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage device 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the electronic device 50 are also stored. The processing device 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0180] Typically, the following devices may be connected to the I / O interface 505: input devices 506 including, for example, a touch screen, a touchpad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; output devices 507 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 508 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 509. The communication device 509 may allow the electronic device 50 to communicate with other devices wirelessly or by wire to exchange data. Although the electronic device 50 with various devices is shown in the figure, it should be understood that it is not required to implement or have all the devices shown. More or fewer devices may be implemented or have alternatively.
[0181] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 509, or installed from a storage device 508, or installed from a ROM 502. When the computer program is executed by the processing device 501, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
[0182] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0183] The computer-readable medium may be included in the electronic device, or may exist independently without being installed in the electronic device.
[0184] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device can execute the relevant steps of the method embodiment.
[0185] Alternatively, the computer-readable medium carries one or more programs, and when the one or more programs are executed by the electronic device, the electronic device can perform the relevant steps of the method embodiment.
[0186] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages, or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0187] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0188] The units involved in the embodiments described in the present disclosure may be implemented by software or by hardware.
[0189] It should be understood that various parts of the present disclosure may be implemented in hardware, software, firmware, or a combination thereof.
[0190] The above is only a specific implementation of the present disclosure, but the protection scope of the present disclosure is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present disclosure should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.
Claims
1. A reliability assessment method for knowledge graph triples, characterized in that: include: Step 1: Obtain a dataset of knowledge graphs and use a preset embedding model to train the embedding vectors in the dataset. Step 2: preprocess the data set, generate negative samples by randomly replacing the head entity, tail entity or relationship in some positive samples, label the positive samples and negative samples, and mix the positive samples and negative samples to generate a training set; Step 3: Use the type information in the knowledge graph to constrain the type of each triple in the training set, and calculate the confidence of the type information accordingly; The step 3 specifically includes: Step 3.1, obtain the type information of each entity and the type information of the relationship in the knowledge graph; Step 3.2: Calculate the type confidence for each triple (h, r, t). The calculation formula is as follows: Type(h,r,t)=p(r head ,h)*p(r tail ,t) Among them, T h Represents the type set of the head entity h, T t represents the type set of the tail entity t, r head represents the set of all head entities that exist in relation r, Represents r head The set of types of all entities in r tail represents the set of tail entities of all existence relations r, Represents r tail The set of types of all entities in , p(r head ,h) represents the ratio of the intersection of the type of head entity h and all head entity types contained in the relationship type to all head entity types in all entity pairs with relationship r, p(r tail ,t) represents the ratio of the intersection of the type of tail entity t in all entity pairs with relationship r and all tail entity types contained in the relationship type to all tail entity types. The type information confidence Type(h,r,t) is the product of the above two, and the confidence range is [0,1]; Step 4: The logic rule confidence of each triple (h, r, t) in the training set is represented based on the logic rule information mined from the knowledge graph and the energy function calculation formula of the translation model and related models; The step 4 specifically includes: Step 4.1: Use the preset rule mining tool to mine high-confidence logical rules in the data set f l represents the lth logical rule, λ l represents the confidence of the lth logical rule, λ l ∈[0,1]; Step 4.2: Calculate f based on the energy function formula and the logic rule truth value calculation formula l The qth specific rule g derived from the rule l,q : The score is as follows: Ψ(g l,q )=σ(h,r1,t)·σ(h,r2,t)-σ(h,r1,t)+1 Among them, l represents the lth rule, q represents the qth specific rule, σ(·) represents the energy function after sigmoid, and the calculation formula is: Among them, δ r It refers to the threshold variable related to the relation r, ||h+rt|| is the energy function calculation formula of TransE, h is the embedding vector of the head entity, r is the embedding vector of the relation, and t is the embedding vector of the tail entity; Step 4.3, use the above formula to get the following confidence calculation formula for rule triples: Where C is the regularization coefficient, represents Ψ(g l,q ) with respect to the gradient of the triple (h,r,t), Make the calculated confidence range between [0,1]; Step 4.4: Integrate the above formulas to obtain the following rule confidence calculation formula: in, It is a set of rule triples derived from the existing triples and logical rules in the knowledge graph; Step 5: construct a directed graph centered on each head entity in the knowledge graph, and use the trained embedding vector to calculate the entity association confidence; The step 5 specifically includes: Step 5.1, obtain all entities in the knowledge graph; Step 5.2: construct a directed graph with each head entity h as the center, and construct a subgraph within the search depth K. The resources will be iteratively allocated to other nodes in the entire directed graph until the resources are stable, and the resource amount of each node can be obtained; Step 5.3, combining the out-degree and in-degree of the head entity h and the tail entity t, the node depth and resource amount of the tail entity t to obtain the entity association confidence; Step 6, using the path search strategy and its embedding vector of the entity pair in each triplet in the training set, solve its global path confidence; The step 6 specifically includes: Step 6.1, search for all reachable paths between the head entity and the tail entity of each triple in the knowledge graph; Step 6.2, calculating the path score of each reachable path according to a preset algorithm; Step 6.3, select the top K reachable paths with the best path scores in each triple, feed the embedding vectors of the top K reachable paths into the recurrent neural network, and calculate the global path confidence of the triple; Step 7, training a binary classification neural network with the type confidence, logic rule confidence, entity association confidence, and global path confidence of each triple to obtain a target recognition network; Step 8: Use the target recognition network to evaluate the reliability of the triplet to be evaluated.
2. The method according to claim 1, characterized in that , the expression of the preset algorithm is The first term in the formula represents the relationship r and the reachable path p i The semantic distance between all relations in the second term represents the tail entity t and the reachable path p i The semantic distance between all tail entities in the , the third term represents the head entity h and the reachable path p i The semantic distance between all head entities in , n is the reachable path p i Length.
3. A reliability evaluation system for knowledge graph triples, characterized in that: include: An acquisition module is used to obtain a dataset of the knowledge graph and train the embedding vectors in the dataset using a preset embedding model; The preprocessing module is used to preprocess the data set, generate negative samples by randomly replacing the head entity, tail entity or relationship in some positive samples, label the positive samples and negative samples, and mix the positive samples and negative samples to generate a training set; The first calculation module is used to use the type information in the knowledge graph to perform type constraints on each triple in the training set, and calculate the confidence of the type information accordingly; The specific process of the first calculation module includes: Step 3.1, obtain the type information of each entity and the type information of the relationship in the knowledge graph; Step 3.2: Calculate the type confidence for each triple (h, r, t). The calculation formula is as follows: Type(h,r,t)=p(r head ,h)*p(r tail ,t) Among them, T h Represents the type set of the head entity h, T t represents the type set of the tail entity t, r head represents the set of all head entities that exist in relation r, Represents r head The set of types of all entities in r tail represents the set of tail entities of all existence relations r, Represents r tail The set of types of all entities in , p(r head ,h) represents the ratio of the intersection of the type of head entity h and all head entity types contained in the relationship type to all head entity types in all entity pairs with relationship r, p(r tail ,t) represents the ratio of the intersection of the type of tail entity t in all entity pairs with relationship r and all tail entity types contained in the relationship type to all tail entity types. The type information confidence Type(h,r,t) is the product of the above two, and the confidence range is [0,1]; The second calculation module is used to represent the logic rule confidence of each triple (h, r, t) in the training set based on the logic rule information mined from the knowledge graph and the energy function calculation formula of the translation model and related models; The specific process of the second calculation module includes: Step 4.1: Use the preset rule mining tool to mine high-confidence logical rules in the data set f l represents the lth logical rule, λ l represents the confidence of the lth logical rule, λ l ∈[0,1]; Step 4.2: Calculate f based on the energy function formula and the logic rule truth value calculation formula l The qth specific rule g derived from the rule l,q : The score is as follows: Ψ(g l,q )=σ(h,r1,t)·σ(h,r2,t)-σ(h,r1,t)+1 Among them, l represents the lth rule, q represents the qth specific rule, σ(·) represents the energy function after sigmoid, and the calculation formula is: Among them, δ r It refers to the threshold variable related to the relation r, ||h+rt|| is the energy function calculation formula of TransE, h is the embedding vector of the head entity, r is the embedding vector of the relation, and t is the embedding vector of the tail entity; Step 4.3, use the above formula to get the following confidence calculation formula for rule triples: Where C is the regularization coefficient, represents Ψ(g l,q ) with respect to the gradient of the triple (h,r,t), Make the calculated confidence range between [0,1]; Step 4.4: Integrate the above formulas to obtain the following rule confidence calculation formula: in, It is a set of rule triples derived from the existing triples and logical rules in the knowledge graph; The third computing module is used to construct a directed graph centered on each head entity in the knowledge graph and calculate the entity association confidence using the trained embedding vector; The specific process of the third calculation module includes: Step 5.1, obtain all entities in the knowledge graph; Step 5.2: construct a directed graph with each head entity h as the center, and construct a subgraph within the search depth K. The resources will be iteratively allocated to other nodes in the entire directed graph until the resources are stable, and the resource amount of each node can be obtained; Step 5.3, combining the out-degree and in-degree of the head entity h and the tail entity t, the node depth and resource amount of the tail entity t to obtain the entity association confidence; The fourth computing module is used to solve the global path confidence by using the path search strategy and the embedding vector of the entity pair in each triple in the training set; The specific process of the fourth calculation module includes: Step 6.1, search for all reachable paths between the head entity and the tail entity of each triple in the knowledge graph; Step 6.2, calculating the path score of each reachable path according to a preset algorithm; Step 6.3, select the top K reachable paths with the best path scores in each triple, feed the embedding vectors of the top K reachable paths into the recurrent neural network, and calculate the global path confidence of the triple; A training module is used to train a binary classification neural network with the type confidence, logic rule confidence, entity association confidence and global path confidence of each triple to obtain a target recognition network; The recognition module is used to evaluate the reliability of the triplet to be evaluated by using the target recognition network.
4. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the reliability assessment method for knowledge graph triples described in any one of claims 1-2.
5. A non-transitory computer-readable storage medium storing computer instructions for causing the computer to execute the reliability assessment method for knowledge graph triples as described in any one of claims 1 to 2.