Comprehensive energy knowledge graph completion method

CN116662567BActive Publication Date: 2026-09-15STATE GRID GREEN ENERGY CO LTD +2
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310592884.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-24
Publication Date
2026-09-15
Estimated Expiration
2043-05-24

AI Technical Summary

Technical Problem

为此,本发明提出综合能源知识图谱补全方法,该综合能源知识图谱补全方法解决了构建知识图谱时没有针对具体领域进行合理设计的问题

Benefits of technology

本发明通过对非结构化的文本信息进行预处理,获取文本集合D;利用异构图结构从文本集合D中抽取出N个三元组T;对三元组T进行筛选,获取预测值;对预测值取值为1的个数进行统计;预测值取值为1的个数为0,将对应的三元组T舍弃;预测值取值为1的个数大于或等于2,将对应的三元组T添加至知识图谱;预测值取值为1的个数为1,进一步区分并补全,将补全后的三元组添加至知识图谱;将构建与补全串联起来,很好地平衡了领域知识的准确性和全面性;提高了领域知识构建过程中的知识准确性,进一步明确了需要补全的知识三元组;将信息抽取时的上下文作为第三方信息辅助补全工作,提高了知识补全的准确性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116662567B_ABST
    Figure CN116662567B_ABST
Patent Text Reader

Abstract

The application discloses a comprehensive energy knowledge graph completion method and relates to the technical field of knowledge graph completion; unstructured text information is preprocessed to obtain a text set D; a heterogeneous graph structure is used to extract N triplets T from the text set D; the triplets T are screened to obtain a prediction value; the number of prediction values equal to 1 is counted; if the number of prediction values equal to 1 is 0, the corresponding triplets T are discarded; if the number of prediction values equal to 1 is greater than or equal to 2, the corresponding triplets T are added to a knowledge graph; if the number of prediction values equal to 1 is 1, the triplets are further distinguished and completed, and the completed triplets are added to the knowledge graph; the series connection training of missing discrimination and completion is realized; the context of extracted knowledge is introduced into the completion process as third-party data to alleviate the problem that entities or relations do not exist in an existing knowledge graph.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of energy and relates to knowledge graph completion technology, specifically a comprehensive energy knowledge graph completion method. Background Technology

[0002] Any knowledge in the integrated energy service knowledge graph can be described using the form of an "entity-relationship-entity" triple. Depending on the source of the knowledge, the triple may sometimes be expressed as an "entity-attribute-attribute value".

[0003] Numerous studies have explored knowledge graphs; however, many have lacked domain-specific design in their construction. Domain-specific knowledge graphs, compared to those containing common-sense information, encompass more complex knowledge and structures, playing a crucial role in domain information integration. Knowledge graph research in the energy sector often focuses on specific details, such as a method for constructing a substation knowledge graph based on multi-source data, building a knowledge graph from basic substation information, alarm data, and equipment connection data. However, this method, utilizing fine-grained knowledge, neglects breadth and depth. Therefore, this paper proposes a comprehensive energy knowledge graph completion method. Summary of the Invention

[0004] This invention aims to at least address one of the technical problems existing in the prior art. To this end, this invention proposes a comprehensive energy knowledge graph completion method, which solves the problem of not rationally designing the knowledge graph for specific domains during its construction.

[0005] To achieve the above objectives, an integrated energy knowledge graph completion method is proposed according to an embodiment of the first aspect of the present invention, comprising the following steps: Step 1: Preprocess the unstructured text information to obtain the text set D; Step 2: Extract N triples T{s,r,o} from the text set D using a heterogeneous graph structure; where N is an integer greater than 0; s represents the subject, o represents the object, and r represents the relationship between the subject and the object; Step 3: Filter the triplet T to obtain the predicted value; Step 4: Count the number of predicted values ​​that are 1; If the number of predicted values ​​of 1 is 0, discard the corresponding triplet T. If the number of predicted values ​​of 1 is greater than or equal to 2, the corresponding triple T is added to the knowledge graph; The number of predicted values ​​of 1 is 1. Further differentiation and completion are performed, and the completed triples are added to the knowledge graph.

[0006] Preferably, the pretreatment includes the following steps: This paper describes how to use Python to deduplicate and remove stop words from unstructured text.

