CN116796001A - Dynamic knowledge graph prediction method and device, electronic equipment and storage medium - Google Patents

Dynamic knowledge graph prediction method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN116796001A
CN116796001A CN202310628310.7A CN202310628310A CN116796001A CN 116796001 A CN116796001 A CN 116796001A CN 202310628310 A CN202310628310 A CN 202310628310A CN 116796001 A CN116796001 A CN 116796001A
Authority
CN
China
Prior art keywords
entity
relation
historical
graph
moment
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
Application number
CN202310628310.7A
Other languages
Chinese (zh)
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.)
Institute of Automation of Chinese Academy of Science
Original Assignee
Institute of Automation of Chinese Academy of Science
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 Institute of Automation of Chinese Academy of Science filed Critical Institute of Automation of Chinese Academy of Science
Priority to CN202310628310.7A priority Critical patent/CN116796001A/en
Publication of CN116796001A publication Critical patent/CN116796001A/en
Pending legal-status Critical Current

Links

Landscapes

  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The invention relates to the technical field of natural language processing, and provides a dynamic knowledge graph prediction method, a dynamic knowledge graph prediction device, electronic equipment and a storage medium, wherein the method acquires a historical event corpus; and inputting the historical event corpus into a graph construction model to obtain a knowledge graph at the current moment. The graph construction model realizes extraction and coding of implicit relations in the historical event corpus through the implicit relation extraction module and the relation coding module, and obtains the current-moment knowledge graph through the entity time sequence characterization module, so that the obtained knowledge graph not only contains the relation information existing in each entity in the historical event corpus, but also contains the association relation of each entity implicit in the historical event corpus, the accuracy of the knowledge graph is higher, and the subsequent application effect of the knowledge graph is better. Moreover, through continuous updating of the corpus of the historical events, accurate dynamic prediction of the knowledge graph can be realized. The present invention has been sponsored by a national emphasis development planning project (2019 YQ 1601).

Description

