Time knowledge graph completion method based on multivariate fact driving

By integrating query-related historical facts and entity-related neighborhood facts in the time knowledge graph completion model, the problem of the existing model using only one type of historical facts has been solved, which significantly improves the time knowledge graph complementation. Full comprehensiveness and model performance.

CN119226524AActive Publication Date: 2024-12-31FUZHOU DIGITAL IND INTERNET TECH CO LTD

Patent Information

Application Number
CN202411064261.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-05
Publication Date
2024-12-31
Estimated Expiration
2044-08-05

AI Technical Summary

Technical Problem

The existing time knowledge graph completion model only uses one type of historical fact, resulting in poor time knowledge graph completion effect and affecting model performance.

Method used

Using the time knowledge graph completion method driven by multiple facts, the time knowledge graph completion model is created by querying the history encoder, entity history encoder, query history evolution module, entity history evolution module and historical fusion module, and training in combination with the loss function. , fusion query related historical facts and entity related neighborhood facts.

Benefits of technology

It significantly improves the comprehensiveness and model performance of time knowledge graph completion, and can more accurately complete and predict the time knowledge graph.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119226524A_ABST
    Figure CN119226524A_ABST
Patent Text Reader

Abstract

The invention provides a time mapping knowledge domain completion method based on multivariate fact driving, and belongs to the technical field of mapping knowledge domains. Comprising the following steps: S1, creating a time knowledge graph completion model based on a query history encoder, an entity history encoder, a query history evolution module, an entity history evolution module, a history fusion module and a decoder, and setting a loss function of the time knowledge graph completion model; step S2, obtaining a large number of historical knowledge maps, and constructing a data set after preprocessing and labeling each historical knowledge map; s3, training a time knowledge graph completion model based on the data set; and S4, executing time knowledge graph completion operation based on the trained time knowledge graph completion model. The method has the advantage that the complementation comprehensiveness of the time knowledge graph is greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of knowledge graphs, and particularly to a method for completing a temporal knowledge graph driven by multiple facts. Background Art

[0002] Knowledge graphs can be used to store a large amount of human knowledge and facts, which represent knowledge and facts in the form of triples (e s , r, e o ), where e s represents the head entity, r represents the relationship, and e o represents the tail entity, such as (Yao*, nationality, China). At present, many large-scale knowledge graphs have been constructed in this field, such as knowledge graphs like WIKI and YAGO. These knowledge graphs contain a vast amount of information and can provide data support for downstream applications, such as intelligent question-and-answer robots, recommendation algorithms, etc. However, there are still various problems of missing facts in these knowledge graphs, which promotes the development of knowledge graph completion technology.

[0003] The goal of knowledge graph completion is to automatically complete the missing facts in the knowledge graph in a machine learning manner and reduce manual annotation behavior. And knowledge graph completion is divided into static knowledge graph completion and dynamic knowledge graph completion.

[0004] For static knowledge graphs, translation models such as TransE and TransH project entities and relationships into a low-dimensional vector space and model the relationship as a translation vector between entities; in the vector space, the translation model calculates the vector coordinates of the tail entity by computing the vectors of the head entity and the relationship, and uses this for fact completion work. The RESCAL model proposed by Bordes et al. is a type of tensor decomposition model. Triples exist in the form of tensors, and by decomposing the tensors, the latent structures and patterns between entities and relationships are learned. However, RESCAL faces the challenge of a large number of parameters; to solve this problem, researchers subsequently proposed the DistMult model, which simplifies the representation of the relationship matrix, and ComplEx uses complex numbers to model entity and relationship representations, solving the problems of symmetry and asymmetry of entities in embeddings.

