CN117909517A - Knowledge graph completion method, apparatus, device, storage medium, and program product - Google Patents
Knowledge graph completion method, apparatus, device, storage medium, and program product Download PDFInfo
- Publication number
- CN117909517A CN117909517A CN202410118780.3A CN202410118780A CN117909517A CN 117909517 A CN117909517 A CN 117909517A CN 202410118780 A CN202410118780 A CN 202410118780A CN 117909517 A CN117909517 A CN 117909517A
- Authority
- CN
- China
- Prior art keywords
- power
- entity
- complemented
- tail
- completed
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 51
- 239000013598 vector Substances 0.000 claims abstract description 259
- 238000011156 evaluation Methods 0.000 claims abstract description 48
- 238000004590 computer program Methods 0.000 claims abstract description 26
- 238000012216 screening Methods 0.000 claims description 5
- 230000000295 complement effect Effects 0.000 description 16
- 230000006870 function Effects 0.000 description 11
- 238000004364 calculation method Methods 0.000 description 5
- 238000000605 extraction Methods 0.000 description 5
- 230000004927 fusion Effects 0.000 description 5
- 238000010586 diagram Methods 0.000 description 4
- 230000003993 interaction Effects 0.000 description 4
- 238000013528 artificial neural network Methods 0.000 description 3
- 230000008569 process Effects 0.000 description 3
- 238000012545 processing Methods 0.000 description 3
- 230000008859 change Effects 0.000 description 2
- 238000010276 construction Methods 0.000 description 2
- 230000003068 static effect Effects 0.000 description 2
- 238000012549 training Methods 0.000 description 2
- NAWXUBYGYWOOIX-SFHVURJKSA-N (2s)-2-[[4-[2-(2,4-diaminoquinazolin-6-yl)ethyl]benzoyl]amino]-4-methylidenepentanedioic acid Chemical compound C1=CC2=NC(N)=NC(N)=C2C=C1CCC1=CC=C(C(=O)N[C@@H](CC(=C)C(O)=O)C(O)=O)C=C1 NAWXUBYGYWOOIX-SFHVURJKSA-N 0.000 description 1
- OKTJSMMVPCPJKN-UHFFFAOYSA-N Carbon Chemical compound [C] OKTJSMMVPCPJKN-UHFFFAOYSA-N 0.000 description 1
- 238000004458 analytical method Methods 0.000 description 1
- 230000002457 bidirectional effect Effects 0.000 description 1
- 238000004422 calculation algorithm Methods 0.000 description 1
- 238000006243 chemical reaction Methods 0.000 description 1
- 238000007405 data analysis Methods 0.000 description 1
- 229910021389 graphene Inorganic materials 0.000 description 1
- 238000013507 mapping Methods 0.000 description 1
- 239000011159 matrix material Substances 0.000 description 1
- 238000005065 mining Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 210000002569 neuron Anatomy 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000011160 research Methods 0.000 description 1
- 238000013519 translation Methods 0.000 description 1
- 238000012795 verification Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/30—Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
- G06F16/36—Creation of semantic tools, e.g. ontology or thesauri
- G06F16/367—Ontology
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/22—Matching criteria, e.g. proximity measures
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/20—Natural language analysis
- G06F40/279—Recognition of textual entities
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N5/00—Computing arrangements using knowledge-based models
- G06N5/02—Knowledge representation; Symbolic representation
- G06N5/022—Knowledge engineering; Knowledge acquisition
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- Artificial Intelligence (AREA)
- Computational Linguistics (AREA)
- Life Sciences & Earth Sciences (AREA)
- Evolutionary Computation (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Health & Medical Sciences (AREA)
- Software Systems (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Bioinformatics & Computational Biology (AREA)
- Mathematical Physics (AREA)
- Evolutionary Biology (AREA)
- Computing Systems (AREA)
- Audiology, Speech & Language Pathology (AREA)
- General Health & Medical Sciences (AREA)
- Animal Behavior & Ethology (AREA)
- Databases & Information Systems (AREA)
- Supply And Distribution Of Alternating Current (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
Abstract
The embodiment of the application provides a knowledge graph completion method, a knowledge graph completion device, computer equipment, a storage medium and a computer program product, and relates to the technical field of knowledge graphs. The method comprises the following steps: acquiring a plurality of power head entities, a plurality of power tail entities and a plurality of power relations of a power knowledge graph to be complemented; acquiring a head entity embedded representation vector, a tail entity embedded representation vector and a relation embedded representation vector by using an embedded model; acquiring a plurality of to-be-complemented triples of the to-be-complemented power knowledge graph, and acquiring similarity between a power head entity, a power tail entity and a power relation in each to-be-complemented triplet; based on the similarity, acquiring an evaluation index value of each to-be-completed triplet, determining the to-be-completed triplet with the evaluation index value larger than a preset index threshold as a to-be-completed triplet of the to-be-completed electric power knowledge graph, and updating the to-be-completed electric power knowledge graph. The method can improve the integrity of the knowledge graph.
Description
Technical Field
The present application relates to the technical field of knowledge graphs, and in particular, to a knowledge graph completion method, a knowledge graph completion device, a computer device, a storage medium, and a computer program product.
Background
Along with the deep research and application of the knowledge graph, the knowledge graph is widely applied to the fields of search engines, question-answering systems, recommendation systems and the like. Taking a question-answering system of the power system as an example, a power knowledge graph of the power system can be constructed, and the power knowledge graph is used for intelligent data analysis of the question-answering system of the power system.
The power data of the power system are often huge, but partial data have certain sparsity, so that the mapping relationship among multiple entities in the constructed power knowledge graph is inaccurate, and the knowledge graph is incomplete.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a knowledge graph completion method, apparatus, computer device, storage medium, and computer program product.
In a first aspect, the present application provides a knowledge graph completion method. The method comprises the following steps:
Acquiring a plurality of power head entities, a plurality of power tail entities and a plurality of power relations of a power knowledge graph to be complemented;
Acquiring a head entity embedded representation vector of each power head entity, a tail entity embedded representation vector of each power tail entity and a relation embedded representation vector of each power relation by utilizing a pre-constructed embedded model;
Acquiring a plurality of to-be-complemented triples of the to-be-complemented power knowledge graph, and acquiring the similarity between a power head entity, a power tail entity and a power relation in each to-be-complemented triplet based on the head entity embedded representation vector, the tail entity embedded representation vector and the relation embedded representation vector;
Based on the similarity, acquiring an evaluation index value of each to-be-complemented triplet, and determining the to-be-complemented triplet with the evaluation index value larger than a preset index threshold as the to-be-complemented triplet of the to-be-complemented power knowledge graph;
And updating the to-be-completed power knowledge graph based on the completion triples.
In one embodiment, the obtaining, by using a pre-built embedding model, a head entity embedding representation vector of each power head entity, a tail entity embedding representation vector of each tail entity, and a relationship embedding representation vector of each power relationship includes: acquiring a head entity initial vector of each power head entity; acquiring tail entity initial vectors of the power tail entities; acquiring a relation initial vector of each electric power relation; and respectively inputting the head entity initial vector, the tail entity initial vector and the relation initial vector into corresponding branch models in the pre-built embedded representation model to obtain head entity embedded representation vectors of all the power head entities, tail entity embedded representation vectors of all the tail entities and relation embedded representation vectors of all the power relations.
In one embodiment, the obtaining the plurality of to-be-completed triples of the to-be-completed power knowledge graph includes: combining each power head entity, each power tail entity and each power relation to obtain a plurality of to-be-complemented triples; each to-be-completed triplet comprises a power head entity, a power tail entity and a power relation.
In one embodiment, the similarities include a first similarity, a second similarity, and a third similarity; the obtaining the similarity between the power head entity, the power tail entity and the power relation in each to-be-complemented triplet based on the head entity embedded representation vector, the tail entity embedded representation vector and the relation embedded representation vector comprises the following steps: determining a power head entity in each to-be-completed triplet as a to-be-completed head entity, determining a power tail entity in each to-be-completed triplet as a to-be-completed tail entity, and determining a power relationship in each to-be-completed triplet as a to-be-completed relationship; acquiring the first similarity of the head entity to be complemented and the tail entity to be complemented based on the head entity embedded representation vector of the head entity to be complemented and the tail entity embedded representation vector of the tail entity to be complemented; acquiring the second similarity of the head entity to be complemented and the relationship to be complemented based on a head entity embedded representation vector of the head entity to be complemented and a relationship embedded representation vector of the relationship to be complemented; and acquiring the third similarity of the tail entity to be complemented and the relationship to be complemented based on the tail entity embedded representation vector of the tail entity to be complemented and the relationship embedded representation vector of the relationship to be complemented.
In one embodiment, the obtaining the first similarity between the head entity to be completed and the tail entity to be completed based on the head entity embedded representation vector of the head entity to be completed and the tail entity embedded representation vector of the tail entity to be completed includes: obtaining a vector product of a head entity embedded representation vector of the head entity to be complemented and a tail entity embedded representation vector of the tail entity to be complemented; acquiring a first vector film of a head entity embedded representation vector of the head entity to be complemented, and acquiring a second vector film of a tail entity embedded representation vector of the tail entity to be complemented; and obtaining a film product of the first vector film and the second vector film, and determining a quotient of the vector product and the film product as the first similarity.
In one embodiment, the obtaining, based on the similarity, an evaluation index value of each to-be-complemented triplet includes: acquiring a first reciprocal of the first similarity, acquiring a second reciprocal of the second similarity, and acquiring a third reciprocal of the third similarity; determining a sum of the first reciprocal, the second reciprocal, and the third reciprocal as the evaluation index value.
In a second aspect, the present application provides a knowledge graph completion apparatus. The device comprises:
The acquisition module is used for acquiring a plurality of power head entities, a plurality of power tail entities and a plurality of power relations of the power knowledge graph to be complemented;
The embedded representation module is used for acquiring a head entity embedded representation vector of each power head entity, a tail entity embedded representation vector of each power tail entity and a relation embedded representation vector of each power relation by utilizing a pre-built embedded model;
The computing module is used for acquiring a plurality of to-be-completed triples of the to-be-completed power knowledge graph, and acquiring the similarity between every two power head entities, every two power tail entities and every two power relations in each to-be-completed triplet based on the head entity embedded representation vector, the tail entity embedded representation vector and the relation embedded representation vector;
the screening module is used for acquiring the evaluation index value of each to-be-completed triplet based on the similarity, and determining the to-be-completed triplet with the evaluation index value larger than a preset index threshold as the to-be-completed triplet of the to-be-completed electric power knowledge graph;
And the updating module is used for updating the to-be-completed electric power knowledge graph based on the completion triples.
In a third aspect, the present application also provides a computer device. The computer device comprises a memory storing a computer program and a processor which when executing the computer program performs the steps of:
Acquiring a plurality of power head entities, a plurality of power tail entities and a plurality of power relations of a power knowledge graph to be complemented;
Acquiring a head entity embedded representation vector of each power head entity, a tail entity embedded representation vector of each power tail entity and a relation embedded representation vector of each power relation by utilizing a pre-constructed embedded model;
Acquiring a plurality of to-be-complemented triples of the to-be-complemented power knowledge graph, and acquiring the similarity between a power head entity, a power tail entity and a power relation in each to-be-complemented triplet based on the head entity embedded representation vector, the tail entity embedded representation vector and the relation embedded representation vector;
Based on the similarity, acquiring an evaluation index value of each to-be-complemented triplet, and determining the to-be-complemented triplet with the evaluation index value larger than a preset index threshold as the to-be-complemented triplet of the to-be-complemented power knowledge graph;
And updating the to-be-completed power knowledge graph based on the completion triples.
In a fourth aspect, the present application also provides a computer-readable storage medium. The computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of:
Acquiring a plurality of power head entities, a plurality of power tail entities and a plurality of power relations of a power knowledge graph to be complemented;
Acquiring a head entity embedded representation vector of each power head entity, a tail entity embedded representation vector of each power tail entity and a relation embedded representation vector of each power relation by utilizing a pre-constructed embedded model;
Acquiring a plurality of to-be-complemented triples of the to-be-complemented power knowledge graph, and acquiring the similarity between a power head entity, a power tail entity and a power relation in each to-be-complemented triplet based on the head entity embedded representation vector, the tail entity embedded representation vector and the relation embedded representation vector;
Based on the similarity, acquiring an evaluation index value of each to-be-complemented triplet, and determining the to-be-complemented triplet with the evaluation index value larger than a preset index threshold as the to-be-complemented triplet of the to-be-complemented power knowledge graph;
And updating the to-be-completed power knowledge graph based on the completion triples.
In a fifth aspect, the present application also provides a computer program product. The computer program product comprises a computer program which, when executed by a processor, implements the steps of:
Acquiring a plurality of power head entities, a plurality of power tail entities and a plurality of power relations of a power knowledge graph to be complemented;
Acquiring a head entity embedded representation vector of each power head entity, a tail entity embedded representation vector of each power tail entity and a relation embedded representation vector of each power relation by utilizing a pre-constructed embedded model;
Acquiring a plurality of to-be-complemented triples of the to-be-complemented power knowledge graph, and acquiring the similarity between a power head entity, a power tail entity and a power relation in each to-be-complemented triplet based on the head entity embedded representation vector, the tail entity embedded representation vector and the relation embedded representation vector;
Based on the similarity, acquiring an evaluation index value of each to-be-complemented triplet, and determining the to-be-complemented triplet with the evaluation index value larger than a preset index threshold as the to-be-complemented triplet of the to-be-complemented power knowledge graph;
And updating the to-be-completed power knowledge graph based on the completion triples.
In the knowledge graph completion method, the device, the computer equipment, the storage medium and the computer program product, the pre-constructed electric power knowledge graph can be determined as the electric power knowledge graph to be completed, and a plurality of electric power head entities, a plurality of electric power tail entities and a plurality of electric power relations of the electric power knowledge graph to be completed are acquired; furthermore, a pre-built embedding model can be utilized to obtain a head entity embedding representation vector of each power head entity, a tail entity embedding representation vector of each power tail entity and a relation embedding representation vector of each power relation; then, a plurality of to-be-completed triples of the to-be-completed power knowledge graph can be obtained, and similarity between every two power head entities, every two power tail entities and every two power relations in each to-be-completed triples is obtained based on the head entity embedded representation vector, the tail entity embedded representation vector and the relation embedded representation vector; further, based on the similarity, an evaluation index value of each to-be-completed triplet is obtained, and the to-be-completed triplet with the evaluation index value larger than a preset index threshold value is determined to be the to-be-completed triplet of the to-be-completed electric power knowledge graph; therefore, the to-be-complemented power knowledge graph can be updated based on the complement triples. In the method provided by the embodiment of the application, the hidden relation between the entities of the electric power knowledge graph to be complemented can be mined by utilizing the pre-built embedded model, and then, some complementing triples can be mined, and the electric power knowledge graph to be complemented can be complemented and updated based on the complementing triples, so that the accuracy of the relation between the entities is improved, and the integrity of the electric power knowledge graph to be complemented is further improved.
Drawings
Fig. 1 is a schematic flow chart of a knowledge graph completion method according to an embodiment of the present application;
FIG. 2 is a schematic diagram of the structure of an interaction layer, a nonlinear layer and an output layer of an embedded model according to an embodiment of the present application;
fig. 3 is a schematic flow chart of obtaining a first similarity according to an embodiment of the present application;
FIG. 4 is a flowchart of obtaining an evaluation index value according to an embodiment of the present application;
Fig. 5 is a block diagram of a knowledge graph completing device according to an embodiment of the present application;
fig. 6 is an internal structure diagram of a computer device according to an embodiment of the present application.
Detailed Description
The present application will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present application more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
In one embodiment, as shown in fig. 1, a knowledge graph completion method is provided, and this embodiment is illustrated by applying the method to a server, where it is understood that the method may also be applied to a terminal, and may also be applied to a system including a terminal and a server, and implemented through interaction between the terminal and the server. In this embodiment, the method includes the steps of:
Step S101, a plurality of power head entities, a plurality of power tail entities and a plurality of power relations of a power knowledge graph to be complemented are obtained.
The power knowledge graph of the power system can be constructed, and further, the power knowledge graph constructed in advance can be used as the power knowledge graph to be complemented. The to-be-completed power knowledge graph may include a plurality of power head entities, a plurality of power tail entities, and a plurality of power relationships. The construction method of the to-be-complemented power knowledge graph can comprise the following steps:
The first step: a plurality of power information data, e.g., power equipment, plant information, and power network topology, etc., of the power system is obtained from a plurality of power data sources associated with the power system.
The power knowledge graph of the power system is logically divided into 2 layers of a mode layer and a data layer, the mode layer is constructed in a top-down construction mode, and the data layer is constructed in a bottom-up mode under the guidance of the mode layer. The model layer is above the data layer, is a conceptual model and a logic foundation of a stable situation map, stores refined situation knowledge, is generally managed by an entity library, and performs standard constraint on the data layer. The data layer is an example of an entity, stores real data, consists of a series of facts describing the power system, and is formed by the processes of knowledge extraction, knowledge fusion, knowledge processing and the like.
And a second step of: and carrying out data conversion and information fusion on the plurality of electric power information data to obtain electric power fusion information of the electric power system.
And a third step of: and carrying out power entity identification on the power fusion information by using the named entity extraction model to realize power entity extraction, and marking to obtain marked power entities, such as power equipment, power stations and the like, wherein the marked power entities can comprise a power head entity and a power tail entity.
Fourth step: and based on the marked electric entity, extracting the electric relation of the electric fusion information through an entity relation extraction model so as to extract an electric triplet, and constructing an electric knowledge graph of the electric system by the electric triplet. The entity relation extraction model comprises a bidirectional circulation network, an expansion gate convolution neural network and a self-attention model.
The to-be-completed power knowledge graph can be a structured knowledge representation for describing entities, concepts and relationships among the entities, concepts of the power system in the real world. The electric entity in the electric knowledge graph to be completed may be any real world thing including people, places, events, concepts, objects, etc. These electric power entities exist in the form of nodes in the electric power knowledge graph to be complemented, and are connected through relationships. It should be appreciated that the to-be-completed power knowledge graph may contain a plurality of power entities, which may include a plurality of power head entities and a plurality of power tail entities. In the to-be-complemented power knowledge graph, a relationship between a power head entity and a power tail entity, i.e., a power relationship, is generally described as an edge, which is an association connecting two entities, and describes a semantic relationship or association between the power head entity and the power tail entity, where the power head entity is generally a starting point of the power relationship, and the power tail entity is an ending point of the power relationship. The power relationship may be any attribute describing an association between a power head entity and a power tail entity, such as "owned" and "located" and the like. In this way. In general, the power head entity, the power tail entity and the power relationship may be stored in the to-be-complemented power knowledge-graph in the form of power triplets, where the triplets may be used to describe the relationship between the entities, and are one of the most basic elements in the knowledge-graph, and are generally expressed in the following form: (Power head entity, power relation, power Tail entity). The power head entity represents a starting point of a relation, the power relation represents a semantic relation between the power head entity and the power tail entity, and the power tail entity represents an ending point of the power relation. In this way, the power knowledge graph to be complemented may describe complex relationships and semantic connections between the power entities.
Step S102, a head entity embedded representation vector of each power head entity, a tail entity embedded representation vector of each power tail entity and a relation embedded representation vector of each power relation are obtained by utilizing a pre-built embedded model.
The embedding model may represent entities and relationships in the to-be-completed power knowledge-graph as vectors in a continuous vector space so as to capture semantic relationships between them. These models typically use neural networks to learn embedded representations of entities and relationships. In particular, these models learn embedded representations of entities and relationships by maximizing or minimizing some of the loss functions so that there are similar vector representations between similar entities and relationships in the vector space. Such representations may be used for a variety of tasks such as real-world linking, relational prediction, and recommendation systems. The embedded model in the embodiment of the application can be a three-branch parallel embedded model and can comprise a head entity embedded model, a tail entity embedded model and a relation embedded model, wherein the head entity embedded model can be used for learning the embedded representation of the electric head entity of the electric power knowledge graph to be complemented, namely, the head entity embedded representation vector of the electric head entity can be acquired based on the head entity initial vector of the electric head entity by utilizing the head entity embedded model; the tail entity embedding model can be used for learning the embedding representation of the electric power tail entity of the electric power knowledge graph to be complemented, namely, the tail entity embedding representation vector of the electric power tail entity can be obtained based on the tail entity initial vector of the electric power tail entity by utilizing the tail entity embedding model; the relation embedding model can be used for learning the embedding representation of the electric relation of the electric power knowledge graph to be complemented, namely the relation embedding representation vector of the electric power relation can be obtained based on the relation initial vector of the electric power relation by utilizing the relation embedding model.
The basic storage unit of the to-be-completed electric power knowledge graph can be an electric power triplet, and can comprise a plurality of to-be-completed triples, and each to-be-completed triplet can be expressed as shown in a formula (1):
Wherein the method comprises the steps of Is a power head entity; Is a power tail entity; Is a power relationship for representing To the point ofIs a constraint relationship of (2); E. r, S are an entity set, a relation set and a triplet set of the electric power knowledge graph network to be complemented respectively. The knowledge graph distributed expression method TransE (Translating Embedding) based on translation can realize the nearest distance between h and t through the relation r, namely as shown in a formula (2):
Further, the entity initial vector set of the power entity and the relationship initial vector set of the power relationship may be expressed as shown in formula (3):
Wherein X E comprises a plurality of entity initial vector sets of a plurality of electric entities of the electric power knowledge graph to be complemented, the plurality of electric power entities comprising a plurality of electric power head entities and a plurality of electric power tail entities; x R comprises a plurality of relation initial vector sets of a plurality of electric power relations of the electric power knowledge graph to be complemented; assuming that the power head entity is denoted as h, the power relation is denoted as r, and the power tail entity is denoted as t, the initial embedded set of the triples of the multiple to-be-completed triples of the to-be-completed power knowledge graph is denoted as X as shown in formula (4):
The embedding model is a three-branch parallel embedding model and can comprise a head entity embedding model, a tail entity embedding model and a relation embedding model, wherein each branch embedding model (the head entity embedding model, the tail entity embedding model and/or the relation embedding model) comprises an interaction layer, a nonlinear layer and an output layer, as shown in fig. 2, and each layer comprises a propagation function. When the embedding model is used for learning the embedding representation of the electric entity and the electric relation of the electric knowledge graph to be complemented, the electric head entity initial vector of each electric head entity, the electric tail entity initial vector of each electric tail entity and the electric relation initial vector of each electric relation can be respectively input into the corresponding branch embedding model, namely, the electric head entity initial vector is input into the head entity embedding model, the electric tail entity initial vector is input into the tail entity embedding model, and the electric relation initial vector is input into the relation embedding model, further, the corresponding initial vectors can be calculated based on the propagation functions of a plurality of network layers (an interaction layer, a nonlinear layer and an output layer) of each branch embedding model, and finally, the head entity embedding representation vector of each electric head entity, the tail entity embedding representation vector of each electric tail entity and the relation embedding representation vector of each electric relation are obtained, and the propagation calculation process is shown in formula (5):
H 1,r1,t1 is a head entity initial vector of the power head entity, a relation initial vector of the power relation and a tail entity initial vector of the power tail entity which are input to the first network layer of the embedded model respectively; h n,rn,tn is a head entity initial vector of a power head entity, a relation initial vector of a power relation and a tail entity initial vector of a power tail entity which are input to an nth network layer of the embedded model respectively, each branch embedded model of the embedded model comprises n layers, and n is a positive integer; h out,rout,tout is a head entity embedded representation vector of each power head entity, a relation embedded representation vector of each power relation and a tail entity embedded representation vector of each power tail entity respectively; w is the propagation weight matrix of the network, and b is the bias term for neuron propagation.
For training the embedded model, an error back propagation algorithm is adopted in the embodiment of the application to train the embedded model. In the training process, there will be a positive sample set and a negative sample set, the input of the embedded model has a similarity to the positive sample, and a similarity to the negative sample is lower, so the loss function in the traditional network model will oscillate between the positive and negative samples, in order to avoid this problem, a proportion Sigmoid function may be introduced to improve the hinge loss function of the embedded model, and the optimized hinge loss function is shown in formula (6):
wherein, The evaluation index function for the triplet to be complemented can be as shown in formula (7):
Wherein, alpha is a dynamic adjustment factor which can adjust the value range of the Sigmoid function; s (x, y) is the similarity of x and y.
Further, the ER-PIN network model parameters W and b, the entity relationship embedding representation X E and X R are graded using hinge loss, and then the model parameters are optimized using the product of the learning rate. The method of obtaining W, b, X E, and X R can be found in formula (8):
Where lr is the learning rate parameter.
Step S103, a plurality of to-be-complemented triples of the to-be-complemented power knowledge graph are obtained, and the similarity between every two power head entities, every two power tail entities and every two power relations in each to-be-complemented triplet is obtained based on the head entity embedded representation vector, the tail entity embedded representation vector and the relation embedded representation vector.
Determining a plurality of power head entities, a plurality of power tail entities and a plurality of power relations of the to-be-completed power knowledge graph in an entity set and a relation set of the to-be-completed power knowledge graph, and determining a first power head entity, a first power tail entity and a first power relation respectively in the plurality of power head entities, the plurality of power tail entities and the plurality of power relations; further, a first power triplet (first power head entity, first power relationship, first power tail entity) is determined; sequentially replacing a first power head entity in the first power triplet with other power head entities except the first power head entity in the plurality of power head entities to obtain a second power triplet set; further, sequentially replacing the first power relation of each second power triplet in the plurality of second power triplets contained in the second power triplet set with other power relations except the first power relation in the plurality of power relations to obtain a third power triplet set; and sequentially replacing the first power tail entity of each third power triplet in the plurality of third power triples contained in the third power triplet set with the rest power tail entities except the first power tail entity in the plurality of power tail entities to obtain a fourth power triplet set, and finally determining a plurality of fourth power triples in the fourth power triplet set as a plurality of to-be-complemented triples of the to-be-complemented power knowledge graph.
Each of the plurality of to-be-completed triples comprises a to-be-completed head entity, a to-be-completed relationship and a to-be-completed tail entity, and further, the first similarity between the to-be-completed head entity and the to-be-completed tail entity can be obtained based on the head entity embedded representation vector of the to-be-completed head entity and the tail entity embedded representation vector of the to-be-completed tail entity; acquiring a second similarity of the head entity to be complemented and the relationship to be complemented based on the head entity embedding representation vector of the head entity to be complemented and the relationship embedding representation vector of the relationship to be complemented; and obtaining a third similarity of the tail entity to be complemented and the relationship to be complemented based on the tail entity embedded representation vector of the tail entity to be complemented and the relationship embedded representation vector of the relationship to be complemented. The similarity calculation can be referred to as formula (9):
Wherein, the values of x and y are selected as any two of h out,rout,tout; s (x, y) is the similarity of x and y.
And step S104, based on the similarity, acquiring the evaluation index value of each to-be-completed triplet, and determining the to-be-completed triplet with the evaluation index value larger than the preset index threshold as the to-be-completed triplet of the to-be-completed electric power knowledge graph.
In one possible implementation manner, the sum of the first similarity, the second similarity and the inverse of the third similarity corresponding to each to-be-compensated triplet may be determined as an evaluation index value of each to-be-compensated triplet, as shown in formula (10), and a preset index threshold value for the evaluation index value may be preset, where the preset index threshold value may be used to measure the accuracy of the relationship determination of each to-be-compensated triplet, and may be a minimum evaluation index value satisfying the relationship determination accuracy condition, or may be an average value of evaluation index values of historical triples of the power knowledge graph of the power system. Under the condition that the evaluation index value of the to-be-completed triplet is larger than the preset index threshold value, the to-be-completed triplet is indicated to meet the relation determination accuracy condition, and the to-be-completed triplet can be determined to be the to-be-completed triplet and updated into the to-be-completed electric power knowledge graph; under the condition that the evaluation index value of the to-be-compensated triplet is smaller than or equal to the preset index threshold value, the to-be-compensated triplet is indicated to not meet the relation determination accuracy condition, and the to-be-compensated triplet can be abandoned.
Wherein S (T) is an evaluation index value of the triplet to be complemented.
And step S105, updating the to-be-complemented power knowledge graph based on the complement triples.
The method of the embodiment can determine a pre-constructed power knowledge graph as a power knowledge graph to be complemented, and acquire a plurality of power head entities, a plurality of power tail entities and a plurality of power relations of the power knowledge graph to be complemented; furthermore, a pre-built embedding model can be utilized to obtain a head entity embedding representation vector of each power head entity, a tail entity embedding representation vector of each power tail entity and a relation embedding representation vector of each power relation; then, a plurality of to-be-completed triples of the to-be-completed power knowledge graph can be obtained, and similarity between every two power head entities, every two power tail entities and every two power relations in each to-be-completed triples is obtained based on the head entity embedded representation vector, the tail entity embedded representation vector and the relation embedded representation vector; further, based on the similarity, an evaluation index value of each to-be-completed triplet is obtained, and the to-be-completed triplet with the evaluation index value larger than a preset index threshold value is determined to be the to-be-completed triplet of the to-be-completed electric power knowledge graph; therefore, the to-be-complemented power knowledge graph can be updated based on the complement triples. In the method provided by the embodiment of the application, the hidden relation between the entities of the electric power knowledge graph to be complemented can be mined by utilizing the pre-built embedded model, and then, some complementing triples can be mined, and the electric power knowledge graph to be complemented can be complemented and updated based on the complementing triples, so that the accuracy of the relation between the entities is improved, and the integrity of the electric power knowledge graph to be complemented is further improved.
In some embodiments, step S102 may include:
Acquiring a head entity initial vector of each power head entity; acquiring tail entity initial vectors of all power tail entities; acquiring a relation initial vector of each electric power relation; and respectively inputting the head entity initial vector, the tail entity initial vector and the relation initial vector into corresponding branch models in the pre-built embedded representation model to obtain head entity embedded representation vectors of all the power head entities, tail entity embedded representation vectors of all the tail entities and relation embedded representation vectors of all the power relations.
The embedding model may represent entities and relationships in the to-be-completed power knowledge-graph as vectors in a continuous vector space so as to capture semantic relationships between them. These models typically use neural networks to learn embedded representations of entities and relationships. In particular, these models learn embedded representations of entities and relationships by maximizing or minimizing some of the loss functions so that there are similar vector representations between similar entities and relationships in the vector space. Such representations may be used for a variety of tasks such as real-world linking, relational prediction, and recommendation systems. The embedded model in the embodiment of the application can be a three-branch parallel embedded model and can comprise a head entity embedded model, a tail entity embedded model and a relation embedded model, wherein the head entity embedded model can be used for learning the embedded representation of the electric head entity of the electric power knowledge graph to be complemented, namely, the head entity embedded representation vector of the electric head entity can be acquired based on the head entity initial vector of the electric head entity by utilizing the head entity embedded model; the tail entity embedding model can be used for learning the embedding representation of the electric power tail entity of the electric power knowledge graph to be complemented, namely, the tail entity embedding representation vector of the electric power tail entity can be obtained based on the tail entity initial vector of the electric power tail entity by utilizing the tail entity embedding model; the relation embedding model can be used for learning the embedding representation of the electric relation of the electric power knowledge graph to be complemented, namely the relation embedding representation vector of the electric power relation can be obtained based on the relation initial vector of the electric power relation by utilizing the relation embedding model.
The method of the embodiment can utilize the embedded model to infer the to-be-completed electric power knowledge graph, mine the relation among all electric power entities, and represent the entities and the relation in the to-be-completed electric power knowledge graph as vectors in a continuous vector space, thereby improving the accuracy of the relation among the entities and further improving the integrity of the to-be-completed electric power knowledge graph.
In some embodiments, the obtaining the plurality of to-be-completed triples of the to-be-completed power knowledge-graph in step S103 may include:
Combining each power head entity, each power tail entity and each power relation to obtain a plurality of triples to be complemented; each to-be-completed triplet includes a power head entity, a power tail entity, and a power relationship.
Determining a plurality of power head entities, a plurality of power tail entities and a plurality of power relations of the to-be-completed power knowledge graph in an entity set and a relation set of the to-be-completed power knowledge graph, and determining a first power head entity, a first power tail entity and a first power relation respectively in the plurality of power head entities, the plurality of power tail entities and the plurality of power relations; further, a first power triplet (first power head entity, first power relationship, first power tail entity) is determined; sequentially replacing a first power head entity in the first power triplet with other power head entities except the first power head entity in the plurality of power head entities to obtain a second power triplet set; further, sequentially replacing the first power relation of each second power triplet in the plurality of second power triplets contained in the second power triplet set with other power relations except the first power relation in the plurality of power relations to obtain a third power triplet set; and sequentially replacing the first power tail entity of each third power triplet in the plurality of third power triples contained in the third power triplet set with the rest power tail entities except the first power tail entity in the plurality of power tail entities to obtain a fourth power triplet set, and finally determining a plurality of fourth power triples in the fourth power triplet set as a plurality of to-be-complemented triples of the to-be-complemented power knowledge graph.
According to the method, all the triples of the to-be-complemented power knowledge graph, namely a plurality of to-be-complemented triples, can be obtained in a combined mode, the to-be-complemented triples are screened, the to-be-complemented triples meeting the relation determination accuracy condition are obtained, and the integrity of the to-be-complemented power knowledge graph is improved.
In some embodiments, the obtaining the similarity between the power head entity, the power tail entity, and the power relationship in each to-be-complemented triplet based on the head entity embedded representation vector, the tail entity embedded representation vector, and the relationship embedded representation vector in step S103 may include:
determining the electric power head entity in each triplet to be complemented as the head entity to be complemented, determining the electric power tail entity in each triplet to be complemented as the tail entity to be complemented, and determining the electric power relation in each triplet to be complemented as the relation to be complemented; acquiring first similarity of the head entity to be complemented and the tail entity to be complemented based on the head entity embedded representation vector of the head entity to be complemented and the tail entity embedded representation vector of the tail entity to be complemented; acquiring a second similarity of the head entity to be complemented and the relationship to be complemented based on the head entity embedding representation vector of the head entity to be complemented and the relationship embedding representation vector of the relationship to be complemented; and obtaining a third similarity of the tail entity to be complemented and the relationship to be complemented based on the tail entity embedded representation vector of the tail entity to be complemented and the relationship embedded representation vector of the relationship to be complemented.
Wherein, the similarity calculation can refer to formula (9):
Wherein, the values of x and y are selected as any two of h out,rout,tout; s (x, y) is the similarity of x and y.
According to the method, the multiple to-be-completed triples can be screened based on the similarity among the to-be-completed head entity, the to-be-completed tail entity and the to-be-completed relation of each to-be-completed triplet, so that the to-be-completed triples meeting the relation determination accuracy condition are obtained, and the integrity of the to-be-completed electric power knowledge graph is improved.
In some embodiments, as shown in fig. 3, the method for obtaining the first similarity may include:
step S301, obtaining a vector product of a head entity embedded representation vector of the head entity to be complemented and a tail entity embedded representation vector of the tail entity to be complemented.
Step S302, a first vector film of a head entity embedded representing vector of a head entity to be complemented and a second vector film of a tail entity embedded representing vector of a tail entity to be complemented are obtained.
Step S303, obtaining a film product of the first vector film and the second vector film, and determining a quotient of the vector product and the film product as a first similarity.
Similarly, the method for obtaining the second similarity may include: obtaining a vector product of a head entity embedded representation vector of a head entity to be complemented and a relation embedded representation vector of a relation to be complemented; acquiring a first vector film of a head entity embedded representation vector of a head entity to be complemented, and acquiring a second vector film of a relation embedded representation vector of a relation to be complemented; a film product of the first vector film and the second vector film is obtained, and a quotient of the vector product and the film product is determined as a first similarity. The method for obtaining the third similarity degree can comprise the following steps: obtaining a vector product of a tail entity embedding representation vector of a tail entity to be complemented and a relation embedding representation vector of a relation to be complemented; acquiring a first vector film of a tail entity embedded representation vector of a tail entity to be complemented, and acquiring a second vector film of a relation embedded representation vector of a relation to be complemented; a film product of the first vector film and the second vector film is obtained, and a quotient of the vector product and the film product is determined as a first similarity.
In some embodiments, as shown in fig. 4, the obtaining, based on the similarity in step S104, the evaluation index value of each triplet to be complemented may include:
in step S401, a first reciprocal of the first similarity is obtained, a second reciprocal of the second similarity is obtained, and a third reciprocal of the third similarity is obtained.
Step S402, the sum of the first reciprocal, the second reciprocal, and the third reciprocal is determined as an evaluation index value.
According to the method, the multiple to-be-completed triples can be screened based on the similarity among the to-be-completed head entity, the to-be-completed tail entity and the to-be-completed relation of each to-be-completed triplet, so that the to-be-completed triples meeting the relation determination accuracy condition are obtained, and the integrity of the to-be-completed electric power knowledge graph is improved.
In some embodiments, the embedded model may be verified based on the obtained multiple complement triples of the to-be-complemented power knowledge graph, taking any one of the multiple complement triples of the to-be-complemented power knowledge graph as an example, a current complement head entity in the current complement triplet may be sequentially replaced with other power entities except the current complement head entity in the multiple power entities of the to-be-complemented power knowledge graph, so as to obtain a triplet candidate set corresponding to the current complement triplet, and then, evaluation scores of multiple candidate triples and the current complement triplet in the triplet candidate set corresponding to the current complement triplet may be obtained, and the evaluation score may be referred to formula (11), where the evaluation score is used for measuring relationship determination accuracy of the corresponding triples; furthermore, the ranking of the evaluation scores of the current complement triples in the evaluation scores of all triples in the triples candidate set can be determined, and similarly, the evaluation score ranks corresponding to the multiple complement triples of the to-be-complemented power knowledge-graph can be obtained by using the same method, and further, the embedded model can be verified by using two model verification indexes shown in the formula (12).
Wherein,As norms, f (h, t) is a score function between h and t entities, and can be used to obtain the evaluation score of the triplet (h, r, t).
Wherein rank (i) is the first of the multiple complement triples of the power knowledge graph to be complementedRanking the evaluation scores corresponding to the complement triples; n is the number of the plurality of the complement triples of the to-be-complemented power knowledge graph; the smaller MeanRank is, the larger Hit@10 shows that the hinge prediction of the embedded model is more accurate, and the more accurate the implicit relation among entities for mining the to-be-complemented power knowledge graph can be understood.
It should be understood that, although the steps in the flowcharts related to the embodiments described above are sequentially shown as indicated by arrows, these steps are not necessarily sequentially performed in the order indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in the flowcharts described in the above embodiments may include a plurality of steps or a plurality of stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of the steps or stages is not necessarily performed sequentially, but may be performed alternately or alternately with at least some of the other steps or stages.
Based on the same inventive concept, the embodiment of the application also provides a knowledge graph completion device for realizing the knowledge graph completion method. The implementation of the solution provided by the device is similar to the implementation described in the above method, so the specific limitation in the embodiment of one or more knowledge graph completion devices provided below may refer to the limitation of the knowledge graph completion method hereinabove, and will not be repeated herein.
In one embodiment, as shown in fig. 5, there is provided a knowledge graph completion apparatus, including: an acquisition module 501, an embedded representation module 502, a calculation module 503, a screening module 504, and an update module 505, wherein:
The obtaining module 501 is configured to obtain a plurality of power head entities, a plurality of power tail entities, and a plurality of power relationships of the power knowledge graph to be complemented;
An embedding representation module 502, configured to obtain a head entity embedding representation vector of each power head entity, a tail entity embedding representation vector of each power tail entity, and a relationship embedding representation vector of each power relationship by using a pre-built embedding model;
A calculating module 503, configured to obtain a plurality of to-be-completed triples of the to-be-completed power knowledge graph, and obtain similarities between power head entities, power tail entities and power relationships in each to-be-completed triplet based on the head entity embedded representation vector, the tail entity embedded representation vector and the relationship embedded representation vector;
A screening module 504, configured to obtain an evaluation index value of each to-be-completed triplet based on the similarity, and determine the to-be-completed triplet, where the evaluation index value is greater than a preset index threshold, as a completed triplet of the to-be-completed power knowledge graph;
and the updating module 505 is configured to update the to-be-completed power knowledge graph based on the completion triples.
In addition, the embedded representation module 502 is further configured to: acquiring a head entity initial vector of each power head entity; acquiring tail entity initial vectors of the power tail entities; acquiring a relation initial vector of each electric power relation; and respectively inputting the head entity initial vector, the tail entity initial vector and the relation initial vector into corresponding branch models in the pre-built embedded representation model to obtain head entity embedded representation vectors of all the power head entities, tail entity embedded representation vectors of all the tail entities and relation embedded representation vectors of all the power relations.
The calculating module 503 is further configured to: combining each power head entity, each power tail entity and each power relation to obtain a plurality of to-be-complemented triples; each to-be-completed triplet comprises a power head entity, a power tail entity and a power relation.
In one possible implementation, the similarities include a first similarity, a second similarity, and a third similarity; a calculation module 503, further configured to: determining a power head entity in each to-be-completed triplet as a to-be-completed head entity, determining a power tail entity in each to-be-completed triplet as a to-be-completed tail entity, and determining a power relationship in each to-be-completed triplet as a to-be-completed relationship; acquiring the first similarity of the head entity to be complemented and the tail entity to be complemented based on the head entity embedded representation vector of the head entity to be complemented and the tail entity embedded representation vector of the tail entity to be complemented; acquiring the second similarity of the head entity to be complemented and the relationship to be complemented based on a head entity embedded representation vector of the head entity to be complemented and a relationship embedded representation vector of the relationship to be complemented; and acquiring the third similarity of the tail entity to be complemented and the relationship to be complemented based on the tail entity embedded representation vector of the tail entity to be complemented and the relationship embedded representation vector of the relationship to be complemented.
Further, the calculating module 503 is further configured to: obtaining a vector product of a head entity embedded representation vector of the head entity to be complemented and a tail entity embedded representation vector of the tail entity to be complemented; acquiring a first vector film of a head entity embedded representation vector of the head entity to be complemented, and acquiring a second vector film of a tail entity embedded representation vector of the tail entity to be complemented; and obtaining a film product of the first vector film and the second vector film, and determining a quotient of the vector product and the film product as the first similarity.
A screening module 504, further configured to: acquiring a first reciprocal of the first similarity, acquiring a second reciprocal of the second similarity, and acquiring a third reciprocal of the third similarity; determining a sum of the first reciprocal, the second reciprocal, and the third reciprocal as the evaluation index value.
All or part of the modules in the knowledge graph completion device can be realized by software, hardware and a combination thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided, which may be a server, the internal structure of which may be as shown in fig. 6. The computer device includes a processor, a memory, and a network interface connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the computer device is used for storing knowledge graph completion related data. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program when executed by a processor implements a knowledge graph completion method.
It will be appreciated by those skilled in the art that the structure shown in FIG. 6 is merely a block diagram of some of the structures associated with the present inventive arrangements and is not limiting of the computer device to which the present inventive arrangements may be applied, and that a particular computer device may include more or fewer components than shown, or may combine some of the components, or have a different arrangement of components.
In an embodiment, there is also provided a computer device comprising a memory and a processor, the memory having stored therein a computer program, the processor implementing the steps of the method embodiments described above when the computer program is executed.
In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored which, when executed by a processor, carries out the steps of the method embodiments described above.
In an embodiment, a computer program product is provided, comprising a computer program which, when executed by a processor, implements the steps of the method embodiments described above.
The user information (including but not limited to user equipment information, user personal information, etc.) and the data (including but not limited to data for analysis, stored data, presented data, etc.) related to the present application are information and data authorized by the user or sufficiently authorized by each party.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, database, or other medium used in embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high density embedded nonvolatile memory, resistive random access memory (ReRAM), magneto-resistive random access memory (Magnetoresistive Random Access Memory, MRAM), ferroelectric memory (Ferroelectric Random Access Memory, FRAM), phase change memory (PHASE CHANGE memory, PCM), graphene memory, and the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, and the like. By way of illustration, and not limitation, RAM can be in various forms such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), etc. The databases referred to in the embodiments provided herein may include at least one of a relational database and a non-relational database. The non-relational database may include, but is not limited to, a blockchain-based distributed database, and the like. The processor referred to in the embodiments provided in the present application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic unit, a data processing logic unit based on quantum computing, or the like, but is not limited thereto.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The foregoing examples illustrate only a few embodiments of the application and are described in detail herein without thereby limiting the scope of the application. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the application, which are all within the scope of the application. Accordingly, the scope of the application should be assessed as that of the appended claims.
Claims (10)
1. A knowledge graph completion method, the method comprising:
Acquiring a plurality of power head entities, a plurality of power tail entities and a plurality of power relations of a power knowledge graph to be complemented;
Acquiring a head entity embedded representation vector of each power head entity, a tail entity embedded representation vector of each power tail entity and a relation embedded representation vector of each power relation by utilizing a pre-constructed embedded model;
Acquiring a plurality of to-be-complemented triples of the to-be-complemented power knowledge graph, and acquiring the similarity between a power head entity, a power tail entity and a power relation in each to-be-complemented triplet based on the head entity embedded representation vector, the tail entity embedded representation vector and the relation embedded representation vector;
Based on the similarity, acquiring an evaluation index value of each to-be-complemented triplet, and determining the to-be-complemented triplet with the evaluation index value larger than a preset index threshold as the to-be-complemented triplet of the to-be-complemented power knowledge graph;
And updating the to-be-completed power knowledge graph based on the completion triples.
2. The method of claim 1, wherein the obtaining, using a pre-built embedding model, a head entity embedded representation vector for each of the power head entities, a tail entity embedded representation vector for each of the tail entities, and a relationship embedded representation vector for each of the power relationships, comprises:
acquiring a head entity initial vector of each power head entity;
acquiring tail entity initial vectors of the power tail entities;
acquiring a relation initial vector of each electric power relation;
And respectively inputting the head entity initial vector, the tail entity initial vector and the relation initial vector into corresponding branch models in the pre-built embedded representation model to obtain head entity embedded representation vectors of all the power head entities, tail entity embedded representation vectors of all the tail entities and relation embedded representation vectors of all the power relations.
3. The method of claim 1, wherein the obtaining the plurality of to-be-completed triples of the to-be-completed power knowledge-graph comprises:
Combining each power head entity, each power tail entity and each power relation to obtain a plurality of to-be-complemented triples; each to-be-completed triplet comprises a power head entity, a power tail entity and a power relation.
4. The method of claim 1, wherein the similarities include a first similarity, a second similarity, and a third similarity; the obtaining the similarity between the power head entity, the power tail entity and the power relation in each to-be-complemented triplet based on the head entity embedded representation vector, the tail entity embedded representation vector and the relation embedded representation vector comprises the following steps:
Determining a power head entity in each to-be-completed triplet as a to-be-completed head entity, determining a power tail entity in each to-be-completed triplet as a to-be-completed tail entity, and determining a power relationship in each to-be-completed triplet as a to-be-completed relationship;
Acquiring the first similarity of the head entity to be complemented and the tail entity to be complemented based on the head entity embedded representation vector of the head entity to be complemented and the tail entity embedded representation vector of the tail entity to be complemented;
Acquiring the second similarity of the head entity to be complemented and the relationship to be complemented based on a head entity embedded representation vector of the head entity to be complemented and a relationship embedded representation vector of the relationship to be complemented;
And acquiring the third similarity of the tail entity to be complemented and the relationship to be complemented based on the tail entity embedded representation vector of the tail entity to be complemented and the relationship embedded representation vector of the relationship to be complemented.
5. The method of claim 4, wherein the obtaining the first similarity of the head entity to be completed and the tail entity to be completed based on the head entity embedded representation vector of the head entity to be completed and the tail entity embedded representation vector of the tail entity to be completed comprises:
obtaining a vector product of a head entity embedded representation vector of the head entity to be complemented and a tail entity embedded representation vector of the tail entity to be complemented;
Acquiring a first vector film of a head entity embedded representation vector of the head entity to be complemented, and acquiring a second vector film of a tail entity embedded representation vector of the tail entity to be complemented;
And obtaining a film product of the first vector film and the second vector film, and determining a quotient of the vector product and the film product as the first similarity.
6. The method of claim 4, wherein the obtaining the evaluation index value of each of the to-be-completed triples based on the similarity comprises:
acquiring a first reciprocal of the first similarity, acquiring a second reciprocal of the second similarity, and acquiring a third reciprocal of the third similarity;
Determining a sum of the first reciprocal, the second reciprocal, and the third reciprocal as the evaluation index value.
7. A knowledge graph completion device, the device comprising:
The acquisition module is used for acquiring a plurality of power head entities, a plurality of power tail entities and a plurality of power relations of the power knowledge graph to be complemented;
The embedded representation module is used for acquiring a head entity embedded representation vector of each power head entity, a tail entity embedded representation vector of each power tail entity and a relation embedded representation vector of each power relation by utilizing a pre-built embedded model;
The computing module is used for acquiring a plurality of to-be-completed triples of the to-be-completed power knowledge graph, and acquiring the similarity between every two power head entities, every two power tail entities and every two power relations in each to-be-completed triplet based on the head entity embedded representation vector, the tail entity embedded representation vector and the relation embedded representation vector;
the screening module is used for acquiring the evaluation index value of each to-be-completed triplet based on the similarity, and determining the to-be-completed triplet with the evaluation index value larger than a preset index threshold as the to-be-completed triplet of the to-be-completed electric power knowledge graph;
And the updating module is used for updating the to-be-completed electric power knowledge graph based on the completion triples.
8. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any of claims 1-6 when the computer program is executed.
9. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1-6.
10. A computer program product comprising a computer program, characterized in that the computer program, when being executed by a processor, implements the steps of the method according to any of claims 1-6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202410118780.3A CN117909517A (en) | 2024-01-29 | 2024-01-29 | Knowledge graph completion method, apparatus, device, storage medium, and program product |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202410118780.3A CN117909517A (en) | 2024-01-29 | 2024-01-29 | Knowledge graph completion method, apparatus, device, storage medium, and program product |
Publications (1)
Publication Number | Publication Date |
---|---|
CN117909517A true CN117909517A (en) | 2024-04-19 |
Family
ID=90687705
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202410118780.3A Pending CN117909517A (en) | 2024-01-29 | 2024-01-29 | Knowledge graph completion method, apparatus, device, storage medium, and program product |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117909517A (en) |
-
2024
- 2024-01-29 CN CN202410118780.3A patent/CN117909517A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112529168B (en) | GCN-based attribute multilayer network representation learning method | |
CN114048331A (en) | Knowledge graph recommendation method and system based on improved KGAT model | |
CN112131261B (en) | Community query method and device based on community network and computer equipment | |
CN111782826A (en) | Knowledge graph information processing method, device, equipment and storage medium | |
CN113642716B (en) | Depth variation self-encoder model training method, device, equipment and storage medium | |
CN114579584A (en) | Data table processing method and device, computer equipment and storage medium | |
KR101467707B1 (en) | Method for instance-matching in knowledge base and device therefor | |
CN114330703A (en) | Method, device and equipment for updating search model and computer-readable storage medium | |
CN116992008A (en) | Knowledge graph multi-hop question-answer reasoning method, device and computer equipment | |
Petersen | Learning with differentiable algorithms | |
Huang et al. | Community detection algorithm for social network based on node intimacy and graph embedding model | |
CN116975743A (en) | Industry information classification method, device, computer equipment and storage medium | |
CN114936327B (en) | Element recognition model acquisition method and device, computer equipment and storage medium | |
CN116467466A (en) | Knowledge graph-based code recommendation method, device, equipment and medium | |
CN116191398A (en) | Load prediction method, load prediction device, computer equipment and storage medium | |
US20230018525A1 (en) | Artificial Intelligence (AI) Framework to Identify Object-Relational Mapping Issues in Real-Time | |
CN116150462A (en) | Vector construction method and device for target object and computer equipment | |
CN117909517A (en) | Knowledge graph completion method, apparatus, device, storage medium, and program product | |
CN114821248A (en) | Point cloud understanding-oriented data active screening and labeling method and device | |
US11829735B2 (en) | Artificial intelligence (AI) framework to identify object-relational mapping issues in real-time | |
CN117829287A (en) | Method, device, equipment and storage medium for evaluating performance of knowledge graph embedded model | |
CN118349916A (en) | Time sequence data prediction method, device, computer equipment and storage medium | |
CN116186170A (en) | Entity confirmation method, device, computer equipment and storage medium of triplet | |
Wu | Spatial-Temporal Data Modeling with Graph Neural Networks | |
CN116757269A (en) | Logic programming prediction model training method, logic programming method and device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |