Time sequence knowledge graph reasoning method and system for distinguishing similar historical structures

By combining two-level modeling of relationships and entities in external inference of time series knowledge graphs, the inference difficulty caused by historical structure similarity is solved, and more efficient candidate entity prediction is achieved.

CN120046725APending Publication Date: 2025-05-27INSTITUTE OF INFORMATION ENGINEERING CHINESE ACADEMY OF SCIENCES
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411989381.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-31
Publication Date
2025-05-27

AI Technical Summary

Technical Problem

Existing external inference methods for timing knowledge graphs are difficult to distinguish situations with similar historical structures, resulting in the inability to find the correct answer in the candidate area.

Method used

By combining the two levels of relationship and entity, we model the temporal evolution of the potential logic of the relationship in time sequence and the subgraph structure of the entity, extract the relationship inference paths between entity pairs, encode the time interval, evaluate the confidence of the relationship inference paths, and use the time gate component to dynamically model the entity embedding, and finally add weights to the scores of the relationship and entity to achieve the prediction of candidate entities.

Benefits of technology

Effectively distinguishing similar historical structures improves the performance of external reasoning of timing knowledge graphs and can find the correct answers in the candidate area more accurately.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120046725A_ABST
    Figure CN120046725A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of information, and relates to a time sequence knowledge graph reasoning method and system for distinguishing similar historical structures. The method comprises the steps that relation reasoning paths between entity pairs are extracted, the confidence degree of each relation reasoning path is evaluated, the confidence degrees of the relation reasoning paths under different timestamps are aggregated, and relation reasoning scores are obtained; and then calculating an entity sub-graph structure score, obtaining a prediction score of the candidate entity according to the relationship reasoning score and the entity sub-graph structure score, and complementing the missing entity in the prediction query by using the candidate entity with the highest prediction score to realize time sequence knowledge graph reasoning. According to the method, similar historical structures are distinguished from the combination of the relation and the entity, modeling is carried out on the potential logic of the relation in the time sequence and the time evolution of the sub-graph structure of the entity, and candidate objects with similar sub-graph structures or similar relation connection can be distinguished; and the performance of the external reasoning task of the time sequence knowledge graph is effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of information technology, and particularly relates to a temporal knowledge graph reasoning method and system for distinguishing similar historical structures. Background Art

[0002] The essence of a temporal knowledge graph is to integrate time information into a traditional knowledge graph, representing facts (events) in the real world as quadruples (subject, relation, object, timestamp), which has become the basis for many artificial intelligence applications. A temporal knowledge graph consists of static subgraphs divided by the time dimension, and each subgraph contains all the facts that occur at a specific corresponding timestamp.

[0003] How to infer unfinished events in future subgraphs based on the information contained in historical subgraphs of a temporal knowledge graph has become a popular research task: the external reasoning of a temporal knowledge graph. Given its practical significance, the external reasoning of a temporal knowledge graph has been widely applied in fields such as financial warning and behavior prediction.

[0004] Currently, the external reasoning of a temporal knowledge graph is mainly divided into two categories. One is a model based on historical entity information, which focuses on modeling the relevant information of entities. Some specific methods are as follows: 1. Statistically count the frequency of entities repeating in history, and use a replication mechanism to select prediction results from entities that frequently appear in history. 2. Adopt a contrastive learning method to capture the dependence of a query on historical entities and non-historical entities to distinguish the most potential entities that best match a given query. 3. Connect historical entities from different timestamps by encoding the global graph structure of entities, and at the same time consider the local subgraph structure of entities, and then combine the structural information of these two types of entities for prediction. The other is a model based on historical relationship information, which is completely independent of entities and focuses on modeling the temporal path of relationships. Some specific methods are as follows: 1. Learn a beam search strategy through reinforcement learning to find clear and reliable relationship clues for the facts to be predicted, and perform reasoning based on the relationship clues. 2. Learn rules independent of the entities in the query, and perform reasoning through the learned first-order logic rules.

[0005] The essence of external reasoning in temporal knowledge graphs is to select the correct answer from all entities based on historical information. Current methods can easily eliminate most incorrect answers, narrowing down the candidate range to a very small area, which is called the candidate area. However, these methods often fail to find the correct answer in the candidate area. The main reason is that the entities in the candidate area are similar in subgraph structure or relationship connection. These two aspects of similarity can be collectively referred to as the historical structure similarity of the knowledge graph. Historical structure similarity has strong interference in the reasoning process, and current methods only model the subgraph structure of entities or only model the relationship paths, and cannot fundamentally solve the problem of historical structure similarity. Generally speaking, existing models only focus on one of the entity and relationship information while ignoring the other, resulting in the inability to distinguish the situation of historical structure similarity, which limits their performance in external reasoning of temporal knowledge graphs. Summary of the Invention

[0006] The purpose of the present invention is to distinguish similar historical structures by combining the two levels of relationship and entity, respectively model the potential logic of relationships in time series and the time evolution of the subgraph structure of entities, and be able to distinguish candidate objects with similar subgraph structures or similar relationship connections, effectively improving the performance in the external reasoning task of temporal knowledge graphs.

[0007] The technical solution adopted by the present invention is as follows:

[0008] A temporal knowledge graph reasoning method for distinguishing similar historical structures, comprising the following steps:

[0009] Extract the relationship reasoning paths between entity pairs;

[0010] Encode the time intervals between relationships that may have causal logic;

[0011] Based on the encoding results, evaluate the confidence of each relationship reasoning path through positive and negative sample contrast learning;

[0012] Aggregate the confidence of relationship reasoning paths at different timestamps to obtain a relationship reasoning score;

[0013] Encode historical subgraphs to obtain entity static embeddings of each historical subgraph, and use a time gate component to model the temporal dependence between entity static embeddings at different timestamps to obtain entity dynamic embeddings;

[0014] Calculate the probability of establishing an association between entities based on entity dynamic embeddings to obtain an entity subgraph structure score;

[0015] Add the relationship reasoning score and the entity subgraph structure score using a weight coefficient to obtain a prediction score for candidate entities;

[0016] Sort the predicted scores of candidate entities, and use the candidate entity with the highest predicted score to complete the missing entity in the predicted query, so as to realize temporal knowledge graph reasoning.

[0017] Furthermore, the extraction of the relationship inference path between entities includes:

[0018] Construct a relationship graph based on the events that occurred before time t, regard entities as nodes, and regard relationships as edges;

[0019] For each event (s, r, o, t), consider the neighbors of node s and node o respectively to extract two subgraphs, and then intersect the subgraphs to obtain a merged subgraph, ensuring that the generated merged subgraph contains all the relationships between node s and node o before t, and form a relationship inference path with the relationship r of the event.

[0020] Furthermore, the encoding of the time interval between relationships that may have causal logic includes:

[0021] Encode the query time t q and the historical time t τ of the time interval Δt:

[0022] T (Δt,2τ) = sin(Δt / 10000 2τ / d )

[0023] T (Δt,2τ+1) = cos(Δt / 10000 2τ / d )

[0024] where T (Δt,2τ) represents the time encoding at even timestamp moments, T (Δt,2τ+1) represents the time encoding at odd timestamp moments, τ represents a certain historical timestamp, and d represents the dimension of the time encoding;

[0025] Add the encoding to the initialized relationship encoding r j,init to obtain the embedding r j of the relationship between node s and node o = r j,init + T Δt , where T Δt includes T (Δt,2τ) and T (Δt,2τ+1) .

[0026] Furthermore, the confidence of each relationship inference path is evaluated by means of positive and negative sample contrast learning, including:

[0027] Negative sampling is first performed to generate incorrect quadruples, and then the SoftMarginLoss function is used to make the correct quadruples, i.e., positive samples, obtain higher scores and the incorrect quadruples, i.e., negative samples, obtain lower scores;

[0028] Regarding the relationships in the relationship inference path as causes and the relationships at the query time as results through the learned relationship embeddings, the dot product method is used to calculate the confidence of the relationship inference path ;

[0029] Furthermore, aggregating the confidences of the relationship inference paths at different timestamps to obtain a relationship inference score includes:

[0030] Aggregating the confidence scores of the relationship inference paths to obtain the total confidence score of all relationship inference paths between entity pairs at timestamp t τ ;

[0031] Using a temporal decay function to add the confidence scores of the relationship inference paths at each timestamp together with weights to obtain a relationship inference score.

[0032] Furthermore, the entity dynamic embedding is obtained by the following steps:

[0033] Using R-GCN as a structure encoder for modeling to obtain static entity encodings;

[0034] Using a time gate component to model the temporal dependence of the entity structure. The dynamic structure semantic embedding e of entity s s,t+1 is determined by two parts, namely the output of the last layer of R-GCN and the dynamic structure semantic embedding e of the previous timestamp s,t ; where:

[0035]

[0036] where denotes the dot product operation, and U t+1 is the time gate; the non-linear transformation performed by the time gate is;

[0037] U t+1 =σ(W u e s,t +b)

[0038] where σ(·) is the sigmoid function, W u is the weight matrix of the time gate, and b is the offset.

[0039] Furthermore, ConvTransE is used as a decoder to calculate at the query timestamp t qThe subject s of the lower query q and the candidate object o i The degree of association at the dynamic structure semantics level, so as to obtain the entity subgraph structure score.

[0040] A temporal knowledge graph reasoning system for distinguishing similar historical structures, which includes:

[0041] A relation reasoning module, responsible for extracting the relation reasoning path between entity pairs; encoding the time interval between relations that may have causal logic; based on the encoding result, evaluating the confidence of each relation reasoning path through positive and negative sample contrast learning; aggregating the confidence of relation reasoning paths at different timestamps to obtain a relation reasoning score;

[0042] An entity subgraph structure learning module, responsible for encoding historical subgraphs to obtain the entity static embeddings of each historical subgraph, using a time gate component to model the temporal dependence between entity static embeddings at different timestamps to obtain entity dynamic embeddings; calculating the probability of establishing an association between entities based on the entity dynamic embeddings to obtain an entity subgraph structure score;

[0043] A relation and entity joint module, responsible for adding the relation reasoning score and the entity subgraph structure score using weight coefficients to obtain the prediction score of the candidate entity;

[0044] An inference module, responsible for sorting the prediction scores of candidate entities, and using the candidate entity with the highest prediction score to complete the missing entity in the prediction query, so as to realize temporal knowledge graph reasoning.

[0045] The method provided by the present invention has been fully experimented on five benchmark datasets, proving that the method of the present invention has the most advanced reasoning performance in external reasoning of temporal knowledge graphs, and the method of the present invention also has the following advantages:

[0046] 1) This method makes full use of relation and entity information, models these two parts of information in a unified framework, and can effectively distinguish the situation where historical structures are similar.

[0047] 2) This method evaluates the relation reasoning path between entities during reasoning, and finally obtains the confidence score of each relation reasoning path. The relation reasoning path with a higher score can be used as the supporting basis for the reasoning result, enhancing the interpretability of the reasoning process. Brief Description of the Drawings

[0048] Figure 1 : The framework structure of the Relation Inference Entity Structure (RIES) of the present invention. The lower left gray shaded part explores the subject s and the candidate entity o iThe causal logic existing in the connection relationship between them in terms of time sequence; the green shaded part in the upper right captures the dynamic structure semantics by modeling each time sub - graph of o i for each time sub - graph.

[0049] Figure 2 : Architecture diagram of the Relation Causal Logic (RCL) module. The Relation Causal Logic module explores the causal logic in time sequence of the relationship r 1 at time stamp t 1 and r 2 with the relationship r q at time stamp t q .

[0050] Figure 3 : Architecture diagram of the Path Confidence Aggregation (PCA) module. The Path Confidence Aggregation module aggregates the confidence scores of all relationship inference paths between the subject s and the candidate entity o i . Detailed implementation manners

[0051] The present invention will be further described in detail below through specific embodiments and accompanying drawings.