[0005] In practical applications, many pieces of information change over time, and traditional static knowledge graphs cannot accurately reflect this dynamic nature. For example, a person may have different occupations or geographical locations at different time points, and such changes are difficult to describe by static knowledge graphs. Therefore, constructing a dynamic knowledge graph with temporal attributes, that is, a temporal knowledge graph (TKG), is more meaningful in reality. And temporal knowledge graph completion (TKGC) is the completion task for TKG, which can be specifically divided into interpolation and extrapolation tasks.

[0006] In the temporal knowledge graph, historical facts are the key factors that need to be considered for completion, especially in extrapolation tasks, where in-depth mining and understanding of historical data becomes particularly important. The temporal knowledge graph is not an overall graph structure, but is divided into multiple small graphs, also called subgraphs, based on timestamps. Each subgraph records facts that occurred at the same time, and entities exist in multiple subgraphs. Entities in different subgraphs will have different structural information, namely neighborhood information. This difference reflects the temporal changes in entity features; modeling this dynamic feature can help the model achieve more accurate temporal knowledge graph completion.

[0007] Existing models such as CyGNet model recurring facts in query history, RE-NET, GLANet and EvoExplore try to aggregate local or global neighborhood facts of entities in each historical subgraph. However, these models only use one type of historical facts, namely historical facts related to the query or neighborhood facts related to the entity. The query-related historical facts involve historical events directly connected to the specific query. This information directly reflects the historical background of the query entity and the corresponding relationship, while the entity-related neighborhood facts include all historical records of each entity in the knowledge graph from the initial to the query time. These facts not only enrich the connotation of the entity, but also provide background information closely related to the query. Since only one type of historical facts is traditionally used, the effect of temporal knowledge graph completion is not good, which in turn affects the model performance of the model modeled using the temporal knowledge graph.

[0008] Therefore, how to provide a temporal knowledge graph completion method based on multiple fact-driven methods to improve the comprehensiveness of temporal knowledge graph completion has become a technical problem that needs to be solved urgently. Summary of the invention

[0009] The technical problem to be solved by the present invention is to provide a method for completing a temporal knowledge graph based on multi-fact driven methods, so as to improve the comprehensiveness of the temporal knowledge graph completion.

[0010] The present invention is implemented as follows: a method for completing a time knowledge graph based on multi-fact driven, comprising the following steps:

[0011] Step S1, creating a temporal knowledge graph completion model based on a query history encoder, an entity history encoder, a query history evolution module, an entity history evolution module, a history fusion module and a decoder, and setting a loss function of the temporal knowledge graph completion model;

[0012] Step S2: Obtain a large number of historical knowledge graphs, pre-process and annotate each of the historical knowledge graphs to construct a data set;

[0013] Step S3: training a temporal knowledge graph completion model based on the data set;

[0014] Step S4: Execute the temporal knowledge graph completion operation based on the trained temporal knowledge graph completion model.

[0015] Furthermore, in step S1, the query history encoder is used to query (e q ,r q ,? ,t q ), historical facts related to the query entity are aggregated to obtain the query embedding:

[0016]

[0017] Among them, e q Represents the query entity; r q represents the query relation; ? represents the query embedding to be generated; t q represents the qth query time; Represents the query entity e q In t i The query embedding at the time; n represents the number of entities; o i Represents the i-th query entity e q and query relation r q Neighbor information of N i Indicates obtaining the query entity e from the first i subgraphs of the temporal knowledge graph q and query relation r q Related tail entity embedding; W v , W q , W k denotes the parameter matrix used by attention, and represents a real number, d represents the entity embedding dimension; T represents transpose; softmax() represents the normalized exponential function.

[0018] Furthermore, in step S1, the entity history encoder is used to aggregate all entities e at t q The historical facts of one-hop neighbors in the previous n subgraphs are used to obtain entity embedding. The specific process is as follows:

[0019] Split entity e into k chunks:

[0020] e k =eG k ;

[0021] Among them, e k represents the entity e of the kth block; e represents the entity in the temporal knowledge graph, including the query entity; G k represents the kth vector space, represents a real number, d represents the entity embedding dimension; n represents the number of entities; t q represents the qth query time;