[0007] Preferably, the process of filtering the triplet T to obtain predicted values ​​includes the following steps: S1: Combine the extracted triple T with the context to obtain the input sentence I; wherein, the context includes the subject and the object; I={w1,w2,…,w n ;r1,r2,…,r k} Among them, w n For a sentence, n is the sentence length; r k Let k be the number of relations; S2: Input sentence I into the pre-trained language model to obtain two sets of vectors for sentence I; wherein, the pre-trained language model includes BERT. open and BERT domain ; The two sets of vectors are represented as H. o and H d ;

[0008]

[0009] S3: Calculate the distance between the two sets of vectors and obtain the offset coefficients α, β and γ;

[0010]

[0011]

[0012] S4: Combine the offset coefficients α, β, and γ with the vector representation {s d ,o d ,r d Multiply and then combine to obtain three vectors SO, SR, and RO;

[0013]

[0014]

[0015] Among them, the combination of subject and object yields vector representation SO, the combination of subject and relation yields vector representation SR, and the combination of object and relation yields vector representation RO; S5: Use the loss function to obtain the predicted values ​​y, y', and y''; where y, y', and y'' take the values ​​0 or 1.

[0016] Preferably, BERT open Training using public domain expectations; BERT domain The training was conducted using a small amount of public expectations and a large amount of energy-related text.

[0017] Preferably, the present invention uses cosine similarity to calculate the distance between two sets of vectors.

[0018] Preferably, if the number of predicted values ​​of 1 is 1, further differentiation and completion are required, including the following steps: When the predicted value y is 1 and y' and y'' are 0, the missing relation type is predicted and filled in. It should be further explained that when the predicted value y is 1 and y' and y'' are 0, the subject and object are correct, but the relation is inappropriate. When the predicted value y' is 1, and y and y'' are 0, and when the predicted value y'' is 1, and y and y' are 0, predict the missing subject or object and complete it.

[0019] Preferably, when the predicted value y is 1 and y' and y'' are 0, the missing relation type is predicted and filled in, including the following steps: S1: Input the subject s and object o of the triple T into BERT. domain In the pre-trained model, the vector representations H of the subject s and the object o are obtained. so ;

[0020] S2: Relationship type prediction is accomplished using a fully connected layer and the Softmax function;

[0021] Among them, P so Location information for both the subject and the object.

[0022] Preferably, when the predicted value y' is 1 and y and y'' are 0, and when the predicted value y'' is 1 and y and y' are 0, predicting and completing the missing subject or object includes the following steps: S1: Transform the prediction of missing subjects or objects into a sequence labeling task. S2: Using BILSTM-CRF as the main structure of the prediction model, for the obtained vectorized representation H'

[0023] S3: Extract subject or object features to obtain sequence features H B

[0024] S4: Transfer sequence features H B The input conditional random field layer is used for sequence decoding to obtain the subject or object that needs to be completed;

[0025] Among them, I pre , I and I next P represents the subject or object input that is currently missing a triple. ro and P sr These are locational information about objects or subjects and their relationships in two different situations.

[0026] Preferably, the missing subject or object is predicted using the BIO tagging method.

[0027] Preferably, the present invention employs a bidirectional long short-term memory neural network layer to extract subject or object features.

[0028] Compared with the prior art, the beneficial effects of the present invention are: This invention preprocesses unstructured text information to obtain a text set D; extracts N triples T from the text set D using a heterogeneous graph structure; filters the triples T to obtain predicted values; counts the number of predicted values ​​of 1; if the number of predicted values ​​of 1 is 0, the corresponding triple T is discarded; if the number of predicted values ​​of 1 is greater than or equal to 2, the corresponding triple T is added to the knowledge graph; if the number of predicted values ​​of 1 is 1, it is further differentiated and completed, and the completed triple is added to the knowledge graph; by linking construction and completion, it effectively balances the accuracy and comprehensiveness of domain knowledge; it improves the accuracy of knowledge in the domain knowledge construction process and further clarifies the knowledge triples that need to be completed; and by using the context during information extraction as third-party information to assist in the completion work, it improves the accuracy of knowledge completion. Attached Figure Description

[0029] Figure 1 This is a flowchart of the present invention; Figure 2 This is a schematic diagram of the device. Detailed Implementation

[0030] The technical solution of the present invention will be clearly and completely described below with reference to the embodiments. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0031] like Figure 1 As shown, the method for completing the comprehensive energy knowledge graph includes the following steps: Step 1: Preprocess the unstructured text information to obtain the text set D; In this embodiment, the preprocessing includes using Python to deduplicate unstructured text information and remove stop words. Step 2: Extract N triples T{s,r,o} from the text set D using a heterogeneous graph structure; where N is an integer greater than 0. Where s represents the subject, o represents the object, and r represents the relationship between the subject and the object; it should be further explained that the knowledge graph can be represented by a triple of (entity-relationship-entity), but in order to distinguish the different entities before and after, we adopt the representation of (subject-relationship-object); Information extraction is a fundamental task in knowledge graphs, and there is a lot of research specifically focused on information extraction tasks. From the perspective of the content of the extracted information, information extraction tasks can be divided into three types: named entity recognition, entity relation extraction, and event extraction. In order to extract knowledge from different text information in the energy field, our information extraction here mainly refers to the entity relation extraction task. Step 3: Filter the triplet T to obtain the predicted value; In this embodiment, the screening of the triplet T includes the following steps: S1: Combine the extracted triple T with the context to obtain the input sentence I; wherein, the context includes the subject and the object; I={w1,w2,…,w n ;r1,r2,…,r k} Among them, w n For a sentence, n is the sentence length; r k Let k be the number of relations; S2: Input sentence I into the pre-trained language model to obtain two sets of vectors for sentence I; wherein, the pre-trained language model includes BERT. open and BERT domain ; The two sets of vectors are represented as H. o and H d ;