Dynamic knowledge graph prediction method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of natural language processing technologies, and in particular, to a dynamic knowledge graph prediction method, a dynamic knowledge graph prediction device, an electronic device, and a storage medium.
Background
Traditional Knowledge Graphs (KGs) represent various entities and relationships of the real world in a structured manner as multi-relationship data and are applied to various downstream tasks such as information retrieval, dialog systems, reading understanding, medical health, etc. However, events in the real world are often changing, and the semantics of many entities and relationships often evolve over time, so dynamic knowledge maps are proposed and widely used.
The dynamic knowledge graph is mainly constructed by extracting important entities and relations from text corpus at different times through an extraction algorithm and a tool. Because of the limitation of a construction algorithm or a tool, only the apparent relation among the entities can be extracted, and a plurality of important hidden relations are not discovered, so that the lack of the association relation among the entities is caused, the accuracy of the dynamic knowledge graph is limited to a certain extent, and the accurate application of the dynamic knowledge graph is further influenced.
Based on this, it is needed to provide a dynamic knowledge graph prediction method, which solves the problem of inaccurate dynamic knowledge graph constructed in the prior art.
Disclosure of Invention
The invention provides a dynamic knowledge graph prediction method, a dynamic knowledge graph prediction device, electronic equipment and a storage medium, which are used for solving the defects in the prior art.
The invention provides a dynamic knowledge graph prediction method, which comprises the following steps:
acquiring a historical event corpus;
inputting the historical event corpus into a graph construction model to obtain a knowledge graph of the current moment output by the graph construction model;
the atlas construction model comprises a structure encoder, an implicit relation extraction module, a relation encoding module and an entity time sequence representation module, and is obtained based on training of event corpus samples;
the structure encoder is used for extracting the relation information between each entity at each historical moment in the historical event corpus, determining the knowledge graph at each historical moment based on the entities and the relation information, and carrying out structure encoding on the knowledge graph at each historical moment to obtain the feature expression of each entity at each historical moment;
the implicit relation extraction module is used for calculating a first association relation between the entities at each historical moment and a second association relation between the entities at any two historical moments based on the feature expression of the entities at each historical moment, and constructing an entity association relation diagram based on the first association relation and the second association relation;
The relation coding module is used for coding the entity association relation graph to obtain neighbor characterization of each entity in the entity association relation graph;
the entity time sequence representation module is used for extracting the time sequence representation of each entity at the current moment based on the feature expression of each entity at each historical moment and the neighbor representation of each entity in the entity association relation graph, and constructing the knowledge graph at the current moment based on the time sequence representation of each entity at the current moment.
According to the dynamic knowledge graph prediction method provided by the invention, based on the feature expression of each entity at each historical moment, a first association relation between each entity at each historical moment and a second association relation between each entity at any two historical moments are calculated, and the method comprises the following steps:
based on the feature expression of each entity at each historical moment, a first association relation between every two entities without the relation information at each historical moment and a second association relation between every two entities without the relation information at any two historical moments are calculated.
According to the dynamic knowledge graph prediction method provided by the invention, an entity association relation graph is constructed based on the first association relation and the second association relation, and the method comprises the following steps:
Performing sparsification operation on the first association relation to obtain a first sparsification operation result;
performing sparsification operation on the second association relation to obtain a second sparsification operation result;
and constructing the entity association relation graph based on the first sparsification operation result and the second sparsification operation result.
According to the dynamic knowledge graph prediction method provided by the invention, the relation coding module is a relation graph neural network based on an attention mechanism;
encoding the entity association relation diagram to obtain neighbor characterization of each entity in the entity association relation diagram, wherein the method comprises the following steps:
calculating attention coefficients between adjacent entities in the entity association relation diagram;
and based on the attention coefficient, aggregating the relation characterization among the entities in the entity association relation graph to obtain the neighbor characterization of the entities in the entity association relation graph.
According to the dynamic knowledge graph prediction method provided by the invention, the time sequence characterization comprises a global time sequence characterization and a local time sequence characterization;
based on the feature expression of each entity at each historical moment and the neighbor characterization of each entity in the entity association relation diagram, extracting the time sequence characterization of each entity at the current moment comprises the following steps:
Coding the characteristic expression of each entity at each historical moment to obtain the local time sequence representation of each entity at the current moment;
and coding neighbor characterization of each entity in the entity association relation diagram to obtain global time sequence characterization of each entity at the current moment.
According to the dynamic knowledge graph prediction method provided by the invention, the knowledge graph at the current moment is constructed based on the time sequence characterization of each entity at the current moment, and the method comprises the following steps:
based on a gating module, fusing the local time sequence characterization of each entity at the current moment with the global time sequence characterization of each entity at the current moment to obtain a fusion result of each entity at the current moment;
and constructing a knowledge graph of the current moment based on the fusion result.
According to the dynamic knowledge graph prediction method provided by the invention, based on the feature expression of each entity at each historical moment, a first association relation between each entity at each historical moment and a second association relation between each entity at any two historical moments are calculated, and the method comprises the following steps:
based on the feature expression of each entity at each historical moment, a cosine similarity measurement function is used for calculating a first association relationship between each entity at each historical moment and a second association relationship between each entity at any two historical moments.
The invention also provides a dynamic knowledge graph prediction device, which comprises:
the corpus acquisition module is used for acquiring the corpus of the historical events;
the atlas prediction module is used for inputting the historical event corpus into an atlas construction model to obtain a knowledge atlas at the current moment output by the atlas construction model;
the atlas construction model comprises a structure encoder, an implicit relation extraction module, a relation encoding module and an entity time sequence representation module, and is obtained based on training of event corpus samples;
the structure encoder is used for extracting the relation information between each entity at each historical moment in the historical event corpus, determining the knowledge graph at each historical moment based on the entities and the relation information, and carrying out structure encoding on the knowledge graph at each historical moment to obtain the feature expression of each entity at each historical moment;
the implicit relation extraction module is used for calculating a first association relation between the entities at each historical moment and a second association relation between the entities at any two historical moments based on the feature expression of the entities at each historical moment, and constructing an entity association relation diagram based on the first association relation and the second association relation;
The relation coding module is used for coding the entity association relation graph to obtain neighbor characterization of each entity in the entity association relation graph;
the entity time sequence representation module is used for extracting the time sequence representation of each entity at the current moment based on the feature expression of each entity at each historical moment and the neighbor representation of each entity in the entity association relation graph, and constructing the knowledge graph at the current moment based on the time sequence representation of each entity at the current moment.
The invention also provides electronic equipment, which comprises a memory, a processor and a computer program stored on the memory and capable of running on the processor, wherein the processor realizes the dynamic knowledge graph prediction method according to any one of the above when executing the computer program.
The present invention also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements a dynamic knowledge-graph prediction method as described in any one of the above.
The invention also provides a computer program product comprising a computer program which when executed by a processor implements a dynamic knowledge-graph prediction method as described in any one of the above.
The invention provides a dynamic knowledge graph prediction method, a device, electronic equipment and a storage medium, wherein the method firstly acquires historical event corpus; and then inputting the historical event corpus into a graph construction model to obtain a knowledge graph at the current moment. The graph construction model realizes extraction and coding of implicit relations in the historical event corpus through the implicit relation extraction module and the relation coding module, and further obtains a current-moment knowledge graph through the entity time sequence characterization module, so that the obtained knowledge graph not only contains relation information existing in each entity in the historical event corpus, but also contains the association relation of each entity implicit in the historical event corpus, the accuracy of the knowledge graph is higher, and the subsequent application effect of the knowledge graph is better. Moreover, the obtained knowledge graph can be updated in time through the continuous updating of the historical event corpus, so that the accurate dynamic prediction of the dynamic knowledge graph is realized.
Drawings
In order to more clearly illustrate the invention or the technical solutions of the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious to those skilled in the art that other drawings can be obtained according to these drawings without inventive effort.
FIG. 1 is a schematic flow chart of a dynamic knowledge graph prediction method provided by the invention;
FIG. 2 is a schematic diagram of a graph construction model in the dynamic knowledge graph prediction method provided by the invention;
FIG. 3 is a schematic structural diagram of the dynamic knowledge graph prediction device provided by the invention;
fig. 4 is a schematic structural diagram of an electronic device provided by the present invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the present invention more apparent, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is apparent that the described embodiments are some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The features of the invention "first", "second" or "first" may be used in the specification to explicitly or implicitly include one or more of such features. In the description of the invention, unless otherwise indicated, the meaning of "a plurality" is two or more. Furthermore, in the description and claims, "and/or" means at least one of the connected objects, and the character "/", generally means that the associated object is an "or" relationship.
In the prior art, due to the limitation of a construction algorithm or a tool, the implicit relation between the entities cannot be extracted, the accuracy of the dynamic knowledge graph is limited to a certain extent, and the accurate application of the dynamic knowledge graph is further affected. Therefore, the embodiment of the invention provides a dynamic knowledge graph prediction method.
Fig. 1 is a flow chart of a dynamic knowledge graph prediction method provided in an embodiment of the present invention, as shown in fig. 1, the method includes:
s1, acquiring a historical event corpus;
s2, inputting the historical event corpus into a graph construction model to obtain a knowledge graph of the current moment output by the graph construction model;
the atlas construction model comprises a structure encoder, an implicit relation extraction module, a relation encoding module and an entity time sequence representation module, and is obtained based on training of event corpus samples;
the structure encoder is used for extracting the relation information between each entity at each historical moment in the historical event corpus, determining the knowledge graph at each historical moment based on the entities and the relation information, and carrying out structure encoding on the knowledge graph at each historical moment to obtain the feature expression of each entity at each historical moment;
The implicit relation extraction module is used for calculating a first association relation between the entities at each historical moment and a second association relation between the entities at any two historical moments based on the feature expression of the entities at each historical moment, and constructing an entity association relation diagram based on the first association relation and the second association relation;
the relation coding module is used for coding the entity association relation graph to obtain neighbor characterization of each entity in the entity association relation graph;
the entity time sequence representation module is used for extracting the time sequence representation of each entity at the current moment based on the feature expression of each entity at each historical moment and the neighbor representation of each entity in the entity association relation graph, and constructing the knowledge graph at the current moment based on the time sequence representation of each entity at the current moment.
Specifically, in the dynamic knowledge graph prediction method provided by the embodiment of the invention, the execution body can be electronic equipment, a component in the electronic equipment, an integrated circuit or a chip. The electronic device may be a mobile electronic device or a non-mobile electronic device. By way of example, the mobile electronic device may be a mobile phone, a tablet computer, a notebook computer, a palm computer, a vehicle-mounted electronic device, an intelligent wearable device, etc., and the non-mobile electronic device may be a server, a network attached memory, a personal computer, etc., which are not particularly limited herein.
Firstly, step S1 is executed to obtain a historical event corpus, where the historical event corpus may be a dialogue corpus, a knowledge question-answer related corpus, may belong to a general knowledge field, and the historical event corpus may be an event corpus obtained from a corpus such as a news event, wikipedia, etc.
After the historical event corpus is obtained, the historical event corpus can be subjected to data cleaning, wherein the cleaning mode can be to remove abnormal value points, and the abnormal value points can comprise abnormal event data, abnormal entities and the like.
And then, executing the step S2, inputting the historical event corpus into a graph construction model, and constructing a knowledge graph at the current moment by using the graph construction model. The knowledge graph construction process is dynamic, namely, as time passes, for the next moment, the event corpus at the current moment becomes the historical event corpus, and then the knowledge graph at the next moment can be constructed by utilizing the historical event corpus at the moment.
As shown in fig. 2, the map construction model may include a structure encoder, an implicit relation extraction module, a relation encoding module, and an entity timing characterization module, where the structure encoder, the implicit relation extraction module, the relation encoding module, and the entity timing characterization module are sequentially connected, and the structure encoder is connected with the entity timing characterization module.
The method comprises the steps of inputting historical event corpus into a structure encoder, wherein the structure encoder can extract relation information between each entity and each entity at each historical moment in the historical event corpus, and determine a knowledge graph at each historical moment by utilizing the relation information between each entity and each entity, so as to carry out structure encoding on the knowledge graph at each historical moment, and obtain the feature expression of each entity at each historical moment. Wherein each entity may include a time, a geographic location, an object name, a person name, an organization/institution name, a character value, an amount value, and the like. The relation information among the entities is the expressed relation directly expressed in the historical event corpus.
Here, the calculation formula of the structure encoder may be:
wherein the structure encoder may comprise a plurality of layers, i is the number of layers of the structure encoder,at t i The output of temporal entity s at layer 1+1 of the structure encoder, s generally referring to an entity,/->At t i The output of the moment entity s at the first layer of the structure encoder, f is the processing function of the first +1 layer of the structure encoder,/o>At t i Entity e of time of day s E s E, for a specific entity o At t i Time division e s Other specific entities than entity s, o refers broadly to some other entity than entity s, +. >At t i Output of time instance entity o at layer i of the structure encoder, x r For vector characterization of relation information r between entity s and entity o, W 1 、W 2 Respectively learnable parameter matrices.
t i The output of each entity at the last layer of the structure encoder at the moment is t i Feature expression of each entity at the moment.
The feature expression of each entity at each historical moment is input to an implicit relation extraction module, and the implicit relation extraction module can automatically discover the implicit important association relation among different entities and calculate the first association relation among the entities at each historical moment and the second association relation among the entities at any two historical moments.
Here, the first association relationship and the second association relationship both represent implicit relationships between the entities. It can be appreciated that the first association is an implicit relationship between entities within each time slice, and the second association is an implicit relationship between entities across time slices.
The first association relationship and the second association relationship can be respectively represented by a first similarity matrix and a second similarity matrix by calculating the similarity measurement intensity between the entities through a cosine similarity measurement function. The cosine similarity measure function can be expressed as:
Wherein d (x, y) represents the similarity matrix of the variable matrices x, y, T represents the matrix transpose, W 3 、W 4 ∈R d×d D is a constant, which is a learnable weight parameter.
And then, constructing an entity association relation diagram by using the first association relation and the second association relation with the similarity being greater than 0. In the entity association relation diagram, only the implicit relation of each entity is considered, and relation information existing in each entity in the historical event corpus is not considered.
And inputting the entity association relation graph to a relation coding module, and coding the entity association relation graph through the relation coding module to obtain neighbor characterization of each entity in the entity association relation graph. To fully exploit the new learned implicit relationships, the relationship encoding module may be a relationship graph neural network based on the attention mechanism. Furthermore, when the entity association relationship graph is encoded, the attention coefficient between adjacent entities in the entity association relationship graph can be calculated by the following formula:
wherein alpha is ij For the attention coefficient between entity i and entity j, when l=0Feature expression of entity i output for structural encoder,/->And->Output of the first layer of the implicit relation extraction module, respectively,>for the relation characterization between entity i and entity j, < > >For the representation of the relationship between entity i and entity k, < >>Representing entity i in entity association relationship diagram +.>In the neighbor entity set, a.epsilon.R 3d And->Is a parameter matrix that can be learned in each layer of the relational encoding module, f (·) is a LeakyReLU activation function, and i is a vector concatenation operation.
And then, aggregating the relation characterization among the entities in the entity association relation graph by using the attention coefficient to obtain the neighbor characterization of each entity in the entity association relation graph. The method comprises the following steps:
wherein, the liquid crystal display device comprises a liquid crystal display device,for neighbor characterization of entity i, i.e., layer I output of the relational encoding module, g (·) is a ReLU activation function, W 6 And W is 7 Is a parameter matrix for each layer in the relational encoding module.
The feature expression of each entity at each historical moment output by the structure encoder and the neighbor characterization of each entity in the entity association relation diagram output by the relation encoding module are input to the entity time sequence characterization module, and the time sequence characterization of each entity at the current moment can be extracted through the entity time sequence characterization module. The entity timing characterization module may be a gated loop recursion network.
The timing characterization of each entity at the current time may include a global timing characterization, which may reflect global timing information of each entity, and a local timing characterization, which may reflect semantic changes of each entity in a recent period of time.
Therefore, when extracting the time sequence characterization of each entity at the current moment, the feature expression of each entity at each historical moment can be encoded to obtain the local time sequence characterization of each entity at the current moment. This process can be expressed by the following formula:
wherein, the liquid crystal display device comprises a liquid crystal display device,for the local timing representation of entity s at time t+1, -/->For the local time sequence representation of the entity s at the moment t, h s,t Is the characteristic expression of entity s at time t.
And coding the neighbor characterization of each entity in the entity association relation diagram to obtain the global time sequence characterization of each entity at the current moment.
This process can be expressed by the following formula:
wherein, the liquid crystal display device comprises a liquid crystal display device,for the global timing representation of entity s at time t+1, -/->For global timing representation of entity s at time t, z s,t The neighbor characterization of the entity s in the entity association relation diagram at the moment t.
And then, constructing a knowledge graph at the current moment by utilizing the time sequence characterization of each entity at the current moment. The process can utilize a gating module in a gating cyclic recursion network to fuse the local time sequence representation of each entity at the current moment with the global time sequence representation of each entity at the current moment to obtain a fusion result of each entity at the current moment, and utilize the fusion result to construct a knowledge graph at the current moment. The fusion result of each entity at the current moment can be expressed by the following formula:
Wherein e s,t+1 The fusion result of the entity s at time t+1, g e ∈R d Is a learnable gating vector.
The dynamic knowledge graph prediction method provided by the embodiment of the invention comprises the steps of firstly obtaining a historical event corpus; and then inputting the historical event corpus into a graph construction model to obtain a knowledge graph at the current moment. The graph construction model realizes extraction and coding of implicit relations in the historical event corpus through the implicit relation extraction module and the relation coding module, and further obtains a current-moment knowledge graph through the entity time sequence characterization module, so that the obtained knowledge graph not only contains relation information existing in each entity in the historical event corpus, but also contains the association relation of each entity implicit in the historical event corpus, the accuracy of the knowledge graph is higher, and the subsequent application effect of the knowledge graph is better. Moreover, the obtained knowledge graph can be updated in time through the continuous updating of the historical event corpus, so that the accurate dynamic prediction of the dynamic knowledge graph is realized.
On the basis of the foregoing embodiments, the dynamic knowledge graph prediction method provided in the embodiments of the present invention calculates, based on the feature expression of each entity at each historical time, a first association relationship between each entity at each historical time and a second association relationship between each entity at any two historical times, including:
Based on the feature expression of each entity at each historical moment, a first association relation between every two entities without the relation information at each historical moment and a second association relation between every two entities without the relation information at any two historical moments are calculated.
Specifically, when the first association relationship and the second association relationship are calculated, only the association relationship between the entities which are not associated in the knowledge graph at the historical moment is calculated in order to improve the calculation effect.
Therefore, the feature expression of each entity at each historical moment can be utilized to calculate the first association relationship between every two entities without relationship information at each historical moment, namely:
wherein, the liquid crystal display device comprises a liquid crystal display device,representing t p Knowledge graph of time->Any two entities e i ,e j A first similarity matrix between +_>At t p Knowledge graph of time->The number of entities in->At t p Knowledge graph of time->Any two entities e i ,e j Similarity between->At t p Time entity e i Is characterized by (A) and (B)>At t p Time entity e j Is characterized by the expression of (3).
The feature expression of each entity at each historical moment can be utilized to calculate the time t at any two moments p And t q Two entities e without relationship information i ,e j The second association relation between the two is:
wherein, the liquid crystal display device comprises a liquid crystal display device,representing t p Knowledge graph of time->Any one entity of the following and t q Knowledge graph of time->A second similarity matrix between any one of the entities,>representing t p Knowledge graph of time->I-th entity e in (a) i And t q Knowledge graph of time->J-th entity e in (b) j Similarity between->At t p Time entity e i Is characterized by (A) and (B)>At t q Time entity e j Is characterized by the expression of (3).
On the basis of the above embodiment, the method for predicting a dynamic knowledge graph provided in the embodiment of the present invention constructs an entity association relationship graph based on the first association relationship and the second association relationship, including:
performing sparsification operation on the first association relation to obtain a first sparsification operation result;
performing sparsification operation on the second association relation to obtain a second sparsification operation result;
and constructing the entity association relation graph based on the first sparsification operation result and the second sparsification operation result.
Specifically, in order to preserve an important association relationship and reduce noise interference, a first association relationship and a second association relationship are subjected to a sparsification operation respectively, so as to obtain a first sparsification operation result and a second sparsification operation result.
The method comprises the following steps:
wherein, the liquid crystal display device comprises a liquid crystal display device,representation->Is the first sparsification operation result of +.>Representation->Is used for the first thinning-out operation result,representing a first similarity matrix->Is the i-th row of (a). />Representing a second similarity momentMatrix->Second sparsification operation result of +.>Representation->Second sparsification operation result of +.>Representing a second similarity matrix->Is the i-th row of (a).Is->Top k with large value 1 Personal (S)>Is->Top k with large value 2 K, k 1 And k 2 Are all constant. Here, each->Record t p Important implicit relations in the knowledge graph of the moment, each +.>The important implicit association relationships that occur between entities at different times are recorded.
Thereafter, using the first and second sparsification results to construct an entity associationRelationship diagramWhen->At->Middle entity->And->Construction of t between p Implicit relation of time of day. When->At +.>Middle entityAnd->An implicit relationship across time is built. It should be noted that only +.>The newly constructed implicit relationship is considered, and relationship information existing in the historical event corpus is not considered.
On the basis of the embodiment, the dynamic knowledge graph prediction method provided by the embodiment of the invention has the advantages that the graph construction model is obtained based on training of the following steps:
The event corpus samples are ordered according to time, and 80%,10% and 10% of data are respectively used as a training set, a verification set and a test set.
Inputting the training set into the initial construction model to enable the initial construction model to automatically learn the map construction function, and obtaining a construction result.
And calculating a loss function value by using the construction result, and updating the structural parameters of the initial construction model according to the loss function value until the initial construction model converges, wherein the structural parameters obtained at the moment reach optimization relative to the event corpus sample.
And selecting the initial building model with the optimal performance on the verification set as the spectrum building model obtained by final training according to the accuracy of the spectrum building of the converged initial building model on the verification set.
And testing the trained map construction model on a test set, and evaluating the accuracy and the precision of the map construction model. In the embodiment of the invention, the data sets ICEWS14, ICEWS05-15 and ICEWS18 are respectively used as test sets, the model construction model is tested, and the indexes of MRR, HITS@1 and HITS@10 are used for measuring the performance of the model construction model. The test results are shown in Table 1. The map construction model has good effects on all three indexes.
Table 1 results of model performance tests for different databases
As shown in fig. 3, on the basis of the above embodiment, an embodiment of the present invention provides a dynamic knowledge graph prediction apparatus, including:
a corpus acquisition module 31, configured to acquire a corpus of historical events;
the graph prediction module 32 is configured to input the historical event corpus into a graph construction model, and obtain a knowledge graph of the current moment output by the graph construction model;
the atlas construction model comprises a structure encoder, an implicit relation extraction module, a relation encoding module and an entity time sequence representation module, and is obtained based on training of event corpus samples;
the structure encoder is used for extracting the relation information between each entity at each historical moment in the historical event corpus, determining the knowledge graph at each historical moment based on the entities and the relation information, and carrying out structure encoding on the knowledge graph at each historical moment to obtain the feature expression of each entity at each historical moment;
the implicit relation extraction module is used for calculating a first association relation between the entities at each historical moment and a second association relation between the entities at any two historical moments based on the feature expression of the entities at each historical moment, and constructing an entity association relation diagram based on the first association relation and the second association relation;
The relation coding module is used for coding the entity association relation graph to obtain neighbor characterization of each entity in the entity association relation graph;
the entity time sequence representation module is used for extracting the time sequence representation of each entity at the current moment based on the feature expression of each entity at each historical moment and the neighbor representation of each entity in the entity association relation graph, and constructing the knowledge graph at the current moment based on the time sequence representation of each entity at the current moment.
On the basis of the foregoing embodiment, the dynamic knowledge graph prediction apparatus provided in the embodiment of the present invention calculates, based on the feature expression of each entity at each historical time, a first association relationship between each entity at each historical time and a second association relationship between each entity at any two historical times, including:
based on the feature expression of each entity at each historical moment, a first association relation between every two entities without the relation information at each historical moment and a second association relation between every two entities without the relation information at any two historical moments are calculated.
On the basis of the foregoing embodiment, the dynamic knowledge graph prediction apparatus provided in the embodiment of the present invention constructs an entity association relationship graph based on the first association relationship and the second association relationship, including:
Performing sparsification operation on the first association relation to obtain a first sparsification operation result;
performing sparsification operation on the second association relation to obtain a second sparsification operation result;
and constructing the entity association relation graph based on the first sparsification operation result and the second sparsification operation result.
On the basis of the above embodiment, the dynamic knowledge graph prediction device provided in the embodiment of the present invention, the relationship coding module is a relationship graph neural network based on an attention mechanism;
encoding the entity association relation diagram to obtain neighbor characterization of each entity in the entity association relation diagram, wherein the method comprises the following steps:
calculating attention coefficients between adjacent entities in the entity association relation diagram;
and based on the attention coefficient, aggregating the relation characterization among the entities in the entity association relation graph to obtain the neighbor characterization of the entities in the entity association relation graph.
On the basis of the above embodiment, the dynamic knowledge graph prediction device provided in the embodiment of the present invention, the timing characterization includes a global timing characterization and a local timing characterization;
based on the feature expression of each entity at each historical moment and the neighbor characterization of each entity in the entity association relation diagram, extracting the time sequence characterization of each entity at the current moment comprises the following steps:
Coding the characteristic expression of each entity at each historical moment to obtain the local time sequence representation of each entity at the current moment;
and coding neighbor characterization of each entity in the entity association relation diagram to obtain global time sequence characterization of each entity at the current moment.
On the basis of the foregoing embodiments, the dynamic knowledge-graph prediction apparatus provided in the embodiments of the present invention constructs a knowledge-graph at the current time based on the time sequence characterization of each entity at the current time, including:
based on a gating module, fusing the local time sequence characterization of each entity at the current moment with the global time sequence characterization of each entity at the current moment to obtain a fusion result of each entity at the current moment;
and constructing a knowledge graph of the current moment based on the fusion result.
On the basis of the foregoing embodiment, the dynamic knowledge graph prediction apparatus provided in the embodiment of the present invention calculates, based on the feature expression of each entity at each historical time, a first association relationship between each entity at each historical time and a second association relationship between each entity at any two historical times, including:
based on the feature expression of each entity at each historical moment, a cosine similarity measurement function is used for calculating a first association relationship between each entity at each historical moment and a second association relationship between each entity at any two historical moments.
Specifically, the functions of each module in the dynamic knowledge graph prediction device provided in the embodiment of the present invention are in one-to-one correspondence with the operation flows of each step in the above method embodiment, and the achieved effects are consistent.
Fig. 4 illustrates a physical schematic diagram of an electronic device, as shown in fig. 4, which may include: processor (Processor) 410, communication interface (Communications Interface) 420, memory (Memory) 430, and communication bus 440, wherein Processor 410, communication interface 420, and Memory 430 communicate with each other via communication bus 440. The processor 410 may invoke logic instructions in the memory 430 to perform the dynamic knowledge-graph prediction method provided in the above embodiments, the method comprising: acquiring a historical event corpus; inputting the historical event corpus into a graph construction model to obtain a knowledge graph of the current moment output by the graph construction model; the atlas construction model comprises a structure encoder, an implicit relation extraction module, a relation encoding module and an entity time sequence representation module, and is obtained based on training of event corpus samples; the structure encoder is used for extracting the relation information between each entity at each historical moment in the historical event corpus, determining the knowledge graph at each historical moment based on the entities and the relation information, and carrying out structure encoding on the knowledge graph at each historical moment to obtain the feature expression of each entity at each historical moment; the implicit relation extraction module is used for calculating a first association relation between the entities at each historical moment and a second association relation between the entities at any two historical moments based on the feature expression of the entities at each historical moment, and constructing an entity association relation diagram based on the first association relation and the second association relation; the relation coding module is used for coding the entity association relation graph to obtain neighbor characterization of each entity in the entity association relation graph; the entity time sequence representation module is used for extracting the time sequence representation of each entity at the current moment based on the feature expression of each entity at each historical moment and the neighbor representation of each entity in the entity association relation graph, and constructing the knowledge graph at the current moment based on the time sequence representation of each entity at the current moment.
Further, the logic instructions in the memory 430 described above may be implemented in the form of software functional units and may be stored in a computer-readable storage medium when sold or used as a stand-alone product. Based on this understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
In another aspect, the present invention also provides a computer program product, where the computer program product includes a computer program, where the computer program can be stored on a non-transitory computer readable storage medium, and when the computer program is executed by a processor, the computer can perform the dynamic knowledge graph prediction method provided in the foregoing embodiments, and the method includes: acquiring a historical event corpus; inputting the historical event corpus into a graph construction model to obtain a knowledge graph of the current moment output by the graph construction model; the atlas construction model comprises a structure encoder, an implicit relation extraction module, a relation encoding module and an entity time sequence representation module, and is obtained based on training of event corpus samples; the structure encoder is used for extracting the relation information between each entity at each historical moment in the historical event corpus, determining the knowledge graph at each historical moment based on the entities and the relation information, and carrying out structure encoding on the knowledge graph at each historical moment to obtain the feature expression of each entity at each historical moment; the implicit relation extraction module is used for calculating a first association relation between the entities at each historical moment and a second association relation between the entities at any two historical moments based on the feature expression of the entities at each historical moment, and constructing an entity association relation diagram based on the first association relation and the second association relation; the relation coding module is used for coding the entity association relation graph to obtain neighbor characterization of each entity in the entity association relation graph; the entity time sequence representation module is used for extracting the time sequence representation of each entity at the current moment based on the feature expression of each entity at each historical moment and the neighbor representation of each entity in the entity association relation graph, and constructing the knowledge graph at the current moment based on the time sequence representation of each entity at the current moment.
In still another aspect, the present invention also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, is implemented to perform the dynamic knowledge graph prediction method provided in the above embodiments, the method comprising: acquiring a historical event corpus; inputting the historical event corpus into a graph construction model to obtain a knowledge graph of the current moment output by the graph construction model; the atlas construction model comprises a structure encoder, an implicit relation extraction module, a relation encoding module and an entity time sequence representation module, and is obtained based on training of event corpus samples; the structure encoder is used for extracting the relation information between each entity at each historical moment in the historical event corpus, determining the knowledge graph at each historical moment based on the entities and the relation information, and carrying out structure encoding on the knowledge graph at each historical moment to obtain the feature expression of each entity at each historical moment; the implicit relation extraction module is used for calculating a first association relation between the entities at each historical moment and a second association relation between the entities at any two historical moments based on the feature expression of the entities at each historical moment, and constructing an entity association relation diagram based on the first association relation and the second association relation; the relation coding module is used for coding the entity association relation graph to obtain neighbor characterization of each entity in the entity association relation graph; the entity time sequence representation module is used for extracting the time sequence representation of each entity at the current moment based on the feature expression of each entity at each historical moment and the neighbor representation of each entity in the entity association relation graph, and constructing the knowledge graph at the current moment based on the time sequence representation of each entity at the current moment.
The apparatus embodiments described above are merely illustrative, wherein the elements illustrated as separate elements may or may not be physically separate, and the elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
From the above description of the embodiments, it will be apparent to those skilled in the art that the embodiments may be implemented by means of software plus necessary general hardware platforms, or of course may be implemented by means of hardware. Based on this understanding, the foregoing technical solution may be embodied essentially or in a part contributing to the prior art in the form of a software product, which may be stored in a computer readable storage medium, such as ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method described in the respective embodiments or some parts of the embodiments.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present invention, and are not limiting; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims (10)

