CN112711667A - Knowledge graph complex relation reasoning method based on multidirectional semantics - Google Patents

Knowledge graph complex relation reasoning method based on multidirectional semantics Download PDF

Info

Publication number
CN112711667A
CN112711667A CN202110329759.4A CN202110329759A CN112711667A CN 112711667 A CN112711667 A CN 112711667A CN 202110329759 A CN202110329759 A CN 202110329759A CN 112711667 A CN112711667 A CN 112711667A
Authority
CN
China
Prior art keywords
entity
relation
relationship
entities
vector
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.)
Granted
Application number
CN202110329759.4A
Other languages
Chinese (zh)
Other versions
CN112711667B (en
Inventor
姜华
杨世辉
田济东
郦一天
胡博文
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Minpu Technology Co ltd
Original Assignee
Shanghai Minpu Technology Co ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Shanghai Minpu Technology Co ltd filed Critical Shanghai Minpu Technology Co ltd
Priority to CN202110329759.4A priority Critical patent/CN112711667B/en
Publication of CN112711667A publication Critical patent/CN112711667A/en
Application granted granted Critical
Publication of CN112711667B publication Critical patent/CN112711667B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/36Creation of semantic tools, e.g. ontology or thesauri
    • G06F16/367Ontology
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/30Semantic analysis

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Animal Behavior & Ethology (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Machine Translation (AREA)

Abstract

The invention provides a knowledge graph complex relation reasoning method based on multidirectional semantics, which maps entities in a training sample data set of a knowledge graph into two groups of low-dimensional space vector representations; mapping the relation in the training sample data set of the knowledge graph into two groups of low-dimensional space vectors and one-dimensional parameter representation; randomly selecting an entity in a training sample data set of the knowledge graph, replacing the entity of the training sample positive triple and generating training negative sample data; defining a target function in the training process according to the training sample positive triples and the generated training negative samples; respectively bringing entity mapping results and relationship mapping results in the training sample data set into an objective function, and optimizing to obtain vector representation corresponding to each entity or relationship in the knowledge graph; and calculating the distance value between the entity and the relation in the knowledge map triple by using the vector representation obtained by optimization, and carrying out relation reasoning according to the distance value. The invention improves the reasoning effect on the complex relation.

Description

Knowledge graph complex relation reasoning method based on multidirectional semantics
Technical Field
The invention relates to the technical field of knowledge graphs in artificial intelligence, in particular to a method for reasoning complex relationships in knowledge graphs by using an artificial intelligence representation learning method.
Background
With the development of artificial intelligence technology, knowledge maps are more and more concerned by academia and industry, and the knowledge maps play a significant role in the development of artificial intelligence in the future. The knowledge graph takes a triple composed of a head entity, a tail entity and a relationship existing between the head entity and the tail entity as a basic unit, wherein the entities can be entities in the real world, such as specific names, place names, organizations and the like, and can also represent attribute values or concepts of attributes, such as a certain color and the like, and the relationship can be a real relationship between two entities and an entity, such as a couple relationship, an affiliation relationship, or a relationship between an entity and an attribute value, such as age and the like. However, as the internet grows, a large amount of data is generated every moment, wherein a large amount of triple knowledge is generated, so that each entity has a complex relationship with other entities. With the continuous expansion of the scale of the knowledge graph, the complex relationships in the knowledge graph cannot be completed in a manual mode. Therefore, a great deal of related research is generated aiming at the problem of knowledge graph relation reasoning completion. Some researches, which map entities and relationships into low-dimensional vectors and then use the vector relationships to perform reasoning, are known as expression learning methods, such as the relationship reasoning methods of TransE, TransH, and TransR. Although these models show their advantages and innovations in some aspects, they consider only the semantic impact of relationship-inference entities, and do not consider the semantic impact of entities on entities and the semantic impact of entities on relationships when using semantic information for complex relationship inference. For example, when learning semantic expression vectors (human beings, eating and vegetables), semantic information of "human beings" should be influenced by the semantics of "vegetables" and "eating", and similarly, semantic information of "vegetables" should be influenced by the semantics of "human beings" and "eating", so that the learned semantic vector expression entities or relationship semantic information is insufficient, and the inference effect on complex relationships is finally influenced.
Disclosure of Invention
Aiming at the defects in the prior art, the invention provides a knowledge graph complex relation reasoning method based on multidirectional semantics.
The invention is realized by the following technical scheme.
A knowledge graph complex relation reasoning method based on multidirectional semantics comprises the following steps:
mapping entities in a training sample data set of a knowledge graph into two groups of low-dimensional space vector representations;
mapping the relation in the training sample data set of the knowledge graph into two groups of low-dimensional space vectors and one-dimensional parameter representation;
randomly selecting an entity in a training sample data set of the knowledge graph, replacing the entity of the training sample positive triple and generating training negative sample data;
defining an objective function in the training process according to the training sample positive triples and the generated training negative samples
Figure 692211DEST_PATH_IMAGE001
Comprises the following steps:
Figure 140510DEST_PATH_IMAGE002
in the formula (I), the compound is shown in the specification,
Figure 451406DEST_PATH_IMAGE003
wherein
Figure 174511DEST_PATH_IMAGE004
Representing positive triplets
Figure 520042DEST_PATH_IMAGE005
Is used as a function of the distance of (c),
Figure 608084DEST_PATH_IMAGE006
representing positive triplets
Figure 671855DEST_PATH_IMAGE007
Corresponding negative example of
Figure 401913DEST_PATH_IMAGE008
A distance function of (d); wherein:
Figure 434958DEST_PATH_IMAGE009
or
Figure 162743DEST_PATH_IMAGE010
Or
Figure 448231DEST_PATH_IMAGE011
In the formula (I), the compound is shown in the specification,
Figure 716401DEST_PATH_IMAGE012
the semantic information representation that the representation head entity corresponds to the inherent attribute of the representation head entity and does not influence the semantic information representation of the tail entity or the relationship due to the property of the representation head entity;
Figure 36524DEST_PATH_IMAGE013
the semantic information corresponding to the inherent attribute of the representation relationship is represented, and the semantic information corresponding to the inherent attribute of the head entity or the tail entity is not changed;
Figure 731947DEST_PATH_IMAGE014
the representation of the semantic information corresponding to the inherent attribute of the tail entity does not influence the semantic information representation of the head entity or the relationship due to the property of the tail entity, and the semantic information corresponding to the inherent attribute of the relationship or the tail entity does not change;
Figure 504731DEST_PATH_IMAGE015
representing semantic effects of head entities on relationships and tail entities within triples due to the fact that the head entities have on the relationships and tail entities within triples when the relationships and tail entities are fixedA change in volume;
Figure 107751DEST_PATH_IMAGE016
representing semantic influence of the relation on a head entity and a tail entity in the triple, wherein when the head entity and the tail entity are fixed, the influence on the head entity and the tail entity changes along with the change of the relation;
Figure 282380DEST_PATH_IMAGE017
representing semantic effects of the tail entities on the relationships and the head entities within the triples due to the relationship and the head entities within the triples, the effects on the relationships and the head entities varying as the tail entities vary when the relationships and the head entities are fixed;
Figure 148705DEST_PATH_IMAGE018
the action which is expressed as the relationship is influenced by the passive information of the head entity and the tail entity, and is simultaneously influenced by the inherent attribute of the action to distinguish and express the entity and the relationship;
Figure 612047DEST_PATH_IMAGE019
representing a non-linear transformation, corresponding to an attention mechanism;
Figure 222020DEST_PATH_IMAGE020
a unit vector representing one m-dimension;
Figure 251156DEST_PATH_IMAGE021
is a distance formula;
respectively bringing entity mapping results and relationship mapping results in the training sample data set into an objective function, and optimizing to obtain vector representation corresponding to each entity or relationship in the knowledge graph;
and calculating the distance value between the entity and the relation in the knowledge map triple by using the vector representation obtained by optimization, and carrying out relation reasoning according to the distance value.
Preferably, the mapping entities in the training sample data set of the knowledge-graph into two sets of low-dimensional space vectors comprises:
training with knowledge mapSet of entities in training sample data set
Figure 553962DEST_PATH_IMAGE022
There are n entities, each of which
Figure 35759DEST_PATH_IMAGE023
Mapped as a m-dimensional vector
Figure 449422DEST_PATH_IMAGE024
And a vector of m dimensions
Figure 598644DEST_PATH_IMAGE025
Preferably, for a set of entities in a set of training sample data in a knowledge-graph
Figure 75280DEST_PATH_IMAGE026
Each entity in
Figure 44373DEST_PATH_IMAGE027
Mapping as vectors
Figure 996149DEST_PATH_IMAGE024
Sum vector
Figure 999877DEST_PATH_IMAGE025
Each is randomly initialized to a vector of m dimensions and constrained to have a modulo length of 1.
Preferably, the mapping the relation in the training sample data set of the knowledge-graph into two sets of low-dimensional space vectors and one-dimensional parametric representation includes:
relation set in training sample data set of knowledge graph
Figure 847747DEST_PATH_IMAGE028
There are t relations, wherein each relation
Figure 304136DEST_PATH_IMAGE029
Mapping to a vector of m dimensions
Figure 325182DEST_PATH_IMAGE030
A vector of m dimensions
Figure 917837DEST_PATH_IMAGE031
And a one-dimensional parameter
Figure 733347DEST_PATH_IMAGE032
Preferably, for a set of relationships in a set of training sample data in a knowledge-graph
Figure 677032DEST_PATH_IMAGE033
Each of the relationships in
Figure 439451DEST_PATH_IMAGE029
Mapping as vectors
Figure 152193DEST_PATH_IMAGE030
Sum vector
Figure 873024DEST_PATH_IMAGE031
Respectively randomly initializing into a vector with m dimensions, limiting the modular length to be 1, and randomly initializing a one-dimensional parameter
Figure 304005DEST_PATH_IMAGE032
Preferably, the method for generating training negative sample data includes:
for positive triplets in training samplesS(h,r,t)Randomly from a set of entities
Figure 401274DEST_PATH_IMAGE026
To select an entity
Figure 499680DEST_PATH_IMAGE034
And randomly replacing the head entity in the triplethOr tail entitytGenerating a negative sample data set
Figure 391413DEST_PATH_IMAGE035
(ii) a Wherein, among others,
Figure 309690DEST_PATH_IMAGE036
a relation set in a training sample data set of a knowledge graph is set.
Preferably, the entity mapping result and the relation mapping result in the training sample data set are respectively brought into an objective function, and the entity and the relation in the knowledge graph are trained; after training, a mapping vector corresponding to each entity or relationship is finally obtained, and the possibility of whether the entities meet a certain relationship is obtained by using the mapping vector.
Preferably, the calculating a distance value between an entity and a relationship in a knowledge-graph triplet using the optimized vector representation includes:
after each group of vectors is obtained, a distance function is utilized
Figure 207721DEST_PATH_IMAGE037
Calculating the distance among the head entity h, the relation r and the tail entity t; when the distance value tends to 0, judging the knowledge map triple to be a positive triple, and obtaining the relation shown in the positive triple; and when the distance value tends to infinity, recommending the candidate entities to perform knowledge graph relation completion, and recalculating the distance among the head entity h, the relation r and the tail entity t.
According to another aspect of the invention, there is provided a terminal comprising a memory, a processor and a computer program stored on the memory and operable on the processor, the processor being operable when executing the computer program to perform any of the methods described above.
According to a third aspect of the invention, there is provided a computer readable storage medium having stored thereon a computer program which, when executed by a processor, is operable to perform the method of any of the above.
Due to the adoption of the technical scheme, compared with the prior art, the invention has the following beneficial effects:
according to the knowledge graph complex relationship inference method based on the multidirectional semantics, when the semantic vector corresponding to each entity or relationship is learned, the influence of the multidirectional semantics on the entity in the triple is fully considered, and meanwhile, the semantic vector of the relationship is influenced by the semantics of the entity, so that the learned vector can better represent semantic information corresponding to each entity or relationship. The knowledge graph complex relation reasoning method based on the multidirectional semantics can better simulate semantic information of different entities or relations under different triple 'environments', and improves the reasoning effect on complex relations.
Drawings
Other features, objects and advantages of the invention will become more apparent upon reading of the detailed description of non-limiting embodiments with reference to the following drawings:
FIG. 1 is a flow chart of a knowledge graph complex relationship inference method based on multidirectional semantics in a preferred embodiment of the present invention.
Detailed Description
The following examples illustrate the invention in detail: the embodiment is implemented on the premise of the technical scheme of the invention, and a detailed implementation mode and a specific operation process are given. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the inventive concept, which falls within the scope of the present invention.
An embodiment of the invention provides a knowledge graph complex relationship inference method based on multidirectional semantics, which fully utilizes multidirectional semantic information when learning semantic vectors, better represents semantic information corresponding to entities or relationships, and further improves inference effect on complex relationships in the knowledge graph.
The knowledge graph complex relation inference method based on multidirectional semantics provided by the embodiment can comprise the following steps
Step 1, mapping entities in a training sample data set of a knowledge graph into two groups of low-dimensional space vectors (the low-dimensional space vectors are used for expressing vectors with limited length in the field, such as 200-dimensional vectors) for representation; mapping the relation in the training sample data set of the knowledge graph into two groups of low-dimensional space vectors and one-dimensional parameter representation;
step 2, randomly selecting an entity in the knowledge graph training sample data set, replacing the entity of the training sample positive triple and generating training negative sample data;
step 3, defining an objective function in the training process according to the training sample positive triple and the generated training negative sample
Figure 629475DEST_PATH_IMAGE001
Comprises the following steps:
Figure 957688DEST_PATH_IMAGE038
in the formula (I), the compound is shown in the specification,
Figure 97682DEST_PATH_IMAGE039
Figure 802333DEST_PATH_IMAGE040
representing positive triplets
Figure 547435DEST_PATH_IMAGE005
Is used as a function of the distance of (c),
Figure 46549DEST_PATH_IMAGE006
representing positive triplets
Figure 673840DEST_PATH_IMAGE007
Corresponding negative example of
Figure 916602DEST_PATH_IMAGE008
A distance function of (d); wherein:
Figure 312949DEST_PATH_IMAGE041
or
Figure 982964DEST_PATH_IMAGE042
Or
Figure 363130DEST_PATH_IMAGE043
In the formula (I), the compound is shown in the specification,
Figure 144004DEST_PATH_IMAGE012
the semantic information representation that the head entity corresponds to the inherent attribute of the head entity and the semantic information representation that the tail entity or the relationship is not influenced by the nature of the head entity (such as the 'tiger') inherent attribute is a carnivore, and the semantic information corresponding to the inherent attribute of the relationship (such as 'eating') or the tail entity (such as 'meat') is not changed by the relationship);
Figure 660436DEST_PATH_IMAGE044
the semantic information corresponding to the inherent attribute of the relation is represented, and the semantic information corresponding to the inherent attribute of the head entity (such as the tiger) or the tail entity (such as the meat) is not changed due to the semantic information (such as the relation attribute represented by the eating);
Figure 704616DEST_PATH_IMAGE014
the semantic information representation that the tail entity corresponds to the inherent attribute of the tail entity is represented, the semantic information representation that the head entity or the relationship is not influenced by the nature of the tail entity, and the semantic information that the inherent attribute of the relationship (such as 'eating') or the tail entity (such as 'meat') corresponds to is not changed by the semantic information;
Figure 306498DEST_PATH_IMAGE045
representing semantic effects of the head entity on the relationship and the tail entity in the triplets due to the relationship and the tail entity in the triplets, wherein when the relationship and the tail entity are fixed, the effect on the relationship and the tail entity changes along with the change of the head entity;
Figure 891063DEST_PATH_IMAGE016
representing semantic influence of the relation on a head entity and a tail entity in the triple, wherein when the head entity and the tail entity are fixed, the influence on the head entity and the tail entity changes along with the change of the relation;
Figure 262002DEST_PATH_IMAGE017
representing semantic effects of the tail entities on the relationships and the head entities within the triples due to the relationship and the head entities within the triples, the effects on the relationships and the head entities varying as the tail entities vary when the relationships and the head entities are fixed;
Figure 276750DEST_PATH_IMAGE046
the representation is that because the relationship is an action, the action itself is influenced by the passive information of the leading entity and the trailing entity, and at the same time, the action itself should be influenced by the inherent property of the action itself, so as to distinguish the representation entity and the relationship (for example, a teacher can be an entity, a triple (teacher, teaching, student), or a relationship, a triple (Wang II, teacher, Zhang III));
Figure 365929DEST_PATH_IMAGE047
representing a non-linear transformation, corresponding to an attention mechanism;
Figure 754185DEST_PATH_IMAGE020
a unit vector representing one m-dimension;
Figure 182892DEST_PATH_IMAGE021
represents the Distance formula, Minkowski Distance;
step 4, respectively bringing the entity mapping result and the relation mapping result in the training sample data set into an objective function, and optimizing to obtain vector representation corresponding to each entity or relation in the knowledge graph;
and 5, calculating a distance value between the entity and the relation in the knowledge map triple by using the vector representation obtained by optimization, and carrying out relation reasoning according to the distance value.
As a preferred embodiment, mapping entities in the training sample data set of the knowledge-graph into two sets of vectors of low-dimensional space vectors includes:
set of entities in a set of training sample data for knowledge-graph modeling
Figure 365612DEST_PATH_IMAGE022
There are n entities, each of which
Figure 942087DEST_PATH_IMAGE023
Mapping to a vector of m dimensions
Figure 134033DEST_PATH_IMAGE024
And a vector of m dimensions
Figure 213985DEST_PATH_IMAGE025
As a preferred embodiment, for a set of entities in a set of training sample data in a knowledge-graph
Figure 833185DEST_PATH_IMAGE026
Each entity in
Figure 631377DEST_PATH_IMAGE027
Mapping as vectors
Figure 564698DEST_PATH_IMAGE024
Sum vector
Figure 499156DEST_PATH_IMAGE025
Each is randomly initialized to a vector of m dimensions and constrained to have a modulo length of 1.
In this step, only random mapping is performed, the corresponding vector cannot represent semantic information of the entity corresponding to the vector, and an accurate vector value is obtained after training.
As a preferred embodiment, mapping the relationship in the training sample data set of the knowledge-graph into two sets of low-dimensional space vectors and one-dimensional parametric representations comprises:
relation set in training sample data set of knowledge graph
Figure 289257DEST_PATH_IMAGE028
There are t relations, wherein each relation
Figure 840324DEST_PATH_IMAGE029
Is mapped into oneVector of m dimension
Figure 108495DEST_PATH_IMAGE030
A vector of m dimensions
Figure 163038DEST_PATH_IMAGE031
And a one-dimensional parameter
Figure 124041DEST_PATH_IMAGE032
As a preferred embodiment, for a set of relationships in a set of training sample data in a knowledge-graph
Figure 834508DEST_PATH_IMAGE033
Each of the relationships in
Figure 906369DEST_PATH_IMAGE029
Mapping as vectors
Figure 78069DEST_PATH_IMAGE030
Sum vector
Figure 209973DEST_PATH_IMAGE031
Respectively randomly initializing into a vector with m dimensions, limiting the modular length to be 1, and randomly initializing a one-dimensional parameter
Figure 470053DEST_PATH_IMAGE032
In this step, only random mapping is performed, the corresponding vector cannot represent semantic information of the entity corresponding to the vector, and an accurate vector value is obtained after training.
As a preferred embodiment, a method for generating training negative sample data includes:
for correct triplets in training samplesS(h,r,t)Randomly from a set of entities
Figure 80026DEST_PATH_IMAGE026
To select an entity
Figure 312424DEST_PATH_IMAGE034
And randomly replacing the head entity in the triplethOr tail entitytGenerating a negative sample data set
Figure 349650DEST_PATH_IMAGE048
(ii) a Wherein, among others,
Figure 362606DEST_PATH_IMAGE036
a relation set in a training sample data set of a knowledge graph is set.
In this step, the training set is known content, and the corresponding vector is obtained by training in this step, so that the corresponding relation is satisfied, thereby determining whether the triplet is established.
As a preferred embodiment, the entity mapping result and the relationship mapping result in the training sample data set are respectively brought into an objective function, and the entity and the relationship in the knowledge graph are trained; after training, a mapping vector corresponding to each entity or relationship is finally obtained, and the possibility of whether the entities meet a certain relationship is obtained by using the mapping vector.
As a preferred embodiment, calculating distance values between entities and relations in the knowledge-graph triples using the optimized vector representation includes:
after each group of vectors is obtained, a distance function is utilized
Figure 776269DEST_PATH_IMAGE037
Calculating the distance among the head entity h, the relation r and the tail entity t; when the distance value tends to 0, judging the knowledge map triple to be a positive triple, and obtaining the relation shown in the positive triple; and when the distance value tends to infinity, recommending the candidate entities to perform knowledge graph relation completion, and recalculating the distance among the head entity h, the relation r and the tail entity t.
In some embodiments of the invention:
the head entity is influenced by the tail entity and the multi-directional semantics of the relation, and finally the corresponding expression vector of the head entity h
Figure 659912DEST_PATH_IMAGE049
Comprises the following steps:
Figure 133618DEST_PATH_IMAGE050
Figure 305974DEST_PATH_IMAGE051
the tail entity is influenced by the multidirectional semantics of the head entity and the relation, and finally the expression vector corresponding to the tail entity t
Figure 257749DEST_PATH_IMAGE052
Comprises the following steps:
Figure 261477DEST_PATH_IMAGE053
Figure 906085DEST_PATH_IMAGE054
the head entity is influenced by the tail entity and the multi-directional semantics of the relation, and finally the corresponding expression vector of the head entity h
Figure 362475DEST_PATH_IMAGE055
Comprises the following steps:
Figure 117941DEST_PATH_IMAGE056
Figure 179438DEST_PATH_IMAGE057
wherein the content of the first and second substances,
Figure 791685DEST_PATH_IMAGE019
the method is represented as a nonlinear activation function commonly used by artificial intelligence, such as a nonlinear activation function of tanh, Relu or softmax;
Figure 938632DEST_PATH_IMAGE058
representing a Hadamard product (Hadamard product).
Finally, the distance function is obtained
Figure 235140DEST_PATH_IMAGE037
Comprises the following steps:
Figure 947881DEST_PATH_IMAGE059
wherein the content of the first and second substances,
Figure 199871DEST_PATH_IMAGE060
representing the euclidean or manhattan distance.
When the entity h and the entity t satisfy the relation r, the distance obtained by calculating the corresponding vectors of the entity h and the entity t is expected
Figure 630852DEST_PATH_IMAGE037
When the entity h and the entity t do not satisfy the relation r, the distance calculated by the corresponding vectors of the entity h and the entity t is expected to be 0
Figure 728121DEST_PATH_IMAGE037
Tending to infinity.
The technical solution provided by the present embodiment is further described below with reference to the accompanying drawings.
As shown in fig. 1, the method provided by this embodiment includes the following steps:
(1) initializing entity and relationship vectors:
mapping the entity in the training sample data set of the knowledge graph into two groups of vectors of low-dimensional space vectors, namely an entity set
Figure 498631DEST_PATH_IMAGE061
There are n entities in total, each entity
Figure 655943DEST_PATH_IMAGE027
Mapping to a vector of m dimensions
Figure 574220DEST_PATH_IMAGE024
And a vector of m dimensions
Figure 209601DEST_PATH_IMAGE025
(ii) a In step (2), the relation in the training sample data set of the knowledge graph is mapped into two groups of vectors of low-dimensional space vectors and one-dimensional parameter representation, namely a relation set
Figure 162514DEST_PATH_IMAGE033
There are t relations in total, each entity
Figure 490727DEST_PATH_IMAGE029
Mapping to a vector of m dimensions
Figure 833983DEST_PATH_IMAGE030
A vector of m dimensions
Figure 538634DEST_PATH_IMAGE031
And a one-dimensional parameter
Figure 80474DEST_PATH_IMAGE032
For example: for entity collections in a knowledge graph
Figure 579589DEST_PATH_IMAGE022
Each entity in (1)
Figure 472458DEST_PATH_IMAGE027
Mapping as vectors
Figure 449641DEST_PATH_IMAGE024
Sum vector
Figure 111567DEST_PATH_IMAGE025
Respectively randomly initializing the vectors into m-dimensional vectors, and limiting the modular length of the vectors to be 1; for relation sets in knowledge graph
Figure 984845DEST_PATH_IMAGE028
Each relationship in
Figure 96502DEST_PATH_IMAGE029
Mapping as vectors
Figure 877376DEST_PATH_IMAGE030
Sum vector
Figure 659387DEST_PATH_IMAGE031
Respectively randomly initializing into a vector with m dimensions, limiting the modular length to be 1, and randomly initializing a one-dimensional parameter
Figure 500304DEST_PATH_IMAGE032
(2) Constructing negative samples and defining vector representation mode
For the correct triplet (h, r, t) in the training sample, the set of entities is randomly selected from
Figure 102187DEST_PATH_IMAGE026
Randomly selecting an entity in the database, randomly replacing a head entity h or a tail entity t, and generating a negative sample data set
Figure 890014DEST_PATH_IMAGE062
(3) Semantic vector representation final computation:
the head entity is influenced by the tail entity and the multi-directional semantics of the relation, and finally the corresponding expression vector of the head entity h
Figure 260953DEST_PATH_IMAGE049
Comprises the following steps:
Figure 272771DEST_PATH_IMAGE063
Figure 96371DEST_PATH_IMAGE064
the tail entity is influenced by the multidirectional semantics of the head entity and the relation, and finally the expression vector corresponding to the tail entity t
Figure 750206DEST_PATH_IMAGE052
Comprises the following steps:
Figure 975651DEST_PATH_IMAGE065
Figure 158371DEST_PATH_IMAGE066
the head entity is influenced by the tail entity and the multi-directional semantics of the relation, and finally the corresponding expression vector of the head entity h
Figure 938108DEST_PATH_IMAGE055
Comprises the following steps:
Figure 864475DEST_PATH_IMAGE067
Figure 944427DEST_PATH_IMAGE068
wherein
Figure 829206DEST_PATH_IMAGE019
The method is represented as a nonlinear activation function commonly used by artificial intelligence, such as a nonlinear activation function of tanh, Relu or softmax;
Figure 627398DEST_PATH_IMAGE058
representing a Hadamard product (Hadamard product).
Defining a distance function and an objective function:
Figure 91877DEST_PATH_IMAGE069
wherein
Figure 495177DEST_PATH_IMAGE060
Representing the euclidean or manhattan distance. When the entity h and the entity t satisfy the relation r, the distance obtained by calculating the corresponding vectors of the entity h and the entity t is expected
Figure 288208DEST_PATH_IMAGE037
Tending to 0, when the entity h and the entity t do not satisfy the relation r, the distance calculated by the corresponding vectors of the entity h and the entity t is expected
Figure 308117DEST_PATH_IMAGE004
Tending to infinity.
The trained objective function:
Figure 841866DEST_PATH_IMAGE070
in the formula
Figure 161989DEST_PATH_IMAGE071
Wherein
Figure 857413DEST_PATH_IMAGE004
Representing positive triplets
Figure 833459DEST_PATH_IMAGE072
The value of (a) is determined,
Figure 905320DEST_PATH_IMAGE006
representing positive triplets
Figure 814370DEST_PATH_IMAGE072
Corresponding negative sample
Figure 211854DEST_PATH_IMAGE073
The distance value of (2).
In the formula:
Figure 206354DEST_PATH_IMAGE074
or
Figure 81907DEST_PATH_IMAGE075
Figure 314305DEST_PATH_IMAGE076
(4) Model training, solving vector optimal value and (5) carrying out relational reasoning
And optimizing the target value function by using an optimal algorithm to obtain a representation vector corresponding to each entity or relationship, replacing a tail entity or a head entity by using all entities in the entity set, or replacing the relationship by using all the relationships in the relationship set, and calculating a replaced triple distance value according to the distance function, wherein the smaller the value, the higher the possibility that the corresponding triple is the positive case. Thereby obtaining the corresponding recommendation relationship.
Another embodiment of the present invention provides a terminal, which includes a memory, a processor, and a computer program stored on the memory and capable of running on the processor, and the processor, when executing the computer program, can be configured to perform the method of any one of the above embodiments.
Optionally, a memory for storing a program; a Memory, which may include a volatile Memory (RAM), such as a Random Access Memory (SRAM), a Double Data Rate Synchronous Dynamic Random Access Memory (DDR SDRAM), and the like; the memory may also comprise a non-volatile memory, such as a flash memory. The memories are used to store computer programs (e.g., applications, functional modules, etc. that implement the above-described methods), computer instructions, etc., which may be stored in partition in the memory or memories. And the computer programs, computer instructions, data, etc. described above may be invoked by a processor.
The computer programs, computer instructions, etc. described above may be stored in one or more memories in a partitioned manner. And the computer programs, computer instructions, data, etc. described above may be invoked by a processor.
A processor for executing the computer program stored in the memory to implement the steps of the method according to the above embodiments. Reference may be made in particular to the description relating to the preceding method embodiment.
The processor and the memory may be separate structures or may be an integrated structure integrated together. When the processor and the memory are separate structures, the memory, the processor may be coupled by a bus.
A third embodiment of the invention provides a computer-readable storage medium, on which a computer program is stored, which program, when being executed by a processor, is adapted to carry out the method of any of the above-mentioned embodiments of the invention.
The knowledge graph complex relation inference method based on the multidirectional semantics, provided by the embodiment of the invention, maps the knowledge graph triples to two groups of vectors in a low-dimensional space respectively; wherein a set of vectors is used to represent corresponding intrinsic information, called intrinsic vectors: (
Figure 351531DEST_PATH_IMAGE077
) The other vector is represented as cross information of semantic information in the triples, which is called a cross vector (
Figure 98907DEST_PATH_IMAGE078
) (ii) a Using the cross vectors to generate corresponding attention mechanism weight vectors respectively (
Figure 778150DEST_PATH_IMAGE079
) (ii) a Weighting the proper vector by the generated weight vector (corresponding to step 3 in the embodiment), generating the vector representation of different entities or relations in different triple environments: (
Figure 661792DEST_PATH_IMAGE049
Figure 869920DEST_PATH_IMAGE055
Figure 42275DEST_PATH_IMAGE052
) (ii) a Then, the head entity, the a relation and the tail entity are utilized to satisfy the Huffman distance calculation of the head entity vector plus the relation vector and the tail entity vector (
Figure 259630DEST_PATH_IMAGE004
) (ii) a Finally, learning is carried out to obtain corresponding vector representation (corresponding to the step 1 in the concrete implementation), and knowledge graph relation reasoning is carried out by using the Huffman distance. The knowledge graph complex relationship inference method based on multidirectional semantics provided by the embodiment of the invention combines the corresponding semantic information differences (such as the same head entity h and relationship r, and different tail entities t) in different triple environments to obtain different vector representations (
Figure 18287DEST_PATH_IMAGE049
Figure 662895DEST_PATH_IMAGE055
Figure 384863DEST_PATH_IMAGE052
) The method and the system can better fit with the semantic information of the actual triple, and have higher accuracy on the reasoning task of the complex relation of the knowledge graph.
The foregoing description of specific embodiments of the present invention has been presented. It is to be understood that the present invention is not limited to the specific embodiments described above, and that various changes and modifications may be made by one skilled in the art within the scope of the appended claims without departing from the spirit of the invention.

Claims (10)

1. A knowledge graph complex relation reasoning method based on multidirectional semantics is characterized by comprising the following steps:
mapping entities in a training sample data set of a knowledge graph into two groups of low-dimensional space vector representations;
mapping the relation in the training sample data set of the knowledge graph into two groups of low-dimensional space vectors and one-dimensional parameter representation;
randomly selecting an entity in a training sample data set of the knowledge graph, replacing the entity of the training sample positive triple and generating training negative sample data;
defining an objective function in the training process according to the training sample positive triples and the generated training negative samples
Figure 568646DEST_PATH_IMAGE001
Comprises the following steps:
Figure 79261DEST_PATH_IMAGE002
in the formula (I), the compound is shown in the specification,
Figure 327840DEST_PATH_IMAGE003
represents a positive triplet
Figure 316525DEST_PATH_IMAGE004
Is used as a function of the distance of (c),
Figure 396476DEST_PATH_IMAGE005
representing positive triplets
Figure 687780DEST_PATH_IMAGE004
Corresponding negative example of
Figure 548289DEST_PATH_IMAGE006
A distance function of (d); wherein:
Figure 950451DEST_PATH_IMAGE007
or
Figure 212805DEST_PATH_IMAGE008
Or
Figure 675011DEST_PATH_IMAGE009
In the formula (I), the compound is shown in the specification,
Figure 694919DEST_PATH_IMAGE010
the semantic information representation that the representation head entity corresponds to the inherent attribute of the representation head entity and does not influence the semantic information representation of the tail entity or the relationship due to the property of the representation head entity;
Figure 25407DEST_PATH_IMAGE011
the semantic information corresponding to the inherent attribute of the representation relationship is represented, and the semantic information corresponding to the inherent attribute of the head entity or the tail entity is not changed;
Figure 17633DEST_PATH_IMAGE012
the representation of the semantic information corresponding to the inherent attribute of the tail entity does not influence the semantic information representation of the head entity or the relationship due to the property of the tail entity, and the semantic information corresponding to the inherent attribute of the relationship or the tail entity does not change;
Figure 775374DEST_PATH_IMAGE013
representing semantic effects of the head entity on the relationship and the tail entity in the triplets due to the relationship and the tail entity in the triplets, wherein when the relationship and the tail entity are fixed, the effect on the relationship and the tail entity changes along with the change of the head entity;
Figure 485841DEST_PATH_IMAGE014
representing semantic influence of the relation on a head entity and a tail entity in the triple, wherein when the head entity and the tail entity are fixed, the influence on the head entity and the tail entity changes along with the change of the relation;
Figure 351510DEST_PATH_IMAGE015
representing semantic effects of the tail entities on the relationships and the head entities within the triples due to the relationship and the head entities within the triples, the effects on the relationships and the head entities varying as the tail entities vary when the relationships and the head entities are fixed;
Figure 463823DEST_PATH_IMAGE017
the action which is expressed as the relationship is influenced by the passive information of the head entity and the tail entity, and is simultaneously influenced by the inherent attribute of the action to distinguish and express the entity and the relationship;
Figure 64568DEST_PATH_IMAGE018
representing a non-linear transformation, corresponding to an attention mechanism;
Figure 386965DEST_PATH_IMAGE019
a unit vector representing one m-dimension;
Figure 669042DEST_PATH_IMAGE021
is a distance formula;
respectively bringing entity mapping results and relationship mapping results in the training sample data set into an objective function, and optimizing to obtain vector representation corresponding to each entity or relationship in the knowledge graph;
and calculating the distance value between the entity and the relation in the knowledge map triple by using the vector representation obtained by optimization, and carrying out relation reasoning according to the distance value.
2. The method of claim 1, wherein the mapping entities in the training sample data set of the knowledge-graph into two sets of vectors of two sets of low-dimensional space vectors comprises:
set of entities in a set of training sample data for knowledge-graph modeling
Figure 760495DEST_PATH_IMAGE022
There are n entities, each of which
Figure 983DEST_PATH_IMAGE023
Mapped as a m-dimensional vector
Figure 545097DEST_PATH_IMAGE024
And a vector of m dimensions
Figure 896444DEST_PATH_IMAGE025
3. The method of claim 2, wherein the set of entities in the training sample data set in the knowledge graph is considered to be a set of entities in the knowledge graph
Figure 514507DEST_PATH_IMAGE022
Each entity in
Figure 253793DEST_PATH_IMAGE023
Mapping as vectors
Figure 285203DEST_PATH_IMAGE024
Sum vector
Figure 971399DEST_PATH_IMAGE025
Each is randomly initialized to a vector of m dimensions and constrained to have a modulo length of 1.
4. The method of claim 1, wherein the mapping the relationships in the training sample data set of the knowledge-graph into two sets of low-dimensional space vectors and one-dimensional parametric representations comprises:
relation set in training sample data set of knowledge graph
Figure 912810DEST_PATH_IMAGE026
There are t relations, wherein each relation
Figure 619735DEST_PATH_IMAGE028
Mapping to a vector of m dimensions
Figure 748228DEST_PATH_IMAGE029
A vector of m dimensions
Figure 566011DEST_PATH_IMAGE030
And a one-dimensional parameter
Figure 893088DEST_PATH_IMAGE032
5. The method of claim 4, wherein the relation set in the training sample data set in the knowledge-graph is considered to be a relation set in the knowledge-graph
Figure 646280DEST_PATH_IMAGE026
Each of the relationships in
Figure 858474DEST_PATH_IMAGE028
Mapping as vectors
Figure 152052DEST_PATH_IMAGE033
Sum vector
Figure 927110DEST_PATH_IMAGE030
Respectively randomly initializing into a vector with m dimensions, limiting the modular length to be 1, and randomly initializing a one-dimensional parameter
Figure 320045DEST_PATH_IMAGE032
6. The method for knowledge-graph complex relationship inference based on multidirectional semantics as claimed in claim 1, wherein the method for generating training negative sample data comprises:
for positive triplets in training samplesS(h,r,t)Randomly from a set of entities
Figure 813344DEST_PATH_IMAGE022
To select an entity
Figure DEST_PATH_IMAGE035
And randomly replacing the head entity in the triplethOr tail entitytGenerating a negative sample data set
Figure DEST_PATH_IMAGE036
(ii) a Wherein, among others,
Figure DEST_PATH_IMAGE038
a relation set in a training sample data set of a knowledge graph is set.
7. The method for reasoning about complex relationships of a knowledge graph based on multidirectional semantics as claimed in claim 1, wherein entity mapping results and relationship mapping results in a training sample data set are respectively brought into an objective function to train the entities and the relationships in the knowledge graph; after training, a mapping vector corresponding to each entity or relationship is finally obtained, and the possibility of whether the entities meet a certain relationship is obtained by using the mapping vector.
8. The method for inference on complex relations of knowledge-graph based on multidirectional semantics as claimed in claim 1, wherein said calculating distance values between entities and relations in the triples of knowledge-graph using vector representation obtained by optimization comprises:
after each group of vectors is obtained, a distance function is utilized
Figure DEST_PATH_IMAGE039
Calculating the distance among the head entity h, the relation r and the tail entity t; when the distance value tends to 0, judging the knowledge map triple to be a positive triple, and obtaining the relation shown in the positive triple; and when the distance value tends to infinity, recommending the candidate entities to perform knowledge graph relation completion, and recalculating the distance among the head entity h, the relation r and the tail entity t.
9. A terminal comprising a memory, a processor and a computer program stored on the memory and operable on the processor, wherein the computer program, when executed by the processor, is operable to perform the method of any of claims 1 to 8.
10. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, is adapted to carry out the method of any one of claims 1 to 8.
CN202110329759.4A 2021-03-29 2021-03-29 Knowledge graph complex relation reasoning method based on multidirectional semantics Active CN112711667B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110329759.4A CN112711667B (en) 2021-03-29 2021-03-29 Knowledge graph complex relation reasoning method based on multidirectional semantics

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110329759.4A CN112711667B (en) 2021-03-29 2021-03-29 Knowledge graph complex relation reasoning method based on multidirectional semantics

Publications (2)

Publication Number Publication Date
CN112711667A true CN112711667A (en) 2021-04-27
CN112711667B CN112711667B (en) 2021-07-06

Family

ID=75550325

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110329759.4A Active CN112711667B (en) 2021-03-29 2021-03-29 Knowledge graph complex relation reasoning method based on multidirectional semantics

Country Status (1)

Country Link
CN (1) CN112711667B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113569773A (en) * 2021-08-02 2021-10-29 南京信息工程大学 Interference signal identification method based on knowledge graph and Softmax regression

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106528609A (en) * 2016-09-28 2017-03-22 厦门理工学院 Vector constraint embedded transformation knowledge graph inference method
US20180247209A1 (en) * 2017-02-28 2018-08-30 Accenture Global Solutions Limited Interpretation of predictive models using semantic grouping
US20190362246A1 (en) * 2018-05-23 2019-11-28 Salesforce.Com, Inc. Multi-hop knowledge graph reasoning with reward shaping
CN110647620A (en) * 2019-09-23 2020-01-03 中国农业大学 Knowledge graph representation learning method based on confidence hyperplane and dictionary information
CN110909172A (en) * 2019-10-22 2020-03-24 中国船舶重工集团公司第七0九研究所 Knowledge representation learning method based on entity distance
CN111260064A (en) * 2020-04-15 2020-06-09 中国人民解放军国防科技大学 Knowledge inference method, system and medium based on knowledge graph of meta knowledge

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106528609A (en) * 2016-09-28 2017-03-22 厦门理工学院 Vector constraint embedded transformation knowledge graph inference method
US20180247209A1 (en) * 2017-02-28 2018-08-30 Accenture Global Solutions Limited Interpretation of predictive models using semantic grouping
US20190362246A1 (en) * 2018-05-23 2019-11-28 Salesforce.Com, Inc. Multi-hop knowledge graph reasoning with reward shaping
CN110647620A (en) * 2019-09-23 2020-01-03 中国农业大学 Knowledge graph representation learning method based on confidence hyperplane and dictionary information
CN110909172A (en) * 2019-10-22 2020-03-24 中国船舶重工集团公司第七0九研究所 Knowledge representation learning method based on entity distance
CN111260064A (en) * 2020-04-15 2020-06-09 中国人民解放军国防科技大学 Knowledge inference method, system and medium based on knowledge graph of meta knowledge

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
KAI NIE 等: ""Knowledge Reasoning Method for Military Decision Support Knowledge Graph Mixing Rule and Graph Neural Networks Learning together"", 《2020 CHINESE AUTOMATION CONGRESS (CAC)》 *
张仲伟 等: ""基于神经网络的知识推理研究综述"", 《计算机工程与应用》 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113569773A (en) * 2021-08-02 2021-10-29 南京信息工程大学 Interference signal identification method based on knowledge graph and Softmax regression
CN113569773B (en) * 2021-08-02 2023-09-15 南京信息工程大学 Interference signal identification method based on knowledge graph and Softmax regression

Also Published As

Publication number Publication date
CN112711667B (en) 2021-07-06

Similar Documents

Publication Publication Date Title
JP6961727B2 (en) Generate a copy of interest
CN111160409A (en) Heterogeneous neural network knowledge reorganization method based on common feature learning
CN111950594A (en) Unsupervised graph representation learning method and unsupervised graph representation learning device on large-scale attribute graph based on sub-graph sampling
CN107544960B (en) Automatic question-answering method based on variable binding and relation activation
CN109241290A (en) A kind of knowledge mapping complementing method, device and storage medium
CN112926655B (en) Image content understanding and visual question and answer VQA method, storage medium and terminal
CN115186097A (en) Knowledge graph and reinforcement learning based interactive recommendation method
CN112860847B (en) Video question-answer interaction method and system
CN112417289A (en) Information intelligent recommendation method based on deep clustering
CN108171328A (en) A kind of convolution algorithm method and the neural network processor based on this method
CN110737730A (en) Unsupervised learning-based user classification method, unsupervised learning-based user classification device, unsupervised learning-based user classification equipment and storage medium
CN114333027A (en) Cross-domain new facial expression recognition method based on joint and alternative learning framework
CN114817568A (en) Knowledge hypergraph link prediction method combining attention mechanism and convolutional neural network
CN112256971A (en) Sequence recommendation method and computer-readable storage medium
CN113987196A (en) Knowledge graph embedding compression method based on knowledge graph distillation
CN112711667B (en) Knowledge graph complex relation reasoning method based on multidirectional semantics
CN111488460B (en) Data processing method, device and computer readable storage medium
CN114971066A (en) Knowledge tracking method and system integrating forgetting factor and learning ability
CN114022687B (en) Image description countermeasure generation method based on reinforcement learning
Bourel et al. Boosting diversity in regression ensembles
CN113409157B (en) Cross-social network user alignment method and device
CN115510932A (en) Model training method and device, electronic equipment and storage medium
CN116738983A (en) Word embedding method, device and equipment for performing financial field task processing by model
CN112183580A (en) Small sample classification method based on dynamic knowledge path learning
JP7283836B2 (en) Meta-knowledge fine-tuning method and platform for multitasking language models

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
GR01 Patent grant
GR01 Patent grant