CN113961720A - Method for predicting entity relationship and method and device for training relationship prediction model - Google Patents
Method for predicting entity relationship and method and device for training relationship prediction model Download PDFInfo
- Publication number
- CN113961720A CN113961720A CN202111279960.2A CN202111279960A CN113961720A CN 113961720 A CN113961720 A CN 113961720A CN 202111279960 A CN202111279960 A CN 202111279960A CN 113961720 A CN113961720 A CN 113961720A
- Authority
- CN
- China
- Prior art keywords
- entity
- graph
- knowledge
- relationship
- target
- 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 82
- 238000012549 training Methods 0.000 title claims abstract description 39
- 238000013528 artificial neural network Methods 0.000 claims abstract description 35
- 238000004422 calculation algorithm Methods 0.000 claims description 20
- 230000006870 function Effects 0.000 claims description 13
- 238000004590 computer program Methods 0.000 claims description 11
- 238000013473 artificial intelligence Methods 0.000 abstract description 4
- 238000013135 deep learning Methods 0.000 abstract description 2
- 238000010586 diagram Methods 0.000 description 19
- 239000003814 drug Substances 0.000 description 9
- 229940079593 drug Drugs 0.000 description 9
- 239000013598 vector Substances 0.000 description 9
- 238000004891 communication Methods 0.000 description 8
- 230000008569 process Effects 0.000 description 8
- 238000012545 processing Methods 0.000 description 8
- 201000010099 disease Diseases 0.000 description 6
- 208000037265 diseases, disorders, signs and symptoms Diseases 0.000 description 6
- 239000011159 matrix material Substances 0.000 description 6
- 230000004048 modification Effects 0.000 description 3
- 238000012986 modification Methods 0.000 description 3
- 230000003287 optical effect Effects 0.000 description 3
- 238000005295 random walk Methods 0.000 description 3
- 230000015572 biosynthetic process Effects 0.000 description 2
- 238000004364 calculation method Methods 0.000 description 2
- 230000000857 drug effect Effects 0.000 description 2
- 230000003993 interaction Effects 0.000 description 2
- 230000004044 response Effects 0.000 description 2
- 230000002411 adverse Effects 0.000 description 1
- 230000002776 aggregation Effects 0.000 description 1
- 238000004220 aggregation Methods 0.000 description 1
- 238000003491 array Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000001413 cellular effect Effects 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 238000013527 convolutional neural network Methods 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 238000010801 machine learning Methods 0.000 description 1
- 239000002547 new drug Substances 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
- 230000000644 propagated effect Effects 0.000 description 1
- 238000011160 research Methods 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 230000001953 sensory effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 208000024891 symptom Diseases 0.000 description 1
- 230000001225 therapeutic effect Effects 0.000 description 1
- 238000013519 translation Methods 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
Images
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
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/045—Combinations of networks
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- Life Sciences & Earth Sciences (AREA)
- General Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- Computational Linguistics (AREA)
- General Health & Medical Sciences (AREA)
- Mathematical Physics (AREA)
- Biophysics (AREA)
- Molecular Biology (AREA)
- Computing Systems (AREA)
- Biomedical Technology (AREA)
- Artificial Intelligence (AREA)
- Evolutionary Computation (AREA)
- Software Systems (AREA)
- Health & Medical Sciences (AREA)
- Animal Behavior & Ethology (AREA)
- Databases & Information Systems (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
Abstract
The disclosure provides a method for predicting entity relationships and a method, a device, equipment and a medium for training a relationship prediction model, and relates to the field of artificial intelligence, in particular to the field of deep learning and knowledge maps. The concrete implementation scheme of the method for predicting the entity relationship comprises the following steps: determining first embedded features of each entity in the first knowledge-graph and second embedded features of each entity relationship in the first knowledge-graph; and determining an entity relationship between two target entities in the first knowledge-graph without entity relationship using a relationship prediction model comprising a graph neural network based on the first embedded features, the second embedded features, and the first knowledge-graph.
Description
Technical Field
The present disclosure relates to the field of artificial intelligence, in particular to the field of deep learning and knowledge maps, and more particularly to a method for predicting entity relationships and a method and apparatus for training a relationship prediction model, an electronic device, and a storage medium.
Background
Entity relation prediction is a research hotspot in the field of artificial intelligence application. In the related art, when predicting an entity relationship, the entity relationship is generally predicted by using a closest distance method, a random walk method, or the like. The methods have the problems of low prediction precision and incomplete prediction results.
Disclosure of Invention
Provided are a method, apparatus, electronic device, and storage medium for predicting entity relationships that improve prediction accuracy.
One aspect of the present disclosure provides a method of predicting entity relationships, comprising: determining first embedded features of each entity in the first knowledge-graph and second embedded features of each entity relationship in the first knowledge-graph; and determining an entity relationship between two target entities in the first knowledge-graph without entity relationship using a relationship prediction model comprising a graph neural network based on the first embedded features, the second embedded features, and the first knowledge-graph.
Another aspect of the present disclosure provides a method for training a relational prediction model, including: determining third embedded features of each entity in the second knowledge-graph and fourth embedded features of each entity relationship in the second knowledge-graph; determining sample data for a relationship prediction model comprising a graph neural network based on a plurality of entities in the second knowledge-graph and entity relationships between the entities, the sample data comprising third embedded features of two entities in the second knowledge-graph and actual entity relationships of the two entities; determining a predicted entity relationship between the two entities using a relationship prediction model comprising a graph neural network based on the sample data and the second knowledge graph; and training a relationship prediction model comprising a graph neural network based on the predicted entity relationship and the actual entity relationship.
Another aspect of the present disclosure provides an apparatus for predicting entity relationships, comprising: a first feature determination module for determining first embedded features of each entity in the first knowledge-graph and second embedded features of each entity relationship in the first knowledge-graph; and a first relationship determination module for determining an entity relationship between two target entities in the first knowledge graph without entity relationship using a relationship prediction model comprising a graph neural network based on the first embedded features, the second embedded features, and the first knowledge graph.
Another aspect of the present disclosure provides a training apparatus for a relational prediction model, including: a second feature determination module to determine a third embedded feature for each entity in the second knowledge-graph and a fourth embedded feature for each entity relationship in the second knowledge-graph; a sample data determination module for determining sample data for a relationship prediction model comprising a graph neural network based on a plurality of entities in the second knowledge graph and entity relationships between the entities, the sample data comprising third embedded features of two entities in the second knowledge graph and actual entity relationships of the two entities; a second relationship determination module for determining a predicted entity relationship between the two entities using a relationship prediction model comprising a graph neural network based on the sample data and the second knowledge graph; and a model training module for training a relationship prediction model including a graph neural network based on the predicted entity relationship and the actual entity relationship.
Another aspect of the present disclosure provides an electronic device including: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the methods of predicting entity relationships and/or training of relationship prediction models provided by the present disclosure.
According to another aspect of the present disclosure, there is provided a non-transitory computer-readable storage medium storing computer instructions for causing a computer to perform the method of predicting entity relationships and/or the method of training a relationship prediction model provided by the present disclosure.
According to another aspect of the present disclosure, a computer program product is provided, comprising a computer program which, when executed by a processor, implements the method of predicting entity relationships and/or the method of training a relationship prediction model provided by the present disclosure.
It should be understood that the statements in this section do not necessarily identify key or critical features of the embodiments of the present disclosure, nor do they limit the scope of the present disclosure. Other features of the present disclosure will become apparent from the following description.
Drawings
The drawings are included to provide a better understanding of the present solution and are not to be construed as limiting the present disclosure. Wherein:
FIG. 1 is a schematic diagram of an application scenario of a method for predicting entity relationships and a method and an apparatus for training a relationship prediction model according to an embodiment of the present disclosure;
FIG. 2 is a schematic flow diagram of a method of predicting entity relationships in accordance with an embodiment of the present disclosure;
FIG. 3 is a schematic diagram of the determination of an entity relationship between two target entities in accordance with an embodiment of the present disclosure;
FIG. 4 is a schematic diagram of determining an entity relationship between two target entities according to another embodiment of the present disclosure;
FIG. 5 is a schematic diagram illustrating the principle of determining context information for each triple in accordance with an embodiment of the present disclosure;
FIG. 6 is a flow diagram of a method of training a relational prediction model according to an embodiment of the disclosure;
FIG. 7 is a block diagram of an apparatus for predicting entity relationships according to an embodiment of the present disclosure;
FIG. 8 is a block diagram of a training apparatus for a relational prediction model according to an embodiment of the present disclosure; and
fig. 9 is a block diagram of an electronic device for implementing a method for predicting entity relationships and/or a method for training a relationship prediction model according to an embodiment of the present disclosure.
Detailed Description
Exemplary embodiments of the present disclosure are described below with reference to the accompanying drawings, in which various details of the embodiments of the disclosure are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present disclosure. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
The present disclosure provides a method of predicting entity relationships, the method comprising a feature determination phase and a relationship determination phase. In a feature determination phase, first embedded features for each entity in the first knowledge-graph and second embedded features for each entity relationship in the first knowledge-graph are determined. In the relationship determination stage, based on the first embedded features, the second embedded features, and the first knowledge graph, an entity relationship between two target entities in the first knowledge graph without entity relationship is determined using a relationship prediction model including a graph neural network.
An application scenario of the method and apparatus provided by the present disclosure will be described below with reference to fig. 1.
Fig. 1 is a schematic application scenario diagram of a method for predicting entity relationships and a method and an apparatus for training a relationship prediction model according to an embodiment of the present disclosure.
As shown in fig. 1, the application scenario 100 of this embodiment may include an electronic device 110. The electronic device 110 may be a variety of devices with processing capabilities including, but not limited to, smart phones, tablets, laptop portable computers, desktop computers, and the like.
For example, the electronic device 110 may have installed thereon various client applications, including but not limited to an instant messaging type application, a relationship prediction type application, a news type application, and the like (by way of example only).
As shown in FIG. 1, the electronic device 110 may store, for example, a knowledge-graph 120, where the knowledge-graph 120 includes a plurality of entities and entity relationships between the entities. In the knowledge graph 120, a plurality of entities are represented by a plurality of nodes, respectively, and entity relationships between the entities are represented by connecting edges between the nodes. The electronic device 110 may, for example, mine the entity relationship 130 for two entities in the knowledge-graph 120 that do not have an entity relationship. The electronic device 110 can also extend the knowledge-graph 120 based on, for example, mined entity relationships 130. By the method, the expanded knowledge graph can better reflect the association relation between the entities.
In one embodiment, the closest distance method or the random walk method may be employed, for example, to mine the entity relationships of two entities in the knowledge graph that are not connected. An embedding algorithm may be used to embed the elements (entities and entity relationships) in the knowledge-graph, and then a relationship prediction model may be used to mine the entity relationships from the embedded representations. The Embedding algorithm may be, for example, a transform Embedding algorithm (transform), a hyperplane transform algorithm (transform on Hyperplanes), or the like.
In one embodiment, as shown in fig. 1, the application scenario 100 may further include a server 140, and the server 140 may be a background management server providing support for a client application running in the electronic device 110. The server 140 may have the relational prediction model 150 trained in advance, and may transmit the relational prediction model 150 to the electronic device 110 in response to a model acquisition request of the electronic device 110. For example, the server 140 may also store the knowledge graph 120, and determine sample data of the relational prediction model according to the entities in the knowledge graph 120 and the association relationship between the entities, so as to train the relational prediction model 150 according to the sample data.
In one embodiment, a knowledge-graph 120 may be maintained in the server 140. The electronic device 110 may send a relationship prediction request to the server 140. Two target entities may be included in the relationship prediction request. The server 140 may predict an entity relationship between two target entities based on the knowledge-graph 120 and the relationship prediction model 150 in response to a relationship prediction request. The server 140 may also feed back the predicted entity relationship to the electronic device 110 for use or presentation by the electronic device.
It should be noted that the method for predicting entity relationships provided by the present disclosure may be executed by the electronic device 110 or the server 140. Accordingly, the apparatus for predicting entity relationships provided by the present disclosure may be disposed in the electronic device 110 or the server 140. The training method of the relationship prediction model provided by the present disclosure may be performed by the server 140. Accordingly, the training device of the relationship prediction model provided by the present disclosure may be disposed in the server 140.
It will be appreciated that the types of electronic devices, knowledge profiles, and servers in FIG. 1 are merely illustrative. There may be any type of electronic device, knowledge graph, and server, as desired for implementation.
The method for predicting entity relationships provided by the present disclosure will be described in detail with reference to fig. 2 to 5 in conjunction with fig. 1.
Fig. 2 is a schematic flow chart diagram of a method of predicting entity relationships according to an embodiment of the present disclosure.
As shown in fig. 2, the method 200 of predicting entity relationships of this embodiment may include operations S210 to S220.
In operation S210, first embedded features of each entity in the first knowledge-graph and second embedded features of each entity relationship in the first knowledge-graph are determined.
According to embodiments of the present disclosure, the first knowledge-graph may represent a plurality of entities and entity relationships between the entities. For example, the first knowledge-graph may represent a plurality of entities by a plurality of nodes, and the entity relationship between two entities is represented by edges connecting the nodes. The entities may be, for example, drugs, diseases, doctors, symptoms, etc., or may be actors, movie names, directors, movie titles, etc. It is understood that the entity may be set according to actual requirements, and accordingly, the type of the entity relationship may be determined according to the entity, which is not limited in this disclosure. For example, if the entities in the first knowledge-graph include drugs and diseases, the entity relationships may include treatment relationships.
According to the embodiment of the disclosure, the entities and the relationships among the entities can be extracted from multimedia information such as professional books, authoritative reports, magazines and the like, so that a plurality of triples are obtained, and then the first knowledge graph can be constructed and obtained based on the triples. Two entities having entity relationships and entity relationships between the two entities may form a triple. For example, a triplet may include a head entity h and a tail entity t, and the entity relationship between the two entities may be represented by r, and in a knowledge graph, the connecting edges representing r point from the node representing h to the node representing t.
According to an embodiment of the present disclosure, a TransE algorithm or the like may be employed to determine the first embedding feature and the second embedding feature. In the TransE algorithm, entities and entity relationships are mapped to a vector space, and both the entities and the entity relationships can be represented by vectors. The main idea of the TransE algorithm is to combine triplesThe relationship in (h, r, t) is equivalent to the process of operation from the vector representing the head entity to the vector representing the tail entity, which is called translation. The TransE algorithm maximizes the likelihood of a triplet being established by measuring the distance between the sum of the vector H representing H and the vector R representing the entity relationship R, and the vector T representing T, and thus obtains the embedded features of the entity and the embedded features of the entity relationship. Wherein, the distance between H + R and T can be L1Distance or L2Distance. It is understood that the embodiment may also employ the TransH algorithm, the TransR algorithm, etc. to derive the embedding characteristics of the entities and the embedding characteristics of the entity relationships.
In operation S220, an entity relationship between two target entities in the first knowledge-graph without entity relationship is determined using a relationship prediction model including a graph neural network based on the first embedded features, the second embedded features, and the first knowledge-graph.
According to an embodiment of the present disclosure, there is no connecting edge between the two nodes representing the two target entities in the first knowledge-graph. The two target entities may be two different types of entities, or may be the same type of entity, for example. For example, if the entities in the first knowledge-graph can include drugs and diseases, one of the two target entities can be a drug and the other can be a disease.
According to embodiments of the present disclosure, the relational prediction model may include, for example, a graph neural network and a classification network. The embodiment may input the first embedded features of each of the two target entities and the structural information of the first knowledge-graph into the graph neural network, resulting in feature data of each target entity represented according to the neighboring entities of the each target entity in the first knowledge-graph. I.e. the graph neural network is used to extract the features of each target entity from the first knowledge-graph. Two characteristic data representing two target entities are thus available. The embodiment may then take the two feature data as inputs to a classification network, which outputs a probability that the two target entities have an entity relationship. If the probability is greater than the threshold, the two can be determinedThe target entities have entity relationships. Wherein the structural information of the first knowledge-graph can be obtained by: the entities in the first knowledge graph are sequentially encoded, and then the sequentially encoded entities are represented by the first embedded features, so that an embedded feature matrix can be obtained. Each row in the embedded feature matrix represents a first embedded feature of an entity. Setting the first embedding feature as an N-dimensional vector, and setting the number of entities in the first knowledge graph as M, wherein the size of the obtained embedding feature matrix is N multiplied by M. And then obtaining a relation matrix A according to the entity relation between any two entities in the sequentially coded entities, wherein the size of the relation matrix A is M multiplied by M. Wherein the element a in the relation matrixijAnd the entity relationship between the ith entity and the jth entity in the M sequentially coded entities is shown. If there is no entity relationship, then aijIs 0. If the entity relationships in the first knowledge graph are of multiple types, different types of entity relationships can be represented by assigning different values to the elements.
In one embodiment, if there are multiple predicted entity relationships, the probability output by the classification network is multiple probabilities corresponding to the multiple entity relationships one to one. The embodiment may select a probability greater than a threshold from the plurality of probabilities, and regard an entity relationship corresponding to the probability greater than the threshold as an entity relationship between two target entities.
For example, where two target entities include drugs and diseases, the predicted entity relationships may include therapeutic relationships, adverse relationships, and the like. In a drug redirection scenario, the predicted entity relationship may be a treatment relationship, and through prediction of the entity relationship, potential drug effects may be mined for existing marketed drugs to treat new diseases using old drugs. This is because the marketed drug already has complete safety and pharmacokinetic data, which can reduce the risk of developing this new drug effect.
According to an embodiment of the present disclosure, the graph neural network may be, for example, a graph convolutional neural network, and the classification network may determine whether an entity relationship exists between two target entities according to a similarity between two feature data, for example. Alternatively, the classification network may adopt a structure in which a plurality of layers of sensors and a softmax layer are connected, and the like, which is not limited by the present disclosure.
The embodiment of the disclosure combines the embedded representation of the knowledge graph with the graph neural network, and can learn the characteristics of the neighbor entities of the entity through the graph neural network on the basis of obtaining the embedded characteristics of the entity and the entity relation. Compared with a random walk algorithm or a nearest distance method in the related art, the method can consider multi-angle information when predicting the entity relationship, so that the prediction precision of the entity relationship can be improved to a certain extent, and the potential relationship between entities can be effectively mined.
FIG. 3 is a schematic diagram illustrating a principle of determining an entity relationship between two target entities according to an embodiment of the present disclosure.
According to the embodiment of the present disclosure, when performing relationship prediction, for example, it may be only predicted whether there is a target entity relationship between two target entities. Accordingly, at least one target entity pair may be initially screened from the first knowledge-graph according to the target entity relationship, and two entities included in each target entity pair may have the target entity relationship.
For example, as shown in fig. 3, when determining an entity relationship between two target entities having no entity relationship in the first knowledge-graph, the embodiment 300 may first select an embedded feature of the target entity relationship from the second embedded features 310 of the entity relationship in the first knowledge-graph, and use the found embedded feature as a target embedded feature. For example, in this embodiment, the target entity relationships in the first knowledge-graph may have annotations added. After obtaining the second embedded feature 310, an embedded feature corresponding to the entity relationship added with the identifier in the second embedded feature may be used as the target embedded feature.
After obtaining the target embedded features 320, at least one target entity pair in the first knowledge-graph may be determined based on the target embedded features and the first embedded features of the entities in the first knowledge-graph.
For example, the embodiment 300 may first derive a first knowledge-graph 330 for nodes 331 representing each entityOther nodes which are not connected with the node through edges are selected, and the entity represented by the other nodes is taken as the candidate entity 332. The first embedded features of each entity are then added to the target embedded features and the distance between the added features and the first embedded features of each candidate entity is calculated. Each candidate entity corresponding to the first embedded feature having a distance from the feature sum less than the predetermined distance is taken as a target entity 333 that may have a target entity relationship with the each entity and forms a target entity pair with the each entity. Wherein the distance between the feature and the first embedded feature may be L1Distance or L2Distance, etc. For each entity in the knowledge graph, the target entity which may have a target entity relationship with each entity can be determined through the above process. Finally, the embodiment may perform a deduplication operation on all the obtained target entity pairs to obtain at least one target entity pair 340. Each target entity pair of the at least one target entity pair 340 includes two target entities that have no entity relationship in the first knowledge-graph 330.
After obtaining the at least one target entity pair, a relationship prediction model may be employed to determine whether each target entity pair has a target entity relationship based on the at least one target entity pair and the first knowledge-graph.
For example, in this embodiment, the structural information of the first knowledge-graph 330 and the two first embedded features 350 of each target entity pair 340 may be input to a relationship prediction model 360, and a probability 370 that the two entities in each target entity pair 340 have a target entity relationship may be output by the relationship prediction model 360. As such, at least one probability may be derived for at least one target entity pair. In the case that at least one target entity pair is multiple, the embodiment may take a target entity pair corresponding to several probabilities with a larger value among the multiple probabilities as a target entity pair having an entity relationship.
FIG. 4 is a schematic diagram of determining an entity relationship between two target entities according to another embodiment of the present disclosure.
According to an embodiment of the present disclosure, after obtaining at least one target entity pair, for example, the first knowledge-graph may be further expanded based on the at least one target entity pair, and whether the target entity pair has a target entity relationship may be determined based on the expanded knowledge-graph.
For example, as shown in fig. 4, in the embodiment 400, the first knowledge graph 410 may include entities 411 to 415, the entity 411 and the entity 413 have an entity relationship, the entity 412 and the entity 414, the entity 412 and the entity 413, and the entity 412 and the entity 415 have an entity relationship, and the entity 414 and the entity 415 have an entity relationship.
The at least one target entity pair obtained by the foregoing embodiment includes an entity pair composed of the entity 411 and the entity 415, an entity pair composed of the entity 411 and the entity 412, an entity pair composed of the entity 411 and the entity 414, an entity pair composed of the entity 413 and the entity 414, and an entity pair composed of the entity 413 and the entity 415. The expansion of the first knowledge-graph 410 may be accomplished by adding edges connecting two nodes representing two entities in each pair of entities in the first knowledge-graph 410, resulting in an expanded knowledge-graph 420.
After the extended knowledge graph 420 is obtained, the first embedded features of the two target entities included in each target entity pair and the structural information of the extended knowledge graph 420 may be input to a relationship prediction model, and the probability that the two target entities in each target entity pair have a target entity relationship may be output by the relationship prediction model.
It should be noted that, in the expanded knowledge graph, a weight may be added to the edge representing the entity relationship. For example, for a first entity relationship existing in the first knowledge-graph, the weight of an edge representing the first entity relationship may be 1. For a second entity relationship obtained by expanding the first knowledge-graph, an edge representing the second entity relationship (e.g., an edge represented by a dotted line in fig. 4) is weighted to a predetermined value less than 1. The predetermined value may be any value such as 0.8, 0.6, etc., which is not limited by this disclosure.
The embodiment can improve the accuracy of the characteristics of the target entity extracted by the graph neural network by expanding the first knowledge graph, and is beneficial to improving the accuracy of the determined target entity relationship.
According to embodiments of the present disclosure, a first embedded feature of each entity in a first knowledge-graph and a second embedded feature of each entity relationship in the first knowledge-graph may be determined based on context information in the first knowledge-graph for each triplet making up the first knowledge-graph. Therefore, the expression capability of the embedded features is improved, and the accuracy of the subsequently determined entity relationship is improved conveniently.
The embodiment may determine the context information for each triplet based on the locations of the two entities in each triplet within the knowledge-graph.
For example, other entities in the knowledge-graph connected to the head entity h and other entities connected to the tail entity t may be taken as context information of the triples.
For example, a first entity connected to the center point may be determined with the head entity h as the center point, and then a plurality of second entities connected to the first entity in a direction away from the entity h may be determined with the first entity as the center point. And taking all entities and entity relations in a range formed by connecting a plurality of second entities as the context information of each triplet. It will be appreciated that the process of determining connected entities each time an entity is centered on the entity is a knowledge propagation process. In this embodiment, the entity and the entity relationship obtained through m knowledge propagation processes with the head entity h as a central point may be used as the context information of the triplet to which the head entity h belongs. Wherein m can be any positive integer set according to actual requirements. In the knowledge propagation process, for example, the knowledge may be propagated only along the pointing direction of the connecting edge, which is not limited by the present disclosure.
In one embodiment, the previously described TransE algorithm or the like may be used to obtain the initial embedding characteristics of each entity and the initial embedding characteristics of each entity relationship in the knowledge-graph. Then, the initial embedding feature of the other entity to which the head entity h is connected and the weighted feature of the initial embedding feature of the head entity h can be taken as the first embedding feature of the head entity h. Similarly, a first embedding feature of the tail entity t may be obtained. The second embedding characteristic of the entity relation can adopt an initial embedding characteristic obtained by a TransE algorithm.
In an embodiment, after obtaining the context information of each triple, the probability of establishing each triple may be determined according to the context information. Then, based on the probability of satisfaction, an objective function associated with the probability of satisfaction is maximized, resulting in a first embedded feature for each entity and a second embedded feature for each entity relationship.
For example, setting the context information of a triplet (h, r, t) to C (h, r, t), the probability of the triplet being established can be represented using the following fractional function (i.e., equation (1)) which is the conditional probability of the embedded representation of all elements in the given context information and knowledge-graph.
f (h, r, t) ═ P ((h, r, t) | C (h, r, t); θ). Formula (1)
Where f (h, r, t) is the probability of occurrence, and θ is the parameter of the model, i.e. the vector of the relationship between all entities and entities.
After obtaining the probability of success for each triplet, this embodiment may obtain the embedded features of each entity and the embedded features of each entity relationship by maximizing the following objective function (i.e., equation (2)):
P(K|θ)=Π(h,r,t)∈Kf (h, r, t). Formula (2)
Where P (K | θ) is an objective function and K is a set of triples in the first knowledge-graph.
It is to be understood that the above-mentioned basis probability and objective function are only examples to facilitate understanding of the present disclosure, and the present disclosure is not limited thereto.
Fig. 5 is a schematic diagram of the principle of determining context information for each triple according to an embodiment of the present disclosure.
According to an embodiment of the present disclosure, in determining context information of each triplet, a target neighbor entity of a head entity in a first knowledge-graph may be determined for the head entity in each triplet first. At the same time, for two entities in each triplet, a set of paths connecting the two entities in the first knowledge-graph is determined. And finally, based on the target neighbor entity and the path set, obtaining the context information of each triple by adopting a preset embedding algorithm. Wherein, the predetermined embedding algorithm may be the TransE algorithm described above, or the like.
For at least one edge of the first knowledge graph connecting the node representing the head entity, a node pointed by an edge led out from the node representing the head entity is a target node, and an entity represented by the target node is a target neighbor entity of the head entity. Wherein, in the path set connecting two entities, each path may include one or more entity relations capable of linking the two entities.
According to the embodiment of the present disclosure, as shown in fig. 5, in this embodiment 500, a first knowledge graph having 11 entities, i.e., entities 501 to 511, and 14 entity relationships, i.e., entity relationship r, in the first knowledge graph is set1Entity relationship r14. Among the 14 entity relationships, there may be a plurality of identical entity relationships.
For a triplet with entity 504 as the head entity and entity 501 as the tail entity { entity 504, r3Entity 501, the determined target neighbor entities may include entity 501 and entity 509. To avoid excessive path aggregation, a number threshold may be defined for a plurality of entity relationships linking two entities, for example, the number threshold is L. Setting L to 3, then r for the triplet { entity 504, r3Entity 501, the determined set of paths may include path r3And a path r7-r8-r4。
For example, the target neighbor entity cn (e) of entity h may be represented by the following formula (3):
for example, the set of paths of the head entity h and the tail entity t can be represented by the following formula (4):
wherein, Cp(h, t) is the set of paths, G is the first knowledge-graph, piIs a sequence of relationships of an entity,representing the entities associated with each path in the set of paths. For example, for path r described earlier7-r8-r4The associated entities include entity 505 and entity 506.
After the target neighbor entity and the path set are obtained, a union of the triplet, the target neighbor entity, and the path set may be determined. The embodiment may then employ a predetermined embedding algorithm to derive and aggregate the embedding characteristics for each entity and each edge. The union represented by the embedded features is used as context information for the triples.
Based on the method for predicting the entity relationship provided by the present disclosure, the present disclosure also provides a training method of a relationship prediction model, which will be described in detail below with reference to fig. 6.
FIG. 6 is a flow chart diagram of a method of training a relational prediction model according to an embodiment of the disclosure.
As shown in fig. 6, the training method 600 of the relational prediction model of this embodiment may include operations S610 to S640.
In operation S610, third embedded features of each entity in the second knowledge-graph and fourth embedded features of each entity relationship in the second knowledge-graph are determined.
According to embodiments of the present disclosure, the second knowledge-graph may be the same knowledge-graph as the first knowledge-graph described above, or may be any knowledge-graph that includes the target entity relationships described above. The implementation of operation S610 is similar to operation S210 described above, and is not described herein again.
In operation S620, sample data for a relationship prediction model including a graph neural network is determined based on a plurality of entities and entity relationships between the entities in the second knowledge-graph.
Wherein the sample data comprises third embedded features of the two entities in the second knowledge-graph and actual entity relationships of the two entities.
According to the embodiment of the disclosure, two entities having the predicted entity relationship can be searched from the second knowledge graph according to the entity relationship needing to be predicted, and then two third embedded characteristics of the two entities and the predicted entity relationship form a first sample data. The first sample data obtained is a positive sample.
In one embodiment, two entities without the predicted entity relationship may be further searched from the second knowledge-graph, and two third embedded features of the two entities may be used to form a second sample data, where the actual entity relationship in the second sample data is null. The obtained second sample data is a negative sample. Or two entities with other entity relations except the predicted entity relation can be searched from the second knowledge graph, two third embedded features of the two entities and the other entity relations form a third sample data, and the obtained third sample data is a negative sample.
By setting the positive sample and the negative sample simultaneously, the learning ability of the relationship prediction model can be improved.
In operation S630, a predicted entity relationship between the two entities is determined using a relationship prediction model including a graph neural network based on the sample data and the second knowledge graph.
According to an embodiment of the present disclosure, the operation S630 may specifically be determining the predicted entity relationship between the two entities by using a relationship prediction model including a graph neural network according to the two third embedded features in the sample data and the second knowledge graph. The operation S630 is similar to the method for determining the entity relationship between two target entities described above, and is not described herein again. And determining the entity relationship between the two entities in the sample data as the predicted entity relationship.
In operation S640, a relationship prediction model including a graph neural network is trained based on the predicted entity relationships and the actual entity relationships.
According to embodiments of the present disclosure, a loss of a relational prediction model may be determined based on a predicted entity relationship and an actual entity relationship. The relational prediction model is trained by minimizing the losses. The loss of the relational prediction model can be represented by a cross-entropy loss function, for example.
For example, the cross entropy loss function can be expressed using the following equation (5):
wherein, f (S)i) The relationship prediction model obtains probabilities with entity relationships based on positive samples in the sample data. f (S)j) The relationship prediction model obtains probabilities with entity relationships based on negative samples in the sample data. Wherein, Around (S)i) Is a set of negative examples.
Based on the method for predicting the entity relationship provided by the disclosure, the disclosure also provides a device for predicting the entity relationship. The apparatus will be described in detail below with reference to fig. 7.
Fig. 7 is a block diagram of an apparatus for predicting entity relationships according to an embodiment of the present disclosure.
As shown in fig. 7, the apparatus 700 for predicting entity relationships of this embodiment may include a first characteristic determination module 710 and a first relationship determination module 720.
The first feature determination module 710 is used to determine a first embedded feature for each entity in the first knowledge-graph and a second embedded feature for each entity relationship in the first knowledge-graph. In an embodiment, the first characteristic determining module 710 may be configured to perform the operation S210 described above, which is not described herein again.
The first relationship determination module 720 is configured to determine an entity relationship between two target entities in the first knowledge-graph that have no entity relationship using a relationship prediction model that includes a graph neural network based on the first embedded features, the second embedded features, and the first knowledge-graph. In an embodiment, the first relation determining module 720 may be configured to perform the operation S220 described above, which is not described herein again.
According to an embodiment of the present disclosure, the first relationship determining module 720 may include a target feature determining sub-module, a target entity determining sub-module, and a relationship determining sub-module. And the target characteristic determining submodule is used for determining the embedded characteristic of the target entity relation in the second embedded characteristic as the target embedded characteristic. The target entity determination sub-module is configured to determine at least one target entity pair in the first knowledge-graph based on the first embedded features and the target embedded features, wherein each target entity pair in the at least one target entity pair comprises two target entities having no entity relationship in the first knowledge-graph. The relationship determination submodule is configured to determine whether each target entity pair of the at least one pair of target entities has a target entity relationship using a relationship prediction model based on the at least one target entity pair and the first knowledge-graph.
According to an embodiment of the present disclosure, the relationship determination submodule may include a map expansion unit and a relationship determination unit. The map expanding unit is used for expanding the first knowledge map based on at least one target entity pair to obtain an expanded knowledge map. The relationship determination unit is used for determining whether each target entity pair has the target entity relationship based on the first embedded characteristics of the two target entities included in each target entity pair and the expanded knowledge graph.
In accordance with an embodiment of the present disclosure, the first feature determination module 710 may be specifically configured to determine a first embedded feature of each entity in the first knowledge-graph and a second embedded feature of each entity relationship in the first knowledge-graph based on context information of each triplet in the first knowledge-graph constituting the first knowledge-graph.
According to an embodiment of the present disclosure, the apparatus 700 for predicting entity relationships may further include a neighbor entity determining module, a path set determining module, and an information determining module. The neighbor entity determining module is configured to determine, for the head entity in each triplet, a target neighbor entity of the head entity in the first knowledge-graph. The path set determination module is configured to determine, for the two entities in each triplet, a set of paths connecting the two entities in the first knowledge-graph. The path set determination module is configured to determine, for the two entities in each triplet, a set of paths connecting the two entities in the first knowledge-graph.
According to an embodiment of the present disclosure, the first feature determination module 710 may include a probability determination sub-module and a feature determination sub-module. And the probability determination submodule is used for determining the establishment probability of each triple based on the context information of each triple. The feature determination submodule is used for maximizing an objective function associated with the formation probability based on the formation probability to obtain a first embedded feature of each entity and a second embedded feature of each entity relation.
Based on the training method of the relation prediction model provided by the disclosure, the disclosure also provides a training device of the relation prediction model. The apparatus will be described in detail below with reference to fig. 8.
Fig. 8 is a block diagram of a structure of a training apparatus of a relational prediction model according to an embodiment of the present disclosure.
As shown in fig. 8, the training apparatus 800 of the relational prediction model of this embodiment may include a second feature determination module 810, a sample data determination module 820, a second relation determination module 830, and a model training module 840.
The second feature determination module 810 is for determining a third embedded feature for each entity in the second knowledge-graph and a fourth embedded feature for each entity relationship in the second knowledge-graph. In an embodiment, the second characteristic determining module 810 may be configured to perform the operation S610 described above, which is not described herein again.
The sample data determination module 820 is configured to determine sample data for a relationship prediction model comprising a graph neural network based on a plurality of entities in the second knowledge-graph and entity relationships between the entities. The sample data includes third embedded features of the two entities in the second knowledge-graph and actual entity relationships of the two entities. In an embodiment, the sample data determining module 820 may be configured to perform the operation S620 described above, for example, and is not described herein again.
The second relationship determination module 830 is configured to determine a predicted entity relationship between two entities using a relationship prediction model comprising a graph neural network based on the sample data and the second knowledge-graph. In an embodiment, the second relation determining module 830 may be configured to perform the operation S630 described above, which is not described herein again.
The model training module 840 may be configured to train a relationship prediction model comprising a graph neural network based on the predicted entity relationships and the actual entity relationships. In an embodiment, the model training module 840 may be configured to perform the operation S640 described above, which is not described herein again.
In the technical scheme of the present disclosure, the processes of acquiring, collecting, storing, using, processing, transmitting, providing, disclosing and the like of the personal information of the related user all conform to the regulations of related laws and regulations, and do not violate the good custom of the public order.
The present disclosure also provides an electronic device, a readable storage medium, and a computer program product according to embodiments of the present disclosure.
FIG. 9 illustrates a schematic block diagram of an example electronic device 900 that may be used to implement the methods of predicting entity relationships and/or the methods of training relationship prediction models of embodiments of the present disclosure. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not meant to limit implementations of the disclosure described and/or claimed herein.
As shown in fig. 9, the apparatus 900 includes a computing unit 901, which can perform various appropriate actions and processes in accordance with a computer program stored in a Read Only Memory (ROM)902 or a computer program loaded from a storage unit 908 into a Random Access Memory (RAM) 903. In the RAM 903, various programs and data required for the operation of the device 900 can also be stored. The calculation unit 901, ROM 902, and RAM 903 are connected to each other via a bus 904. An input/output (I/O) interface 905 is also connected to bus 904.
A number of components in the device 900 are connected to the I/O interface 905, including: an input unit 906 such as a keyboard, a mouse, and the like; an output unit 907 such as various types of displays, speakers, and the like; a storage unit 908 such as a magnetic disk, optical disk, or the like; and a communication unit 909 such as a network card, a modem, a wireless communication transceiver, and the like. The communication unit 909 allows the device 900 to exchange information/data with other devices through a computer network such as the internet and/or various telecommunication networks.
The computing unit 901 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of the computing unit 901 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various dedicated Artificial Intelligence (AI) computing chips, various computing units running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, and so forth. The calculation unit 901 performs various methods and processes described above, such as a method of predicting entity relationships and/or a training method of a relationship prediction model. For example, in some embodiments, the method of predicting entity relationships and/or the method of training the relationship prediction model may be implemented as a computer software program tangibly embodied on a machine-readable medium, such as storage unit 908. In some embodiments, part or all of the computer program may be loaded and/or installed onto device 900 via ROM 902 and/or communications unit 909. When loaded into RAM 903 and executed by computing unit 901, a computer program may perform one or more steps of the above described method of predicting entity relationships and/or training method of a relationship prediction model. Alternatively, in other embodiments, the computing unit 901 may be configured by any other suitable means (e.g., by means of firmware) to perform the method of predicting entity relationships and/or the training method of the relationship prediction model.
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuitry, Field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), system on a chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
Program code for implementing the methods of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the program codes, when executed by the processor or controller, cause the functions/operations specified in the flowchart and/or block diagram to be performed. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), Wide Area Networks (WANs), and the Internet.
The computer system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The Server may be a cloud Server, which is also called a cloud computing Server or a cloud host, and is a host product in a cloud computing service system, so as to solve the defects of high management difficulty and weak service extensibility in a traditional physical host and a VPS service ("Virtual Private Server", or simply "VPS"). The server may also be a server of a distributed system, or a server incorporating a blockchain.
It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present disclosure may be executed in parallel, sequentially, or in different orders, as long as the desired results of the technical solutions disclosed in the present disclosure can be achieved, and the present disclosure is not limited herein.
The above detailed description should not be construed as limiting the scope of the disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present disclosure should be included in the scope of protection of the present disclosure.
Claims (17)
1. A method of predicting entity relationships, comprising:
determining first embedded features of each entity in a first knowledge-graph and second embedded features of each entity relationship in the first knowledge-graph; and
determining an entity relationship between two target entities in the first knowledge-graph that do not have an entity relationship using a relationship prediction model that includes a graph neural network based on the first embedded features, the second embedded features, and the first knowledge-graph.
2. The method of claim 1, wherein determining entity relationships between two target entities in the first knowledge-graph without entity relationships using a relationship prediction model comprising a graph neural network comprises:
determining an embedding feature of the target entity relationship in the second embedding feature as a target embedding feature;
determining at least one target entity pair in the first knowledge-graph based on the first embedding features and the target embedding features, wherein each target entity pair of the at least one target entity pair comprises two target entities having no entity relationship in the first knowledge-graph; and
determining, with the relationship prediction model, whether each of the at least one target entity pair has the target entity relationship based on the at least one target entity pair and the first knowledge-graph.
3. The method of claim 2, wherein determining whether each of the at least one target entity pair has the target entity relationship using the relationship prediction model comprises:
expanding the first knowledge-graph based on the at least one target entity pair to obtain an expanded knowledge-graph; and
determining whether each target entity pair has the target entity relationship based on the extended knowledge-graph and the first embedded features of the two target entities included in the each target entity pair.
4. The method of claim 1, wherein the determining first embedded features for each entity in the first knowledge-graph and second embedded features for each entity relationship in the first knowledge-graph comprises:
determining first embedded features of each entity in the first knowledge-graph and second embedded features of each entity relationship in the first knowledge-graph based on context information in the first knowledge-graph for each triplet comprising the first knowledge-graph.
5. The method of claim 4, further comprising:
determining, for a head entity in each triplet, a target neighbor entity of the head entity in the first knowledge-graph;
for two entities in each triplet, determining a set of paths connecting the two entities in the first knowledge-graph; and
and obtaining the context information of each triple by adopting a preset embedding algorithm based on the target neighbor entity and the path set.
6. The method of claim 4 or 5, wherein the determining first embedded features for each entity in the first knowledge-graph and second embedded features for each entity relationship in the first knowledge-graph based on context information in the first knowledge-graph for each triplet comprising the first knowledge-graph comprises:
determining a probability of being established for each triplet based on the context information for each triplet; and
and based on the probability of satisfaction, maximizing an objective function associated with the probability of satisfaction to obtain a first embedded feature of each entity and a second embedded feature of each entity relation.
7. A method for training a relational prediction model, comprising:
determining third embedded features of each entity in a second knowledge-graph and fourth embedded features of each entity relationship in the second knowledge-graph;
determining sample data for a relationship prediction model comprising a graph neural network based on a plurality of entities in the second knowledge-graph and entity relationships between entities, the sample data comprising third embedded features of two entities in the second knowledge-graph and actual entity relationships of the two entities;
determining a predicted entity relationship between the two entities using a relationship prediction model comprising the graph neural network based on the sample data and the second knowledge graph; and
training the relationship prediction model comprising the graph neural network based on the predicted entity relationship and the actual entity relationship.
8. An apparatus for predicting entity relationships, comprising:
a first feature determination module to determine first embedded features for each entity in a first knowledge-graph and second embedded features for each entity relationship in the first knowledge-graph; and
a first relationship determination module to determine an entity relationship between two target entities in the first knowledge-graph that do not have an entity relationship using a relationship prediction model that includes a graph neural network based on the first embedded features, the second embedded features, and the first knowledge-graph.
9. The apparatus of claim 8, wherein the first relationship determination module comprises:
the target characteristic determining submodule is used for determining the embedding characteristic of the target entity relationship in the second embedding characteristic as a target embedding characteristic;
a target entity determination sub-module to determine at least one target entity pair in the first knowledge-graph based on the first embedded features and the target embedded features, wherein each target entity pair of the at least one target entity pair comprises two target entities having no entity relationship in the first knowledge-graph; and
a relationship determination sub-module to determine whether each of the at least one target entity pair has the target entity relationship using the relationship prediction model based on the at least one target entity pair and the first knowledge-graph.
10. The apparatus of claim 9, wherein the relationship determination submodule comprises:
the map expanding unit is used for expanding the first knowledge map based on the at least one target entity pair to obtain an expanded knowledge map; and
a relationship determining unit, configured to determine whether each target entity pair has the target entity relationship based on the extended knowledge-graph and the first embedded features of the two target entities included in each target entity pair.
11. The apparatus of claim 8, wherein the first feature determination module is to:
determining first embedded features of each entity in the first knowledge-graph and second embedded features of each entity relationship in the first knowledge-graph based on context information in the first knowledge-graph for each triplet comprising the first knowledge-graph.
12. The apparatus of claim 11, further comprising:
a neighbor entity determining module, configured to determine, for a head entity in each triplet, a target neighbor entity of the head entity in the first knowledge-graph;
a path set determination module, configured to determine, for two entities in each triplet, a set of paths connecting the two entities in the first knowledge-graph; and
and the information determining module is used for obtaining the context information of each triple by adopting a preset embedding algorithm based on the target neighbor entity and the path set.
13. The apparatus of claim 11 or 12, wherein the first feature determination module comprises:
a probability determination submodule, configured to determine a probability of establishing each triplet based on the context information of each triplet; and
and the characteristic determining submodule is used for maximizing an objective function associated with the probability of satisfaction based on the probability of satisfaction to obtain the first embedded characteristic of each entity and the second embedded characteristic of each entity relation.
14. An apparatus for training a relational prediction model, comprising:
a second feature determination module to determine a third embedded feature for each entity in a second knowledge-graph and a fourth embedded feature for each entity relationship in the second knowledge-graph;
a sample data determination module for determining sample data for a relationship prediction model comprising a graph neural network based on a plurality of entities in the second knowledge-graph and entity relationships between the entities, the sample data comprising third embedded features of two entities in the second knowledge-graph and actual entity relationships of the two entities;
a second relationship determination module for determining a predicted entity relationship between the two entities using a relationship prediction model comprising the graph neural network based on the sample data and the second knowledge graph; and
and the model training module is used for training the relation prediction model comprising the graph neural network based on the predicted entity relation and the actual entity relation.
15. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-7.
16. A non-transitory computer readable storage medium having stored thereon computer instructions for causing the computer to perform the method of any of claims 1-7.
17. A computer program product comprising a computer program which, when executed by a processor, implements a method according to any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111279960.2A CN113961720A (en) | 2021-10-29 | 2021-10-29 | Method for predicting entity relationship and method and device for training relationship prediction model |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111279960.2A CN113961720A (en) | 2021-10-29 | 2021-10-29 | Method for predicting entity relationship and method and device for training relationship prediction model |
Publications (1)
Publication Number | Publication Date |
---|---|
CN113961720A true CN113961720A (en) | 2022-01-21 |
Family
ID=79468683
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111279960.2A Pending CN113961720A (en) | 2021-10-29 | 2021-10-29 | Method for predicting entity relationship and method and device for training relationship prediction model |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113961720A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114925898A (en) * | 2022-05-13 | 2022-08-19 | 阳光保险集团股份有限公司 | Method, device and system for predicting family relationship of client entity |
CN115934967A (en) * | 2023-01-05 | 2023-04-07 | 瓴创(北京)科技有限公司 | Commodity recommendation method and system based on combination of twin transform model and knowledge graph |
-
2021
- 2021-10-29 CN CN202111279960.2A patent/CN113961720A/en active Pending
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114925898A (en) * | 2022-05-13 | 2022-08-19 | 阳光保险集团股份有限公司 | Method, device and system for predicting family relationship of client entity |
CN115934967A (en) * | 2023-01-05 | 2023-04-07 | 瓴创(北京)科技有限公司 | Commodity recommendation method and system based on combination of twin transform model and knowledge graph |
CN115934967B (en) * | 2023-01-05 | 2024-02-27 | 瓴创(北京)科技有限公司 | Commodity recommendation method and system based on combination of twin transducer model and knowledge graph |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2023000574A1 (en) | Model training method, apparatus and device, and readable storage medium | |
US20210312139A1 (en) | Method and apparatus of generating semantic feature, method and apparatus of training model, electronic device, and storage medium | |
JP7331975B2 (en) | Cross-modal search model training methods, apparatus, equipment, and storage media | |
CN114357105B (en) | Pre-training method and model fine-tuning method of geographic pre-training model | |
WO2022110640A1 (en) | Model optimization method and apparatus, computer device and storage medium | |
CN111460234B (en) | Graph query method, device, electronic equipment and computer readable storage medium | |
CN113806582B (en) | Image retrieval method, image retrieval device, electronic equipment and storage medium | |
CN113961720A (en) | Method for predicting entity relationship and method and device for training relationship prediction model | |
CN112580733B (en) | Classification model training method, device, equipment and storage medium | |
CN115130581B (en) | Sample generation method, training method, data processing method and electronic equipment | |
WO2022198752A1 (en) | Push model training method, data push method and apparatus, and storage medium | |
US20220130495A1 (en) | Method and Device for Determining Correlation Between Drug and Target, and Electronic Device | |
CN112214775A (en) | Injection type attack method and device for graph data, medium and electronic equipment | |
WO2021184547A1 (en) | Conversation robot intention corpus generation method and apparatus, medium, and electronic device | |
CN115565177A (en) | Character recognition model training method, character recognition device, character recognition equipment and medium | |
CN113657596B (en) | Method and device for training model and image recognition | |
CN113360683A (en) | Method for training cross-modal retrieval model and cross-modal retrieval method and device | |
CN113326449A (en) | Method, apparatus, electronic device, and medium for predicting traffic flow | |
CN115169489B (en) | Data retrieval method, device, equipment and storage medium | |
US12007965B2 (en) | Method, device and storage medium for deduplicating entity nodes in graph database | |
CN114897666B (en) | Graph data storage, access, processing method, training method, device and medium | |
CN115082742A (en) | Training method and device for image classification model, electronic equipment and storage medium | |
CN115935027B (en) | Data processing method of target object topological graph and training method of graph classification model | |
CN116304253B (en) | Data storage method, data retrieval method and method for identifying similar video | |
US12038989B2 (en) | Methods for community search, method for training community search model, and electronic 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 |