Knowledge graph reasoning method for information with time information
By employing a knowledge graph reasoning method for intelligence with time information, combined with Markov logic networks and embedded learning, the shortcomings of time-based knowledge graphs in handling temporal relationships and sparse samples are addressed, resulting in stronger extrapolation capabilities and interpretability.
Patent Information
- Application Number
- CN202510888477.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-30
- Publication Date
- 2025-11-21
AI Technical Summary
Existing time knowledge graph reasoning methods are insufficient in handling complex temporal relationships and sparse sample problems, and are difficult to effectively utilize time information and prior knowledge.
We employ a knowledge graph reasoning method for intelligence with time information. By initialization, scoring functions, Markov logic networks, and variational reasoning, combined with long short-term memory networks, we capture time dependencies, generate high-dimensional time features, and use time logic rules to generate Markov logic networks to establish a joint probability distribution model for predicting unknown facts.
It achieves better temporal representation and stable prediction under sparse samples, improves the dynamic updating capability and future reliability of knowledge graphs, and makes the inference results easy to understand.
Smart Images

Figure CN120996177A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of knowledge graph reasoning, and in particular relates to a knowledge graph reasoning method for knowledge graph intelligence with time information. Background Technology
[0002] Knowledge graphs are an effective form of knowledge representation, capable of organizing and encoding information in a structured manner, representing knowledge through triples (subject-predicate-object). Extending this to temporal knowledge graphs, each fact is appended with a timestamp or time period information, thus enabling a more comprehensive depiction of the dynamic changes in knowledge. However, in practical applications, static knowledge graphs struggle to effectively capture the patterns of knowledge change over time, and existing time-enhanced knowledge graph reasoning methods still have shortcomings in handling complex temporal relationships and sparse sample problems.
[0003] To address these issues, existing temporal knowledge graph reasoning methods mainly fall into two categories: one is based on data embedding (such as T-TransE and TA-DistMult), which maps entities and relations to a low-dimensional vector space and enhances them with temporal information; the other is based on logical rules (such as TLogic and TILP), which extracts rules by performing random walks on the knowledge graph or simulates the reasoning process using formal logic systems. However, both of these traditional methods have significant limitations: embedding-based methods struggle to fully incorporate prior knowledge and perform poorly in sparse data scenarios; while symbolic rule-based methods offer strong interpretability, they typically only allow for simple temporal sequencing when utilizing temporal information.
[0004] Therefore, there is an urgent need for a new knowledge reasoning method that can utilize temporal information more efficiently while maintaining good interpretability, and also has good sparse sample learning ability. Summary of the Invention
[0005] Based on the above analysis, the present invention aims to provide a knowledge graph reasoning method for information with time information, which solves the problems of sparsity and weak utilization of time information in existing temporal knowledge graph reasoning methods.
[0006] This invention discloses a knowledge graph reasoning method for information with time information, comprising:
[0007] Step S1: Initialize the intelligence with time information; the intelligence is factual information with explicit timestamps added to the knowledge graph; during initialization, embedding learning is used to vectorize the head and tail entities in the facts, and capture the time dependency relationship of the timestamp sequence to generate high-dimensional time.
[0008] Step S2: Using the head and tail entities that evaluate the given relation constraints in high-dimensional time as a scoring function for the probability of fact validity, unknown facts in the knowledge graph are scored and then transformed into approximate posterior probabilities of unknown facts.
[0009] Step S3: Generate a Markov logic network using the temporal logic rules mined from the knowledge graph, and establish a joint probability distribution model of known and unknown facts to solve the probability of unknown facts;
[0010] Step S4: Use variational inference to iteratively solve the joint probability distribution model with the approximate posterior probability of the unknown facts as the initial input to predict the unknown facts.
[0011] Furthermore, the process of capturing the temporal dependencies of timestamp sequences to generate high-dimensional time includes:
[0012] 1) Convert the given timestamp into a numerical form, decompose the converted value into a sequence of individual numbers and input it into the time embedding matrix as the basic time feature matrix;
[0013] 2) For a series of timestamp sequences, stack their corresponding basic time feature matrices to form a three-dimensional tensor;
[0014] 3) Input the three-dimensional tensor corresponding to the timestamp sequence into the Long Short-Term Memory (LSTM) network to capture the time dependency of the timestamp sequence and generate a high-dimensional time.
[0015] Furthermore, the scoring function is:
[0016]
[0017] in,
[0018] l represents a given relational constraint; e s e o These are the head entity embedding vector and the tail entity embedding vector obtained from embedding learning, respectively; t lstm Generate high-dimensional time for the Long Short-Term Memory (LSTM) network;
[0019] f(·) is a nonlinear activation function;
[0020] W R For a bilinear tensor of dimension d×d×k, the bilinear operation is performed... Generate a k-dimensional vector representing the strength of the relationship between entity pairs;
[0021] V R Given a linear tensor of dimension k×2d, V is obtained through linear operations. R [e s ;e o Capture combined information about the features of the head and tail entities;
[0022] b R This is a k-dimensional bias vector used to balance the model output;
[0023] U R It is a bilinear tensor with dimensions k×k×k, used to further integrate entity relationships and temporal information;
[0024] T R Let T be a linear tensor of dimension k×d, used for linear operations. R [t lstm Dimension mapping for high-dimensional time;
[0025] d is the number of entities in the head or tail entity embedding vector, and k is the embedding dimension of an entity.
[0026] Furthermore, the formula for the approximate posterior probability is:
[0027] p=σ(g(l,e s ,e o ,t lstm ))
[0028] in,
[0029]
[0030] x is the input to the function σ(·).
[0031] Furthermore, the process of generating Markov logic networks using temporal logic rules mined from knowledge graphs includes:
[0032] 1) Process and standardize the knowledge graph; extract the predicates, entities and their timestamp information from the graph, and represent the knowledge graph as a set of facts composed of quadruples (predicate, subject, object, timestamp);
[0033] 2) Preprocess the rules mined from the knowledge graph; after deduplication and confidence processing, obtain a set of temporal logic rules for reasoning;
[0034] 3) Generate a Markov logic network; for each rule in the set of temporal logic rules, extract all its corresponding instances to form a clique in the Markov logic network; in each clique, expand the instantiated triplet atoms into quadruple atoms with timestamp information to record the temporal characteristics of the event.
[0035] Furthermore, the joint probability distribution P(F,U|ω) of the joint probability distribution model of known and unknown facts is:
[0036]
[0037] Where r is a rule in the time logic rule set R, ω r ω represents the weights assigned to rule r; F represents the set of known facts; U represents the set of unknown facts to be predicted; ω is the weight of the network corresponding to the preferred rule; N(F,U) is the number of all instances that satisfy rule r; Z(ω) is the partition function, which is the sum of instances corresponding to all rules.
[0038] Furthermore, the link prediction process, which obtains the probability posterior distribution of the unknown fact to be predicted by maximizing the joint probability distribution P(F,U|ω), includes:
[0039] a) Determine the time point t to be predicted;
[0040] b) Based on the known set of facts F and timestamp information, reasoning is performed using the defined set of time logic rules R to obtain the probability score that the target fact u belongs to the unknown set of facts U at a specific time point;
[0041] c) Sort all possible facts and output the K most likely results as prediction links;
[0042] In the calculation process, while considering the logical matching relationship between predicates, it also explicitly verifies whether the timestamp of the instance meets the temporal constraints defined by the rule.
[0043] Furthermore, the implementation process of calculating the joint probability distribution P(F,U|ω) in the E-step of the variational inference computation includes:
[0044] 1) Initialize parameter settings;
[0045] The approximate posterior probability of the unknown facts calculated in step S2 is used as the initial input data;
[0046] 2) Construct sampling batches;
[0047] A batch of unrelated instantiated rules is randomly selected from the knowledge graph to form a training batch;
[0048] 3) Construct a probability distribution model;
[0049] In the model, the joint probability distribution of all unknown facts is calculated by combining the probability distribution of all basic facts in each instantiated rule;
[0050] 4) Optimize the objective function;
[0051] The objective function comprehensively considers the weight of the rules, the probability distribution of unknown facts, and the scores of positive samples; during the optimization process, the value of the objective function is improved by adjusting the probability parameters.
[0052] Furthermore, the process of constructing the probability distribution model includes:
[0053] a) For each batch of instantiated rules u g Define u g From basic unknown facts u k Composition; unknown facts u k The approximate posterior probability after scoring by the scoring function is p. k ;
[0054] b) Constructing a single unknown fact u k probability distribution f k (u k );
[0055] f k (u k ) = p k u k ·(1-p k (1-u) k );
[0056] c) Calculate the overall probability distribution Q(U) of the set of unknown facts U;
[0057]
[0058] Furthermore, the objective function of the variational inference calculation process is expressed as:
[0059]
[0060] Where, d fact Scores for positive samples;
[0061]
[0062] λ is a hyperparameter for the positive sample score.
[0063] The present invention can achieve at least one of the following beneficial effects:
[0064] The knowledge graph reasoning method disclosed in this invention, designed for information with temporal information, possesses superior temporal representation capabilities. It can simultaneously model the temporal relationships of events and specific time-value information, overcoming the limitations of traditional methods that rely solely on temporal order or simple temporal feature representations. The model reasoning process is highly interpretable, and the reasoning results are easy to understand.
[0065] This invention effectively combines Markov logic networks with embedded learning, successfully achieving stable prediction under sparse sample conditions and demonstrating stronger extrapolation capabilities, providing reliable technical support for the dynamic updating and future development of knowledge graphs. Attached Figure Description
[0066] The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Throughout the drawings, the same reference numerals denote the same parts.
[0067] Figure 1 This is a flowchart of a knowledge graph reasoning method for information with time information in an embodiment of the present invention. Detailed Implementation
[0068] Preferred embodiments of the present invention will now be described in detail with reference to the accompanying drawings, which form part of this application and are used together with the embodiments of the present invention to illustrate the principles of the present invention, but are not intended to limit the scope of the present invention.
[0069] A specific embodiment of the present invention discloses a knowledge graph reasoning method for knowledge graphs containing time-related information, such as... Figure 1 As shown, it includes:
[0070] Step S1: Initialize the intelligence with time information.
[0071] The intelligence is factual information with explicit timestamps appended to the knowledge graph; during initialization, embedding learning is used to vectorize the head and tail entities in the facts, and the time dependencies of the timestamp sequence are captured to generate high-dimensional time; the timestamps can also be time periods;
[0072] Step S2: Using the head and tail entities that evaluate the given relation constraints in high-dimensional time as a scoring function for the probability of fact validity, unknown facts in the knowledge graph are scored and then transformed into approximate posterior probabilities of unknown facts.
[0073] Step S3: Generate a Markov logic network using the temporal logic rules mined from the knowledge graph, and establish a joint probability distribution model of known and unknown facts to solve the probability of unknown facts;
[0074] Step S4: Use variational inference to iteratively solve the joint probability distribution model with the approximate posterior probability of the unknown facts as the initial input to predict the unknown facts.
[0075] In this embodiment, "intelligence with time information" refers to factual information with a clear timestamp attached to the knowledge graph; "knowledge reasoning" refers to making inferences based on existing knowledge facts and using temporal logic rules to predict possible future facts.
[0076] Specifically, in step S1, during initialization, the head entity and tail entity features in the facts are represented as vectors e respectively. s and e o ;
[0077] Specifically, the head entity set and tail entity set in the knowledge graph are vectorized using a One-Hot encoding method; then, the above representation is updated and optimized using an embedding network such as an MLP (Multilayer Perceptron) to obtain the optimized vector representation e. s and e o .
[0078] In step S1, the initialization process, which involves capturing the temporal dependencies of the timestamp sequence to generate a high-dimensional time sequence, includes:
[0079] 1) Convert the given timestamp into a numerical form, decompose the converted value into a sequence of individual numbers and input it into the time embedding matrix as the basic time feature matrix;
[0080] For a given timestamp (e.g., "2013-1-06"), it is first converted into a numerical form (e.g., "735,178"); then the numerical value is decomposed into a sequence of individual digits (i.e., [7,3,5,1,7,8]), and a corresponding embedding vector is assigned to each digit (from 0 to 9) using a predefined time embedding matrix, thereby obtaining the basic time features.
[0081] 2) For a series of timestamp sequences (time1, time2, ..., time...) N The corresponding basic time feature matrices are stacked to form a three-dimensional tensor;
[0082] 3) Input the three-dimensional tensor corresponding to the timestamp sequence into the Long Short-Term Memory (LSTM) network to capture the time dependency of the timestamp sequence and generate a high-dimensional time.
[0083] The LSTM processing flow is as follows:
[0084] f t =σ(W f ·[h t-1 ,x t ]+b f ),
[0085] i t =σ(W i ·[h t-1 ,x t ]+b i ),
[0086] o t =σ(W o ·[h t-1 ,x t ]+b o ),
[0087]
[0088] h t =o t ⊙tanh(c t ),
[0089] In the formula, x t W is the input embedding vector at time t. f W i W o W c Let b be the weight matrix. f b i ,b o ,b e σ represents the bias term; the symbol σ represents the Sigmoid activation function, and ⊙ represents element-wise multiplication.
[0090] By iterating through all time points and obtaining the final hidden state h t We can obtain a high-dimensional representation of each timestamp under the adaptive structure:
[0091]
[0092] Temporal information is preserved and transformed into numerical features suitable for deep learning optimization. LSTM networks further capture the complex dependencies between these temporal features.
[0093] In this embodiment, timestamps are transformed into learnable distributed representations to obtain more detailed temporal features and adaptive relationships, providing comprehensive and refined temporal support for sequential knowledge graph reasoning tasks and significantly enhancing the model's ability to handle temporal order relationships.
[0094] The scoring function in step S2 is used to evaluate the unknown facts by a score. The score not only serves as evidence for calculating the KL divergence between the approximate posterior distribution and the true posterior distribution, but also needs to satisfy model constraints to minimize the loss of the correct facts.
[0095] In the scoring function design of this embodiment, the feature vectors e of the head and tail entities under the given relation constraints are updated and optimized using an embedded network. s and e o And the high-dimensional time t obtained after processing time series information using an LSTM network. lstm Model the scoring function;
[0096] The scoring function obtained from the model is:
[0097]
[0098] in,
[0099] l represents a given relational constraint; e s eo These are the head entity embedding vector and the tail entity embedding vector obtained from embedding learning, respectively; t lstm Generate high-dimensional time for the Long Short-Term Memory (LSTM) network; g(l,e s ,e o ,t lstm () represents the evaluation score;
[0100] f(·) is a nonlinear activation function;
[0101] W R For a bilinear tensor of dimension d×d×k, the bilinear operation is performed... Generate a k-dimensional vector representing the strength of the relationship between entity pairs;
[0102] V R Given a linear tensor of dimension k×2d, V is obtained through linear operations. R [e s ;e o Capture combined information about the features of the head and tail entities;
[0103] b R This is a k-dimensional bias vector used to balance the model output;
[0104] U R It is a bilinear tensor with dimensions k×k×k, used to further integrate entity relationships and temporal information;
[0105] T R Let T be a linear tensor of dimension k×d, used for linear operations. R [t lstm Dimension mapping for high-dimensional time;
[0106] d is the number of entities in the head or tail entity embedding vector, and k is the embedding dimension of an entity.
[0107] Furthermore, the formula for converting the scoring of facts into approximate posterior probabilities is as follows:
[0108] p=σ(g(l,e s ,e o ,t lstm ))
[0109] in,
[0110]
[0111] x is the input to the function σ(·).
[0112] In the embodiments of this invention, the fact scoring model is improved to effectively combine entity structural features with time-series information. This design enhances the model's ability to reason about temporal relationships, thereby improving the accuracy and robustness of fact-based reasoning in the knowledge graph and thus strengthening overall performance.
[0113] Step S3, the process of generating a Markov logic network using the temporal logic rules mined from the knowledge graph, includes:
[0114] 1) Process and standardize the knowledge graph; extract the predicates, entities and their timestamp information from the graph, and represent the knowledge graph as a set of facts composed of quadruples (predicate, subject, object, timestamp);
[0115] 2) Preprocess the rules mined from the knowledge graph; after deduplication and confidence processing, obtain a set of temporal logic rules for reasoning;
[0116] In the process of establishing the set of time logic rules, the TLogic framework is used to generate multiple first candidate rules based on the knowledge graph;
[0117] Among them, using the TLogic framework to mine the logical rules for knowledge graph generation is the existing method for mining logical rules for knowledge graphs, which will not be elaborated here;
[0118] By eliminating reflexive logical rules and duplicates from the plurality of first candidate rules, a plurality of second candidate rules are obtained;
[0119] For the same target predicate, a confidence score threshold is preset, and the multiple preferred rules are determined based on the preset confidence score threshold and the multiple second candidate rules to form a time logic rule set.
[0120] The resulting set of time logic rules for reasoning is R = {r1, r2, ..., r...} n}, where each rule r∈R has the form:
[0121]
[0122] t1≤t2≤t head
[0123] In Pred1(C1,C2,t1), Pred1 represents the predicate of the event, C1 and C2 represent the subject and object respectively, and t1 represents the timestamp of the event; Pred2(C2,C3,t2) represents another event, with a similar structure to Pred1(C1,C2,t1); “∧” represents the logical AND operation; Pred3(C2,C3,t1) represents another event. headThe result event is derived from the preceding events Pred1(C1,C2,t1) and Pred2(C2,C3,t2).
[0124] 3) Generate a Markov logic network; for each rule in the set of temporal logic rules, extract all its corresponding instances to form a clique in the Markov logic network; in each clique, expand the instantiated triplet atoms into quadruple atoms with timestamp information to record the temporal characteristics of the event.
[0125] The time logic rules are defined as independent "cliques" in a Markov logic network. A weight ω is assigned to each rule r∈R. r This is used to control the degree of influence of the rule on the overall probability distribution. The specific construction process is as follows:
[0126] a. For each temporal logic rule r, extract all its possible instances (grounded rules), which constitute a clique in the Markov logic network;
[0127] b. In each group, the predicate atom is expanded into a timed atom containing timestamp information to record the temporal characteristics of the event.
[0128] Furthermore, in step S3, the joint probability distribution P(f,U|ω) of the joint probability distribution model of known and unknown facts is:
[0129]
[0130] Where r is a rule in the time logic rule set R, ω r The weights are assigned to rule r; F represents the set of known facts, U represents the set of unknown facts to be predicted, and ω is the weight of the network corresponding to the preferred rule; N(F,U) is the number of all instances that satisfy rule r, and Z(ω) is the partition function, which is the sum of instances corresponding to all rules, Z(ω) = ∑ F,U Π r∈ R exp(ω r N(F,U)); exp(ω r N(F,U)) is the potential function of the rule r, and each potential function represents the case of a clique.
[0131] Furthermore, the link prediction process, which obtains the probabilistic posterior distribution of the unknown fact to be predicted by maximizing the joint probability distribution P(F,U|v), includes:
[0132] a) Determine the time point t to be predicted;
[0133] b) Based on the known set of facts F and timestamp information, reasoning is performed using the defined set of time logic rules R to obtain the probability score that the target fact u belongs to the unknown set of facts U at a specific time point;
[0134] c) Sort all possible facts and output the K most likely results as prediction links;
[0135] In the calculation process, while considering the logical matching relationship between predicates, it also explicitly verifies whether the timestamp of the instance meets the temporal constraints defined by the rule.
[0136] This method can effectively improve the model's expressive power and reasoning accuracy in sequence knowledge graph scenarios.
[0137] Each state in a Markov logic network assigns different possibilities to all facts, representing a possible open world. Each set of possible worlds is a different combination of {F, U, R} relations, which together determine the truth value of each basic atom. After establishing the joint probability distribution, inferring the missing set of facts {U} from the known set of facts {F} requires solving the posterior distribution F(f, U|ω). Obviously, this can be regarded as an approximate inference problem, and therefore can be solved using variational inference methods.
[0138] In the iterative process of variational inference, during step E of the variational inference calculation in the t-th iteration, the value of ω is fixed, and the probability set of each factor in all ground rules is updated to obtain the true posterior probability distribution P(U|F,ω) for this iteration. t );
[0139] In the variational inference computation process of the t-th iteration, step M is fixed, Q(U) (i.e., p is fixed). k Then, the weights ω of the preferred rule set R are... r The update is performed, and the partition function obtained in step E is treated as a constant. In step M, the weights in the partition function Z(w) are optimized by maximizing it.
[0140] More specifically, the posterior distribution P(F,U|ω) is calculated in the E-step of the variational inference computation process; the implementation process includes:
[0141] 1) Initialize parameter settings;
[0142] Initialize all probability parameters p using preset or empirical values. k ∈[0,1], where p k Indicates unknown facts u k The probability of occurrence;
[0143] Preferably, the approximate posterior probability of the unknown fact calculated in step S2 is used as the initial input data; that is, p k Using unknown facts u k The approximate posterior probability converted from the initial rating in the rating function;
[0144] 2) Construct sampling batches;
[0145] A batch of unrelated instantiated rules is randomly selected from the knowledge graph to form a training batch;
[0146] 3) Construct a probability distribution model;
[0147] In the model, the joint probability distribution of all unknown facts is calculated by combining the probability distribution of all basic facts in each instantiated rule;
[0148] 4) Optimize the objective function;
[0149] The objective function comprehensively considers the weight of the rules, the probability distribution of unknown facts, and the scores of positive samples; during the optimization process, the value of the objective function is improved by adjusting the probability parameters.
[0150] Specifically, the process of constructing a probability distribution model includes:
[0151] a) For each batch of instantiated rules u g Define u g From basic unknown facts u k Composition; unknown facts u k The approximate posterior probability after scoring by the scoring function is p. k ;
[0152] b) Constructing a single unknown fact u k probability distribution f k (u k );
[0153] f k (u k ) = p k u k ·(1-p k (1-u) k );
[0154] c) Calculate the overall probability distribution Q(U) of the set of unknown facts U;
[0155]
[0156] Specifically, the objective function of the variational inference calculation process is expressed as:
[0157]
[0158] Where, d fact Scores for positive samples;
[0159]
[0160] λ is a hyperparameter for the positive sample score.
[0161] Specifically, in the variational inference calculation process M steps, after fixing the overall probability distribution Q(U), the weights in the partition function Z(w) are optimized and updated using pseudo-log-likelihood as the alternative optimization objective.
[0162] The number of terms in the partition function Z(w) is exponential, making direct optimization of the ELBO algorithm extremely difficult. This problem can be solved by using pseudo-log-likelihood as an alternative optimization objective, defined as:
[0163]
[0164] Among them, MB u It is a Markov blanket of the basic predicate u. For each formula k connecting the basic predicate and the Markov blanket, the weights are optimized by gradient descent formula in this embodiment of the invention:
[0165]
[0166] The final vector for each entity and relation is generated through variational reasoning. Finally, the predicted unknown facts can be obtained by calculating the probability of events occurring in the unknown facts.
[0167] The above steps realize the variational reasoning calculation process for unknown facts. By applying random sampling and the mean-field theorem, the complexity of solving traditional Markov logic networks (MLNs) is reduced, improving computational efficiency while ensuring reasoning accuracy.
[0168] Specifically, a stepwise approximation method can also be used, repeating steps S1-S4 to filter and update rules. During the filtering and updating process, the number of approximations is selected based on the number of optimal rules in the knowledge graph, and evaluation metrics such as Hit@1, Hit@3, and Hit@10 are chosen. The best optimal rule, missing intelligence, and a trained intelligence knowledge graph inference model are obtained through iterative analysis based on the numerical values of these inference evaluation metrics.
[0169] In summary, in this embodiment,
[0170] To address the problems of existing time-based knowledge graph reasoning methods based on data embedding being unable to effectively utilize prior logic rules and lacking the ability to model complex time sequences and specific time values, as well as the shortcomings of symbolic logic-based methods in large-scale reasoning with low computational efficiency and difficulty in fully utilizing time information, a knowledge graph reasoning framework with time information is proposed.
[0171] Furthermore, it innovatively combines Markov Logic Networks (MLNs) and entity-relation embedding representation methods, achieving comprehensive modeling of temporal sequence information and specific temporal features by establishing a joint probabilistic model among entities, relations, and events. This framework simultaneously leverages the temporal ordering constraints of prior logical rules and the semantic representation capabilities based on deep learning.
[0172] Furthermore, the novel scoring function employed in this embodiment effectively combines the learning ability of embedded networks with the logical reasoning ability of Markov logic networks, maintaining the interpretability of the model while enhancing its temporal representation capability. This scoring function considers both the temporal order of events and the influence of specific time values.
[0173] Therefore, the knowledge graph reasoning method for information with time information in this invention has better temporal representation capabilities, and can simultaneously model the temporal relationships of events and specific time value information, overcoming the limitations of traditional methods that only rely on time sequence or simple time feature representation. The model reasoning process is highly interpretable, and the reasoning results are easy to understand.
[0174] Furthermore, by effectively combining Markov logic networks with embedded learning, this invention successfully achieves stable prediction under sparse sample conditions, demonstrating stronger extrapolation capabilities and providing reliable technical support for the dynamic updating and future development of knowledge graphs.
[0175] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention.
Claims
1. A knowledge graph reasoning method for information with time information, characterized in that, include: Step S1: Initialize the acquisition of intelligence with time information; the intelligence is factual information with a specific timestamp attached to the knowledge graph; During initialization, embedding learning is used to vectorize the head and tail entities in the facts, and to capture the time dependencies of the timestamp sequence to generate high-dimensional time. Step S2: Using the head and tail entities that evaluate the given relation constraints in high-dimensional time as a scoring function for the probability of fact validity, unknown facts in the knowledge graph are scored and then transformed into approximate posterior probabilities of unknown facts. Step S3: Generate a Markov logic network using the temporal logic rules mined from the knowledge graph, and establish a joint probability distribution model of known and unknown facts to solve the probability of unknown facts; Step S4: Use variational inference to iteratively solve the joint probability distribution model with the approximate posterior probability of the unknown facts as the initial input to predict the unknown facts.
2. The knowledge graph reasoning method for information with time information as described in claim 1, characterized in that, The process of capturing the time dependencies of timestamp sequences to generate high-dimensional time includes: 1) Convert the given timestamp into a numerical form, decompose the converted value into a sequence of individual numbers and input it into the time embedding matrix as the basic time feature matrix; 2) For a series of timestamp sequences, stack their corresponding basic time feature matrices to form a three-dimensional tensor; 3) Input the three-dimensional tensor corresponding to the timestamp sequence into the Long Short-Term Memory (LSTM) network to capture the time dependency of the timestamp sequence and generate a high-dimensional time.
3. The knowledge graph reasoning method for information with time information as described in claim 2, characterized in that, The scoring function is: in, l represents a given relational constraint; e s e o These are the head entity embedding vector and the tail entity embedding vector obtained from embedding learning, respectively; t lstm Generate high-dimensional time for the Long Short-Term Memory (LSTM) network; f(·) is a nonlinear activation function; W R For a bilinear tensor of dimension d×d×k, the bilinear operation is performed... Generate a k-dimensional vector representing the strength of the relationship between entity pairs; V R Given a linear tensor of dimension k×2d, V is obtained through linear operations. R [e s ;e o Capture combined information about the features of the head and tail entities; b R This is a k-dimensional bias vector used to balance the model output; U R It is a bilinear tensor with dimensions k×k×k, used to further integrate entity relationships and temporal information; T R Let T be a linear tensor of dimension k×d, used for linear operations. R [t lstm Dimension mapping for high-dimensional time; d is the number of entities in the head or tail entity embedding vector, and k is the embedding dimension of an entity.
4. The knowledge graph reasoning method for information with time information as described in claim 3, characterized in that, The formula for the approximate posterior probability is: p=σ(g(l,e s ,and o ,t lstm )) in, x is the input to the function σ(·).
5. The knowledge graph reasoning method for information with time information according to any one of claims 1-4, characterized in that, The process of generating Markov logic networks using temporal logic rules mined from knowledge graphs includes: 1) Process and standardize the knowledge graph; extract the predicates, entities and their timestamp information from the graph, and represent the knowledge graph as a set of facts composed of quadruples (predicate, subject, object, timestamp); 2) Preprocess the rules mined from the knowledge graph; after deduplication and confidence processing, obtain a set of temporal logic rules for reasoning; 3) Generate a Markov logic network; for each rule in the set of temporal logic rules, extract all its corresponding instances to form a clique in the Markov logic network; in each clique, expand the instantiated triplet atoms into quadruple atoms with timestamp information to record the temporal characteristics of the event.
6. The knowledge graph reasoning method for information with time information as described in claim 5, characterized in that, The joint probability distribution P(F,U|ω) of the model for the joint probability distribution of known and unknown facts is: Where r is a rule in the time logic rule set R, ω r ω represents the weights assigned to rule r; F represents the set of known facts; U represents the set of unknown facts to be predicted; ω is the weight of the network corresponding to the preferred rule; N(F,U) is the number of all instances that satisfy rule r; Z(ω) is the partition function, which is the sum of instances corresponding to all rules.
7. The knowledge graph reasoning method for knowledge graphs with time-based information as described in claim 6, characterized in that, The link prediction process, which obtains the probabilistic posterior distribution of the unknown fact to be predicted by maximizing the joint probability distribution P(F,U|ω), includes: a) Determine the time point t to be predicted; b) Based on the known set of facts F and timestamp information, reasoning is performed using the defined set of time logic rules R to obtain the probability score that the target fact u belongs to the unknown set of facts U at a specific time point; c) Sort all possible facts and output the K most likely results as prediction links; In the calculation process, while considering the logical matching relationship between predicates, it also explicitly verifies whether the timestamp of the instance meets the temporal constraints defined by the rule.
8. The knowledge graph reasoning method for information with time information as described in claim 7, characterized in that, The implementation process of calculating the joint probability distribution P(F,U|ω) in the E-step of the variational inference computation includes: 1) Initialize parameter settings; The approximate posterior probability of the unknown facts calculated in step S2 is used as the initial input data; 2) Construct sampling batches; A batch of unrelated instantiated rules is randomly selected from the knowledge graph to form a training batch; 3) Construct a probability distribution model; In the model, the joint probability distribution of all unknown facts is calculated by combining the probability distribution of all basic facts in each instantiated rule; 4) Optimize the objective function; The objective function comprehensively considers the weight of the rules, the probability distribution of unknown facts, and the scores of positive samples; during the optimization process, the value of the objective function is improved by adjusting the probability parameters.
9. The knowledge graph reasoning method for information with time information as described in claim 8, characterized in that, The process of constructing the probability distribution model includes: a) For each batch of instantiated rules u g Define u g From basic unknown facts u k Composition; unknown facts u k The approximate posterior probability after scoring by the scoring function is p. k ; b) Constructing a single unknown fact u k probability distribution f k (u k ); f k (in k )=p k in k ·(1-p k )(1-in k ); c) Calculate the overall probability distribution Q(U) of the set of unknown facts U; 10. The knowledge graph reasoning method for knowledge graphs with time-based information as described in claim 9, characterized in that, The objective function of the variational inference calculation process is expressed as: Where, d fact Scores for positive samples; λ is a hyperparameter for the positive sample score.