Knowledge graph automatic correction method, control device, equipment and storage medium
By generating hypergraphs of parks and enterprises, constructing target negative examples, and combining the joint confidence score of hypergraph loss and KG embedding loss, an automatic error correction knowledge graph is generated. This solves the problem of poor error correction effect of traditional methods in complex scenarios and achieves efficient and low-cost error correction.
Patent Information
- Application Number
- CN202310403332.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-14
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2043-04-14
AI Technical Summary
Traditional knowledge graph embedding methods are ineffective in correcting errors in complex real-world scenarios, and rule-based methods rely on human intervention and domain experts, resulting in high costs and complex rule base maintenance.
By generating a hypergraph of the entire park and a local hypergraph of enterprises, target negative examples of triples are constructed. The initial vector representation is trained using a Bi-LSTM model. The joint confidence score is obtained by combining hypergraph loss and KG embedding loss, and the knowledge graph is automatically corrected.
It improves the error correction effect of knowledge graphs in real production environments, maintains a high degree of consistency between the whole and the parts, and reduces manual intervention and costs.
Smart Images

Figure CN116450849B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of artificial intelligence, and in particular to a knowledge graph automatic error correction method, a control device, equipment and a storage medium. BACKGROUND
[0002] In the chemical industry park project of Kaoxu empowerment, due to the multiple enterprises in the chemical industry park, the variety of materials, the complex relationship, etc., in the process of constructing the graph, it is found that it is easy to have noise problems such as error nodes, which will seriously affect the accuracy and effectiveness of graph industry chain query and reasoning analysis.
[0003] At present, the error correction research of knowledge graph mainly focuses on rule-based methods or knowledge graph embedding loss-based methods.
[0004] The traditional rule-based graph error correction method requires a lot of manual work, and the construction of professional field rules also needs field experts. This method has a high cost, and the rule base maintenance and operation also need to consume a lot of energy.
[0005] Although the traditional knowledge graph embedding-based method reduces the dependence on manual and field experts, the negative samples required in the training are generally generated by randomly replacing the head or tail entity in the triple. This simple negative sampling strategy cannot adapt to complex actual scenarios, resulting in poor error correction effect in actual production environment. SUMMARY
[0006] The present application provides a knowledge graph automatic error correction method, a control device, equipment and a storage medium to solve the problem that the traditional knowledge graph embedding-based method cannot adapt to complex actual scenarios, resulting in poor error correction effect in actual production environment.
[0007] In a first aspect, the present application provides a knowledge graph automatic error correction method, comprising:
[0008] generating a park overall hypergraph according to a park knowledge graph G, and generating a local enterprise hypergraph corresponding to each enterprise according to an enterprise knowledge graph g of each enterprise in the park;
[0009] constructing a target negative example of a triple (h, r, t) of the park knowledge graph G, and obtaining an initial vector representation (H, R, T) of the triple by using the target negative example;
[0010] obtaining a global embedding representation X of the park hypergraph node according to the park overall hypergraph i , and obtaining a global embedding representation Y of the enterprise hypergraph node according to the local enterprise hypergraph i ;
[0011] obtaining a KG embedding loss according to the initial vector representation (H, R, T) i Y i obtaining a hypergraph loss;
[0012] obtaining a joint confidence score of the triple (h, r, t) according to the KG embedding loss and the hypergraph loss, and performing automatic graph correction according to the joint confidence score.
[0013] In a possible implementation, the target negative example of the triple (h, r, t) of the park knowledge graph G comprises:
[0014] performing replacement processing on the entities in the triple (h, r, t) to obtain a candidate negative example of the triple (h, r, t);
[0015] obtaining an enterprise node word vector representation x i and a material node word vector representation y i
[0016] obtaining an average embedding representation of the enterprise nodes in the park knowledge graph in the vector space:
[0017] obtaining an average embedding representation of the material nodes in the park knowledge graph in the vector space:
[0018] when the condition and the condition are met, the candidate negative example is taken as the target negative example.
[0019] wherein n: the number of enterprise nodes in the park knowledge graph, m: the number of material nodes in the park knowledge graph, β1: the first threshold value; β2: the second threshold value, a i : the word vector representation of the replacement node of the enterprise node in the park knowledge graph, b i : the word vector representation of the replacement node of the material node in the park knowledge graph.
[0020] In a possible implementation, the initial vector representation (H, R, T) of the triple is obtained by using the target negative example, which comprises:
[0021] initializing the relation of the target negative example triple and the relation in the corresponding original triple as a random vector conforming to a normal distribution
[0022] initializing the head entity of the target negative example triple and the head entity in the corresponding original triple as a random vector conforming to a normal distribution
[0023] The tail entities of the target negative triplet and the corresponding tail entities in the original triplet are initialized as random vectors conforming to a normal distribution.
[0024] The initial vector representation (H, R, T) of the triple is obtained by training the Bi-LSTM model.
[0025] In one possible implementation, the global embedding representation X of the park hypergraph nodes is obtained based on the overall park hypergraph. i ,include:
[0026] By concatenating the initial vector representation (H,R,T), the node embedding q of the overall hypergraph of the park is obtained. i :q i =(H i ;R i ;T i );
[0027] Get q i With each of the k neighboring nodes q j First correlation score: α ij =q i *q j Where j = 1...k, and k is a positive integer;
[0028] According to the above By combining with the third threshold μ, we obtain Among them, the
[0029] According to the above and the q i The global embedding representation X of the hypergraph node of the campus is obtained by using the sigmoid function. i : in, σ∈(0,1);
[0030] The global embedding representation Y of the enterprise hypergraph nodes is obtained based on the enterprise local hypergraph. i ,include:
[0031] Initialize the enterprise local hypergraph node embedding p i ;
[0032] Get p i With each of the k neighboring nodes p j Second correlation score: β ij =p i *p j Where j = 1...k, and k is a positive integer;
[0033] The second correlation score is normalized to obtain the normalized second correlation coefficient.
[0034] According to the above Combined with the third threshold μ, we obtain Among them, the
[0035] According to the above and the p j The global embedding representation Y of the enterprise hypergraph node is obtained through the sigmoid function. i :
[0036] In one possible implementation, the step of using the global embedding representation X... i Y i Obtain the hypergraph loss, including:
[0037] Obtain the X i With the Y i The third correlation score cos(X) i ,Y i );
[0038] Obtain the loss function for the overall hypergraph of the park and the local hypergraph of each enterprise:
[0039]
[0040] Obtain the loss function for the overall hypergraph of the park and the local hypergraphs of all the enterprises:
[0041]
[0042] Where c: number of nodes in the local hypergraph of an enterprise, d: number of enterprises in the park, and τ: hyperparameter used to control the sensitivity of the loss function to positive and negative examples.
[0043] In one possible implementation, obtaining the KG embedding loss based on the initial vector representation (H,R,T) includes:
[0044] Based on the TransD model, the initial vector representation (H,R,T) is trained, and the scoring function is defined as follows:
[0045]
[0046] Among them, M RH =R p H p T +I is the projection matrix of the head entity onto the relation space, MRT = R p T p T + I is the projection matrix of tail entity projection to relation space, I is unit matrix, R p , H p , T p are projection vectors corresponding to head entity, relation and tail entity.
[0047] In a possible implementation, the obtaining the joint confidence score of the triple (h, r, t) according to the KG embedding loss and the hypergraph loss comprises:
[0048] According to the KG embedding loss and the hypergraph loss, a joint confidence score is obtained:
[0049] com(h, r, t) = σ (cos(x i , y i )-λf r (h, t))
[0050] Wherein, the λ is used to weigh the contribution weight of embedding loss and hypergraph loss, σ is a sigmoid function, the joint confidence score is mapped to the (0, 1) interval, the closer the joint confidence score is to 0, the greater the probability of the triple (h, r, t) being an abnormal triple.
[0051] In a possible implementation, the automatic error correction of the knowledge graph according to the joint confidence score comprises:
[0052] Randomly retaining two elements in the triple whose joint confidence score is lower than a fourth threshold value, obtaining three empty slot binary tuples;
[0053] Searching for a triple that fills the empty slot in the knowledge graph, filling the empty slot binary tuple, obtaining an alternative triple; obtaining the joint confidence score of the alternative triple, selecting the alternative triple with the highest joint confidence score and higher than the fourth threshold value, replacing the triple whose joint confidence score is lower than the fourth threshold value.
[0054] In a second aspect, the application provides a control device for automatic error correction of a knowledge graph, comprising:
[0055] A generation module is configured to generate a park overall hypergraph according to a park knowledge graph G, and generate an enterprise local hypergraph corresponding to each enterprise according to an enterprise knowledge graph g of each enterprise in the park;
[0056] An acquisition module is configured to construct a target negative example of a triple (h, r, t) of the park knowledge graph G, and obtain an initial vector representation (H, R, T) of the triple by using the target negative example;
[0057] The acquisition module is further configured to obtain a global embedding representation of a park supergraph node according to the park overall supergraph, and obtain a global embedding representation of an enterprise supergraph node according to the enterprise local supergraph;
[0058] The acquisition module is further configured to obtain a KG embedding loss according to the initial vector representation (H, R, T), and obtain a supergraph loss according to the global embedding representation;
[0059] The control module is configured to obtain a joint confidence score of the triple (h, r, t) according to the KG embedding loss and the supergraph loss, and perform automatic graph correction.
[0060] In a possible implementation, the acquisition module is further configured to perform replacement processing on entities in the triple (h, r, t) to obtain a candidate negative example of the triple (h, r, t);
[0061] An enterprise node word vector representation x i and a material node word vector representation y i are obtained through a Word2Vec model training.
[0062] An average embedding representation of an enterprise node in a park knowledge graph in a vector space is obtained:
[0063]
[0064] When a condition is met and a condition is met, the candidate negative example is taken as the target negative example.
[0065] wherein n: the number of enterprise nodes in the park knowledge graph, m: the number of material nodes in the park knowledge graph, β1: a first threshold value; β2: a second threshold value, a i : a word vector representation of a replacement node of an enterprise node in the park knowledge graph, b i : a word vector representation of a replacement node of a material node in the park knowledge graph.
[0066] In a possible implementation, the acquisition module is further configured to initialize a relation of the target negative example triple and a relation in a corresponding original triple as a random vector conforming to a normal distribution
[0067] Initialize a head entity of the target negative example triple and a head entity in the corresponding original triple as a random vector conforming to a normal distribution
[0068] Initialize a tail entity of the target negative example triple and a tail entity in the corresponding original triple as a random vector conforming to a normal distribution
[0069] The initial vector representation (H, R, T) of the triple is obtained by training the Bi-LSTM model.
[0070] In one possible implementation, the acquisition module is further configured to concatenate the initial vector representation (H,R,T) to obtain the node embedding q of the overall hypergraph of the park. i :q i =(H i ;R i ;T i );
[0071] Get q i With each of the k neighboring nodes q j First correlation score: α ij =q i *q j Where j = 1...k, and k is a positive integer;
[0072] The first correlation score is normalized to obtain the normalized first correlation coefficient.
[0073] According to the above By combining with the third threshold μ, we obtain Among them, the
[0074] According to the above and the q i The global embedding representation X of the hypergraph node of the campus is obtained by using the sigmoid function. i : in, σ∈(0,1);
[0075] The global embedding representation Y of the enterprise hypergraph nodes is obtained based on the enterprise local hypergraph. i ,include:
[0076] Initialize the enterprise local hypergraph node embedding p i ;
[0077] Get p i With each of the k neighboring nodes p j Second correlation score: β ij =p i *p j Where j = 1...k, and k is a positive integer;
[0078] The second correlation score is normalized to obtain a normalized second correlation coefficient
[0079] According to the third threshold μ, the third correlation score cos(X , Y ) is obtained
[0080] According to the third threshold μ, the third correlation score cos(X , Y j ) is obtained i :
[0081] In a possible implementation, the obtaining module is further configured to obtain the third correlation score cos(X i , Y i ) of the third vector representation X i and the third vector representation Y i .
[0082] Obtain the loss function of the park overall hypergraph and each enterprise local hypergraph:
[0083]
[0084] Obtain the loss function of the park overall hypergraph and all enterprise local hypergraphs:
[0085]
[0086] Wherein, c: the number of nodes in the enterprise local hypergraph, d: the number of park enterprises, τ: hyperparameter, used to control the sensitivity of the loss function to positive and negative examples.
[0087] In a possible implementation, the obtaining module is further configured to train the initial vector representation (H, R, T) based on the TransD model to obtain a scoring function defined as:
[0088]
[0089] Wherein, M RH = R p H p T +I is the projection matrix of the head entity projected into the relationship space, M RT = R p T p T +I is the projection matrix of the tail entity projected into the relationship space, I is the unit matrix, R p , H p , T pThe projection vector corresponding to the head entity, the relation, and the tail entity.
[0090] In a possible implementation, the control module is further configured to obtain a joint confidence score of the triple (h, r, t) according to the KG embedding loss and the hypergraph loss:
[0091] com(h, r, t) = σ(cos(x i ,y i )-λf r (h, t))
[0092] wherein λ is used to weigh the contribution weight of the embedding loss and the hypergraph loss, σ is a sigmoid function that maps the joint confidence score to the interval (0, 1), and the closer the joint confidence score is to 0, the greater the probability that the triple (h, r, t) is an abnormal triple.
[0093] In a possible implementation, the control module is further configured to perform automatic error correction on the knowledge graph according to the joint confidence score, including:
[0094] randomly retaining two elements in the triple whose joint confidence score is lower than a fourth threshold value, obtaining three empty-slot binary triples;
[0095] searching for a triple that fills the empty slot in the knowledge graph, filling the empty-slot binary triple to obtain an alternative triple, obtaining a joint confidence score of the alternative triple, and selecting an alternative triple with the highest joint confidence score and higher than the fourth threshold value to replace the triple whose joint confidence score is lower than the fourth threshold value.
[0096] In a third aspect, the present application provides an electronic device, at least one processor and a memory, wherein:
[0097] the memory is configured to store computer-executable instructions;
[0098] the at least one processor is configured to execute the computer-executable instructions stored in the memory, so that the at least one processor performs the knowledge graph automatic error correction method according to the first aspect.
[0099] In a fourth aspect, the present application provides a computer-readable storage medium, the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are executed by a processor to implement the knowledge graph automatic error correction method according to the first aspect.
[0100] The knowledge graph automatic error correction method, control device, device, and storage medium provided by the present application achieve the following technical effects:
[0101] 1. By generating the overall supergraph of the chemical industry park and the local supergraph of the enterprise, the comparative learning data is constructed from the overall and local perspectives, thereby maintaining high consistency between the overall and local.
[0102] 2. The supergraph loss function is constructed according to the comparative learning data of the present application, the joint confidence score of the triplets is obtained by combining the supergraph loss and the KG embedding loss, and the error correction effect in the actual production environment is improved. BRIEF DESCRIPTION OF DRAWINGS
[0103] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed to be used in the embodiments or the prior art description will be briefly introduced. Obviously, the drawings in the following description are some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0104] Figure 1 The supergraph construction schematic diagram provided for the embodiments of the present application;
[0105] Figure 2 The flowchart of the knowledge graph automatic error correction method provided for the embodiments of the present application Figure 1 ;
[0106] Figure 3 The flowchart of the knowledge graph automatic error correction method provided for the embodiments of the present application Figure 2 ;
[0107] Figure 4 The flowchart of the knowledge graph automatic error correction method provided for the embodiments of the present application Figure 3 ;
[0108] Figure 5 The structural schematic diagram of the control device for the knowledge graph automatic error correction provided for the embodiments of the present application;
[0109] Figure 6 The structural schematic diagram of the electronic device provided for the embodiments of the present application. DETAILED DESCRIPTION
[0110] The exemplary embodiments will be described in detail herein with reference to the attached drawings. The description of the exemplary embodiments is intended to apply to any exemplary embodiment, unless specified otherwise. It is believed that the application will be better understood from the following description with reference to the drawings, in which:
[0111] The terms "first", "second", "third", "fourth", and the like used in the description and the claims herein, and the above appended drawings, if any, are used for distinguishing between similar objects, and are not necessarily used to describe a particular sequential or chronological order. It is to be understood that the use of the terms "first", "second", "third", "fourth", and the like, if used herein, are
[0112] In the present application, the word "exemplary" or "for example" is used to mean serving as an example, instance, or illustration. Any implementation or design scheme described herein as "exemplary" or "for example" is not necessarily to be construed as preferred or advantageous over other implementations or design schemes. Rather, the use of the word "exemplary" or "for example" is intended to present concepts in a concrete manner.
[0113] In the Chaos-enabled chemical industrial park project, due to the large number of enterprises in the chemical industrial park, the large number of materials, the complex relationship, and the like, in the process of constructing the knowledge graph, it is found that error nodes, noise, and the like are prone to occur, which will seriously affect the accuracy and effectiveness of the knowledge graph industry chain query and reasoning analysis.
[0114] The prior art for the above-mentioned problems prone to occur in the process of constructing the knowledge graph, the existing technology for error correction of the knowledge graph mainly concentrates on rule-based methods or knowledge graph embedding loss-based methods for error correction. However, the rule-based graph correction method requires a large amount of manual work, and the construction of professional field rules also needs field experts, and the rule base maintenance and operation also needs to consume a lot of energy, so the cost of this method is relatively high. The method based on knowledge graph embedding, the negative samples required in the training are generally generated by randomly replacing the head or tail entity in the triple, this simple negative sampling strategy cannot adapt to complex actual scenarios, resulting in poor correction effect in the actual production environment.
[0115] Therefore, this application proposes a graph correction method that generates a holistic hypergraph of the park and local hypergraphs of each enterprise based on the park's knowledge graph. It constructs negative examples and obtains their initial vector representations based on triples from the park's knowledge graph. Then, it obtains corresponding global embedding representations based on the holistic hypergraph and local enterprise hypergraphs. The KG embedding loss is calculated based on the initial vector representations, and the hypergraph loss is calculated based on the global embedding representations. Finally, the joint confidence score of the triples is obtained by combining the KG embedding loss and the hypergraph loss, and graph correction is performed. This method constructs a hypergraph loss function based on contrastive learning data, and obtains the joint confidence score of the triples by combining the hypergraph loss and the KG embedding loss. By constructing contrastive learning data from both holistic and local perspectives, it maintains a high degree of consistency between the whole and the parts, thereby improving its error correction effect in a real-world production environment.
[0116] Figure 1 This is a schematic diagram of hypergraph construction provided for an embodiment of this application. For example... Figure 1 As shown, the hypergraph construction process is as follows:
[0117] Treating triples in the knowledge graph as a whole, and using them as nodes in the hypergraph, the relationships within the hypergraph are defined as follows: Relationships are established through shared entities in triple 1 (h1, r1, t1) and triple 2 (h2, r2, t2), following the direction of the original relationship, i.e., (h1, r1, t1) → (h2, r2, t2), where t1 = h2. This method generates a global hypergraph for the entire park and partial hypergraphs for individual enterprises. The global hypergraph for the entire park has only one instance, while the partial hypergraphs for individual enterprises have the same number of enterprises as the park itself.
[0118] For example, two triples are selected from the enterprise's local knowledge graph g: triple A (vinyl acetate, process manufacturing, E / VAC) and triple B (ethylene, external supply production, vinyl acetate). Triple A and triple B as a whole are used as two nodes in the enterprise's local hypergraph. A relationship is established based on the common entity vinyl acetate of triple A and triple B, with the direction being the original direction, thus constructing a new hypergraph. Figure 3 Tuple C: A→B.
[0119] This application generates a hypermap of the entire chemical industrial park and a local hypermap of the enterprises, constructing comparative learning data from both overall and local perspectives, thereby maintaining a high degree of consistency between the whole and the parts.
[0120] The following is combined Figure 2 This application describes how an automatic error correction method for knowledge graphs, provided in its embodiments, achieves automatic error correction for knowledge graphs.
[0121] Figure 2 A flowchart illustrating an automatic error correction method for knowledge graphs provided in this application embodiment. Figure 1 .like Figure 2 As shown, the method includes:
[0122] S201, generating a park overall hypergraph according to the park knowledge graph G, and generating an enterprise local hypergraph corresponding to each enterprise according to the enterprise knowledge graph g of each enterprise in the park.
[0123] In this step, the structure and relationship of the chemical industry park are complex, resulting in very rich structure information of the knowledge graph of the chemical industry park. The original knowledge graph embedding method can only learn the local structure information of the knowledge graph. Therefore, in order to learn the rich structure information of the chemical industry park knowledge graph from a more macro perspective, the application adopts a hypergraph-based method to construct the overall hypergraph and the local hypergraph of the chemical industry park knowledge graph, and to construct the contrastive learning data. Meanwhile, the nodes of the overall hypergraph and the local hypergraph constructed based on the chemical industry park knowledge graph should maintain high consistency. Therefore, the application will calculate the similarity of the triples in the overall hypergraph and the local hypergraph. Therefore, the abnormal nodes in the hypergraph have poor similarity, which can be used as one of the bases for judging node abnormalities.
[0124] Therefore, the park knowledge graph G and the enterprise knowledge graph g of the chemical industry park are first constructed, then the park overall hypergraph is generated according to the park knowledge graph G, and the enterprise local hypergraph corresponding to each enterprise is generated according to the enterprise knowledge graph g. The number of park overall hypergraphs is only one, and the number of enterprise local hypergraphs is equal to the number of enterprises. How to construct the hypergraph has been explained in detail in Figure 1 , and therefore this embodiment will not be described in detail.
[0125] S202, constructing target negative examples of triples (h, r, t) of the park knowledge graph G, and obtaining initial vector representations (H, R, T) of the triples by using the target negative examples.
[0126] In this step, the application constructs contrastive learning data through hypergraphs to judge whether the nodes are abnormal from a whole and macro perspective. In order to make the knowledge graph anomaly judgment of the application more rigorous and comprehensive, the application jointly trains the similarity of triples in the overall hypergraph and the local hypergraph with the traditional embedding method to comprehensively judge whether the nodes are abnormal. Therefore, the target negative examples of triples (h, r, t) of the park knowledge graph G are constructed, and the initial vector representations (H, R, T) of the triples (h, r, t) of the knowledge graph G are obtained according to the target negative examples.
[0127] In this embodiment, how to construct the target negative examples of triples (h, r, t) of the knowledge graph G is not limited, for example, the head entity and the tail entity of the triples (h, r, t) of the knowledge graph G can be randomly replaced. For example, the target negative examples of triples (h, r, t) of the knowledge graph G can also be constructed based on the prototype network method. After generating the target negative examples, the initial vector representations (H, R, T) of the triples (h, r, t) of the knowledge graph G are obtained by training through the Bi-LSTM model.
[0128] S203, obtaining a global embedding representation X of the park supergraph node according to the park overall supergraph i , and obtaining a global embedding representation Y of the enterprise supergraph node according to the enterprise local supergraph i .
[0129] In this step, based on the attention mechanism, the initial representation of the park supergraph node is obtained according to the park overall supergraph, and the initial representation of the enterprise supergraph node is obtained according to the enterprise local supergraph. Directly based on the initial representation of the park supergraph node and the initial representation of the enterprise supergraph node to calculate the similarity of the triples in the overall supergraph and the local supergraph may cause error information transmission. Therefore, in order to avoid the transmission of error information and further reduce the influence of error information on subsequent tasks, the embodiment preferentially obtains the initial representation of the park supergraph node and the initial representation of the enterprise supergraph node based on the attention mechanism, and then corrects the initial representation of the park supergraph node and the initial representation of the enterprise supergraph node through the simoid function to obtain the global embedding representation X i of the park supergraph node and the global embedding representation Y i of the enterprise supergraph node.
[0130] S204, obtaining a KG embedding loss according to the initial vector representation (H, R, T), obtaining a supergraph loss according to the global embedding representation X i Y i .
[0131] In this step, the initial vector representation (H, R, T) of the triples (h, r, t) of the knowledge graph G is used to obtain an embedding loss, i.e. a KG embedding loss, through model training. The model used to obtain the embedding loss is not limited in this embodiment, and exemplary models that can be selected include TransE, TransH, TransR, TransD, etc.
[0132] Based on the contrastive learning data constructed in this embodiment, a special supergraph loss function is involved in this embodiment, which is used to obtain a supergraph loss according to the similarity of the triples in the overall supergraph and the local supergraph. In this embodiment, the correlation score cos(X i , Y i ) of the triples in the overall supergraph and the local supergraph is calculated by using the cosine similarity, and then the loss function loss j of the park overall supergraph and each enterprise local supergraph is obtained according to the correlation score cos(X i , Y i ), and the loss function loss of the park overall supergraph and all enterprise local supergraphs is obtained according to the loss function loss j .
[0133] S205, obtain a joint confidence score of the triple (h, r, t) according to the KG embedding loss and the supergraph loss, and perform automatic graph correction according to the joint confidence score.
[0134] In this step, the embodiment constructs contrastive learning data through supergraph construction to determine whether the node is abnormal from a whole and macroscopic perspective. In order to make the knowledge graph anomaly judgment of the embodiment more rigorous and comprehensive, the embodiment jointly trains the similarity of the triple in the whole supergraph and the local supergraph with the traditional embedding method to comprehensively determine whether the node is abnormal.
[0135] Therefore, the KG embedding loss and the supergraph loss are jointly trained to obtain a joint confidence score of the triple (h, r, t) of the knowledge graph, and automatic correction update is performed according to the abnormal triple with a lower joint confidence score. The embodiment does not make any limitation on how to perform automatic correction update on the abnormal triple.
[0136] The embodiment of the present application proposes a knowledge graph automatic correction method. The park knowledge graph is used to generate a park whole supergraph and a local supergraph of each enterprise, and the park knowledge graph is used to generate a park whole supergraph and a local supergraph of each enterprise. Figure 3 The negative example is constructed, and the initial vector representation is obtained. The global embedding representation is obtained according to the park whole supergraph and the enterprise local supergraph. The KG embedding loss is calculated according to the initial vector representation. The supergraph loss is calculated according to the global embedding representation. Finally, the joint confidence score of the triple is obtained by combining the KG embedding loss and the supergraph loss, and the graph correction is performed. Through this method, the contrastive learning data is constructed from the whole and local perspectives, so as to maintain the high consistency of the whole and the local. The supergraph loss function is constructed according to the contrastive learning data. The joint confidence score of the triple is obtained by combining the supergraph loss and the KG embedding loss, and the correction effect in the actual production environment is improved.
[0137] The following will be described in combination Figure 3 with the embodiment of the present application to explain how the knowledge graph automatic correction method provided by the present application obtains the supergraph loss and the KG embedding loss.
[0138] Figure 2 The flowchart of the knowledge graph automatic correction method provided by the embodiment of the present application is shown in Figure 3 . As shown in Figure 4 , the method comprises:
[0139] S301, replace the entities in the triple (h, r, t) to obtain the candidate negative example of the triple (h, r, t), obtain the average embedding representation of the enterprise node and the material node in the knowledge graph, and obtain the target negative example according to the average embedding representation and the word vector representation.
[0140] In this step, the head entity or tail entity in the triple (h, r, t) is randomly replaced to obtain the candidate negative example of the triple (h, r, t), and then the enterprise node word vector representation x is obtained through Word2Vec model training i and the material node word vector representation y i is obtained. Then, the average embedding representation of the enterprise node in the vector space is calculated according to x i and the average embedding representation of the material node in the vector space is calculated according to y i , wherein:
[0141] The average embedding representation of the enterprise node is:
[0142] The average embedding representation of the material node is:
[0143] n is the number of enterprise nodes in the park knowledge graph, and m is the number of material nodes in the park knowledge graph.
[0144] In order to ensure that the replaced entity and the replaced entity remain consistent in type, the head entity or tail entity in the triple (h, r, t) is randomly replaced to obtain the candidate negative example of the triple (h, r, t) during the process of the candidate negative example, and the replacement node cannot deviate from the original type node in the original network too much.
[0145] Therefore, the enterprise node word vector representation a i and the material node word vector representation b i are obtained through Word2Vec model training, when and are satisfied, the corresponding candidate negative example is taken as the target negative example.
[0146] Wherein, β1 is the first threshold value; β2 is the second threshold value, and β1 and β2 are determined according to the actual situation.
[0147] S302, the head entity, the relationship and the tail entity of the target negative example triple and the original triple are initialized as random vectors and the initial vector representation (H, R, T) of the triple is obtained through Bi-LSTM model training.
[0148] In this step, the relationship of the target negative example triple and the corresponding relationship in the original triple are initialized as random vectors The head entity of the target negative example triple and the corresponding head entity in the original triple are initialized as random vectors The tail entity of the target negative example triple and the corresponding tail entity in the original triple are initialized as random vectors
[0149] In sequence Inputting into a Bi-LSTM model, the initial vector representation (H,R,T) of the triples (h,r,t) is obtained through training the model, i.e.:
[0150] S303. Concatenate the initial vector representation (H,R,T) to obtain the node embedding q of the overall hypergraph of the park. i According to q i and each of the k neighboring nodes q j Obtain the first relevance score and the global embedding representation X of the hypergraph node of the park. i .
[0151] In this step, the node embedding q of the overall hypergraph of the park is obtained by concatenating the initial vector representation (H,R,T). i :q i =(H i ;R i ;T i However, directly splicing together the node embeddings of the overall hypergraph of the park... i This may lead to the transmission of error messages, so it is recommended to use q. i and the K adjacent nodes q j It utilizes the attention mechanism to q i To perform the update, follow these steps:
[0152] Get q i With each of the k neighboring nodes q j First correlation score: α ij =q i *q j , where j = 1...k, and K is a positive integer.
[0153] The first correlation score is normalized using softmax to obtain the normalized first correlation coefficient.
[0154] A third threshold μ∈(0,1) is set, and its specific value is determined based on the actual situation. According to the above... By combining with the third threshold μ, we obtain Among them, the
[0155] According to the above and the q i The global embedding representation X of the hypergraph node of the campus is obtained by using the sigmoid function. i : in, σ∈(0,1).
[0156] S304, Obtain Enterprise Local Hypergraph Node Embedsion p i According to p i and each of the k adjacent nodes p j Obtain a second relevance score, and obtain the global embedding representation Y of the enterprise hypergraph node based on the second relevance score. i .
[0157] In this step, the node embedding p of the enterprise local hypergraph is obtained by concatenating the initial vector representation (H,R,T). i , through p i and the K adjacent nodes p j It utilizes the attention mechanism to target p i To perform the update, follow these steps:
[0158] Get p i With each of the k neighboring nodes p j Second correlation score: β ij =p i *p j Where j = 1...k, and k is a positive integer;
[0159] The second correlation score is normalized to obtain the normalized second correlation coefficient.
[0160] According to the above Combined with the third threshold μ, we obtain Among them, the
[0161] According to the above and the p j The global embedding representation Y of the enterprise hypergraph node is obtained through the sigmoid function. i :
[0162] S305. Obtain a third correlation score based on Xi and Yi, obtain the loss function lossj of the overall hypergraph of the park and each of the local hypergraphs of the enterprises based on the third correlation score, and then obtain the loss function loss of the overall hypergraph of the park and all the local hypergraphs of the enterprises.
[0163] In this step, this application generates a hypergraph of the entire chemical industrial park and local hypergraphs of enterprises, constructing comparative learning data from both global and local perspectives. Therefore, it is necessary to set specific loss functions from both the global and local perspectives. Thus, this application calculates the global embedding representation X of the park hypergraph nodes using cosine similarity.i and global embedding representation Y of the enterprise supergraph node i correlation score of Y
[0164] obtain the X i and the Y i third correlation score cos(X i , Y i );
[0165] obtain the loss function of the park overall supergraph and each of the enterprise local supergraph:
[0166]
[0167] obtain the loss function of the park overall supergraph and all the enterprise local supergraph:
[0168]
[0169] wherein c is the number of nodes in the enterprise local supergraph, d is the number of enterprises in the park, and τ is a hyperparameter for controlling the sensitivity of the loss function to positive and negative examples.
[0170] In a possible implementation, to ensure that the local supergraph nodes can be quickly matched to the corresponding nodes in the overall supergraph, the nodes in the overall supergraph and the nodes in the enterprise supergraph are both labeled, and the node labels in each enterprise supergraph should be consistent with the corresponding node labels in the overall supergraph.
[0171] S306, obtain the KG embedding loss according to the initial vector representation (H, R, T) trained by the TransD model.
[0172] In this step, there are many enterprises in the chemical industry park, many types of materials, and complex relationships, so the head entity and tail entity of the triple in the knowledge graph of the chemical industry park may have different types or complex attributes. Therefore, the embodiment trains the initial vector representation (H, R, T) by the TransD model to obtain the KG embedding loss, and the specific steps are as follows:
[0173] The KG embedding loss is:
[0174] wherein M RH = R p H p T +I is the projection matrix of the head entity of the initial vector representation projected to the relationship space, M RT = R p T p T +I is the projection matrix of the tail entity of the initial vector representation projected to the relationship space, and I is an identity matrix, R p, H p , T p are respectively the projection vectors corresponding to the head entity, the relation, and the tail entity.
[0175] The embodiment of the application provides a knowledge graph automatic error correction method, a target negative example is constructed based on a prototype network, an initial vector representation of a triple is obtained through Bi-LSTM, and a KG embedding loss is obtained. Meanwhile, based on an attention mechanism, an initial representation of a hypergraph is obtained, finally, a final embedding representation of the hypergraph is obtained through a simoid function, and a hypergraph loss is obtained according to the final embedding representation of the hypergraph. Through the above method, it is ensured that the replaced entity and the replaced entity are consistent in type when the negative example is constructed, and the replaced entity is prevented from jumping too much; the KG embedding loss is obtained through the TransD model, so that the application can be applied to a more complex chemical park graph project.
[0176] The embodiment of the application provides a knowledge graph automatic error correction method. Figure 4 The embodiment of the application provides a knowledge graph automatic error correction method.
[0177] Figure 3 The embodiment of the application provides a knowledge graph automatic error correction method. Figure 4 The embodiment of the application provides a knowledge graph automatic error correction method. Figure 5 The embodiment of the application provides a knowledge graph automatic error correction method.
[0178] S401, according to the KG embedding loss and the hypergraph loss, obtaining a joint confidence score of the triple (h, r, t).
[0179] In this step, the KG embedding loss and the hypergraph loss in the contrast learning are jointly trained to obtain the joint confidence score of the triple (h, r, t): com(h, r, t) = σ (cos(x i , y i )-λf r (h, t)).
[0180] Wherein, the λ is used to weigh the contribution weight of the embedding loss and the hypergraph loss, the σ is a sigmoid function, the joint confidence score is mapped to the (0, 1) interval, and the closer the joint confidence score is to 0, the greater the probability that the triple (h, r, t) is an abnormal triple.
[0181] S402, randomly retaining two elements in the triple whose joint confidence score is lower than the fourth threshold value, and obtaining three empty slot binary tuples.
[0182] In this step, if the joint confidence score of the triple is lower than the fourth threshold value, two elements are randomly retained to form three empty slot binary tuples, for example: the error triple whose joint confidence score is lower than the fourth threshold value is (hw r w t w ), randomly reserve two elements in the triple, obtain three empty slot binary tuples (*, r w t w ), (h w , *, t w ) and (h w , r w , *).
[0183] S403, search for a triple that fills the empty slot in the knowledge graph, fill the empty slot binary tuple, and obtain an alternative triple.
[0184] In this step, search for a triple that fills the empty slot binary tuple in the knowledge graph, and when the searched triple is consistent with the two elements of the empty slot binary tuple, fill the other element into the corresponding empty slot binary tuple to obtain an alternative triple.
[0185] S404, obtain the joint confidence score of the alternative triple, select the alternative triple with the highest joint confidence score and higher than the fourth threshold, and replace the triple with a joint confidence score lower than the fourth threshold.
[0186] In this step, after obtaining three alternative triples, the joint confidence score of the alternative triple is obtained, and the specific steps have been explained in detail before and will not be described in detail here. Keep the alternative triple with the maximum confidence score and greater than the fourth threshold, and replace it with the error triple. When the confidence score of the alternative triple is less than the fourth threshold, return to manual verification and adjustment.
[0187] The embodiment of the application proposes a knowledge graph automatic error correction method, which obtains the joint confidence score of the triple according to the KG embedding loss and the hypergraph loss, randomly reserves two triples with a joint confidence score lower than the fourth threshold, matches the graph in a similar way, and selects the one with a higher confidence score to replace it. Through the above-mentioned way, the application can be applied to more complex chemical park graph projects, and the error correction effect and efficiency in the actual production environment are improved.
[0188] Figure 5 A structural schematic diagram of a control device for the knowledge graph automatic error correction provided by the embodiment of the application. As shown in Figure 6 , the device comprises:
[0189] The generation module 501 is configured to generate a park overall hypergraph according to the park knowledge graph G, and generate an enterprise local hypergraph corresponding to each enterprise according to the enterprise knowledge graph g of each enterprise in the park.
[0190] The acquisition module 502 is configured to construct a target negative example of a triple (h, r, t) of the park knowledge graph G, and obtain an initial vector representation (H, R, T) of the triple by using the target negative example.
[0191] The acquisition module 502 is further configured to obtain a global embedding representation of a park supergraph node according to the park overall supergraph, and obtain a global embedding representation of an enterprise supergraph node according to the enterprise local supergraph.
[0192] The acquisition module 502 is further configured to obtain a KG embedding loss according to the initial vector representation (H, R, T), and obtain a supergraph loss according to the global embedding representation.
[0193] The control module 503 is configured to obtain a joint confidence score of the triple (h, r, t) according to the KG embedding loss and the supergraph loss, and perform automatic graph correction according to the joint confidence score.
[0194] In a possible implementation, the acquisition module 502 is further configured to perform replacement processing on entities in the triple (h, r, t) to obtain a candidate negative example of the triple (h, r, t).
[0195] An enterprise node word vector representation x is obtained by training a Word2Vec model i and a material node word vector representation y i .
[0196] An average embedding representation of an enterprise node in the park knowledge graph in a vector space is obtained:
[0197]
[0198] When the condition is met, and the condition is met, the candidate negative example is taken as the target negative example.
[0199] Wherein n: the number of enterprise nodes in the park knowledge graph, m: the number of material nodes in the park knowledge graph, β1: the first threshold value; β2: the second threshold value, a i : the word vector representation of the replacement node of the enterprise node in the park knowledge graph, b i : the word vector representation of the replacement node of the material node in the park knowledge graph.
[0200] In a possible implementation, the acquisition module 502 is further configured to initialize a relationship of the target negative example triple and a relationship in a corresponding original triple as a random vector conforming to a normal distribution
[0201] The head entity of the target negative triplet and the head entity of the corresponding original triplet are initialized as random vectors conforming to a normal distribution.
[0202] The tail entities of the target negative triplet and the corresponding tail entities in the original triplet are initialized as random vectors conforming to a normal distribution.
[0203] The initial vector representation (H, R, T) of the triple is obtained by training the Bi-LSTM model.
[0204] In one possible implementation, the acquisition module 502 is further configured to concatenate the initial vector representation (H,R,T) to obtain the node embedding q of the overall hypergraph of the park. i :q i =(H i ;R i ;T i );
[0205] Get q i With each of the k neighboring nodes q j First correlation score: α ij =q i *q j Where j = 1...k, and k is a positive integer;
[0206] The first correlation score is normalized to obtain the normalized first correlation coefficient.
[0207] According to the above By combining with the third threshold μ, we obtain Among them, the
[0208] According to the above and the q i The global embedding representation X of the hypergraph node of the campus is obtained by using the sigmoid function. i : in, σ∈(0,1);
[0209] The global embedding representation Y of the enterprise hypergraph nodes is obtained based on the enterprise local hypergraph. i ,include:
[0210] Initialize the enterprise local hypergraph node embedding p i ;
[0211] Get p i With each of the k neighboring nodes pj the second correlation score: β ij = p i * p j , where j = 1...k, and k is a positive integer;
[0212] normalizing the second correlation score to obtain a normalized second correlation coefficient
[0213] According to the and the third threshold μ, a wherein the
[0214] According to the and the p j , the global embedding representation Y of the enterprise supergraph node is obtained by a sigmoid function i :
[0215] In one possible implementation, the obtaining module 502 is further configured to obtain the X i and the third correlation score cos(X i , Y i ) of the Y i ;
[0216] obtain the loss function of the park overall supergraph and each enterprise local supergraph:
[0217]
[0218] obtain the loss function of the park overall supergraph and all enterprise local supergraphs:
[0219]
[0220] wherein c is the number of nodes in the enterprise local supergraph, d is the number of park enterprises, and τ is a hyperparameter for controlling the sensitivity of the loss function to positive and negative examples.
[0221] In one possible implementation, the obtaining module 502 is further configured to train an initial vector representation (H, R, T) based on a TransD model to obtain a scoring function defined as:
[0222]
[0223] wherein M RH = R p H p T + I is a projection matrix of the head entity projected to the relationship space, and M RT= R p T p T +I is the projection matrix of the tail entity projection to the relation space, I is the unit matrix, R p , H p , T p are the projection vectors corresponding to the head entity, relation and tail entity.
[0224] In a possible implementation, the control module 503 is further configured to obtain a joint confidence score according to the KG embedding loss and the hypergraph loss:
[0225] com(h,r,t) = σ(cos(x i ,y i )-λf r (h,t))
[0226] Wherein, the λ is used to weigh the contribution weight of the embedding loss and the hypergraph loss, σ is a sigmoid function, the joint confidence score is mapped to the interval (0, 1), and the closer the joint confidence score is to 0, the greater the probability that the triple (h, r, t) is an abnormal triple.
[0227] In a possible implementation, the control module 503 is further configured to perform automatic error correction of the knowledge graph according to the joint confidence score, including:
[0228] Randomly retaining two elements in the triple whose joint confidence score is lower than a fourth threshold value, obtaining three empty slot binary tuples;
[0229] Searching for a triple that fills the empty slot in the knowledge graph, filling the empty slot binary tuple to obtain an alternative triple, obtaining the joint confidence score of the alternative triple, selecting the alternative triple with the highest joint confidence score and higher than the fourth threshold value, and replacing the triple whose joint confidence score is lower than the fourth threshold value.
[0230] Figure 6 A structural schematic diagram of an electronic device provided by an embodiment of the present application is shown in FIG. 1. As shown in the figure, the electronic device 60 includes at least one processor 601 and a memory 602, wherein:
[0231] The memory 602 is configured to store computer execution instructions;
[0232] The at least one processor 601 is configured to execute the computer execution instructions stored by the memory 602, so that the at least one processor 601 executes the technical solutions of the foregoing automatic error correction method of the knowledge graph.
[0233] The at least one processor 601 can be a central processing unit (CPU), or an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement one or more embodiments of the present application.
[0234] Optionally, in a specific implementation, the processor 601 and the memory 602 are implemented independently, and the processor 601 and the memory 602 can be connected to each other through a bus and complete communication between each other. The bus can be an industry standard architecture (ISA) bus, a peripheral component interconnect (PCI) bus, or an extended industry standard architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc., but it does not mean that there is only one bus or one type of bus.
[0235] Optionally, in a specific implementation, if the processor 601 and the memory 602 are integrated on a chip, the processor 601 and the memory 602 can complete communication through an internal interface.
[0236] The present application also provides a computer storage medium, and the computer storage medium stores computer execution instructions. When the processor executes the computer execution instructions, the technical solution of the foregoing knowledge graph automatic error correction method is implemented.
[0237] The foregoing computer readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as a static random access memory (SRAM), an electrically erasable programmable read-only memory (EEPROM), an erasable programmable read-only memory (EPROM), a programmable read-only memory (PROM), a read-only memory (ROM), a magnetic memory, a flash memory, a magnetic disk, or an optical disk. The computer readable storage medium can be any available medium that can be accessed by a general or special purpose computer.
[0238] An example readable storage medium is coupled to the processor such that the processor is able to read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be part of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (ASIC). Of course, the processor and the readable storage medium can also exist as discrete components in the control device of the laundry treating apparatus.
[0239] The division of the units is only a logical function division, and in actual implementation, there can be another division manner, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units shown or discussed can be indirect coupling or communication connection through some interfaces, devices or units, and can be electrical, mechanical or other forms.
[0240] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, that is, can be located in one place, or can be distributed on a plurality of network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment scheme.
[0241] In addition, the functional units in each embodiment of the present application can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit.
[0242] If the functions are realized in the form of software function units and sold or used as independent products, they can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application or the part of the present application that essentially contributes to the prior art or the part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The foregoing storage medium includes a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various program code storage media.
[0243] Those skilled in the art can understand that all or part of the steps of the above-mentioned method embodiments can be completed by program instruction related hardware. The foregoing program can be stored in a computer readable storage medium. The program executes to perform the steps of the above-mentioned method embodiments; and the foregoing storage medium includes various storage media that can store program codes, such as ROM, RAM, magnetic disk or optical disk.
[0244] So far, the technical solutions of the present application have been described in combination with the preferred embodiments shown in the drawings, but those skilled in the art can easily understand that the protection scope of the present application is obviously not limited to these specific embodiments, and the above embodiments are only used to illustrate the technical solutions of the present application, not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for part or all of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A knowledge graph automatic error correction method, characterized in that, The method comprises the following steps: generating a park overall hypergraph according to a park knowledge graph G, and generating a local hypergraph corresponding to each enterprise according to an enterprise knowledge graph g of each enterprise in the park; constructing a target negative example of a triple (h, r, t) of the park knowledge graph G, and obtaining an initial vector representation (H, R, T) of the triple by using the target negative example; obtaining global embedding representations of the park supergraph nodes from the park overall supergraph and obtaining global embedding representations of the enterprise supergraph nodes from the enterprise local supergraph ; obtaining a KG embedding loss from the initial vector representation (H, R, T), obtaining a global embedding representation obtaining a hypergraph loss; obtaining a joint confidence score of the triple (h, r, t) according to the KG embedding loss and the hypergraph loss; randomly retaining two elements of the triple whose joint confidence score is lower than a fourth threshold value, obtaining three empty slot binary tuples; searching for a triple for filling the empty slot in the knowledge graph, filling the empty slot binary tuple to obtain an alternative triple, obtaining a joint confidence score of the alternative triple, and selecting the alternative triple with the highest joint confidence score and higher than the fourth threshold value to replace the triple whose joint confidence score is lower than the fourth threshold value.
2. The method of claim 1, wherein, The method further comprises the following steps: performing replacement processing on entities in the triple (h, r, t) to obtain a candidate negative example of the triple (h, r, t); The enterprise node word vector representation is obtained by training a Word2Vec model and the material node word vector representation ; obtaining an average embedding representation of the enterprise node in the vector space in the park knowledge graph: ; Obtaining an average embedding representation of a material node in a park knowledge graph in a vector space: ; When the condition and the condition is satisfied, the candidate negative example is taken as the target negative example; wherein n: the number of enterprise nodes in the park knowledge graph, m: the number of material nodes in the park knowledge graph, : a first threshold value; : a second threshold value, : a word vector representation of a replacement node of an enterprise node in the park knowledge graph, : a word vector representation of a replacement node of a material node in the park knowledge graph.
3. The method of claim 1, wherein, The method further comprises the following steps: initializing the relation of the target negative triple and the relation in the corresponding original triple as a random vector conforming to normal distribution ; initializing the head entity of the target negative example triple and the head entity in the corresponding original triple as a random vector conforming to a normal distribution ; initializing the tail entity of the target negative example triple and the tail entity in the corresponding original triple as a random vector conforming to a normal distribution ; training the initial vector representation (H, R, T) of the triple by using a Bi-LSTM model.
4. The method of claim 1, wherein, the global embedding representation of the park supergraph node is obtained according to the park overall supergraph , comprising: concatenating the initial vector representations (H, R, T) to obtain node embeddings of the overall supergraph of the campus : ; acquiring a first correlation score of each of the k adjacent nodes: wherein, K is a positive integer; normalizing the first correlation score to obtain a normalized first correlation coefficient : ; According to the application with a third threshold value , obtaining wherein the According to the described and the described , the global embedding representation of the park hypergraph node is obtained by a sigmoid function : ; wherein ; the global embedding representation of the enterprise supergraph node is obtained according to the enterprise local supergraph comprising: initializing the enterprise local hypergraph node embeddings ; acquiring a second correlation score of each of the adjacent k nodes: wherein, K is a positive integer; normalizing the second correlation score to obtain a normalized second correlation coefficient : ; According to the described With the third threshold , get Wherein, the ; According to the method and the method , the global embedding representation of the enterprise hypergraph node is obtained by a sigmoid function : .
5. The method of claim 4, wherein, the global embedding representation obtaining a hypergraph loss, comprising: obtaining the with the third correlation score ; obtaining a loss function of the park overall hypergraph and each local hypergraph of the enterprise: ; obtaining a loss function of the park overall hypergraph and all local hypergraphs of the enterprise: ; wherein, : number of nodes in the enterprise partial hypergraph, : number of park enterprises, : hyperparameter for controlling the sensitivity of the loss function to positive and negative examples.
6. The method of claim 5, wherein, The method further comprises the following steps: training the initial vector representation (H, R, T) based on a TransD model to obtain a scoring function defined as: ; wherein, is a projection matrix of the head entity into the relation space, is a projection matrix of the tail entity into the relation space, is an identity matrix, is a projection vector corresponding to the head entity, the relation, the tail entity.
7. The method of claim 6, wherein, The method further comprises the following steps: obtaining a joint confidence score according to the KG embedding loss and the hypergraph loss: wherein the contribution weights to trade off the contribution of the embedding loss and the hypergraph loss, maps the joint confidence score to the interval [0, 1] for the sigmoid function, the closer the joint confidence score is to 0, the greater the probability that the triple (h, r, t) is an abnormal triple. interval, the closer the joint confidence score is to 0, the greater the probability that the triple (h, r, t) is an abnormal triple.
8. An electronic device, comprising: The method comprises the following steps: at least one processor and a memory, wherein; The memory is used to store computer execution instructions; The at least one processor is used to execute the computer execution instructions stored in the memory, so that the at least one processor executes the method according to any one of claims 1-7.
9. A computer storage medium, characterized in that The computer storage medium stores computer execution instructions, and the computer execution instructions are executed by a processor to implement the method according to any one of claims 1-7.
Citation Information
Patent Citations
Knowledge graph completion method based on double-view hyper-relation embedding framework
CN115269866A
Fault knowledge graph completion method and device, equipment and storage medium
CN115422366A