[0022] For each of the e k To transfer in chunks:

[0023] msg k =W1[r k ||e k ];

[0024] Among them, msg k Indicates e k The message delivered; k Indicates the block embedding of the relationship between two entities e; W1 represents the parameter matrix; || represents the concatenation operation;

[0025] Use graph attention to calculate different msg k The importance coefficients of are concatenated based on the importance coefficients to get the neighbor embedding:

[0026]

[0027] Among them, α k represents the kth importance coefficient; exp() represents the natural exponential function; LeakeyReLU() represents the linear rectification function; W2 represents the parameter matrix; msg i Indicates e i The message delivered; represents the neighbor embedding of neighbor entity o obtained by embedding with attention of l layers of block graph; represents the neighbor embedding of the kth neighbor entity obtained by l-1 layer block graph attention embedding;

[0028] Based on the And e gets the entity embedding:

[0029]

[0030] in, Indicates t i Entity embedding at the moment; N t (e) represents the tail entity embedding related to e; represents the neighbor embedding of neighbor entity o obtained by l-1 layer block graph attention embedding.

[0031] Furthermore, in step S1, the query history evolution module is used to evolve the output of the query history encoder according to the time series to obtain the query embedding representation:

[0032]

[0033] The entity history evolution module is used to evolve the output of the entity history encoder according to the time series to obtain the entity embedding representation:

[0034]

[0035] Among them, GRU() represents the gated recurrent unit function; Represents the query entity e q In t i Query embedding at the moment; Indicates t i The query embedding representation obtained by evolving at all times; Indicates t i-1 The query embedding representation obtained by evolving at all times; Indicates t i The physical embedding of the moment; Indicates t i The entity embedding representation obtained by momentary evolution; Indicates t i-1 The entity embedding representation evolved over time.

[0036] Furthermore, in step S1, the history fusion module is used to fuse the outputs of the query history evolution module and the entity history evolution module to obtain the query entity embedding:

[0037]

[0038] in, represents query entity embedding; β represents adaptive function; sigmoid() represents activation function; w g Represents the parameter matrix used by attention; || represents the concatenation operation.

[0039] Furthermore, in step S1, the decoder is used to decode the output of the history fusion module to obtain the candidate entity probabilities related to the query, and output the prediction results of the query based on the candidate entity probabilities:

[0040]

[0041] Among them, p(o'|e q ,r q ,t q ) represents the query with the time knowledge graph (e q ,r q ,? ,t q ) related candidate entity probability; o' represents the candidate entity; e q Represents the query entity; r q Indicates the query relationship; t qrepresents the qth query time; ? represents the query embedding to be generated; sigmoid() represents the activation function; ConvTransE() represents the decoding function; represents the query entity embedding output by the history fusion module; Indicates t i The entity embedding representation evolved over time.

[0042] Furthermore, in step S1, the formula of the loss function is:

[0043] Loss = -∑∑log p;

[0044] Among them, Loss represents the loss value of the loss function; p represents the probability of candidate entities related to the query of the temporal knowledge graph.

[0045] Furthermore, the step S2 is specifically as follows:

[0046] Acquire a large number of historical knowledge graphs, perform preprocessing on each of the historical knowledge graphs, including at least null value processing, data standardization processing, data merging and missing value processing, annotate each of the preprocessed historical knowledge graphs, and construct a data set based on each of the annotated historical knowledge graphs.

[0047] Furthermore, the step S3 is specifically as follows:

[0048] The data set is divided into a training set and a validation set based on a preset ratio, and the temporal knowledge graph completion model is trained with the training set until the loss value of the loss function is less than the preset loss threshold. The temporal knowledge graph completion model is then verified with the validation set to determine whether the completion accuracy is greater than the preset accuracy threshold. If so, the training is terminated; if not, the training set is expanded to continue the training.

[0049] The advantages of the present invention are:

[0050] A temporal knowledge graph completion model is created by querying history encoder, entity history encoder, query history evolution module, entity history evolution module, history fusion module and decoder, and the loss function of the temporal knowledge graph completion model is set; then a large number of historical knowledge graphs are obtained for preprocessing and annotation to construct a data set, and the temporal knowledge graph completion model is trained based on the data set and the loss function, and finally the temporal knowledge graph completion operation is performed based on the trained temporal knowledge graph completion model; since the query history encoder is used to focus on historical facts related to the query entity in the query, the query embedding is obtained; the entity history encoder is used to aggregate all entities e in t qThe query history evolution module is used to evolve the output of the query history encoder according to the time series to obtain the query embedding representation; the entity history evolution module is used to evolve the output of the entity history encoder according to the time series to obtain the entity embedding representation; the history fusion module is used to fuse the outputs of the query history evolution module and the entity history evolution module to obtain the query entity embedding; the decoder is used to decode the output of the history fusion module to obtain the query-related candidate entity probability of the temporal knowledge graph, and output the prediction result of the query based on the candidate entity probability; that is, the temporal knowledge graph completion model can fuse the query-related historical facts and the entity-related neighborhood facts, which greatly improves the comprehensiveness of the temporal knowledge graph completion, and thus greatly improves the model performance of the model obtained by modeling using the temporal knowledge graph. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] The present invention will be further described below in conjunction with embodiments with reference to the accompanying drawings.

