An event detection method and device based on a time sequence knowledge graph
By using an event detection method based on temporal knowledge graphs, the method directly completes and predicts the temporal knowledge graph, solving the problems of existing technologies that cannot directly complete missing facts and do not consider the incompleteness of the graph, thus improving the performance and accuracy of event detection.
Patent Information
- Application Number
- CN202111566708.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-20
- Publication Date
- 2026-01-02
- Estimated Expiration
- 2041-12-20
AI Technical Summary
Existing time-series knowledge graph completion methods cannot directly complete missing facts, and the prediction methods do not consider the impact of graph incompleteness on prediction, resulting in performance degradation.
An event detection method based on temporal knowledge graph is adopted. By obtaining the event to be detected and its timestamp, the prediction model is trained using the completed temporal knowledge graph, and the completion and prediction are performed directly, which reduces the search space and improves the event detection performance.
It enables direct completion of time-series knowledge graphs, enhances the performance of event detection, and improves the accuracy and reliability of event authenticity assessment.
Smart Images

Figure CN115577114B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of information technology and data services, in particular to an event detection method and device based on a time sequence knowledge graph. BACKGROUND
[0002] The time sequence knowledge graph is a collection of facts with time attributes. Generally, the time sequence knowledge graph has the characteristics of incompleteness, that is, part of the facts under each timestamp may be missing. In addition, it also has the characteristics of continuous updating, that is, new facts will appear continuously. Therefore, the time sequence knowledge graph mainly has two tasks: completion and prediction. The completion task is to complete the missing facts under each timestamp, and the prediction task is to predict what facts will occur in the future.
[0003] The current mainstream time sequence knowledge graph completion method includes Hyte, DE-SimplE, TComplEx. This kind of method is based on model parameters and numerical vectors, and learns to judge true quadruples and false quadruples through a scoring function. However, this kind of model is a discriminative model, not a generative model, and due to the huge search space (the search space size of all possible quadruples is ), it is impossible to directly complete the missing facts.
[0004] The current mainstream time sequence knowledge graph prediction method includes RE-NET, CyGNet. This kind of method is based on the historical facts that have occurred, and predicts future facts. However, they do not take into account the impact of graph incompleteness on prediction. In theory, due to the incompleteness of the graph, the clues for prediction may be missing, which may lead to a decline in prediction performance. Therefore, there is a need to first complete the graph and then make predictions. However, since the existing completion model is a discriminative model, it cannot directly complete the missing facts. SUMMARY
[0005] The present application aims to at least partially solve one of the problems in the related art.
[0006] To this end, the present application aims to improve the existing discriminative knowledge graph completion model, solve the problem of being unable to directly complete the missing facts, thereby supplementing the clues for event authenticity evaluation, solving the problem of performance defects in event authenticity evaluation, and proposing an event detection method based on a time sequence knowledge graph.
[0007] Another object of the present application is to propose an event detection device based on a time sequence knowledge graph.
[0008] To achieve the above-mentioned objects, the present application proposes an event detection method based on a time sequence knowledge graph, which comprises the following steps:
[0009] acquire an event to be detected, the event to be detected including a plurality of text data and a time stamp corresponding to each text data; and
[0010] train a prediction model according to the completed time sequence knowledge graph, to obtain a trained prediction model;
[0011] input the event to be detected into the trained prediction model, to obtain a detection result of the event to be detected.
[0012] The event detection method based on the time sequence knowledge graph according to the embodiments of the present application can directly complete the time sequence knowledge graph, reduce the search space, and improve the performance of event detection.
[0013] In addition, the event detection method based on the time sequence knowledge graph according to the above embodiments of the present application can have the following additional technical features:
[0014] Further, before the training of the prediction model according to the completed time sequence knowledge graph, the method further includes:
[0015] training the completed time sequence knowledge graph according to a time sequence knowledge graph completion model.
[0016] Further, the training of the completed time sequence knowledge graph according to the time sequence knowledge graph completion model includes:
[0017] training the completion model using the time sequence knowledge graph, learning all facts of a training set, and obtaining a first scoring function model to calculate the probability that each quadruple is established for the occurred time stamp;
[0018] obtaining candidate triples from all facts of the training set through the time stamp-by-time stamp completion of the time sequence knowledge graph, combining the candidate triples with each occurred time stamp to obtain candidate quadruples;
[0019] scoring the candidate quadruples by the completion model, and selecting a preset number of candidate quadruples with the highest scores to complete the current time stamp, to obtain the completed time sequence knowledge graph.
[0020] Further, the training of the prediction model according to the completed time sequence knowledge graph comprises: inputting the completed time sequence knowledge graph into the prediction model for model training; obtaining a second score function model based on the model training; and calculating the probability of each quadruple being established at a future timestamp according to the second score function model, to obtain the trained prediction model.
[0021] Further, the inputting of the to-be-detected event into the trained prediction model to obtain the detection result of the to-be-detected event comprises:
[0022] After the training of the prediction model is completed, each quadruple of the future timestamp is scored to obtain a score result.
[0023] Based on the score result, the event detection performance is evaluated by comparison and ranking with negative samples, to obtain the detection result of the to-be-detected event.
[0024] Further, the training of the prediction model according to the completed time sequence knowledge graph comprises:
[0025] All facts are used for the candidate triplets for completion by ignoring the timestamp:
[0026]
[0027] For each timestamp t, the candidate quadruples are obtained by combining the completed candidate triplets:
[0028]
[0029] The candidate quadruples are scored by using DE-SimplE trained on the time sequence knowledge graph, and the top k quadruples with the highest scores are selected as the completed events of each timestamp t:
[0030]
[0031] The graph of each timestamp t is updated as:
[0032]
[0033] Further, the training of the prediction model according to the completed time sequence knowledge graph comprises:
[0034] The probability distribution of all facts of the time sequence knowledge graph is defined by a recurrent event network RE-NET as:
[0035]
[0036] where, represents the set of facts from time stamp i to j , the probability of each head entity t from the graph features of time stamp s : t-1
[0037]
[0038] the probability of each relation r is derived from the local features of head entity s and historical features :
[0039]
[0040] the probability of each tail entity o depends on the local features of head entity s , relation r , and historical features :
[0041] ;
[0042] CyGNet is generated by copying, for each time , the historical vocabulary of the queried quadruple is:
[0043]
[0044] where, is a multi-hot vector of dimension N, and the copying module generates an index vector:
[0045]
[0046] the probability of each entity is the sum of the index vector and the historical vocabulary :
[0047]
[0048] the generation module predicts new facts without querying the relevant history:
[0049]
[0050] the final probability is the sum of the copying probability and the generation probability:
[0051] .
[0052] Further, the method further comprises:
[0053] After the training of the prediction model is completed, the second score function model is obtained to detect future events, including head entity detection, tail entity detection and relationship detection, wherein,
[0054] The head entity detection comprises: for a first query, substituting a first entity into the first query to obtain a first score of the first entity, and selecting the highest entity from the first score as an answer to obtain a first detection event.
[0055] The tail entity detection comprises: for a second query, substituting a second entity into the second query to obtain a second score of the second entity, and selecting the highest entity from the second score as an answer to obtain a second detection event.
[0056] The relationship detection comprises: for a third query, substituting all relationships into the third query to obtain a third score of the all relationships, and selecting the highest relationship from the third score as an answer to obtain a third detection event.
[0057] To achieve the above object, another aspect of the present application provides an event detection device based on a time sequence knowledge graph, comprising:
[0058] An acquisition module is configured to acquire an event to be detected, wherein the event to be detected comprises a plurality of text data and a time stamp corresponding to each text data.
[0059] A training module is configured to train a prediction model according to the completed time sequence knowledge graph to obtain a trained prediction model.
[0060] A detection module is configured to input the event to be detected into the trained prediction model to obtain a detection result of the event to be detected.
[0061] The event detection device based on the time sequence knowledge graph according to the embodiments of the present application acquires an event to be detected, wherein the event to be detected comprises a plurality of text data and a time stamp corresponding to each text data, and trains a prediction model according to the completed time sequence knowledge graph to obtain a trained prediction model, and inputs the event to be detected into the trained prediction model to obtain a detection result of the event to be detected. The present application can directly complete the time sequence knowledge graph, reduce the search space, and improve the performance of event detection.
[0062] The present application has the following advantages:
[0063] The application improves the existing discriminant knowledge graph completion model, realizes direct completion of the time sequence knowledge graph, supplements the clues for event authenticity evaluation, reduces the search space, makes up for the defects in the performance of event authenticity evaluation, and improves the performance of event detection.
[0064] Additional aspects and advantages of the application will be set forth in part in the description which follows, and in part will become apparent to those skilled in the art upon examination of the following and / or can be learned by practice of the application. BRIEF DESCRIPTION OF DRAWINGS
[0065] The above and / or additional aspects and advantages of the application will become apparent and be more readily understood through reference to the following description, taken in conjunction with the accompanying drawings, in which:
[0066] Figure 1 It is a schematic diagram of the event detection framework based on the time sequence knowledge graph according to the embodiment of the application.
[0067] Figure 2 It is a flowchart of the event detection method based on the time sequence knowledge graph according to the embodiment of the application.
[0068] Figure 3 It is a schematic diagram of the prediction model training according to the embodiment of the application.
[0069] Figure 4 It is a schematic diagram of the use of the event detection method based on the time sequence knowledge graph according to the embodiment of the application.
[0070] Figure 5 It is a structural schematic diagram of the event detection device based on the time sequence knowledge graph according to the embodiment of the application. DETAILED DESCRIPTION
[0071] It should be noted that the embodiments and features in the embodiments in the present application can be combined with each other without conflict. The technical solutions in the embodiments of the present application will be described in detail below with reference to the drawings and in combination with the embodiments.
[0072] In order to enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings. Obviously, the described embodiments are only a part of the embodiments of the present application, not all. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor should belong to the protection scope of the present application.
[0073] The event detection method and device based on the time sequence knowledge graph according to the embodiments of the present application will be described below with reference to the drawings. First, the event detection method based on the time sequence knowledge graph according to the embodiments of the present application will be described with reference to the drawings.
[0074] In the time series knowledge graph, each timestamp has missing or potential events. The idea of the framework is to complete the time series knowledge graph first, and then make predictions. The framework mainly consists of 3 modules: (1) time series knowledge graph; (2) completion module; (3) detection module, as shown in Figure 1 . At the same time, the framework uses a completion strategy to reduce the search space, and uses a discriminative completion model for time series knowledge graph completion in order to use the completed graph for event detection. There are mainly 4 interaction processes between the 3 modules: time series knowledge graph completion model training, timestamp-by-time stamp completion, event detection model training and evaluation of event authenticity.
[0075] The present application defines a problem, wherein represents the knowledge graph at time, which can be represented as a set of quadruples, that is , , is an entity set of ; , is a relationship set of .
[0076] The problem is as follows: given a time series knowledge graph that has occurred for training, the goal is to make the system learn and train on the graph, and obtain the ability to predict future facts, that is, to answer queries or or , wherein .
[0077] Figure 2 is a flowchart of the event detection method based on the time series knowledge graph according to an embodiment of the present application.
[0078] As shown in Figure 2 , the event detection method based on the time series knowledge graph comprises the following steps:
[0079] Step S1, obtaining an event to be detected, the event to be detected comprising a plurality of text data and a time stamp corresponding to each text data.
[0080] Specifically, the event to be detected can be obtained by browsing websites such as microblogs and news webpages, for example, the text data of the event to be detected comprises a quadruple set, wherein s represents a head entity, o represents a tail entity, r represents a relationship, and t represents time.
[0081] Step S2, training a prediction model according to the completed time series knowledge graph to obtain a trained prediction model.
[0082] It is understandable that the present invention first trains the temporal knowledge graph completion model to obtain the completed temporal knowledge graph.
[0083] Specifically, the temporal knowledge graph completion model is first trained. This model is responsible for learning all events in the training set to obtain a discriminative scoring function model. It can measure the timestamps of events that have already occurred. Any quadruple The probability of being true (where ).
[0084] As an example, this invention uses the DE-SimplE completion model as an example to illustrate the training of the completion model. First, it is assumed that each entity e has two embeddings. , Each relation r has 2 embeddings , Assuming some features of an entity are static and others are dynamic, DE-SimplE assigns a temporal encoder to each entity v, causing the embedding of some dimensions of the entity to change over time:
[0085]
[0086] in, Static embedding of entity v , The weight vector representing the encoding time of entity v. The activation function is (e.g., the sine function). The score of the quadruple (s, r, o, t) is defined as... .
[0087] Then, timestamp completion is performed. Since many events, such as economic crises and diplomatic activities, exhibit cyclical characteristics, meaning that events that have already occurred may recur, an event missing at a certain timestamp t may be an event that occurs at other timestamps, and the probability of these events being true is higher than that of randomly generated events.
[0088] Therefore, to reduce the search space for completion, by ignoring timestamps, this invention uses all events that have occurred as candidate triples for completion, and candidate triples can be obtained from all events in the training set:
[0089]
[0090] Then, for each timestamp t, it is combined with the candidate triples to obtain the candidate quadruples.
[0091]
[0092] Then, the authenticity of these candidate quadruples can be measured by a discriminative completion model. The higher the score of a quadruple, the higher the authenticity of the quadruple is considered by the model. The candidate quadruples are scored by DE-SimplE trained on the incomplete graph, and the top-k quadruples with the highest scores are selected as the completed events for the timestamp t:
[0093]
[0094] Finally, the graph for each timestamp t is updated as:
[0095]
[0096] Further, the completed time sequence knowledge graph is input into a prediction model for model training, and a second scoring function model is obtained, which calculates the probability of each quadruple being true at a future timestamp, to obtain a trained prediction model.
[0097] Specifically, the completed time sequence knowledge graph is input into the prediction model, and the scoring function model is obtained after training, which can measure the probability of any one quadruple being true at a future timestamp .
[0098] As an example, the present application is described by taking the recurrent event network RE-NET and the copy generation network CyGNet as examples.
[0099] RE-NET defines the probability distribution of all facts of the time sequence knowledge graph as
[0100]
[0101] wherein represents the fact set from timestamp i to j, and the probability of each head entity s of timestamp t is obtained from the graph features of timestamp t-1 :
[0102]
[0103] The probability of each relationship r is obtained from the local features of the head entity s and the historical features :
[0104]
[0105] The probability of each tail entity o depends on the local features of the head entity s, the relationship r ,and the historical features :
[0106]
[0107] Copy-Generating Network
[0108] CyGNet utilizes copy and generation mechanisms to recognize and predict facts with periodicity. For each query four tuple , the history vocabulary is:
[0109]
[0110] where, is an N-dimensional multi-hot vector. The copy module first generates an index vector
[0111]
[0112] The probability of each entity is the sum of the index vector and the history vocabulary
[0113]
[0114] The generation module directly predicts new facts without querying the relevant history:
[0115]
[0116] The final probability is the sum of the copy probability and the generation probability:
[0117]
[0118] Step S3, input the event to be detected into the trained prediction model to obtain the detection result of the event to be detected.
[0119] Specifically, after the training of the fact prediction model is completed, each four tuple of the fact set of the future timestamp is scored, the fact prediction performance of the entire framework is evaluated by comparison and ranking with negative samples, and the detection result of the event to be detected is obtained. The detection result obtained by the present application is more realistic, and the prediction is more reliable.
[0120] Specifically, after the training of the prediction model is completed, the scoring function model is obtained, each four tuple of the event set of the future timestamp is scored, and then the detection result of the event to be detected is obtained, including head entity detection, tail entity detection and relationship detection. The training, querying and detection processes of the present application are as shown in Figure 3 .
[0121] (1) Head entity detection: for a certain query , all entities s’ are substituted into the query to obtain the scores of all entities , the highest entity is selected from them s as the answer, and the event is obtained .
[0122] (2) Tail entity detection: for a certain query , all entities o’ are substituted into the query to obtain the scores of all entities , the highest entity is selected from them o as the answer, and the event is obtained .
[0123] (3) Relationship detection : for a certain query , all relationships r’ are substituted into the query to obtain the scores of all relationships , the highest relationship is selected from them r as the answer, and the event is obtained .
[0124] Further, taking the query tail entity detection as an example, the use flow of the detection of the present application is as shown in Figure 4 .
[0125] Through the above steps, by obtaining a to-be-detected event, the to-be-detected event includes a plurality of text data and a time stamp corresponding to each text data; and training a prediction model according to the completed time sequence knowledge graph to obtain a trained prediction model; inputting the to-be-detected event into the trained prediction model to obtain a detection result of the to-be-detected event. The present application can directly complete the time sequence knowledge graph, reduce the search space, and improve the performance of event detection.
[0126] It should be noted that there are many ways to implement the time sequence knowledge graph completion and event detection method, but no matter how the specific implementation method is, as long as the method improves the performance of event detection, it is a solution to the problems of the prior art and has the corresponding effect.
[0127] In order to realize the above-mentioned embodiment, as shown in Figure 5 , the present embodiment further provides an event detection device 10 based on a time sequence knowledge graph, which comprises an acquisition module 100, a training module 200 and a detection module 300.
[0128] The acquisition module 100 is used for acquiring a to-be-detected event, and the to-be-detected event includes a plurality of text data and a time stamp corresponding to each text data;
[0129] The training module 200 is configured to train a prediction model according to the completed time sequence knowledge graph, and obtain a trained prediction model.
[0130] The detection module 300 is configured to input the event to be detected into the trained prediction model, so as to obtain a detection result of the event to be detected.
[0131] Further, the training module 200 is further configured to:
[0132] The completed time sequence knowledge graph is obtained according to the time sequence knowledge graph completion model.
[0133] According to the event detection device based on the time sequence knowledge graph, the event to be detected is obtained, the event to be detected includes a plurality of text data and a time stamp corresponding to each text data; a prediction model is trained according to the completed time sequence knowledge graph, and a trained prediction model is obtained; and the event to be detected is input into the trained prediction model, so as to obtain a detection result of the event to be detected. The time sequence knowledge graph can be directly completed, the search space is reduced, and the performance of event detection is improved.
[0134] It should be noted that the above description of the event detection method based on the time sequence knowledge graph is also applicable to the event detection device based on the time sequence knowledge graph, which will not be described here.
[0135] In addition, the terms "first", "second", "third", etc. are used only for descriptive purposes and should not be construed as indicating or implying relative importance or a specific number of the technical features indicated. Therefore, the features defined as "first", "second", etc. can explicitly or implicitly include at least one of the features. In the description of the present application, the meaning of "a plurality of" is at least two, such as two, three, etc., unless otherwise specifically limited.
[0136] In the description of the present application, the description of the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of the present application. In the present application, the illustrative description of the above terms is not necessarily for the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any appropriate manner in any one or more embodiments or examples. In addition, the skilled in the art can combine and combine the different embodiments or examples described in the present application and the features of the different embodiments or examples without contradiction.
[0137] Although the embodiments of the present application have been shown and described above, it is understood that the above-described embodiments are exemplary and are not to be construed as limiting the present application, and that variations, modifications, substitutions and changes can be made by those skilled in the art without departing from the scope of the present application.
Claims
1. A method for event detection based on a time knowledge graph, characterized in that, The method comprises the following steps: obtaining a to-be-detected event, the to-be-detected event comprising a plurality of text data and a time stamp corresponding to each text data; and, training a prediction model according to the completed time sequence knowledge graph to obtain a trained prediction model; inputting the to-be-detected event into the trained prediction model to obtain a detection result of the to-be-detected event; before the step of training the prediction model according to the completed time sequence knowledge graph, the method further comprises: training the completed time sequence knowledge graph according to a time sequence knowledge graph completion model; the step of training the completed time sequence knowledge graph according to the time sequence knowledge graph completion model comprises: training the completion model by using the time sequence knowledge graph, learning all facts of a training set, and obtaining a first scoring function model to calculate a probability that each quadruple is established for an occurred time stamp; obtaining candidate triples from all facts of the training set through time stamp-by-time stamp completion of the time sequence knowledge graph, combining the candidate triples with each occurred time stamp to obtain candidate quadruples; scoring the candidate quadruples through the completion model, and selecting a preset number of candidate quadruples with the highest scores to complete a current time stamp, so as to obtain the completed time sequence knowledge graph; the step of training the prediction model according to the completed time sequence knowledge graph to obtain the trained prediction model comprises: inputting the completed time sequence knowledge graph into a prediction model for model training; obtaining a second scoring function model based on the model training; calculating a probability that each quadruple is established for a future time stamp according to the second scoring function model, so as to obtain the trained prediction model; the step of inputting the to-be-detected event into the trained prediction model to obtain the detection result of the to-be-detected event comprises: after the training of the prediction model is completed, scoring each quadruple for the future time stamp to obtain a scoring result; based on the scoring result, comparing and ranking the event detection performance with negative samples to obtain the detection result of the to-be-detected event; the step of training the completed time sequence knowledge graph according to the time sequence knowledge graph completion model further comprises: ignoring time stamps, and using all facts for candidate triples for completion: G static = {(s, r, o) | (s, r, o, t) G t} combining each time stamp t with the completed candidate triples to obtain the candidate quadruples: scoring the candidate quadruples by using DE-SimplE trained on the time sequence knowledge graph, and selecting the top k quadruples with the highest scores as the completed events for each time stamp t: the graph for each time stamp t is updated as: 2.The time knowledge graph based event detection method of claim 1, wherein, the step of training the prediction model according to the completed time sequence knowledge graph to obtain the trained prediction model comprises: defining a probability distribution of all facts of the time sequence knowledge graph G by using a recurrent event network RE-NET as: where G i:j representing the set of facts from timestamps i to j, the probability of each head entity s at timestamp t from the graph features H t-1 gives: The probability of each relation r is given by the local features e s and historical features h t-1 (s) gives: The probability of each tail entity o depends on the local features e of the head entity s, the relation r s r and the historical features h t-1 (s, r) is obtained: By copying the generation network CyGNet, for time t k , the historical vocabulary of each four-tuple (s, p,?, t k ) to be queried is: wherein, is a multi-hot vector of N dimensions, the copy module generates an index vector: v q = tanh(W c [s, p, t k + b c ) The probability for each entity is an index vector v q The sum of the probabilities of the historical words is: a generation module predicts new facts without querying related history: p(g) = softmax(W g [s, p, t k + b g ) a final probability is a sum of a copy probability and a generation probability: p(o|s,p,t)=α·p(c)+(1-α)·p(g). 3.The time knowledge graph based event detection method of claim 1, wherein, the method further comprises: After the training of the prediction model is completed, the second score function model is obtained to detect future events, including head entity detection, tail entity detection and relationship detection; wherein The head entity detection comprises: for a first query, substituting a first entity into the first query to obtain a first score of the first entity, and selecting the highest entity from the first score as an answer to obtain a first detection event; The tail entity detection comprises: for a second query, substituting a second entity into the second query to obtain a second score of the second entity, and selecting the highest entity from the second score as an answer to obtain a second detection event; The relationship detection comprises: for a third query, substituting all relationships into the third query to obtain a third score of the all relationships, and selecting the highest relationship from the third score as an answer to obtain a third detection event.
4. A time knowledge graph based event detection apparatus using the method of claim 1, characterized in that, Comprise: An acquisition module is configured to acquire a to-be-detected event, the to-be-detected event comprising a plurality of text data and a time stamp corresponding to each text data; A training module is configured to train a prediction model according to a completed time sequence knowledge graph to obtain a trained prediction model; A detection module is configured to input the to-be-detected event into the trained prediction model to obtain a detection result of the to-be-detected event. 5.The time knowledge graph based event detection apparatus according to claim 4, characterized in that, The training module is further configured to: Train the completed time sequence knowledge graph according to a time sequence knowledge graph completion model.
Citation Information
Patent Citations
Recursive time sequence knowledge graph completion method and device
CN112395423A
Supplier default risk prediction method
CN113642826A