1. The dynamic knowledge graph prediction method is characterized by comprising the following steps of:
acquiring a historical event corpus;
inputting the historical event corpus into a graph construction model to obtain a knowledge graph of the current moment output by the graph construction model;
the atlas construction model comprises a structure encoder, an implicit relation extraction module, a relation encoding module and an entity time sequence representation module, and is obtained based on training of event corpus samples;
the structure encoder is used for extracting the relation information between each entity at each historical moment in the historical event corpus, determining the knowledge graph at each historical moment based on the entities and the relation information, and carrying out structure encoding on the knowledge graph at each historical moment to obtain the feature expression of each entity at each historical moment;
The implicit relation extraction module is used for calculating a first association relation between the entities at each historical moment and a second association relation between the entities at any two historical moments based on the feature expression of the entities at each historical moment, and constructing an entity association relation diagram based on the first association relation and the second association relation;
the relation coding module is used for coding the entity association relation graph to obtain neighbor characterization of each entity in the entity association relation graph;
the entity time sequence representation module is used for extracting the time sequence representation of each entity at the current moment based on the feature expression of each entity at each historical moment and the neighbor representation of each entity in the entity association relation graph, and constructing the knowledge graph at the current moment based on the time sequence representation of each entity at the current moment.
2. The dynamic knowledge graph prediction method according to claim 1, wherein calculating a first association relationship between entities at each history time and a second association relationship between entities at any two history times based on the feature expression of the entities at each history time, comprises:
Based on the feature expression of each entity at each historical moment, a first association relation between every two entities without the relation information at each historical moment and a second association relation between every two entities without the relation information at any two historical moments are calculated.
3. The dynamic knowledge graph prediction method according to claim 1, wherein constructing an entity association relationship graph based on the first association relationship and the second association relationship comprises:
performing sparsification operation on the first association relation to obtain a first sparsification operation result;
performing sparsification operation on the second association relation to obtain a second sparsification operation result;
and constructing the entity association relation graph based on the first sparsification operation result and the second sparsification operation result.
4. The dynamic knowledge graph prediction method according to claim 1, wherein the relational coding module is a relational graph neural network based on an attention mechanism;
encoding the entity association relation diagram to obtain neighbor characterization of each entity in the entity association relation diagram, wherein the method comprises the following steps:
calculating attention coefficients between adjacent entities in the entity association relation diagram;
And based on the attention coefficient, aggregating the relation characterization among the entities in the entity association relation graph to obtain the neighbor characterization of the entities in the entity association relation graph.
5. The dynamic knowledge-graph prediction method according to any one of claims 1-4, wherein the timing characterization includes a global timing characterization and a local timing characterization;
based on the feature expression of each entity at each historical moment and the neighbor characterization of each entity in the entity association relation diagram, extracting the time sequence characterization of each entity at the current moment comprises the following steps:
coding the characteristic expression of each entity at each historical moment to obtain the local time sequence representation of each entity at the current moment;
and coding neighbor characterization of each entity in the entity association relation diagram to obtain global time sequence characterization of each entity at the current moment.
6. The method for dynamic knowledge-graph prediction according to claim 5, wherein constructing the knowledge-graph at the current time based on the time sequence characterization of each entity at the current time comprises:
based on a gating module, fusing the local time sequence characterization of each entity at the current moment with the global time sequence characterization of each entity at the current moment to obtain a fusion result of each entity at the current moment;
And constructing a knowledge graph of the current moment based on the fusion result.
7. The dynamic knowledge graph prediction method according to any one of claims 1 to 4, wherein calculating a first association relationship between entities at each history time and a second association relationship between entities at any two history times based on the feature expression of the entities at each history time, comprises:
based on the feature expression of each entity at each historical moment, a cosine similarity measurement function is used for calculating a first association relationship between each entity at each historical moment and a second association relationship between each entity at any two historical moments.
8. A dynamic knowledge graph prediction apparatus, comprising:
the corpus acquisition module is used for acquiring the corpus of the historical events;
the atlas prediction module is used for inputting the historical event corpus into an atlas construction model to obtain a knowledge atlas at the current moment output by the atlas construction model;
the atlas construction model comprises a structure encoder, an implicit relation extraction module, a relation encoding module and an entity time sequence representation module, and is obtained based on training of event corpus samples;
The structure encoder is used for extracting the relation information between each entity at each historical moment in the historical event corpus, determining the knowledge graph at each historical moment based on the entities and the relation information, and carrying out structure encoding on the knowledge graph at each historical moment to obtain the feature expression of each entity at each historical moment;
the implicit relation extraction module is used for calculating a first association relation between the entities at each historical moment and a second association relation between the entities at any two historical moments based on the feature expression of the entities at each historical moment, and constructing an entity association relation diagram based on the first association relation and the second association relation;
the relation coding module is used for coding the entity association relation graph to obtain neighbor characterization of each entity in the entity association relation graph;
the entity time sequence representation module is used for extracting the time sequence representation of each entity at the current moment based on the feature expression of each entity at each historical moment and the neighbor representation of each entity in the entity association relation graph, and constructing the knowledge graph at the current moment based on the time sequence representation of each entity at the current moment.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the dynamic knowledge-graph prediction method of any one of claims 1-7 when the computer program is executed by the processor.
10. A non-transitory computer readable storage medium having stored thereon a computer program, wherein the computer program when executed by a processor implements the dynamic knowledge-graph prediction method of any of claims 1-7.
CN202310628310.7A 2023-05-30 2023-05-30 Dynamic knowledge graph prediction method and device, electronic equipment and storage medium Pending CN116796001A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310628310.7A CN116796001A (en) 2023-05-30 2023-05-30 Dynamic knowledge graph prediction method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310628310.7A CN116796001A (en) 2023-05-30 2023-05-30 Dynamic knowledge graph prediction method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116796001A true CN116796001A (en) 2023-09-22