[0052] Figure 1 It is a flow chart of a method for completing a time knowledge graph driven by multiple facts according to the present invention.

[0053] Figure 2 It is a flow chart of a method for completing a time knowledge graph driven by multiple facts according to the present invention. DETAILED DESCRIPTION

[0054] The technical solution in the embodiment of the present application has the following general idea: based on the temporal knowledge graph completion model including the query history encoder, the entity history encoder, the query history evolution module, the entity history evolution module, the history fusion module and the decoder, the temporal knowledge graph completion operation is performed; since the query history encoder is used to focus on the historical facts related to the query entity in the query, the query embedding is obtained; the entity history encoder is used to aggregate all entities e in t q The query history evolution module is used to evolve the output of the query history encoder according to the time series to obtain the query embedding representation; the entity history evolution module is used to evolve the output of the entity history encoder according to the time series to obtain the entity embedding representation; the history fusion module is used to fuse the outputs of the query history evolution module and the entity history evolution module to obtain the query entity embedding; the decoder is used to decode the output of the history fusion module to obtain the query-related candidate entity probability of the temporal knowledge graph, and output the query prediction result based on the candidate entity probability; that is, the temporal knowledge graph completion model can fuse the query-related historical facts and the entity-related neighborhood facts to improve the comprehensiveness of the temporal knowledge graph completion.

[0055] Please refer to Figure 1 to Figure 2 As shown, a preferred embodiment of the method for completing a time knowledge graph based on multi-fact driven time knowledge graph of the present invention includes the following steps:

[0056] Step S1, creating a temporal knowledge graph completion model based on a query history encoder, an entity history encoder, a query history evolution module, an entity history evolution module, a history fusion module and a decoder, and setting a loss function of the temporal knowledge graph completion model;

[0057] The query history encoder and entity history encoder are used to aggregate attention to different categories of historical information respectively; the query history evolution module, entity history evolution module and history fusion module are used to evolve entity features in time series and learn the potential semantic information of entities in the entire historical context; the decoder is used to calculate candidate entity scores and give predicted entities, that is, to give the candidate entity probabilities related to the query of the temporal knowledge graph, and to make predictions based on the candidate entity probabilities;

[0058] Step S2: Obtain a large number of historical knowledge graphs, pre-process and annotate each of the historical knowledge graphs to construct a data set;

[0059] Step S3: training a temporal knowledge graph completion model based on the data set;

