CN115062779A - Event prediction method and device based on dynamic knowledge graph - Google Patents

Event prediction method and device based on dynamic knowledge graph Download PDF

Info

Publication number
CN115062779A
CN115062779A CN202210576172.8A CN202210576172A CN115062779A CN 115062779 A CN115062779 A CN 115062779A CN 202210576172 A CN202210576172 A CN 202210576172A CN 115062779 A CN115062779 A CN 115062779A
Authority
CN
China
Prior art keywords
knowledge graph
entity
prediction
feature
period
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
CN202210576172.8A
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 CN202210576172.8A priority Critical patent/CN115062779A/en
Publication of CN115062779A publication Critical patent/CN115062779A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N5/00Computing arrangements using knowledge-based models
    • G06N5/02Knowledge representation; Symbolic representation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q10/00Administration; Management
    • G06Q10/04Forecasting or optimisation specially adapted for administrative or management purposes, e.g. linear programming or "cutting stock problem"

Landscapes

  • Engineering & Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Economics (AREA)
  • Human Resources & Organizations (AREA)
  • Strategic Management (AREA)
  • General Physics & Mathematics (AREA)
  • Operations Research (AREA)
  • Computational Linguistics (AREA)
  • Quality & Reliability (AREA)
  • Tourism & Hospitality (AREA)
  • Marketing (AREA)
  • General Business, Economics & Management (AREA)
  • Entrepreneurship & Innovation (AREA)
  • Development Economics (AREA)
  • Artificial Intelligence (AREA)
  • Game Theory and Decision Science (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The invention provides an event prediction method and device based on a dynamic knowledge graph, wherein the method comprises the following steps: acquiring target historical events in a first historical period, and constructing a first knowledge graph corresponding to each time according to all the target historical events at each time in the first historical period; splicing the first knowledge maps corresponding to all the moments in the first history period to generate a second knowledge map; inputting the second knowledge graph into a first prediction module of the prediction model to obtain characteristic representation of each entity in the second knowledge graph and the relation between the entities in the current period; and inputting the characteristic representation of each entity and each relation in the second knowledge graph in the current period into a second prediction module of the prediction model to obtain the prediction event of the current period. The invention realizes dynamic prediction to obtain the characteristic representation of each entity in the second knowledge graph and the relation between the entities in the current period so as to realize accurate dynamic prediction of the event.

Description

Event prediction method and device based on dynamic knowledge graph
Technical Field
The invention relates to the technical field of artificial intelligence, in particular to an event prediction method and device based on a dynamic knowledge graph.
Background
Traditional Knowledge maps (KGs) represent real-world various entities and relationships as multi-relationship data in a structured manner and are applied to various downstream tasks such as information retrieval, dialog systems, reading comprehension, medical health, and the like. However, due to the limitation of manpower and material resources, the relationship information in the knowledge graph is usually incomplete, so that the knowledge graph inference model is required to complement and infer the existing knowledge graph.
In the prior art, the knowledge graph reasoning method mostly assumes that the knowledge graph is static, namely, only entities and the relationship between the entities are used for reasoning and constructing the knowledge graph. In practice, many knowledge graphs constructed from event data tend to be dynamic, i.e., the entity or relationship semantics evolve over time.
However, the knowledge graph inference method in the prior art ignores time information, that is, ignores the property of evolution of entity and relationship representation over time, so that the existing static state graph inference model cannot be applied to a prediction scene of a dynamic knowledge graph, and cannot accurately infer and predict an event.
In summary, the need for accurately and dynamically predicting events based on dynamic knowledge maps is an important issue to be solved in the industry.
Disclosure of Invention
The invention provides an event prediction method and device based on a dynamic knowledge graph, which are used for solving the defects that the existing static graph inference model in the prior art cannot be suitable for the prediction scene of the dynamic knowledge graph and cannot accurately infer and predict an event, and realize accurate dynamic prediction of the event.
The invention provides an event prediction method based on a dynamic knowledge graph, which comprises the following steps:
acquiring target historical events in a first historical period, and constructing a first knowledge graph corresponding to each moment according to all target historical events at each moment in the first historical period;
splicing the first knowledge maps corresponding to all the moments in the first history period to generate a second knowledge map;
inputting the second knowledge graph into a first prediction module of a prediction model to obtain characteristic representation of each entity in the second knowledge graph and the relation between the entities in the current period;
inputting the characteristic representation of each entity and each relation in the second knowledge graph in the current period into a second prediction module of the prediction model to obtain a prediction event of the current period;
the prediction model is obtained by training based on sample historical events in a second historical period and real events in the next historical period of the second historical period.
According to the event prediction method based on the dynamic knowledge graph, the first prediction module comprises a coding sub-module and a characteristic prediction sub-module;
inputting the second knowledge graph into a first prediction module of a prediction model to obtain a characteristic representation of each entity in the second knowledge graph and a relationship between the entities in the current period, wherein the characteristic representation comprises the following steps:
inputting the second knowledge graph into the coding submodule to obtain a feature coding result of each entity in the second knowledge graph at each moment in the first historical period;
and inputting the feature coding results and the relationships of the entities in the second knowledge graph at each moment in the first historical period into the feature prediction submodule to obtain feature representations of the entities and the relationships in the second knowledge graph in the current period.
According to the event prediction method based on the dynamic knowledge graph, the encoding submodule comprises a first encoding unit and a second encoding unit;
inputting the second knowledge graph into the coding submodule to obtain a feature coding result of each entity in the second knowledge graph at each moment in the first history period, wherein the feature coding result comprises:
inputting the second knowledge graph into the first coding unit, and performing feature coding on each entity in each first knowledge graph in the second knowledge graph on the level of each first knowledge graph in the second knowledge graph to obtain a first feature coding result of each entity in each first knowledge graph in the second knowledge graph at each moment in the first historical period;
and inputting the first feature coding result of each entity in each first knowledge graph into the second coding unit, and performing feature coding on each entity in the second knowledge graph on the level of the second knowledge graph to obtain a second feature coding result of each entity in the second knowledge graph at each moment in the first history period.
According to an event prediction method based on a dynamic knowledge graph, the method includes the steps of inputting first feature coding results of each entity in each first knowledge graph into the second coding unit, and performing feature coding on each entity in the second knowledge graph on the level of the second knowledge graph to obtain second feature coding results of each entity in the second knowledge graph at each time in the first history cycle, and includes:
performing the following steps for each entity in the second knowledge-graph:
acquiring time difference and relation between a current entity and a neighbor entity of the current entity;
acquiring the time dependence degree of the relationship between the current entity and the neighbor entity according to the time difference and the relationship;
and according to the relationship between the current entity and the neighbor entity and the dependency degree, performing aggregation updating on the current entity to obtain a second feature coding result of the current entity.
According to the event prediction method based on the dynamic knowledge graph, the feature prediction submodule comprises a first feature prediction unit, a second feature prediction unit and a fusion unit; the fusion unit comprises a first fusion unit and a second fusion unit;
inputting the feature coding results and the relationships of the entities in the second knowledge graph at each time in the first history period into the feature prediction sub-module to obtain feature representations of the entities and the relationships in the second knowledge graph in the current period, wherein the feature coding results and the relationships comprise:
inputting the first feature coding results and the relationships of the entities in the first knowledge graphs in the second knowledge graph at each moment in the first historical period into the first feature prediction unit to obtain first feature representations of the entities and the relationships in the second knowledge graph in the current period;
inputting second feature coding results and relationships of the entities in the second knowledge graph at each moment in the first history period into the second feature prediction unit to obtain second feature representations of the entities and the relationships in the second knowledge graph in the current period;
inputting the first characteristic representation and the second characteristic representation of each entity in the second knowledge graph into the first fusion unit to obtain the characteristic representation of each entity in the second knowledge graph in the current period;
and inputting the first characteristic representation and the second characteristic representation of each relation in the second knowledge graph into the second fusion unit to obtain the characteristic representation of each relation in the second knowledge graph in the current period.
According to the event prediction method based on the dynamic knowledge graph, provided by the invention, the loss function of the first prediction module is generated based on the fusion of a first loss function and a second loss function;
the first loss function is constructed and generated based on the predicted characteristic representation of each entity in a fourth knowledge graph generated by splicing third knowledge graphs corresponding to all the moments in the second historical period and the deviation between real characteristic representations;
the second loss function is generated based on a deviation construction between the predicted feature representation and the true feature representation of each relationship in the fourth knowledge-graph.
According to the event prediction method based on the dynamic knowledge graph, the first prediction module is constructed and generated based on a graph neural network and a circulating neural network.
The invention also provides an event prediction device based on the dynamic knowledge graph, which comprises the following components:
a first building block to: acquiring target historical events in a first historical period, and constructing a first knowledge graph corresponding to each time according to all the target historical events at each time in the first historical period;
a second building block for: splicing the first knowledge graphs corresponding to all the moments in the first history period to generate a second knowledge graph;
a feature prediction module to: inputting the second knowledge graph into a first prediction module of a prediction model to obtain characteristic representation of each entity in the second knowledge graph and the relation between the entities in the current period;
an event prediction module to: inputting the characteristic representation of each entity and each relation in the second knowledge graph in the current period into a second prediction module of the prediction model to obtain a prediction event of the current period;
the prediction model is obtained by training based on sample historical events in a second historical period and real events in the next historical period of the second historical period.
The present invention also provides an electronic device, comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the dynamic knowledge graph-based event prediction method as described in any one of the above.
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 based event prediction method as described in any one of the above.
The present invention also provides a computer program product comprising a computer program which, when executed by a processor, implements a method for dynamic knowledge-graph based event prediction as described in any one of the above.
According to the event prediction method and device based on the dynamic knowledge graph, the entity and the relation of the target historical event are utilized to construct the first knowledge graph corresponding to each time, the sequence formed by all the first knowledge graphs is spliced to obtain the global second knowledge graph, the time sequence information of the global second knowledge graph is learned, and the characteristic representation of the relation between each entity and each entity in the second knowledge graph in the current period is obtained through dynamic prediction, so that the event can be accurately and dynamically predicted.
Drawings
In order to more clearly illustrate the technical solutions of the present invention or the prior art, the drawings needed for the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and those skilled in the art can also obtain other drawings according to the drawings without creative efforts.
FIG. 1 is a schematic flow diagram of a dynamic knowledge graph-based event prediction method provided by the present invention;
FIG. 2 is a second flowchart illustrating a dynamic knowledge-graph-based event prediction method according to the present invention;
FIG. 3 is a schematic diagram of the dynamic knowledge-graph-based event prediction device provided by the present invention;
fig. 4 is a schematic structural diagram of an electronic device provided in the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is obvious that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the execution subject of the method may be an electronic device, a component in an electronic device, an integrated circuit, or a chip. The electronic device may be a mobile electronic device or a non-mobile electronic device. For example, the mobile electronic device may be a mobile phone, a tablet computer, a notebook computer, a palm computer, a vehicle-mounted electronic device, a smart wearable device, and the like, and the non-mobile electronic device may be a server, a network-attached storage, a personal computer, and the like, and the invention is not limited in particular.
The dynamic knowledge-graph-based event prediction method of the present invention is described below with reference to fig. 1, and the method includes the following steps:
step 101, acquiring target historical events in a first historical period, and constructing a first knowledge graph corresponding to each time according to all the target historical events at each time in the first historical period;
the first history period is a time period with a preset duration, and can be specifically set according to actual requirements.
The target historical event is a historical event which occurs in a first historical period and meets a preset condition; for example, a history event with a trending degree greater than a preset threshold, a history event with a theme being a preset theme or a target field, and the like are taken as a target history event, and this embodiment does not specifically limit this.
Optionally, the target historical events are collected from a news event or corpus such as wikipedia, the target historical events are imported into an event database, and data cleaning is performed on target time in the event database, so that abnormal target historical events and/or abnormal entities in the event database are removed.
Then, extracting the entity and the relation between the entities in each target historical event at each moment in the first historical period through entity extraction, such as a named entity recognition algorithm and the like, and an entity relation recognition technology, such as various machine learning models and the like; taking all entities in all target historical events at all times as nodes, taking the relation among all the entities in all the target historical events at all times as edges, and constructing and generating a dynamic knowledge graph related to time, namely a first knowledge graph corresponding to all the times; wherein, each time is in one-to-one correspondence with each first knowledge graph.
The relationship includes, but is not limited to, a co-occurrence relationship, an association relationship, and the like, which is not specifically limited in this embodiment. The co-occurrence relation is used for representing whether the two entities simultaneously appear in the same target historical event; the association relationship is the association relationship between the attribute information of the two entities.
102, splicing the first knowledge graphs corresponding to all the moments in the first historical period to generate a second knowledge graph;
optionally, after the first knowledge graph corresponding to each time in the first history period is acquired, the first knowledge graph corresponding to each time may be converted into a global knowledge graph, that is, a second knowledge graph.
Optionally, the first knowledge graph corresponding to each time in the first history period is used as a sub-graph in the second knowledge graph, and the first knowledge graphs corresponding to all the times in the first history period are spliced, so that the first knowledge graph corresponding to each time can be converted into the second knowledge graph.
The knowledge graph splicing method comprises the following steps: splicing the same entities appearing in the first knowledge graph corresponding to different moments; or the entities with higher similarity in the first knowledge graph corresponding to different times are spliced, and the like, and the method for splicing the knowledge graphs is not specifically limited in this embodiment.
103, inputting the second knowledge graph into a first prediction module of a prediction model to obtain characteristic representation of each entity in the second knowledge graph and the relation between the entities in the current period; the prediction model is obtained by training based on a sample historical event in a second historical period and a real event of the next historical period of the second historical period;
the prediction model comprises a first prediction module and a second prediction module; the first prediction module is used for predicting the characteristic representation of each entity and each relation in the second knowledge graph, and the second prediction module is used for predicting the event.
The structures of the first prediction module and the second prediction module can be set according to actual requirements, such as construction and generation based on a hierarchical relational graph neural network model, a feature extraction module, a prediction submodule and the like.
Before step 103 is executed, the prediction model needs to be trained, and the specific training steps include:
firstly, collecting a sample historical event in a second historical period and a real event of the next historical period of the second historical period; it should be noted that the number of the second history cycles is multiple, and the number of the second history cycles may be specifically set according to actual requirements.
According to all sample historical events at all times in the second historical period, a third knowledge graph corresponding to all the times is constructed and generated, and the third knowledge graphs corresponding to all the times in the second historical period are spliced to generate a fourth knowledge graph;
taking the fourth knowledge graph as a sample of the prediction model, and taking a real event of the next history period of the second history period as a label of the sample to construct a sample data set;
dividing the sample data set into a training set, a verification set and a test set; if the fourth knowledge graph sequence in the constructed sample data set is ordered according to time, 80%, 10% and 10% of data are respectively used as a training set, a verification set and a test set.
And then, inputting the fourth knowledge graph in the training set into the prediction model, updating parameters of the prediction model according to the prediction event and the real event output by the prediction model until the termination condition of the prediction model training is met, wherein if the prediction model is converged, the parameters of the prediction model obtained at the moment reach global optimum, and further obtaining the prediction model which can accurately and dynamically predict the event according to the global knowledge graph formed by the historical events. And selecting the prediction model with the optimal performance on the verification set as the final prediction model according to the prediction accuracy of the prediction model on the verification set.
In order to verify the accuracy of the event prediction in this embodiment, the prediction model obtained by training is tested on a test set, and the accuracy and precision of the prediction are evaluated, as specifically shown in table 1.
As shown in table 1. The prediction model in this embodiment has better performance indexes on the data sets ICEWS14, ICEWS05-15 and ICEWS 18.
TABLE 1 prediction Performance of the prediction model in this example on different datasets
Figure BDA0003660474480000091
The MRR index in table 1 is used to calculate the average of the reciprocal rank of the truth value in the predicted link entity. The MRR measures the order of the predicted ranking, and the larger the MRR value, the more forward the correct recommendation is. The calculation formula is as follows:
Figure BDA0003660474480000101
wherein N is the total number of searches, rank i Is the position of the most relevant result in the results of the ith search.
Hit (Hit ratio, recall off-line assessment), which represents the average of the predicted proportion of true values in the first k entities, and is calculated by the formula:
Figure BDA0003660474480000102
wherein n is hit Representing the number of true values, n, in the first k predicted entities test Representing the number of test cases.
After the second knowledge graph is obtained, the second knowledge graph can be used as an input of the trained first prediction module, and prediction updating is performed on feature representations of the entities and the relations between the entities in the second knowledge graph, so that feature representations of the entities and the relations between the entities in the second knowledge graph in the current period are obtained.
And 104, inputting the characteristic representation of each entity and each relation in the second knowledge graph in the current period into a second prediction module of the prediction model to obtain the prediction event of the current period.
The predicted event is a new event obtained by prediction according to the target historical event.
Optionally, after the feature representations of the entities and the relationships in the second knowledge graph in the current period are obtained, the feature representations of the entities and the relationships in the second knowledge graph in the current period may be input into the second prediction module, and the prediction event of the current period may be obtained by learning the features of the entities and the relationships in the current period.
In the event prediction method based on the dynamic knowledge graph provided by this embodiment, the entity and the relationship of the target historical event are used to construct the first knowledge graph corresponding to each time, the sequence formed by all the first knowledge graphs is spliced to obtain the global second knowledge graph, and the time sequence information of the global second knowledge graph is learned to dynamically predict the characteristic representation of the relationship between each entity and each entity in the second knowledge graph in the current period, so as to accurately and dynamically predict the event.
On the basis of the foregoing embodiment, in this embodiment, the first prediction module includes an encoding sub-module and a feature prediction sub-module; inputting the second knowledge graph into a first prediction module of a prediction model to obtain a characteristic representation of each entity in the second knowledge graph and a relationship between the entities in the current period, wherein the characteristic representation comprises the following steps: inputting the second knowledge graph into the coding submodule to obtain a feature coding result of each entity in the second knowledge graph at each moment in the first historical period; and inputting the feature coding results and the relationships of the entities in the second knowledge graph at each moment in the first historical period into the feature prediction submodule to obtain feature representations of the entities and the relationships in the second knowledge graph in the current period.
The coding sub-module can be constructed and generated based on other deep learning models such as a hierarchical relational graph neural network and the like; the feature prediction submodule can be constructed and generated on the basis of other deep learning models such as a recurrent neural network model and the like; the number of the coding sub-modules and the number of the feature prediction sub-modules may be set according to actual requirements, which is not specifically limited in this embodiment.
Optionally, in order to better capture the time sequence information of each entity in the second knowledge graph, the second knowledge graph may be input into the encoding sub-module, and the feature encoding of each entity in the second knowledge graph is performed to obtain the feature encoding result of each entity in the second knowledge graph at each time in the first history period.
The feature coding mode comprises the following steps: directly performing feature coding on each entity in the second knowledge graph on the global graph level of the second knowledge graph according to each entity in the second knowledge graph, the relation of each entity and time;
or, firstly, performing feature coding on each entity in each first knowledge graph according to each entity in the first knowledge graph and the relation between each entity on a sub-graph level of the second knowledge graph, namely a first knowledge graph level; secondly, performing feature coding on each entity in the second knowledge graph according to the coding features of each entity in each first knowledge graph, the relation between each entity and time on the global graph level of the second knowledge graph; the present example does not specifically limit the manner in which the features are encoded.
After the feature coding results of each entity in the second knowledge graph at each moment in the first history period are obtained, feature prediction can be performed on each entity and each relation in the second knowledge graph according to the feature coding results of each entity in the second knowledge graph, and feature representation of each entity and each relation in the second knowledge graph in the current period is obtained.
Wherein, the characteristic prediction mode comprises the following steps: and directly predicting to obtain the feature representation of each entity and each relation in the second knowledge graph in the current period according to the feature coding result and each relation of each entity in the second knowledge graph at each moment in the first historical period.
Or, firstly, on a sub-graph level of the second knowledge graph, namely a first knowledge graph level, predicting to obtain feature representation of each entity and each relation of each first knowledge graph in the second knowledge graph in the current period according to the feature coding result of each entity in the first knowledge graph and the relation between the entities, namely short-term feature prediction; meanwhile, in the global graph level of the second knowledge graph, according to the feature coding results of all the entities in the second knowledge graph and the relations among all the entities, feature representation of all the entities and relations in the current period in the second knowledge graph is obtained through prediction, namely long-term feature prediction; then, the short-term characteristic prediction and the long-term characteristic prediction are fused, and final characteristic representation of each entity and each relation in the second knowledge graph is obtained through prediction; the present example does not specifically limit the feature prediction manner.
After the second knowledge graph is obtained, the present embodiment may perform feature coding on each node in the second knowledge graph first to obtain timing information of each node; and then, performing feature prediction according to the feature coding result of each node in the second knowledge graph, so that the feature representation of the current period of each node in the second knowledge graph can be rapidly and accurately predicted according to the time sequence information, and further, the event can be accurately and dynamically predicted.
On the basis of the above embodiment, in this embodiment, the encoding sub-module includes a first encoding unit and a second encoding unit; inputting the second knowledge graph into the coding submodule to obtain a feature coding result of each entity in the second knowledge graph at each moment in the first history period, wherein the feature coding result comprises: inputting the second knowledge graph into the first coding unit, and performing feature coding on each entity in each first knowledge graph in the second knowledge graph on the level of each first knowledge graph in the second knowledge graph to obtain a first feature coding result of each entity in each first knowledge graph in the second knowledge graph at each moment in the first historical period; and inputting the first feature coding result of each entity in each first knowledge graph into the second coding unit, and performing feature coding on each entity in the second knowledge graph on the level of the second knowledge graph to obtain a second feature coding result of each entity in the second knowledge graph at each moment in the first history period.
The coding submodule can be constructed and generated by a hierarchical relational graph neural network. The structure of the coding sub-module, such as the number of layers, the initialization super-parameter, etc., can be set according to actual requirements.
Optionally, the constructed second knowledge graph is input to an encoding submodule, and the second knowledge graph can be subjected to two-level feature encoding by a hierarchical relational graph neural network; wherein:
the first encoding unit is used for performing aggregation updating on each entity in the first knowledge graph according to each entity in each first knowledge graph and the relation between each entity on the level of the first knowledge graph so as to obtain a first feature encoding result of each entity in the first knowledge graph.
The calculation formula of the first coding unit for performing feature coding on each entity is as follows:
Figure BDA0003660474480000131
wherein the content of the first and second substances,
Figure BDA0003660474480000132
coding the result of the characteristic of the entity s output by the l +1 layer coding network in the first coding unit, wherein f (-) is the coding function of the first coding unit;
Figure BDA0003660474480000133
and
Figure BDA0003660474480000134
the weight of the l layer coding network in the first coding unit is given; t is t i Representing an entity e in a first knowledge-graph s The time of occurrence;
Figure BDA0003660474480000135
representing an entity e s At t i The number of neighbor entities in the first knowledge-graph at the time;
Figure BDA0003660474480000136
representing an entity e s At t i A neighbor entity in the first knowledge-graph of the time of day,
Figure BDA0003660474480000137
Characteristic coding result x of neighbor entity o output by l-th layer coding network in first coding unit r And
Figure BDA0003660474480000138
static representation of relation r and entity e of l-th layer coding network output in first coding unit s The feature coding result of (1).
The second encoding unit is used for performing aggregation updating on each entity in the second knowledge graph on the level of the second knowledge graph according to each entity in the second knowledge graph, the relationship among the entities and the corresponding time information so as to obtain a second feature encoding result of each entity in the second knowledge graph.
After the first feature coding result and the second feature coding result are obtained, the second feature coding result can be directly used as a final feature coding result, feature representation of each entity and each relation in the second knowledge graph is obtained in a prediction mode, and feature representation of each entity and each relation in the second knowledge graph can also be obtained in a prediction mode by combining the first feature coding result and the second feature coding result as the final feature coding result; this embodiment does not specifically limit this.
In the embodiment, a first feature coding result of each node in each first knowledge graph in a second knowledge graph is obtained on a sub-graph level (a first knowledge graph level) in a hierarchical mode; then, on a global graph level (a second knowledge graph level), acquiring a second feature coding result of each node in the second knowledge graph; the time sequence information and the incidence relation information of each node in the second knowledge graph can be extracted more comprehensively, and further the event prediction result is more accurate.
In addition to the foregoing embodiments, in this embodiment, the inputting the first feature encoding result of each entity in each first knowledge graph into the second encoding unit, and performing feature encoding on each entity in the second knowledge graph at the level of the second knowledge graph to obtain the second feature encoding result of each entity in the second knowledge graph at each time in the first history period includes: performing the following steps for each entity in the second knowledge-graph: acquiring time difference and relation between a current entity and a neighbor entity of the current entity; acquiring the time dependence degree of the relationship between the current entity and the neighbor entity according to the time difference and the relationship; and performing aggregation updating on the current entity according to the relationship between the current entity and the neighbor entity and the degree of dependence to obtain a second feature coding result of the current entity.
Optionally, the following feature encoding steps are performed for each entity in the second knowledge-graph using the second encoding unit:
firstly, the degree of dependence of time in a second knowledge graph on the adjacent relation between the current entity and the neighbor entity is considered; specifically, the dependency degree between the current entity and the neighbor entity is obtained according to the time difference and the relationship between the current entity and the neighbor entity
Figure BDA0003660474480000151
The specific calculation formula is as follows:
Figure BDA0003660474480000152
Figure BDA0003660474480000153
wherein the content of the first and second substances,
Figure BDA0003660474480000154
embedding the relationship between the entity i and the neighbor entity j in the second knowledge graph, i.e. the degree of dependence, t i And t j The time corresponding to the entity i and the entity j is obtained; phi (t) is a time encoding function,x r static tokens which are the relation r, feature dimensions with d representing a static token, w and p are learnable vector parameters.
Then, an attention mechanism in a graph neural network in a second coding unit is adopted, and an attention calculation coefficient between the current entity and the neighbor entity is calculated and obtained according to the relationship and the dependency degree between the current entity and the neighbor entity, wherein the specific formula is as follows:
Figure BDA0003660474480000155
wherein, the first and the second end of the pipe are connected with each other,
Figure BDA0003660474480000156
coefficients are calculated for attention between the current entity s and the neighboring entity o,
Figure BDA0003660474480000157
is a weight coefficient, a T Is a learnable weight vector parameter,
Figure BDA0003660474480000158
As nodes in the second knowledge-graph
Figure BDA0003660474480000159
At the output of the l-th layer of the encoder,
Figure BDA00036604744800001510
as nodes in the second knowledge-graph
Figure BDA00036604744800001511
At the output of the l-th layer of the encoder,
Figure BDA00036604744800001512
embedded for the relationship of entity i to neighbor entity j in the second knowledge-graph,
Figure BDA00036604744800001513
as nodes in the second knowledge-graph
Figure BDA00036604744800001514
At the output of the l-th layer of the encoder,
Figure BDA0003660474480000161
embedded for the relationship of entity i to neighbor entity k in the second knowledge-graph,
Figure BDA0003660474480000162
are nodes in the second knowledge-graph,
Figure BDA0003660474480000163
as nodes in the second knowledge-graph
Figure BDA0003660474480000164
Of the neighboring node.
Then, according to the attention calculation coefficient between the current entity and the neighbor entity, the neighbor entity of each entity is aggregated, and a second characteristic coding result of the current entity is obtained by updating; the concrete formula is as follows:
Figure BDA0003660474480000165
wherein the content of the first and second substances,
Figure BDA0003660474480000166
encoding the result for the second feature of the current entity s,
Figure BDA0003660474480000167
coefficients are calculated for attention between the current entity s and the neighboring entity o,
Figure BDA0003660474480000168
and
Figure BDA0003660474480000169
is a weight coefficient, t i The time when the entity interaction occurs,
Figure BDA00036604744800001610
As nodes in the second knowledge-graph
Figure BDA00036604744800001611
Output at layer l of the encoder;
Figure BDA00036604744800001612
embedding the relation between the entity i and the neighbor entity k in the second knowledge graph;
Figure BDA00036604744800001613
as nodes in the second knowledge-graph
Figure BDA00036604744800001614
Output at layer l of the encoder.
In recent years, with the development of computer technology and the explosive growth of mass data, deep learning and big data technology become mainstream of dynamic knowledge map prediction. Based on the consensus, the embodiment develops and establishes an algorithm and a model for dynamic knowledge map prediction, converts a first knowledge map sequence related to time into a global second knowledge map, and performs multi-level feature coding on an entity in the second knowledge map by using a graph neural network model in a coding submodule, so that time sequence information is captured better, prediction accuracy of the dynamic knowledge map is improved, and more effective reference information is provided for an event prediction scene.
On the basis of the foregoing embodiment, in this embodiment, the feature prediction sub-module includes a first feature prediction unit, a second feature prediction unit, and a fusion unit; the fusion unit comprises a first fusion unit and a second fusion unit; inputting the feature coding results and the relationships of the entities in the second knowledge graph at each time in the first history period into the feature prediction sub-module to obtain feature representations of the entities and the relationships in the second knowledge graph in the current period, wherein the feature coding results and the relationships comprise: inputting the first feature coding results and the relationships of the entities in the first knowledge graphs in the second knowledge graph at each moment in the first historical period into the first feature prediction unit to obtain first feature representations of the entities and the relationships in the second knowledge graph in the current period; inputting second feature coding results and relationships of the entities in the second knowledge graph at each moment in the first history period into the second feature prediction unit to obtain second feature representations of the entities and the relationships in the second knowledge graph in the current period; inputting the first characteristic representation and the second characteristic representation of each entity in the second knowledge graph into the first fusion unit to obtain the characteristic representation of each entity in the second knowledge graph in the current period; and inputting the first characteristic representation and the second characteristic representation of each relation in the second knowledge graph into the second fusion unit to obtain the characteristic representation of each relation in the second knowledge graph in the current period.
As shown in fig. 2, the feature prediction sub-module includes a first feature prediction unit, a second feature prediction unit, and a fusion unit.
The structure of each Unit in the feature prediction sub-module may be constructed and generated according to actual requirements, for example, the first feature prediction Unit and the fusion Unit may be constructed and generated based on other deep learning models such as a GRU (Gated current Unit) network, and the second feature prediction Unit may be constructed and generated based on other neural network models such as an MLP (multi layer Perceptron).
After the coding submodule is used for coding the features of each node in the second knowledge graph, the feature prediction submodule can be used for extracting the long-term and short-term feature representation of the entity and the relation in the second knowledge graph at each moment in the current period from the output result of the coding submodule.
Wherein, for short-term feature representation, namely the first feature representation extraction, the following steps can be implemented:
and taking the first feature coding result and the relationship of each entity at the first knowledge graph, namely a sub-graph level, as input information of a first feature prediction unit, and performing coding prediction on the first feature coding result and the relationship of each entity at the first knowledge graph level through the first feature prediction unit to obtain short-term feature representation, namely first feature representation, of each entity and each relationship in a second knowledge graph at the current period. Wherein, the first characteristic of each entity in the current period is represented as:
Figure BDA0003660474480000181
wherein the content of the first and second substances,
Figure BDA0003660474480000182
representing a first feature of the entity s in the second knowledge graph in a t +1 period;
Figure BDA0003660474480000183
is a first feature representation of an entity s in the second knowledge-graph in a period t, h s,t And coding the result of the first feature of the entity s in the first knowledge graph in the t period.
Wherein, the first characteristic of each relation in the current period is represented as:
Figure BDA0003660474480000184
wherein the content of the first and second substances,
Figure BDA0003660474480000185
representing a first characteristic of the relation r in the second knowledge graph in a t +1 period;
Figure BDA0003660474480000186
is a first feature representation of an entity r in the second knowledge-graph in a period t, h r,t The characteristic representation of the relation r in the first knowledge graph in the t period is represented, namely the relation characterization.
Wherein the relationship at each moment represents h r,t The calculation method of (c) is as follows:
Figure BDA0003660474480000187
wherein, Meanpooling (·) is an average pooling operation;
Figure BDA0003660474480000188
for entity s in the first knowledge-graph t i The first feature coding result of the moment, | | is the vector splicing symbol, x r Is a static characterization of the relation r, e s Is a function of the entity s, and,
Figure BDA0003660474480000189
is the associated entity set of the relation r at each moment in the t period.
For the long-term feature representation, namely the second feature representation extraction, the method can be realized by the following steps:
and taking the second feature coding result and the relationship of each entity at the level of the second knowledge graph, namely the global graph, as input information of a second feature prediction unit, and performing coding prediction on the second feature coding result and the relationship of each entity at the level of the second knowledge graph through the second feature prediction unit to obtain long-term feature representation, namely second feature representation, of each entity and each relationship in the second knowledge graph at the current period.
The entity input of the global graph hierarchy can be used as the long-term characterization of each entity at different time, that is, the second feature of each entity in the current period represents:
Figure BDA0003660474480000191
wherein the content of the first and second substances,
Figure BDA0003660474480000192
for the long-term characterization of the entity s in the period t +1, i.e. the second characterization, W 6 And b are the weight coefficient and offset in the second feature prediction unit, Z s,t Encoding a result of a second feature of the entity s in the second knowledge graph in the period t;
wherein, a static representation of the relationship can be used as a long-term representation of each relationship at different time, that is, a second characteristic representation of each relationship in the current period:
Figure BDA0003660474480000193
wherein the content of the first and second substances,
Figure BDA0003660474480000194
for a second characterization of each relation r in the t +1 period, x r Is a static characterization of each relationship r.
Optionally, after obtaining the first feature representation and the second feature representation of each entity and each relationship in the second knowledge graph in the current period, the fusion unit may be used to respectively fuse the first feature representation and the second feature representation of the entity, and fuse the first feature representation and the second feature representation of the relationship, so as to obtain final feature representations of the entity and the relationship.
Wherein the fusion unit can be generated based on the gate control unit construction; the final characterization is calculated as:
Figure BDA0003660474480000195
Figure BDA0003660474480000196
wherein e is s,t+1 For the final characterization of entity s in period t +1, g e ,
Figure BDA0003660474480000197
Gating vectors that are entities and relationships, respectively; as an element multiplication operation,
Figure BDA0003660474480000201
for the long-term characterization of entity s over the period t +1,
Figure BDA0003660474480000202
for entity s in period t +1Short-term characterization; e.g. of the type r,t+1 For the final characterization of the relationship r over the t +1 period,
Figure BDA0003660474480000203
for long-term characterization of the relationship r over the t +1 period,
Figure BDA0003660474480000204
is a short term characterization of the relationship r over the t +1 period.
In the embodiment, a serialized first knowledge graph is converted into a global second knowledge graph, then a hierarchical relational graph neural network in a coding sub-module is used for carrying out feature coding on the second knowledge graph, after feature coding results of each entity in different levels are obtained, long-term feature representation and short-term feature representation of the predicted entity and the relation are respectively coded from the feature coding results of the different levels through a first feature prediction unit and a second feature prediction unit, and finally a fusion unit is used for fusing long-term and short-term representations of the entity and the relation, so that the feature representation of each entity and the feature representation of each relation are dynamically predicted more accurately, and the event is accurately and dynamically predicted.
In conclusion, compared with the existing static map reasoning model which cannot model the time dependency relationship in the map sequence difficultly, the prediction model in the embodiment can not only self-adaptively establish the long-term time dependency relationship in the map sequence, but also self-adaptively establish the short-term time dependency relationship in the map sequence; and long-term time dependency relationship and short-term time dependency relationship in the map sequence are combined, so that the characteristic representation of each entity and the characteristic representation of each relationship are predicted more accurately through reasoning, and the event prediction result is more reliable and accurate.
On the basis of the above embodiments, in this embodiment, the loss function of the first prediction module is generated based on the fusion of the first loss function and the second loss function; the first loss function is constructed and generated based on the predicted characteristic representation of each entity in a fourth knowledge graph generated by splicing third knowledge graphs corresponding to all the moments in the second historical period and the deviation between real characteristic representations; the second loss function is generated based on a deviation construction between the predicted feature representation and the true feature representation of each relationship in the fourth knowledge-graph.
Optionally, in the process of training the prediction model, the prediction model needs to be trained by combining the loss function of the first prediction module and the loss function of the second prediction module;
and constructing and generating a loss function of the second prediction model based on the deviation between the predicted event corresponding to the sample historical time and the real event.
The loss function of the first prediction module is generated based on the fusion of the first loss function and the second loss function.
Optionally, the step of obtaining the loss function of the first prediction module includes:
firstly, a fourth knowledge graph generated by splicing third knowledge graphs corresponding to all times in a second historical period is used as input information of a prediction model, and predicted characteristic representation of each entity and each relation in the fourth knowledge graph in the next historical period is obtained through prediction;
then, constructing a deviation between the predicted characteristic representation and the real characteristic representation of each entity in the fourth knowledge graph in the next history period to generate a first loss function, wherein the specific formula is as follows:
Figure BDA0003660474480000211
wherein the content of the first and second substances,
Figure BDA0003660474480000212
predicting a loss function for a first loss function, i.e., an entity; t is the total number of all moments in the second history period; e.g. of the type s Is an entity s; r is a relationship; e.g. of the type o Is an entity o; g t+1 A knowledge graph of the period t + 1;
Figure BDA0003660474480000213
in the case of a conditional probability,
Figure BDA0003660474480000214
is a knowledge graph with less than t +1 period.
And constructing the deviation of each relation in the fourth knowledge graph between the predicted characteristic representation and the real characteristic representation of the next historical period to generate a second loss function, wherein the specific formula is as follows:
Figure BDA0003660474480000215
wherein, the first and the second end of the pipe are connected with each other,
Figure BDA0003660474480000216
in order to be a function of the second loss,
Figure BDA0003660474480000217
is a conditional probability.
Finally, in order to balance the first loss function and the second loss function, the first loss function and the second loss function are fused, and parameters of the target detection model and the classification model are optimized according to a fusion result;
the fusion method includes, but is not limited to, directly adding the first loss function and the second loss function or adding them in a weighted manner, which is not specifically limited in this embodiment.
For example, the specific formula for fusing the first loss function and the second loss function to generate the loss function of the first prediction module is as follows:
Figure BDA0003660474480000221
wherein the content of the first and second substances,
Figure BDA0003660474480000222
is a loss function of the first prediction module, lambda 1 And λ 2 Is a weight coefficient, | Θ | 2 Is a regularization term.
The operation operations involved in the prediction model are differentiable; therefore, the parameters of the prediction model can be updated by adopting a standard gradient descent method or other optimization gradient descent methods.
In the embodiment, the overall training is performed on the prediction model by combining the first loss function generated by the entity prediction construction and the second loss function generated by the relationship prediction construction, so that the comprehensive performance of the trained prediction model is better.
On the basis of the above embodiments, in this embodiment, the first prediction module is generated based on the graph neural network and the recurrent neural network.
As shown in fig. 2, the coding sub-module and the feature prediction sub-module in the first prediction module;
the first coding unit and the second coding unit of the coding submodule can be generated based on a graph neural network construction; the type of the graph neural network may be other types such as a hierarchical graph neural network, and this embodiment is not particularly limited thereto.
One or more combinations of the first feature prediction unit, the second feature prediction unit, and the fusion unit of the feature prediction sub-module may be constructed and generated by using a recurrent neural network, and the types of the recurrent neural networks used may be the same or different, which is not specifically limited in this embodiment.
For example, the first feature prediction unit and the second fusion unit both employ a GRU network.
The method and the device perform dynamic knowledge graph prediction based on the hierarchical relation graph neural network and the circulation network capable of extracting the upper and lower relations, and realize accurate dynamic prediction of events.
The event prediction device based on the dynamic knowledge graph provided by the invention is described below, and the event prediction device based on the dynamic knowledge graph described below and the event prediction method based on the dynamic knowledge graph described above can be referred to correspondingly.
As shown in fig. 3, the present embodiment provides an event prediction apparatus based on a dynamic knowledge graph, which includes:
the first building block 301 is configured to: acquiring target historical events in a first historical period, and constructing a first knowledge graph corresponding to each time according to all the target historical events at each time in the first historical period;
optionally, the target historical events are first collected from a news event or wikipedia corpus or the like.
Then, extracting the relationship between the entity and the entity in each target historical event at each moment in the first historical period through entity extraction; and constructing and generating a dynamic knowledge graph related to time, namely a first knowledge graph corresponding to each time by taking each entity in all the target historical events at each time as a node and taking the relation among each entity in all the target historical events at each time as an edge.
The second building block 302 is for: splicing the first knowledge maps corresponding to all the moments in the first history period to generate a second knowledge map;
optionally, after the first knowledge graph corresponding to each time in the first history period is acquired, the first knowledge graph corresponding to each time may be converted into a global knowledge graph, that is, a second knowledge graph.
The feature prediction module 303 is configured to: inputting the second knowledge graph into a first prediction module of a prediction model to obtain characteristic representation of each entity in the second knowledge graph and the relation between the entities in the current period;
after the second knowledge graph is obtained, the second knowledge graph can be used as an input of the trained first prediction module, and prediction updating is performed on feature representations of the entities and the relations between the entities in the second knowledge graph, so that feature representations of the entities and the relations between the entities in the second knowledge graph in the current period are obtained.
The event prediction module 304 is configured to: inputting the feature representation of each entity and each relation in the second knowledge graph in the current period into a second prediction module of the prediction model to obtain a prediction event of the current period; the prediction model is obtained by training based on sample historical events in a second historical period and real events in the next historical period of the second historical period.
Optionally, after the feature representations of the entities and the relationships in the second knowledge graph in the current period are obtained, the feature representations of the entities and the relationships in the second knowledge graph in the current period may be input into the second prediction module, and the prediction event of the current period may be obtained by learning the features of the entities and the relationships in the current period.
In the event prediction method based on the dynamic knowledge graph provided by this embodiment, the entity and the relationship of the target historical event are used to construct the first knowledge graph corresponding to each time, the sequence formed by all the first knowledge graphs is spliced to obtain the global second knowledge graph, and the time sequence information of the global second knowledge graph is learned to dynamically predict the characteristic representation of the relationship between each entity and each entity in the second knowledge graph in the current period, so as to accurately and dynamically predict the event.
On the basis of the foregoing embodiment, in this embodiment, the first prediction module includes an encoding sub-module and a feature prediction sub-module; a feature prediction module to: inputting the second knowledge graph into the coding submodule to obtain a feature coding result of each entity in the second knowledge graph at each moment in the first historical period; and inputting the feature coding results and the relationships of the entities in the second knowledge graph at each moment in the first historical period into the feature prediction submodule to obtain feature representations of the entities and the relationships in the second knowledge graph in the current period.
On the basis of the foregoing embodiment, in this embodiment, the encoding sub-module includes a first encoding unit and a second encoding unit; a feature prediction module further to: inputting the second knowledge graph into the first coding unit, and performing feature coding on each entity in each first knowledge graph in the second knowledge graph on the level of each first knowledge graph in the second knowledge graph to obtain a first feature coding result of each entity in each first knowledge graph in the second knowledge graph at each moment in the first historical period; and inputting the first feature coding result of each entity in each first knowledge graph into the second coding unit, and performing feature coding on each entity in the second knowledge graph on the level of the second knowledge graph to obtain a second feature coding result of each entity in the second knowledge graph at each moment in the first history period.
On the basis of the foregoing embodiments, the feature prediction module in this embodiment is further configured to: performing the following steps for each entity in the second knowledge-graph: acquiring time difference and relation between a current entity and a neighbor entity of the current entity; acquiring the time dependence degree of the relationship between the current entity and the neighbor entity according to the time difference and the relationship; and performing aggregation updating on the current entity according to the relationship between the current entity and the neighbor entity and the degree of dependence to obtain a second feature coding result of the current entity.
On the basis of the foregoing embodiments, in this embodiment, the feature prediction sub-module includes a first feature prediction unit, a second feature prediction unit, and a fusion unit; the fusion unit comprises a first fusion unit and a second fusion unit;
the feature prediction module is further to: inputting the first feature coding results and the relationships of the entities in the first knowledge graphs in the second knowledge graph at each moment in the first historical period into the first feature prediction unit to obtain first feature representations of the entities and the relationships in the second knowledge graph in the current period; inputting second feature coding results and relationships of the entities in the second knowledge graph at each moment in the first history period into the second feature prediction unit to obtain second feature representations of the entities and the relationships in the second knowledge graph in the current period; inputting the first characteristic representation and the second characteristic representation of each entity in the second knowledge graph into the first fusion unit to obtain the characteristic representation of each entity in the second knowledge graph in the current period; and inputting the first characteristic representation and the second characteristic representation of each relation in the second knowledge graph into the second fusion unit to obtain the characteristic representation of each relation in the second knowledge graph in the current period.
On the basis of the foregoing embodiments, in this embodiment, the loss function of the first prediction module is generated based on a fusion of a first loss function and a second loss function; the first loss function is constructed and generated based on the predicted characteristic representation of each entity in a fourth knowledge graph generated by splicing third knowledge graphs corresponding to all the moments in the second historical period and the deviation between real characteristic representations; the second loss function is generated based on a deviation construction between the predicted feature representation and the true feature representation of each relationship in the fourth knowledge-graph.
On the basis of the above embodiments, in this embodiment, the first prediction module is constructed and generated based on a graph neural network and a recurrent neural network.
Fig. 4 illustrates a physical structure diagram of an electronic device, which may include, as shown in fig. 4: a processor (processor)401, a communication Interface (communication Interface)402, a memory (memory)403 and a communication bus 404, wherein the processor 401, the communication Interface 402 and the memory 403 complete communication with each other through the communication bus 404. Processor 401 may invoke logic instructions in memory 403 to perform a dynamic knowledge-graph-based event prediction method comprising: acquiring target historical events in a first historical period, and constructing a first knowledge graph corresponding to each time according to all the target historical events at each time in the first historical period; splicing the first knowledge maps corresponding to all the moments in the first history period to generate a second knowledge map; inputting the second knowledge graph into a first prediction module of a prediction model to obtain characteristic representation of each entity in the second knowledge graph and the relation between the entities in the current period; inputting the characteristic representation of each entity and each relation in the second knowledge graph in the current period into a second prediction module of the prediction model to obtain a prediction event of the current period; the prediction model is obtained by training based on sample historical events in a second historical period and real events in the next historical period of the second historical period.
In addition, the logic instructions in the memory 403 may be implemented in the form of software functional units and stored in a computer readable storage medium when the software functional units are sold or used as independent products. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute 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 (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
In another aspect, the present invention also provides a computer program product, the computer program product including a computer program, the computer program being stored on a non-transitory computer-readable storage medium, wherein when the computer program is executed by a processor, the computer is capable of executing the dynamic knowledge-graph-based event prediction method provided by the above methods, the method including: acquiring target historical events in a first historical period, and constructing a first knowledge graph corresponding to each time according to all the target historical events at each time in the first historical period; splicing the first knowledge maps corresponding to all the moments in the first history period to generate a second knowledge map; inputting the second knowledge graph into a first prediction module of a prediction model to obtain characteristic representation of each entity in the second knowledge graph and the relation between the entities in the current period; inputting the characteristic representation of each entity and each relation in the second knowledge graph in the current period into a second prediction module of the prediction model to obtain a prediction event of the current period; the prediction model is obtained by training based on sample historical events in a second historical period and real events in the next historical period of the second historical period.
In yet 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, implements a dynamic knowledge-graph based event prediction method provided by the above methods, the method comprising: acquiring target historical events in a first historical period, and constructing a first knowledge graph corresponding to each time according to all the target historical events at each time in the first historical period; splicing the first knowledge maps corresponding to all the moments in the first history period to generate a second knowledge map; inputting the second knowledge graph into a first prediction module of a prediction model to obtain characteristic representation of each entity in the second knowledge graph and the relation between the entities in the current period; inputting the characteristic representation of each entity and each relation in the second knowledge graph in the current period into a second prediction module of the prediction model to obtain a prediction event of the current period; the prediction model is obtained by training based on sample historical events in a second historical period and real events in the next historical period of the second historical period.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present 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 solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (10)

1. An event prediction method based on a dynamic knowledge graph is characterized by comprising the following steps:
acquiring target historical events in a first historical period, and constructing a first knowledge graph corresponding to each time according to all the target historical events at each time in the first historical period;
splicing the first knowledge maps corresponding to all the moments in the first history period to generate a second knowledge map;
inputting the second knowledge graph into a first prediction module of a prediction model to obtain characteristic representation of each entity in the second knowledge graph and the relation between the entities in the current period;
inputting the characteristic representation of each entity and each relation in the second knowledge graph in the current period into a second prediction module of the prediction model to obtain a prediction event of the current period;
the prediction model is obtained by training based on sample historical events in a second historical period and real events in the next historical period of the second historical period.
2. The dynamic knowledge graph-based event prediction method of claim 1, wherein the first prediction module comprises an encoding sub-module and a feature prediction sub-module;
inputting the second knowledge graph into a first prediction module of a prediction model to obtain a characteristic representation of each entity in the second knowledge graph and a relationship between the entities in the current period, wherein the characteristic representation comprises the following steps:
inputting the second knowledge graph into the coding submodule to obtain a feature coding result of each entity in the second knowledge graph at each moment in the first historical period;
and inputting the feature coding result and the relationship of each entity in the second knowledge graph at each moment in the first historical period into the feature prediction submodule to obtain feature representation of each entity and each relationship in the second knowledge graph in the current period.
3. The dynamic knowledge-graph-based event prediction method according to claim 2, wherein the encoding sub-module comprises a first encoding unit and a second encoding unit;
inputting the second knowledge graph into the coding submodule to obtain a feature coding result of each entity in the second knowledge graph at each moment in the first history period, wherein the feature coding result comprises:
inputting the second knowledge graph into the first coding unit, and performing feature coding on each entity in each first knowledge graph in the second knowledge graph on the level of each first knowledge graph in the second knowledge graph to obtain a first feature coding result of each entity in each first knowledge graph in the second knowledge graph at each moment in the first historical period;
and inputting the first feature coding result of each entity in each first knowledge graph into the second coding unit, and performing feature coding on each entity in the second knowledge graph on the level of the second knowledge graph to obtain a second feature coding result of each entity in the second knowledge graph at each moment in the first historical period.
4. The dynamic-knowledge-graph-based event prediction method according to claim 3, wherein the inputting the first feature coding result of each entity in each first knowledge graph into the second coding unit, and performing feature coding on each entity in the second knowledge graph at the level of the second knowledge graph to obtain the second feature coding result of each entity in the second knowledge graph at each time in the first history period comprises:
performing the following steps for each entity in the second knowledge-graph:
acquiring a time difference and a relation between a current entity and a neighbor entity of the current entity;
acquiring the time dependence degree of the relationship between the current entity and the neighbor entity according to the time difference and the relationship;
and performing aggregation updating on the current entity according to the relationship between the current entity and the neighbor entity and the degree of dependence to obtain a second feature coding result of the current entity.
5. The dynamic knowledge graph-based event prediction method according to claim 3, wherein the feature prediction submodule comprises a first feature prediction unit, a second feature prediction unit and a fusion unit; the fusion unit comprises a first fusion unit and a second fusion unit;
inputting the feature coding results and the relationships of the entities in the second knowledge graph at each time in the first history period into the feature prediction sub-module to obtain feature representations of the entities and the relationships in the second knowledge graph in the current period, wherein the feature coding results and the relationships comprise:
inputting the first feature coding results and the relationships of the entities in the first knowledge graphs in the second knowledge graph at each moment in the first historical period into the first feature prediction unit to obtain first feature representations of the entities and the relationships in the second knowledge graph in the current period;
inputting a second feature coding result and each relation of each entity in the second knowledge graph at each moment in the first history period into the second feature prediction unit to obtain a second feature representation of each entity and each relation in the second knowledge graph in the current period;
inputting the first characteristic representation and the second characteristic representation of each entity in the second knowledge graph into the first fusion unit to obtain the characteristic representation of each entity in the second knowledge graph in the current period;
and inputting the first characteristic representation and the second characteristic representation of each relation in the second knowledge graph into the second fusion unit to obtain the characteristic representation of each relation in the second knowledge graph in the current period.
6. The dynamic knowledge graph-based event prediction method according to any one of claims 1-5, wherein the loss function of the first prediction module is generated based on a fusion of a first loss function and a second loss function;
the first loss function is constructed and generated based on the predicted characteristic representation of each entity in a fourth knowledge graph generated by splicing third knowledge graphs corresponding to all the moments in the second historical period and the deviation between real characteristic representations;
the second loss function is generated based on a deviation construction between the predicted feature representation and the true feature representation of each relationship in the fourth knowledge-graph.
7. The dynamic knowledge graph-based event prediction method according to any one of claims 1 to 5, wherein the first prediction module is generated based on a graph neural network and a recurrent neural network.
8. An event prediction device based on a dynamic knowledge graph, comprising:
a first build module to: acquiring target historical events in a first historical period, and constructing a first knowledge graph corresponding to each time according to all the target historical events at each time in the first historical period;
a second building block for: splicing the first knowledge maps corresponding to all the moments in the first history period to generate a second knowledge map;
a feature prediction module to: inputting the second knowledge graph into a first prediction module of a prediction model to obtain characteristic representation of each entity in the second knowledge graph and the relation between the entities in the current period;
an event prediction module to: inputting the characteristic representation of each entity and each relation in the second knowledge graph in the current period into a second prediction module of the prediction model to obtain a prediction event of the current period;
the prediction model is obtained by training based on sample historical events in a second historical period and real events in the next historical period of the second historical period.
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-based event prediction method according to any one of claims 1 to 7 when executing the program.
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 based event prediction method according to any one of claims 1 to 7.
CN202210576172.8A 2022-05-24 2022-05-24 Event prediction method and device based on dynamic knowledge graph Pending CN115062779A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210576172.8A CN115062779A (en) 2022-05-24 2022-05-24 Event prediction method and device based on dynamic knowledge graph

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210576172.8A CN115062779A (en) 2022-05-24 2022-05-24 Event prediction method and device based on dynamic knowledge graph

Publications (1)

Publication Number Publication Date
CN115062779A true CN115062779A (en) 2022-09-16

Family

ID=83198020

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210576172.8A Pending CN115062779A (en) 2022-05-24 2022-05-24 Event prediction method and device based on dynamic knowledge graph

Country Status (1)

Country Link
CN (1) CN115062779A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115907144A (en) * 2022-11-21 2023-04-04 哈尔滨工业大学(深圳)(哈尔滨工业大学深圳科技创新研究院) Event prediction method and device, terminal equipment and storage medium
CN117076484A (en) * 2023-09-04 2023-11-17 北京大学 Human resource data analysis method based on time sequence knowledge graph

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115907144A (en) * 2022-11-21 2023-04-04 哈尔滨工业大学(深圳)(哈尔滨工业大学深圳科技创新研究院) Event prediction method and device, terminal equipment and storage medium
CN117076484A (en) * 2023-09-04 2023-11-17 北京大学 Human resource data analysis method based on time sequence knowledge graph
CN117076484B (en) * 2023-09-04 2024-04-19 北京大学 Human resource data analysis method based on time sequence knowledge graph

Similar Documents

Publication Publication Date Title
CN110866140B (en) Image feature extraction model training method, image searching method and computer equipment
CN110837602B (en) User recommendation method based on representation learning and multi-mode convolutional neural network
CN110795657B (en) Article pushing and model training method and device, storage medium and computer equipment
CN109120462B (en) Method and device for predicting opportunistic network link and readable storage medium
CN110659723B (en) Data processing method and device based on artificial intelligence, medium and electronic equipment
CN115062779A (en) Event prediction method and device based on dynamic knowledge graph
CN114580263A (en) Knowledge graph-based information system fault prediction method and related equipment
CN113822315A (en) Attribute graph processing method and device, electronic equipment and readable storage medium
CN113609337A (en) Pre-training method, device, equipment and medium of graph neural network
Demertzis et al. Geo-AI to aid disaster response by memory-augmented deep reservoir computing
CN115982467A (en) Multi-interest recommendation method and device for depolarized user and storage medium
CN114091594A (en) Model training method and device, equipment and storage medium
CN116304341A (en) Fraud discrimination method and system based on user network big data
CN111626098A (en) Method, device, equipment and medium for updating parameter values of model
CN116361643A (en) Model training method for realizing object recommendation, object recommendation method and related device
CN114792097B (en) Method and device for determining prompt vector of pre-training model and electronic equipment
CN116401372A (en) Knowledge graph representation learning method and device, electronic equipment and readable storage medium
CN112686339B (en) Case routing determination method and device based on appeal
CN114064912A (en) Data processing method, data processing device, computer equipment and storage medium
CN113239272A (en) Intention prediction method and intention prediction device of network management and control system
CN111767934A (en) Image identification method and device and electronic equipment
CN116089722B (en) Implementation method, device, computing equipment and storage medium based on graph yield label
CN116467466A (en) Knowledge graph-based code recommendation method, device, equipment and medium
CN116977262A (en) Object quality detection method, quality detection model construction method and device
CN117218474A (en) Model training method and device, electronic equipment and storage medium

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