[0032]

[0033] Specifically, the pre-trained language model is used to convert text into vectors; In this embodiment, the pre-trained language model includes BERT. open and BERT domain ; BERT open Training using public domain expectations; BERT domain Training was conducted using a small amount of public expectations and a large amount of energy-related text. It should be further noted that if the subject and object are unrelated to the energy domain, there will be a small difference between the two vector spaces; conversely, a subject and object or relationship specific to the energy domain will produce a large difference. S3: Calculate the distance between the two sets of vectors and obtain the offset coefficients α, β and γ; Specifically, there are three ways to calculate the distance between vectors: cosine similarity, Jacquard similarity, and Euclidean distance. This invention uses cosine similarity to calculate the distance between two sets of vectors, and experimental results show that cosine similarity produces the best results.

[0034]

[0035]

[0036] The formula for calculating the distance between two sets of vectors using cosine similarity is as follows:

[0037] S4: Combine the offset coefficients α, β, and γ with the vector representation {s d ,o d ,r d Multiply and then combine to obtain three vectors SO, SR, and RO; Specifically, the combination of subject and object yields vector representation SO, the combination of subject and relation yields vector representation SR, and the combination of object and relation yields vector representation RO;

[0038]

[0039]

[0040] S5: By setting the loss function to Binary Cross Entropy, the task is transformed into a binary classification task. The final loss function is obtained by summing the losses of the three different classifiers.

[0041]

[0042] The final filtering mechanism yields three predicted values: y, y', and y''. Specifically, y, y', and y'' take values ​​of 0 or 1; Step 4: Count the number of predicted values ​​that are 1; If the number of predicted values ​​of 1 is 0, it indicates that the triplet is an incorrect triplet and should be discarded. If the number of predicted values ​​of 1 is greater than or equal to 2, it means that the triple is correct and related to the energy field, and it is directly added to the knowledge graph. If the number of predicted values ​​is 1, it needs to be further differentiated and completed. The correct domain triples obtained after completion are then directly added to the knowledge graph. In this embodiment, if the number of predicted values ​​of 1 is 1, it is necessary to further distinguish and complete the prediction, including the following steps: When the predicted value y is 1 and y' and y'' are 0, the missing relation type is predicted and filled in. It should be further explained that when the predicted value y is 1 and y' and y'' are 0, the subject and object are correct, but the relation is inappropriate. When the predicted value y' is 1 and y and y'' are 0, and when the predicted value y'' is 1 and y and y' are 0, predict the missing subject or object and fill in the missing one; In this embodiment, when the predicted value y is 1 and y' and y'' are 0, the missing relation type is predicted and filled in, including the following steps: S1: Input the subject s and object o of the triple into BERT. domain In the pre-trained model, the vector representations H of the subject s and the object o are obtained. so ;

[0043] It should be further explained that the input is text information that does not contain relations, and only the original text context is considered; we expect to use entity relation representation to predict relation types in the energy field, thereby forming complete energy knowledge; however, due to the limitations of predefined supervised learning, we cannot list all relation types; therefore, in order to increase the robustness of relation prediction, we add an additional "other" relation as a supplementary relation type. S2: Relationship type prediction is accomplished using a fully connected layer and the Softmax function;

[0044] Among them, P so Location information for both the subject and the object; In this embodiment, when the predicted value y' is 1 and y and y'' are 0, and when the predicted value y'' is 1 and y and y' are 0, the missing subject or object is predicted and filled in, including the following steps: S1: The prediction of missing subjects or objects is transformed into a sequence labeling task, and the missing subjects or objects are predicted using the BIO labeling method. It should be further explained that the annotation content is the entity location information that needs to be completed. "B" indicates the starting position of the subject or object, "I" indicates the middle position of the subject or object, and "O" indicates other content in the sequence. S2: Using BILSTM-CRF as the main structure of the prediction model, for the obtained vectorized representation H';

[0045] S3: Extract subject or object features through a bidirectional long short-term memory neural network layer to obtain sequence features H. B ;

[0046] S4: Transfer sequence features H B The input conditional random field layer is used for sequence decoding to obtain the subject or object that needs to be completed;

[0047] Among them, I pre , I and I next P represents the subject or object input that is currently missing a triple. ro and P sr These are locational information about objects or subjects and their relationships in two different situations.

[0048] The above formulas are all numerical calculations after removing dimensions. The formulas are obtained by software simulation based on a large amount of data and are closest to the real situation. The preset parameters and preset thresholds in the formulas are set by those skilled in the art according to the actual situation or obtained by simulation based on a large amount of data.

[0049] like Figure 2 As shown, the integrated energy knowledge graph completion device includes an acquisition module and a statistics module; The acquisition module is used to acquire a text set D based on unstructured text information; extract N triples T{s,r,o} from the text set D using a heterogeneous graph structure; where N is an integer greater than 0; s represents the subject, o represents the object, and r represents the relationship between the subject and the object; and filter the triples T to obtain predicted values. The statistics module is used to count the number of predicted values ​​of 1; if the number of predicted values ​​of 1 is 0, the corresponding triple T is discarded; if the number of predicted values ​​of 1 is greater than or equal to 2, the corresponding triple T is added to the knowledge graph; if the number of predicted values ​​of 1 is 1, it is further distinguished and completed, and the completed triple is added to the knowledge graph.

[0050] In this embodiment, obtaining the text set D based on unstructured text information includes: This paper describes how to use Python to deduplicate and remove stop words from unstructured text.

[0051] In this embodiment, the process of filtering the triplet T to obtain the predicted value includes the following steps: S1: Combine the extracted triple T with the context to obtain the input sentence I; wherein, the context includes the subject and the object; I={w1,w2,…,w n ;r1,r2,…,r k} Among them, w n For a sentence, n is the sentence length; r k Let k be the number of relations; S2: Input sentence I into the pre-trained language model to obtain two sets of vectors for sentence I; wherein, the pre-trained language model includes BERT. open and BERT domain ; The two sets of vectors are represented as H. o and H d ;

[0052]

[0053] S3: Calculate the distance between the two sets of vectors and obtain the offset coefficients α, β and γ;

[0054]

[0055]

[0056] S4: Combine the offset coefficients α, β, and γ with the vector representation {s d ,o d ,r d Multiply and then combine to obtain three vectors SO, SR, and RO;

[0057]

[0058]

[0059] Among them, the combination of subject and object yields vector representation SO, the combination of subject and relation yields vector representation SR, and the combination of object and relation yields vector representation RO; S5: Use the loss function to obtain the predicted values ​​y, y', and y''; where y, y', and y'' take the values ​​0 or 1.

[0060] In this embodiment, the number of predicted values ​​of 1 is 1. Further differentiation and completion include the following steps: When the predicted value y is 1 and y' and y'' are 0, the missing relation type is predicted and filled in. It should be further explained that when the predicted value y is 1 and y' and y'' are 0, the subject and object are correct, but the relation is inappropriate. When the predicted value y' is 1, and y and y'' are 0, and when the predicted value y'' is 1, and y and y' are 0, predict the missing subject or object and complete it.

[0061] In this embodiment, when the predicted value y is 1 and y' and y'' are 0, the missing relation type is predicted and filled in, including the following steps: S1: Input the subject s and object o of the triple T into BERT. domain In the pre-trained model, the vector representations H of the subject s and the object o are obtained. so ;

[0062] S2: Relationship type prediction is accomplished using a fully connected layer and the Softmax function;

[0063] Among them, P so Location information for both the subject and the object.

[0064] In this embodiment, when the predicted value y' is 1 and y and y'' are 0, and when the predicted value y'' is 1 and y and y' are 0, the missing subject or object is predicted and filled in, including the following steps: S1: Transform the prediction of missing subjects or objects into a sequence labeling task. S2: Using BILSTM-CRF as the main structure of the prediction model, for the obtained vectorized representation H'

[0065] S3: Extract subject or object features to obtain sequence features H B

[0066] S4: Transfer sequence features H B The input conditional random field layer is used for sequence decoding to obtain the subject or object that needs to be completed;

[0067] Among them, I pre , I and I next P represents the subject or object input that is currently missing a triple. ro and P sr These are locational information about objects or subjects and their relationships in two different situations.

[0068] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code. The solutions in the embodiments of the present invention can be implemented using various computer languages, such as the object-oriented programming language Java and the interpreted scripting language JavaScript.

[0069] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0070] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0071] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0072] Although preferred embodiments of the invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including both the preferred embodiments and all changes and modifications falling within the scope of the invention.