[0060] Step S4: Execute the temporal knowledge graph completion operation based on the trained temporal knowledge graph completion model.

[0061] In step S1, the query history encoder is used to query (e q ,r q ,? ,t q ), historical facts related to the query entity are aggregated to obtain the query embedding:

[0062]

[0063] o i =(N i W v )softmax((N i W q ) T (N i W k ));

[0064]

[0065] Among them, e q Represents the query entity; r q represents the query relation; ? represents the query embedding to be generated; tq represents the qth query time; Represents the query entity e q In t i The query embedding at the time; n represents the number of entities; o i Represents the i-th query entity e q and query relation r q Neighbor information of N i Indicates obtaining the query entity e from the first i subgraphs of the temporal knowledge graph q and query relation r q Related tail entity embedding; W v , W q , W k denotes the parameter matrix used by attention, and represents a real number, d represents the entity embedding dimension; T represents transpose; softmax() represents the normalized exponential function.

[0066] Attention aggregation through the query history encoder helps the temporal knowledge graph completion model learn the entities related to the query entity e q and query relation r q Directly relevant historical background information.

[0067] In step S1, the entity history encoder is used to aggregate all entities e at t q The historical facts of one-hop neighbors in the previous n subgraphs are used to obtain entity embedding. The specific process is as follows:

[0068] Split entity e into k chunks:

[0069] e k =eG k ;

[0070] Among them, e k represents the entity e of the kth block; e represents the entity in the temporal knowledge graph, including the query entity; G k represents the kth vector space, represents a real number, d represents the entity embedding dimension; n represents the number of entities; t q represents the qth query time;

[0071] For each of the e k To transfer in chunks:

[0072] msg k =W1[r k ||e k ];

[0073] Among them, msg k Indicates e kThe message delivered; k Indicates the block embedding of the relationship between two entities e; W1 represents the parameter matrix; || represents the concatenation operation;

[0074] In order to aggregate the attribute characteristics of entities in a fine-grained manner, the message transmission method is carried out in a block form;

[0075] Use graph attention to calculate different msg k The importance coefficients of are concatenated based on the importance coefficients to get the neighbor embedding:

[0076]

[0077] Among them, α k represents the kth importance coefficient; exp() represents the natural exponential function; LeakeyReLU() represents the linear rectification function; W2 represents the parameter matrix; msg i Indicates e i The message delivered; represents the neighbor embedding of neighbor entity o obtained by embedding with attention of l layers of block graph; represents the neighbor embedding of the kth neighbor entity obtained by l-1 layer block graph attention embedding;

[0078] Based on the And e gets the entity embedding:

[0079]

[0080] in, Indicates t i Entity embedding at the moment; N t (e) represents the tail entity embedding related to e; represents the neighbor embedding of neighbor entity o obtained by l-1 layer block graph attention embedding.

[0081] Aggregating one-hop neighbor historical facts through the entity history encoder helps to enrich the embedding information of entity e; the embedding of entity e contains attribute features of various aspects of an entity. There are various relationships between an entity e and other entities e, and different relationships focus on different aspects of entity e; taking (Newton, subject,?) as an example, we should focus on subject information related to the entity Newton, rather than information such as Newton’s family relationship. When implementing neighbor aggregation operations, existing methods usually aggregate entity embeddings as units, but entity embeddings are composed of various attribute features, that is, different aspects of entities. The present invention achieves the amplification of relevant attribute features and the weakening of irrelevant attribute features by weighted aggregation of various aspects of entity voice information with specific relationships. To this end, the entity history encoder performs graph attention aggregation on entities by blocks to achieve fine-grained aggregation.

[0082] In step S1, the query history evolution module is used to evolve the output of the query history encoder according to the time series to obtain the query embedding representation:

[0083]

[0084] The entity history evolution module is used to evolve the output of the entity history encoder according to the time series to obtain the entity embedding representation:

[0085]