[0052] The present invention aims to solve the problem that existing methods are difficult to distinguish similar historical structures. Similar historical structures mainly come from aspects of relationships or entities, namely similar relationship connections and similar sub - graph structures of entities. Current methods only consider a single information source of relationships or entities and can only solve one of the situations of similar historical structures. The present invention first discloses a relationship - reasoning - based method, proposes a specific scheme for evaluating relationship inference paths, and realizes capturing the causal logic of the relationship between entity pairs at the time level. Then, the present invention models the time evolution of the sub - graph structure of entities to learn the structural information of entity sub - graphs. Finally, the present invention combines the causal logic of relationship paths and the structural information of entity sub - graphs to effectively distinguish similar historical structures.

[0053] A relationship - reasoning - based method provided by the present invention, the main steps of which include:

[0054] (1) Relationship inference path extraction, extracting the relationship inference paths between entity pairs.

[0055] (2) Relationship time encoding, encoding the time interval Δt between two relationships that may have causal logic. Through the model encoding time - interval information, the dependence relationship between different relationships can be effectively captured.

[0056] (3) Relationship inference path confidence evaluation, which evaluates the confidence of each relationship inference path through a positive and negative sample contrast learning method.

[0057] (4) Relationship inference path confidence aggregation, which uses a time decay function to aggregate the confidences of relationship inference paths at different timestamps to obtain the final relationship inference score.

[0058] A method for jointly modeling relationships and entities provided by the present invention, the main steps of which include:

[0059] (1) Entity embedding learning. First, use R-GCN to encode len historical subgraphs before time t to obtain entity static embeddings under each historical subgraph. Then use a time gate component to model the temporal dependence between entity static embeddings at different timestamps, and finally obtain the dynamic embedding of the entity.

[0060] (2) Entity subgraph structure learning, using ConvTransE as a decoder to calculate the probability of establishing an association between entity s and entity o, and obtaining the entity subgraph structure score.

[0061] (3) Combining relationship causal logic and entity subgraph structure, adding the relationship inference score and the entity subgraph structure score with weight coefficients to obtain the final prediction score of the candidate entity.

[0062] The technical key points of the present invention are:

[0063] 1. Based on the historical information before timestamp t q to predict the missing entity in the query q=(s, r q ,?, t q ). Where? represents the missing entity.

[0064] 2. A temporal knowledge graph reasoning method for distinguishing similar historical structures, the overall process of which is as Figure 1 shown, and the main steps include:

[0065] (1) Relationship inference path extraction, extracting the relationship inference path between entity pairs;

[0066] (2) Relationship time encoding, encoding the time interval Δt between two relationships that may have causal logic. Through the model that encodes time interval information, the dependence between different relationships can be effectively captured.

[0067] (3) Relationship inference path confidence evaluation, which evaluates the confidence of each relationship inference path through a positive and negative sample contrast learning method.

[0068] (4) Relationship inference path confidence aggregation: Use a time decay function to aggregate the confidences of relationship inference paths at different timestamps to obtain the final relationship inference score.

[0069] (5) Entity embedding learning: First, use R-GCN to encode the len historical subgraphs before time t to obtain the entity static embeddings under each historical subgraph. Then, use a time gate component to model the temporal dependencies between the entity static embeddings at different timestamps, and finally obtain the dynamic embeddings of the entities.

[0070] (6) Entity dynamic structure decoding: Use ConvTransE as the decoder to calculate the probability of establishing an association between entities, and obtain the entity subgraph structure score.

[0071] (7) Combining relationship inference and entity structure: Add the relationship inference score and the entity subgraph structure score using weight coefficients to obtain the final prediction score, that is, the score of the predicted candidate entity.

[0072] (8) Sort the prediction scores in step (7), and use the candidate entity with the highest prediction score to complete the missing part in the prediction query q, thereby realizing temporal knowledge graph reasoning.

[0073] 3. In step (1), first construct a relationship graph based on the events that occurred before time t, regarding entities as nodes and relationships as edges. For each event (s, r, o, t), consider the neighbors of node s and node o respectively to extract two subgraphs, and then intersect these subgraphs to obtain the merged subgraph. This process ensures that the generated merged subgraph contains all the relationship connections between node s and node o before t. Finally, form a relationship inference path with these relationships and the relationship r of the event.

[0074] 4. In step (2), encode the time interval Δt between the query time t q and the historical time t τ :