[0073] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of the claims of this invention and their equivalents, this invention also intends to include these modifications and variations.

Claims

1. A comprehensive energy knowledge graph completion method, characterized in that, Includes the following steps: Step 1: Obtain the text set D based on the unstructured text information; including: using Python to deduplicate and remove stop words from the unstructured text information; Step 2: Extract N triples T{s,r,o} from the text set D using a heterogeneous graph structure; where N is an integer greater than 0; s represents the subject, o represents the object, and r represents the relationship between the subject and the object; Step 3: Filter the triplet T to obtain the predicted value; including the following steps: S1: Combine the extracted triple T with the context to obtain the input sentence I; wherein, the context includes the subject and the object; I={w1,w2,…,w n ;r1,r2,…,r k } Among them, w n For a sentence, n is the sentence length; r k Let k be the number of relations; S2: Input sentence I into the pre-trained language model to obtain two sets of vectors for sentence I; wherein, the pre-trained language model includes BERT. open and BERT domain ; The two sets of vectors are represented as H. o and H d ; S3: Calculate the distance between the two sets of vectors and obtain the offset coefficients α, β and γ; S4: Combine the offset coefficients α, β, and γ with the vector representation {s d ,o d ,r d Multiply and then combine to obtain three vectors SO, SR, and RO; Among them, the combination of subject and object yields vector representation SO, the combination of subject and relation yields vector representation SR, and the combination of object and relation yields vector representation RO; S5: Use the loss function to obtain the predicted values ​​y, y', and y''; where y, y', and y'' take the values ​​0 or 1; Step 4: Count the number of predicted values ​​that are 1; If the number of predicted values ​​of 1 is 0, then the corresponding triple T is discarded; If the number of predicted values ​​of 1 is greater than or equal to 2, then the corresponding triple T is added to the knowledge graph. If the number of predicted values ​​of 1 is 1, then further differentiation and completion are performed, and the completed triples are added to the knowledge graph. If the number of predicted values ​​of 1 is 1, then further differentiation and completion are performed, including the following steps: When the predicted value y is 1, and y' and y'' are 0, predict the missing relation type and complete it; including the following steps: S1: Input the subject s and object o of the triple T into BERT. domain In the pre-trained model, the vector representations H of the subject s and the object o are obtained. so ; S2: Relationship type prediction is accomplished using a fully connected layer and the Softmax function; Among them, P so Location information for both the subject and the object; When the predicted value y' is 1 and y and y'' are 0, and when the predicted value y'' is 1 and y and y' are 0, predict the missing subject or object and complete it; including the following steps: S1: Transform the prediction of missing subjects or objects into a sequence labeling task. S2: Using BILSTM-CRF as the main structure of the prediction model, for the obtained vectorized representation H' S3: Extract subject or object features to obtain sequence features H B S4: Transfer sequence features H B The input conditional random field layer is used for sequence decoding to obtain the subject or object that needs to be completed; Among them, I pre , I and I next P represents the subject or object input that is currently missing a triple. ro and P sr These are locational information about objects or subjects and their relationships in two different situations.

2. A comprehensive energy knowledge graph completion device, used to perform the method as described in claim 1, characterized in that, Includes an acquisition module and a statistics module; The acquisition module is used to acquire a text set D based on unstructured text information; extract N triples T{s,r,o} from the text set D using a heterogeneous graph structure; where N is an integer greater than 0; s represents the subject, o represents the object, and r represents the relationship between the subject and the object; and filter the triples T to obtain predicted values. The statistics module is used to count the number of predicted values ​​of 1; if the number of predicted values ​​of 1 is 0, the corresponding triple T is discarded; if the number of predicted values ​​of 1 is greater than or equal to 2, the corresponding triple T is added to the knowledge graph; if the number of predicted values ​​of 1 is 1, it is further distinguished and completed, and the completed triple is added to the knowledge graph.

3. The integrated energy knowledge graph completion device according to claim 2, characterized in that, Obtain a text set D based on unstructured text information, including: This paper describes how to use Python to deduplicate and remove stop words from unstructured text.

4. The integrated energy knowledge graph completion device according to claim 2, characterized in that, The process of filtering the triplet T to obtain predicted values ​​includes the following steps: S1: Combine the extracted triple T with the context to obtain the input sentence I; wherein, the context includes the subject and the object; I={w1,w2,…,w n ;r1,r2,…,r k } Among them, w n For a sentence, n is the sentence length; r k Let k be the number of relations; S2: Input sentence I into the pre-trained language model to obtain two sets of vectors for sentence I; wherein, the pre-trained language model includes BERT. open and BERT domain ; The two sets of vectors are represented as H. o and H d ; S3: Calculate the distance between the two sets of vectors and obtain the offset coefficients α, β and γ; S4: Combine the offset coefficients α, β, and γ with the vector representation {s d ,o d ,r d Multiply and then combine to obtain three vectors SO, SR, and RO; Among them, the combination of subject and object yields vector representation SO, the combination of subject and relation yields vector representation SR, and the combination of object and relation yields vector representation RO; S5: Use the loss function to obtain the predicted values ​​y, y', and y''; where y, y', and y'' take the values ​​0 or 1.

5. The integrated energy knowledge graph completion device according to claim 2, characterized in that, The number of predicted values ​​of 1 is 1. Further differentiation and completion are performed, including the following steps: When the predicted value y is 1 and y' and y'' are 0, the missing relation type is predicted and filled in. It should be further explained that when the predicted value y is 1 and y' and y'' are 0, the subject and object are correct, but the relation is inappropriate. When the predicted value y' is 1, and y and y'' are 0, and when the predicted value y'' is 1, and y and y' are 0, predict the missing subject or object and complete it.

6. The integrated energy knowledge graph completion device according to claim 5, characterized in that, When the predicted value y is 1, and y' and y'' are 0, predict the missing relation type and complete it, including the following steps: S1: Input the subject s and object o of the triple T into BERT. domain In the pre-trained model, the vector representations H of the subject s and the object o are obtained. so ; S2: Relationship type prediction is accomplished using a fully connected layer and the Softmax function; Among them, P so Location information for both the subject and the object.

7. The integrated energy knowledge graph completion device according to claim 5, characterized in that, When the predicted value y' is 1 and y and y'' are 0, and when the predicted value y'' is 1 and y and y' are 0, predict the missing subject or object and complete it, including the following steps: S1: Transform the prediction of missing subjects or objects into a sequence labeling task. S2: Using BILSTM-CRF as the main structure of the prediction model, for the obtained vectorized representation H' S3: Extract subject or object features to obtain sequence features H B S4: Transfer sequence features H B The input conditional random field layer is used for sequence decoding to obtain the subject or object that needs to be completed; Among them, I pre , I and I next P represents the subject or object input that is currently missing a triple. ro and P sr These are locational information about objects or subjects and their relationships in two different situations.

Citation Information

Patent Citations

  • Knowledge graph relation completion method

    CN113918730A