[0086] Among them, GRU() represents the gated recurrent unit function; Represents the query entity e q In t i Query embedding at the moment; Indicates t i The query embedding representation obtained by evolving at all times; Indicates t i-1 The query embedding representation obtained by evolving at all times; Indicates t i The physical embedding of the moment; Indicates t i The entity embedding representation obtained by momentary evolution; Indicates t i-1 The entity embedding representation evolved over time.

[0087] In order to further utilize the information of entities in different subgraphs, the present invention adopts GRU() to forget and remember different facts of the same entity in the time series to capture the historical evolution law of entities in different subgraphs.

[0088] In step S1, the history fusion module is used to fuse the outputs of the query history evolution module and the entity history evolution module to obtain the query entity embedding:

[0089]

[0090] in, represents query entity embedding; β represents an adaptive function, which is used to balance the influence of the two types of historical information, that is, to adaptively adjust the weights of the two types of historical information; sigmoid() represents an activation function; w g Represents the parameter matrix used by attention; || represents the concatenation operation.

[0091] In step S1, the decoder is used to decode the output of the history fusion module to obtain the candidate entity probabilities related to the query, and output the prediction results of the query based on the candidate entity probabilities:

[0092]

[0093] Among them, p(o'|e q ,r q ,t q ) represents the query with the time knowledge graph (e q ,r q ,? ,t q ) related candidate entity probability; o' represents the candidate entity; e q Represents the query entity; r q Indicates the query relationship; t q represents the qth query time; ? represents the query embedding to be generated; sigmoid() represents the activation function; ConvTransE() represents the decoding function; represents the query entity embedding output by the history fusion module; Indicates t i The entity embedding representation evolved over time.

[0094] The present invention adopts ConvTransE() as a decoder to calculate the scores of candidate entities. It uses convolutional neural networks to enhance the traditional TransE model, which can more effectively capture the complex connections between entities and their relationships, and provide a more powerful and flexible method for embedding and reasoning of temporal knowledge graphs.

[0095] In step S1, the formula of the loss function is:

[0096] Loss = -∑∑log p;

[0097] Among them, Loss represents the loss value of the loss function; p represents the probability of candidate entities related to the query of the temporal knowledge graph.

[0098] For the query (s, r, o, t), when predicting the head / tail, the head / tail entity is masked. The training goal is to minimize the loss, aiming to make the correct facts score high and the wrong facts score low. The formula is:

[0099]

[0100] Among them, t Represents the subgraph of the temporal knowledge graph at time t.

[0101] The step S2 is specifically as follows:

[0102] Acquire a large number of historical knowledge graphs, perform preprocessing on each of the historical knowledge graphs, including at least null value processing, data standardization processing, data merging and missing value processing, annotate each of the preprocessed historical knowledge graphs, and construct a data set based on each of the annotated historical knowledge graphs.

[0103] The step S3 is specifically as follows:

[0104] The data set is divided into a training set and a validation set based on a preset ratio, and the temporal knowledge graph completion model is trained with the training set until the loss value of the loss function is less than the preset loss threshold. The temporal knowledge graph completion model is then verified with the validation set to determine whether the completion accuracy is greater than the preset accuracy threshold. If so, the training is terminated; if not, the training set is expanded to continue the training.

[0105] In summary, the advantages of the present invention are:

[0106] A temporal knowledge graph completion model is created by querying history encoder, entity history encoder, query history evolution module, entity history evolution module, history fusion module and decoder, and the loss function of the temporal knowledge graph completion model is set; then a large number of historical knowledge graphs are obtained for preprocessing and annotation to construct a data set, and the temporal knowledge graph completion model is trained based on the data set and the loss function, and finally the temporal knowledge graph completion operation is performed based on the trained temporal knowledge graph completion model; since the query history encoder is used to focus on historical facts related to the query entity in the query, the query embedding is obtained; the entity history encoder is used to aggregate all entities e in t q The query history evolution module is used to evolve the output of the query history encoder according to the time series to obtain the query embedding representation; the entity history evolution module is used to evolve the output of the entity history encoder according to the time series to obtain the entity embedding representation; the history fusion module is used to fuse the outputs of the query history evolution module and the entity history evolution module to obtain the query entity embedding; the decoder is used to decode the output of the history fusion module to obtain the query-related candidate entity probability of the temporal knowledge graph, and output the prediction result of the query based on the candidate entity probability; that is, the temporal knowledge graph completion model can fuse the query-related historical facts and the entity-related neighborhood facts, which greatly improves the comprehensiveness of the temporal knowledge graph completion, and thus greatly improves the model performance of the model obtained by modeling using the temporal knowledge graph.

[0107] Although the specific implementation modes of the present invention are described above, those skilled in the art should understand that the specific implementation modes described are only illustrative and are not intended to limit the scope of the present invention. Equivalent modifications and changes made by those skilled in the art in accordance with the spirit of the present invention should be included in the scope of protection of the claims of the present invention.

Claims

1. A method for completing a temporal knowledge graph based on multi-fact driven methods, characterized by: The steps include: Step S1, creating a temporal knowledge graph completion model based on a query history encoder, an entity history encoder, a query history evolution module, an entity history evolution module, a history fusion module and a decoder, and setting a loss function of the temporal knowledge graph completion model; Step S2: Obtain a large number of historical knowledge graphs, pre-process and annotate each of the historical knowledge graphs to construct a data set; Step S3: training a temporal knowledge graph completion model based on the data set; Step S4: Execute the temporal knowledge graph completion operation based on the trained temporal knowledge graph completion model.

2. The method for completing a time knowledge graph based on multi-fact driven methods as claimed in claim 1, characterized in that: In step S1, the query history encoder is used to query (e q ,r q ,? ,t q ), historical facts related to the query entity are aggregated to obtain the query embedding: o i =(N i W v )softmax((N i W q ) T (N i W k )); Among them, e q Represents the query entity; r q represents the query relation; ? represents the query embedding to be generated; t q represents the qth query time; Represents the query entity e q In t i The query embedding at the time; n represents the number of entities; o i Represents the i-th query entity e q and query relation r q Neighbor information of N i Indicates obtaining the query entity e from the first i subgraphs of the temporal knowledge graph q and query relation r q Related tail entity embedding; W v , W q , W k Both represent the parameter matrices used by attention, and represents a real number, d represents the entity embedding dimension; T represents transpose; softmax() represents the normalized exponential function.

3. The method for completing a time knowledge graph based on multi-fact driven methods as claimed in claim 1, characterized in that: In step S1, the entity history encoder is used to aggregate all entities e at t q The historical facts of one-hop neighbors in the previous n subgraphs are used to obtain entity embedding. The specific process is as follows: Split entity e into k chunks: e k =eG k ; Among them, e k represents the entity e of the kth block; e represents the entity in the temporal knowledge graph, including the query entity; G k represents the kth vector space, represents a real number, d represents the entity embedding dimension; n represents the number of entities; t q represents the qth query time; For each of the e k To transfer in chunks: msg k =W1[r k ||e k ]; Among them, msg k Indicates e k The message delivered; k Indicates the block embedding of the relationship between two entities e; W1 represents the parameter matrix; || represents the concatenation operation; Use graph attention to calculate different msg k The importance coefficients of are concatenated based on the importance coefficients to get the neighbor embedding: Among them, α k represents the kth importance coefficient; exp() represents the natural exponential function; LeakeyReLU() represents the linear rectification function; W2 represents the parameter matrix; msg i Indicates e i the message delivered; represents the neighbor embedding of neighbor entity o obtained by embedding with attention of l layers of block graph; represents the neighbor embedding of the kth neighbor entity obtained by l-1 layer block graph attention embedding; Based on the And e gets the entity embedding: in, Indicates t i Entity embedding at the moment; N t (e) represents the tail entity embedding related to e; represents the neighbor embedding of neighbor entity o obtained by l-1 layer block graph attention embedding.

4. The method for completing a time knowledge graph based on multi-fact driven methods as claimed in claim 1, characterized in that: In step S1, the query history evolution module is used to evolve the output of the query history encoder according to the time series to obtain the query embedding representation: The entity history evolution module is used to evolve the output of the entity history encoder according to the time series to obtain the entity embedding representation: Among them, GRU() represents the gated recurrent unit function; Represents the query entity e q In t i Query embedding at the moment; Indicates t i The query embedding representation obtained by evolving at all times; Indicates t i-1 The query embedding representation obtained by evolving at all times; Indicates t i The physical embedding of the moment; Indicates t i The entity embedding representation that evolves over time; Indicates t i-1 The entity embedding representation evolved over time.

5. The method for completing a time knowledge graph based on multi-fact driven methods as claimed in claim 4, characterized in that: In step S1, the history fusion module is used to fuse the outputs of the query history evolution module and the entity history evolution module to obtain the query entity embedding: in, represents query entity embedding; β represents adaptive function; sigmoid() represents activation function; w g Represents the parameter matrix used by attention; || represents the concatenation operation.

6. The method for completing a temporal knowledge graph based on multi-fact driven methods as claimed in claim 1, characterized in that: In step S1, the decoder is used to decode the output of the history fusion module to obtain the candidate entity probabilities related to the query, and output the prediction results of the query based on the candidate entity probabilities: Among them, p(o'|e q ,r q ,t q ) represents the query with the time knowledge graph (e q ,r q ,? ,t q ) related candidate entity probability; o' represents the candidate entity; e q Represents the query entity; r q Indicates the query relationship; t q represents the qth query time; ? represents the query embedding to be generated; sigmoid() represents the activation function; ConvTransE() represents the decoding function; represents the query entity embedding output by the history fusion module; Indicates t i The entity embedding representation evolved over time.

7. The method for completing a temporal knowledge graph based on multi-fact driven methods as claimed in claim 1, characterized in that: In step S1, the formula of the loss function is: Loss = -∑∑log p; Among them, Loss represents the loss value of the loss function; p represents the probability of candidate entities related to the query of the temporal knowledge graph.

8. The method for completing a time knowledge graph based on multi-fact driven methods as claimed in claim 1, characterized in that: The step S2 is specifically as follows: Acquire a large number of historical knowledge graphs, perform preprocessing on each of the historical knowledge graphs, including at least null value processing, data standardization processing, data merging and missing value processing, annotate each of the preprocessed historical knowledge graphs, and construct a data set based on each of the annotated historical knowledge graphs.

9. The method for completing a time knowledge graph based on multi-fact driven methods as claimed in claim 1, characterized in that: The step S3 is specifically as follows: The data set is divided into a training set and a validation set based on a preset ratio, and the temporal knowledge graph completion model is trained with the training set until the loss value of the loss function is less than a preset loss threshold. The temporal knowledge graph completion model is then verified with the validation set to determine whether the completion accuracy is greater than the preset accuracy threshold. If so, the training is terminated; if not, the training set is expanded to continue the training.

Citation Information

Patent Citations

  • Small sample tense knowledge graph completion method based on relation adaptive network

    CN116340524A

  • Semantic perception embedding-based open knowledge graph link prediction method

    CN117609515A

  • Knowledge graph construction method and device, electronic equipment and storage medium

    CN117933386A

  • Time sequence knowledge graph reasoning method and device based on time rule capture

    CN118069869A

  • Method for temporal knowledge graph reasoning based on distributed attention

    US20230401466A1

Cited By

  • Time knowledge graph question-answering system based on constraint perception and graph reasoning

    CN122065955A