[0075] T (Δt,2τ) = sin(Δt / 10000 2τ / d )

[0076] T (Δt,2τ+1) = cos(Δt / 10000 2τ / d )

[0077] where T (Δt,2τ) represents the time encoding at even timestamp moments, T (Δt,2τ+1) represents the time encoding at odd timestamp moments, τ represents a certain historical timestamp, and d represents the dimension of the time encoding.

[0078] Add the time encoding to the initialized relationship encoding rj,init In this way, the relationship between node s and node o is obtained. The embedding r of j = r j,init + T Δt . Where T Δt includes T (Δt,2τ) and T (Δt,2τ+1) .

[0079] 5. In step (3), negative sampling is first performed to generate incorrect quadruples. Then, through the SoftMarginLoss loss function, correct quadruples (positive samples) obtain higher scores, and incorrect quadruples (negative samples) obtain lower scores. The SoftMarginLoss loss function is as follows:

[0080]

[0081] where P is the set of correct quadruples, N is the set of incorrect quadruples, and score r represents the relationship inference score, and y.score r represents the product operation of y and score r .

[0082] After training, it is possible to learn the embedding of historical relationships from the perspective that there is an inference path between historical relationships and query relationships in terms of time sequence. The finally learned historical relationship embedding contains the potential causal logic in terms of time sequence with the query relationship.

[0083] Through the already learned relationship embedding, regarding the relationship r in the relationship inference path j as the cause, and the relationship r q at the query time t q as the result, the dot product method is used to calculate the confidence that the relationship inference path holds:

[0084]

[0085] where "*" represents the dot product.

[0086] Figure 2 is the architecture diagram of the relationship causal logic module of the present invention. The relationship causal logic module uses the method described above to explore the causal logic in terms of time sequence between the relationship r 1 at the time stamp t 1 , r 2 and the relationship r q at the time stamp t q .

[0087] 6. In step (4), first aggregate the confidence scores of these relational inference paths to obtain the timestamp t τ for the lower entity pair s and o i the total confidence score of all relational inference paths between them:

[0088]

[0089] is the timestamp t τ the set of relationships connected to the subject s of the query q at. After obtaining the total confidence score at the timestamp between the subject s and the candidate object o i use the temporal decay function W d (t q , t τ ) to weight and sum up the confidence scores of the relational inference paths at each timestamp. The specific method is as follows:

[0090] W d (t q , t τ ) = (t q - t τ ) -γ

[0091]

[0092] where W d (t q , t τ ) represents the temporal decay function, γ represents the decay coefficient, PCA represents the path confidence aggregation module, and len represents the historical length considered.

[0093] Finally, obtain the relational inference score for the query q = (s, r q , o i , t q ) to hold true from the relational level.

[0094] Figure 3 is the architecture diagram of the path confidence aggregation module of the present invention. The path confidence aggregation module aggregates the confidence scores of all relational inference paths between the subject s and the candidate entity o i using the above method.

[0095] 7. In step (5), obtain the dynamic structure encoding of o i by capturing the structural changes of the subgraph where o is located i .

[0096] First, use the ω-layer R-GCN as a structure encoder to perform modeling to obtain the static entity encoding:

[0097]

[0098] Among them, is the entity encoding obtained by the subject s passing through l layers of R-GCN at the timestamp t, and N s,t is the neighborhood set of the entity s in the static subgraph at the timestamp t, f(·) is the rectified linear unit (ReLU) activation function, is the relation-specific parameter used to aggregate structural features according to different edge aggregation structures, represents the parameter for aggregating the self-connections of all entities, and r respectively represent the embeddings of adjacent entities at the l-th layer of the R-GCN and the embeddings of the connected relationships. After passing through ω layers of R-GCN, a representation that only considers the semantic dependencies of the nodes adjacent to the entity s at the timestamp t can be obtained

[0099] Furthermore, a time gate component is further used to model the temporal dependencies of the entity structure. Finally, the dynamic structure semantic embedding e of the entity s s,t+1 is determined by two parts, namely the output of the last layer of the R-GCN and the dynamic structure semantic embedding e of the previous timestamp s,t . The specific expression is as follows:

[0100]