Family

ID=88044532

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310628310.7A Pending CN116796001A (en) 2023-05-30 2023-05-30 Dynamic knowledge graph prediction method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116796001A (en)

Similar Documents

Publication Publication Date Title
Robbins et al. Mean shift testing in correlated data
CN111382255B (en) Method, apparatus, device and medium for question-answering processing
CN110928993A (en) User position prediction method and system based on deep cycle neural network
Qin et al. Simulating and Predicting of Hydrological Time Series Based on TensorFlow Deep Learning.
CN111460101B (en) Knowledge point type identification method, knowledge point type identification device and knowledge point type identification processor
CN110633859B (en) Hydrologic sequence prediction method integrated by two-stage decomposition
Dierckx et al. Change point analysis of extreme values
CN106227884B (en) A kind of recommended method of calling a taxi online based on collaborative filtering
CN111078847A (en) Power consumer intention identification method and device, computer equipment and storage medium
CN107516279A (en) A kind of method of network public-opinion automatic early-warning
CN108879732A (en) Transient stability evaluation in power system method and device
CN111862260B (en) Cross-domain dual generation type countermeasure network-based bias eliminating method and device
Wang et al. Artificial intelligent fault diagnosis system of complex electronic equipment
CN112883182A (en) Question-answer matching method and device based on machine reading
CN114331122A (en) Key person risk level assessment method and related equipment
CN115062779A (en) Event prediction method and device based on dynamic knowledge graph
CN116862318B (en) New energy project evaluation method and device based on text semantic feature extraction
Miao et al. A novel model of estimating sea state bias based on multi-layer neural network and multi-source altimeter data
CN116796001A (en) Dynamic knowledge graph prediction method and device, electronic equipment and storage medium
CN115545168A (en) Dynamic QoS prediction method and system based on attention mechanism and recurrent neural network
Olenko et al. Average sampling restoration of harmonizable processes
CN111949783A (en) Question and answer result generation method and device in knowledge base
Li et al. Information theory in nonlinear error growth dynamics and its application to predictability: Taking the Lorenz system as an example
CN115238903B (en) Model compression method, system, electronic device and storage medium
Al-Hemyari et al. A class of efficient and modified testimators for the mean of normal distribution using complete data

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