[0101] Among them represents the dot product operation. The time gate U t+1 ∈R d×d performs the following non-linear transformation:

[0102] U t+1 = σ(W u e s,t + b)

[0103] Among them, σ(·) is the sigmoid function, W u ∈R d×d is the weight matrix of the time gate, and b is the offset.

[0104] 7. In step (6), ConvTransE is used as the decoder to calculate the degree of association between the subject s of the query q and the candidate object o q at the dynamic structure semantic level at the query timestamp t, which is specifically expressed as follows: i Among them, score

[0105]

[0106] Among them, score e represents the entity-level score of the candidate object o i , and σ represents the sigmoid activation function, Denote the dynamic structure semantic embedding of entity o i , and denote the dynamic structure semantic embedding of entity s.

[0107] 8. Step (7) combines the scores at the relation level and the entity level, namely the relation reasoning score and the entity subgraph structure score, and uses this score as the final probability score for predicting that the query q = (s, r q , o i , t q ) holds.

[0108] P(o|s, r q , t q ) = α * (score r ) + score e

[0109]

[0110] where P(o|s, r q , t q ) represents the prediction probability for all candidate object entities o ∈ ε, ε represents the set of candidate entities, represents the finally predicted candidate entity, and α represents the weight coefficient for combining the scores at the relation level and the entity level.

[0111] Examples of the present invention:

[0112] In this example, the ICEWS14, ICEWS0515, ICEWS18, WIKI, and YAGO public datasets are used. These five datasets are considered the most representative datasets in the temporal knowledge graph reasoning task. The information on the number of entities, relations, and triples they contain is shown in Table 1.

[0113] Table 1: Statistical data of the datasets

[0114] Dataset Entities Relation Training Validation Test ICEWS14 7128 230 63685 13823 13222 ICEWS0515 10488 251 322958 69224 69147 ICEWS18 23033 256 373018 45995 49545 WIKI 12554 24 539286 67538 63110 YAGO 10623 10 161540 19523 20026

[0115] The evaluation metrics adopted include Hits@n and Mean Reciprocal Rank (MRR). Hits@n represents the proportion of correct entities ranked in the top n according to similarity calculation. MRR represents the average reciprocal rank of the correct entities. The higher the Hits@n and MRR values, the stronger the performance of the method.

[0116] The model of the present invention was compared with static KG reasoning models and TKG reasoning models, and the performance of the model was comprehensively evaluated. DistMult, ComplEX, and R-GCN were selected as the static models for comparison. DE-SimplE, CyGNet, xERTE, TiTer, RE-GCN, CEN, TLogic, RE-GAT, TECHS, DaeMon, HGLS, RPC, TiPNN, and DLGR were selected as the temporal models for comparison. The performance on the ICEWS14, ICEWS18, and ICEWS0515 datasets is shown in Table 2, where the best performance is in bold and the second-best performance is underlined. The performance on the WIKI and YAGO datasets is shown in Table 3, where the best performance is in bold and the second-best performance is underlined.

[0117] Table 2: Performance on the ICEWS14, ICEWS18, and ICEWS0515 Datasets (values in %)

[0118]

[0119] Table 3: Performance on the WIKI and YAGO Datasets (values in %)

[0120]

[0121] From the experimental results in the above tables, it can be seen that the static models DistMult, ComplEX, and R-GCN perform worse than the temporal models because the static models do not consider temporal information and the dependencies between different snapshots. Similarly, the interpolation model DE-SimplE also performs poorly because such models are difficult to handle events occurring at future timestamps. Among the extrapolation models, CyGNet, xERTE, CEN, HGLS, and DLGR start from entity information and ignore the dynamic changes in the relationship connections between entities over time. TECHS, DaeMon, RPC, and TiPNN start from relationships and extract potential logical rules in the graph based on path search. These methods are restricted by existing paths, which limits their search scope and damages their performance.

[0122] The model proposed in the present invention models relationships and entities in a unified framework, explores the causal logic between relationships in time series and the dynamic structural changes of entities, makes full use of relationship and entity information for prediction, and finally outperforms the baseline models in all metrics on five datasets.

[0123] The present invention can be used in scenarios such as pollution prediction and weather forecasting. For example, in the pollution prediction scenario, when using the method of the present invention, a temporal knowledge graph is established for the historical environmental pollution data in this scenario. The nodes in the graph represent the activity events and pollutant types in this scenario, and the relationships in the graph represent the causal relationships in this scenario; then, the method of the present invention is used for temporal knowledge graph reasoning to predict the impact of various activity events on pollutant concentration in this scenario.

[0124] Another embodiment of the present invention provides a temporal knowledge graph reasoning system for distinguishing similar historical structures, which includes:

[0125] A relationship reasoning module, responsible for extracting the relationship reasoning paths between entity pairs; encoding the time intervals between relationships that may have causal logic; based on the encoding results, evaluating the confidence of each relationship reasoning path through positive and negative sample contrast learning; aggregating the confidence of the relationship reasoning paths at different timestamps to obtain a relationship reasoning score;

[0126] An entity subgraph structure learning module, responsible for encoding historical subgraphs to obtain the entity static embeddings of each historical subgraph, using a time gate component to model the temporal dependence between the entity static embeddings at different timestamps to obtain entity dynamic embeddings; calculating the probability of establishing an association between entities based on the entity dynamic embeddings to obtain an entity subgraph structure score;

[0127] A relationship and entity joint module, responsible for adding the relationship reasoning score and the entity subgraph structure score using weight coefficients to obtain the prediction score of the candidate entity;

[0128] An inference module, responsible for sorting the prediction scores of the candidate entities, and using the candidate entity with the highest prediction score to complete the missing entity in the prediction query, thereby realizing temporal knowledge graph reasoning.

[0129] The above division of each module is only for illustration. In actual applications, the above functions can be allocated to different functional modules as needed to complete all or part of the functions described in the foregoing method. The specific working processes of the above modules can refer to the corresponding processes in the foregoing method embodiments and will not be elaborated here.

[0130] Another embodiment of the present invention provides a computer device (such as a computer, server, smart phone, etc.), which includes a memory and a processor. The memory stores a computer program, and the computer program is configured to be executed by the processor. The computer program includes instructions for executing each step in the method of the present invention.

[0131] Another embodiment of the present invention provides a computer-readable storage medium (such as ROM / RAM, disk, optical disc), which stores a computer program. When the computer program is executed by a computer, each step of the method of the present invention is implemented.

[0132] The specific embodiments of the present invention disclosed above are intended to help understand the content of the present invention and implement it accordingly. Those of ordinary skill in the art can understand that various substitutions, changes, and modifications are possible without departing from the spirit and scope of the present invention. The present invention should not be limited to the content disclosed in the embodiments of this specification, and the protection scope of the present invention shall be subject to the scope defined by the claims.

Claims

1. A temporal knowledge graph reasoning method for distinguishing similar historical structures, characterized in that: The following steps are involved: Extract the relationship reasoning path between entity pairs; Encodes the time intervals between relations that may have causal logic; Based on the encoding results, the confidence of each relational reasoning path is evaluated through positive and negative sample comparative learning; Aggregate the confidence of the relational reasoning paths at different timestamps to obtain the relational reasoning score; Encode the historical subgraphs to obtain the static embeddings of entities in each historical subgraph. Use the time gate component to model the temporal dependencies between static embeddings of entities at different timestamps to obtain dynamic embeddings of entities. Based on the dynamic embedding of entities, the probability of establishing associations between entities is calculated to obtain the entity subgraph structure score; The relationship reasoning score and the entity subgraph structure score are added together using a weight coefficient to obtain a prediction score for the candidate entity; The prediction scores of candidate entities are sorted, and the candidate entities with the highest prediction scores are used to complete the missing entities in the prediction query, thereby realizing temporal knowledge graph reasoning.

2. The method according to claim 1, characterized in that The relationship reasoning path between the extracted entity pairs includes: Build a relationship graph based on the events that occurred before time t, treating entities as nodes and relationships as edges; For each event (s, r, o, t), consider the neighbors of node s and node o respectively to extract two subgraphs, and then intersect the subgraphs to obtain a merged subgraph. Make sure that the generated merged subgraph contains all relations between node s and node i before t, and combine these relations with the relation r of the event to form a relational reasoning path.

3. The method according to claim 1, characterized in that The encoding of the time intervals between relationships that may have causal logic includes: For query time t q With historical time t τ The time interval Δt is encoded as: T (Δt,2τ) =sin(Δt / 10000 2τ / d ) T (Δt,2τ+1) =cos(Δt / 10000 2τ / d ) Among them, T (Δt,2τ) The time code representing the even timestamp moment, T (Δt,2τ+1) represents the time code at the odd timestamp moment, τ represents a historical timestamp, and d represents the dimension of the time code; Add the code to the initialized relation code r j,init In the above example, we obtain the embedding r of the relationship between node s and node o. j =r j,init +T Δt , where T Δt Including T (Δt,2τ) and T (Δt,2τ+1) .

4. The method according to claim 1, characterized in that: The confidence of each relational reasoning path is evaluated by positive and negative sample comparison learning, including: First, negative sampling is performed to generate error quadruple, and then the SoftMarginLoss loss function is used to make the correct quadruple, i.e., positive sample, get a higher score, and the error quadruple, i.e., negative sample, get a lower score; Through the learned relationship embedding, the relationship reasoning path The relationship in the query time is regarded as the cause, and the relationship at query time is regarded as the result. The confidence of the relationship reasoning path is calculated using the dot multiplication method.

5. The method according to claim 1, characterized in that The confidences of the relational reasoning paths at different timestamps are aggregated to obtain the relational reasoning score, including: Aggregate the confidence scores of the relationship reasoning paths and get the timestamp t τ The total confidence score of all relational reasoning paths between the following entity pairs; The confidence scores of the relational reasoning paths at each time stamp are weighted and added together using a time decay function to obtain a relational reasoning score.

6. The method according to claim 1, characterized in that The entity dynamic embedding is obtained by the following steps: Use R-GCN as a structural encoder for modeling to obtain static entity encoding; The temporal dependencies of entity structures are modeled using time-gating components, and the dynamic structural semantic embedding of entity s s,t+1 It is determined by two parts, namely the output of the last layer of R-GCN and the dynamic structural semantic embedding of the previous timestamp s,t ; in: in represents the dot product operation, U t+1 is a time gate; the nonlinear transformation performed by the time gate is; U t+1 =σ(W u e s,t +b) where σ(·) is the sigmoid function, W u is the weight matrix of the time gate and b is the offset.

7. The method according to claim 1, characterized in that Use ConvTransE as the decoder to calculate the query time stamp t q The subject s of the query q and the candidate object o i The degree of association at the dynamic structure semantic level is used to obtain the entity subgraph structure score.

8. A temporal knowledge graph reasoning system for distinguishing similar historical structures, characterized in that: include: Relational reasoning module, responsible for extracting the relationship reasoning path between entity pairs; Encodes the time intervals between relations that may have causal logic; Based on the encoding results, the confidence of each relational reasoning path is evaluated by positive and negative sample comparison learning; the confidence of the relational reasoning paths at different timestamps is aggregated to obtain the relational reasoning score; The entity subgraph structure learning module is responsible for encoding historical subgraphs to obtain the static embedding of entities in each historical subgraph. The time gate component is used to model the temporal dependency between static embeddings of entities at different timestamps to obtain dynamic embeddings of entities. Based on the dynamic embeddings of entities, the probability of establishing associations between entities is calculated to obtain the entity subgraph structure score. The relationship and entity combination module is responsible for adding the relationship reasoning score and the entity subgraph structure score using a weight coefficient to obtain a prediction score of the candidate entity; The reasoning module is responsible for sorting the prediction scores of candidate entities and using the candidate entities with the highest prediction scores to complete the missing entities in the prediction query, thereby realizing temporal knowledge graph reasoning.

9. A computer device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, the computer program is configured to be executed by the processor, and the computer program comprises instructions for executing the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a computer, the method according to any one of claims 1 to 7 is implemented.

Citation Information

Cited By

  • Target action prediction method based on time sequence knowledge graph

    CN120724294A

  • Question answering method and system based on knowledge graph

    CN121071073A