Temporal knowledge graph reasoning method and system based on Markov logic network

Through the time series knowledge graph inference method based on Markov logical network, the timing knowledge graph is processed using LSTM and variable expectation maximization algorithm, the problem of inefficient timing knowledge graph inference is solved, and efficient and interpretable knowledge inference is achieved. Suitable for static knowledge graphs.

CN117273143BActive Publication Date: 2024-12-27NANJING UNIV OF POSTS & TELECOMM
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310992329.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-08-08
Publication Date
2024-12-27
Estimated Expiration
2043-08-08

AI Technical Summary

Technical Problem

Existing knowledge graph inference methods are difficult to effectively process timing knowledge graphs, especially because traditional methods are no longer applicable due to the timing characteristics of data, and Markov logical networks are inefficient in reasoning in large knowledge graphs.

Method used

Using the time series knowledge graph inference method based on Markov logical network, the timing predicate sequence is generated by reading the timing knowledge graph, the embedding representation is obtained using LSTM, and a known triplet is established in combination with the variable expectation maximization algorithm and knowledge graph embedding technology. and the joint distribution of hidden triples for reasoning and learning.

Benefits of technology

Effective reasoning of timing knowledge graphs is realized, the accuracy and interpretability of reasoning are improved, and data-driven methods are combined to improve efficiency, simulate human cognitive processes, and are suitable for traditional static knowledge graph inference tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117273143B_ABST
    Figure CN117273143B_ABST
Patent Text Reader

Abstract

The present invention discloses a temporal knowledge graph reasoning method and system based on a Markov logic network, including: reading a temporal knowledge graph and processing it to generate a temporal predicate sequence; using LSTM to obtain an embedded representation of the temporal predicate sequence, and establishing a joint distribution of known triples and hidden triples through a Markov logic network; reasoning and learning the joint distribution based on a variational expectation maximization algorithm combined with knowledge graph embedding technology to complete the temporal knowledge graph reasoning task; the method proposed by the present invention is a temporal knowledge graph reasoning method driven by the collaboration of knowledge and data, which improves the reasoning accuracy while also making the reasoning explainable, and the present invention can also be used for static knowledge graph reasoning.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and specifically to a temporal knowledge graph reasoning method and system based on a Markov logic network. Background Art

[0002] Knowledge graph is an important technology in the field of artificial intelligence. It uses triple structures to store the knowledge contained in entities in reality. A triple is generally composed of (head entity h, relationship r, tail entity t), where relationship r is a predicate. The entities of each triple are connected through different relationships to form the entire knowledge graph. Although there are currently a large number of knowledge graphs covering a wide range of fields, the knowledge structure of existing knowledge graphs is not yet complete in terms of relationships (edges). Therefore, it is necessary to use knowledge reasoning to perform knowledge graph reasoning. The goal of knowledge reasoning is to infer unknown knowledge through existing knowledge based on predefined rules or automatically learned rules.

[0003] Traditional knowledge graph reasoning methods are knowledge-driven symbolic logic and rule-based methods. These rules can be manually created by domain experts or mined from knowledge graphs. Traditional methods such as expert systems use hard logic rules for prediction. For example, given a logic rule: And a fact: A is B's husband, then it can be inferred that B is A's wife. But in many cases, the rules of logic may be imperfect or even contradictory.

[0004] Another approach to knowledge graph reasoning is data-driven methods such as TransE, DistMult, and ComplEx, which learn useful embedding representations of entities and relations by projecting existing triples into a low-dimensional space. These embedding representations retain the semantic meaning of entities and relations and can effectively predict missing triples. In addition, they can be efficiently trained via stochastic gradient descent. However, they do not exploit logical rules, which can compactly encode domain knowledge, which is useful in many applications.

[0005] With the rapid development of technologies such as social networks and IoT perception, time-series knowledge graphs have emerged. Time-series knowledge graphs are based on static knowledge graphs and add elements that express timeliness, that is, timestamps are added to triples, and their structure evolves into a quadruple of (head entity h, relation r, tail entity t, timestamp time). The temporal characteristics of data make the method for static knowledge graph reasoning no longer applicable to time-series knowledge graph reasoning tasks. Summary of the invention

[0006] The purpose of this section is to summarize some aspects of embodiments of the present invention and briefly introduce some preferred embodiments. Some simplifications or omissions may be made in this section and the specification abstract and the invention title of this application to avoid blurring the purpose of this section, the specification abstract and the invention title, and such simplifications or omissions cannot be used to limit the scope of the present invention.

[0007] In view of the above-mentioned problems, the present invention is proposed.

[0008] According to a first aspect of an embodiment of the present invention, a temporal knowledge graph reasoning method based on a Markov logic network is provided, comprising: reading a temporal knowledge graph and processing it to generate a temporal predicate sequence; obtaining an embedded representation of the temporal predicate sequence using an LSTM, and establishing a joint distribution of known triples and hidden triples through a Markov logic network; and reasoning and learning the joint distribution based on a variational expectation maximization algorithm combined with knowledge graph embedding technology to complete the temporal knowledge graph reasoning task.

[0009] As a preferred solution of the temporal knowledge graph reasoning method based on Markov logic network described in the present invention, the generation of the temporal predicate sequence includes:

[0010] Read the time series knowledge graph to be processed;

[0011] If the triple of the temporal knowledge graph contains a timestamp element, the predicate of the triple is connected with the timestamp element to generate a temporal predicate sequence p of length N. seq , and then convert the triple (h, p, t, time) of the temporal knowledge graph into (h, p seq ,time) form;

[0012] If the triple of the temporal knowledge graph does not contain a timestamp element, the original predicate is directly regarded as a temporal predicate sequence p seq .

[0013] As a preferred solution of the temporal knowledge graph reasoning method based on Markov logic network described in the present invention, wherein: the acquisition of the embedded representation of the temporal predicate sequence includes:

[0014] The temporal predicate sequence p seq Input to the linear layer of LSTM to obtain the temporal predicate sequence p seq The corresponding embedding vector is used as the input of LSTM.

[0015] The last hidden state of LSTM is represented by h N As the temporal predicate sequence p seq The final embedding of The head entity and the tail entity of the temporal knowledge graph are embedded respectively to obtain the corresponding embedding representation e h and e t .

[0016] As a preferred solution of the temporal knowledge graph reasoning method based on Markov logic network described in the present invention, wherein: the establishment of the joint distribution includes:

[0017] The Markov logic network is used to establish the joint distribution of known triplets and hidden triplets, and the formula is expressed as:

[0018]

[0019] Among them, V O Represents a known triple, V H represents the hidden triplet, Z represents the normalization factor of the entire joint space, and w l represents the weight of the logical rule l, n l Indicates based on V O and V H Logical rules that conform to actual conditions.

[0020] As a preferred solution of the temporal knowledge graph reasoning method based on Markov logic network described in the present invention, it includes:

[0021] The joint distribution is optimized based on the variational expectation maximization algorithm combined with the knowledge graph embedding technology, that is, the joint distribution is learned by maximizing the variational lower bound of the log-likelihood of the observed facts. The formula is expressed as:

[0022]

[0023] Among them, logp w (V O ) represents the maximum log-likelihood of the observed facts for the known triples, L(q θ ,p w ) represents the variational lower bound, q θ (V H |V o ) represents a variational distribution for the posterior distribution of hidden triplets.

[0024] As a preferred solution of the temporal knowledge graph reasoning method based on Markov logic network described in the present invention, the reasoning steps include:

[0025] Fix the model parameters to be learned and update the variational distribution q θ (V H |V o ), and then approximate the posterior distribution p of the hidden triplesw (V H |V O ), and parameterizing the variational distribution using the obtained embedding representation of the temporal predicate sequence;

[0026] The vector representation of entities and relations is learned by minimizing the loss function of the triples of the training time series knowledge graph, and the knowledge graph reasoning is performed. The scoring function of each triple is used as the criterion to parameterize the q θ (V H |V o ) to update.

[0027] As a preferred solution of the temporal knowledge graph reasoning method based on Markov logic network described in the present invention, wherein: the learning step includes:

[0028] Fixing the updated variational distribution, updating the model parameters to be learned, and then learning the weight of the logic formula by maximizing the log-likelihood function;

[0029] In order to improve the optimization efficiency, a pseudo log-likelihood function is used instead of the optimization of the maximum log-likelihood function, that is, Among them, V (h,r,t) represents a triple, and MB(h,r,t) represents a triple V (h,r,t) The Markov blanket.

[0030] A second aspect of an embodiment of the present invention provides a temporal knowledge graph reasoning system based on a Markov logic network, comprising:

[0031] A data processing unit, used to read the time series knowledge graph and process it to generate a time series predicate sequence;

[0032] A joint distribution establishment unit, used for obtaining an embedded representation of the temporal predicate sequence by using LSTM, and establishing a joint distribution of known triples and hidden triples by using a Markov logic network;

[0033] The reasoning learning unit is used to reason and learn the joint distribution based on the variational expectation maximization algorithm combined with the knowledge graph embedding technology to complete the time series knowledge graph reasoning task.

[0034] According to a third aspect of an embodiment of the present invention, a device is provided, the device comprising:

[0035] processor;

[0036] a memory for storing processor-executable instructions;

[0037] The processor is configured to call the instructions stored in the memory to execute the method described in any embodiment of the present invention.

[0038] According to a fourth aspect of an embodiment of the present invention, a computer-readable storage medium is provided, on which computer program instructions are stored, including:

[0039] When the computer program instructions are executed by a processor, a method according to any embodiment of the present invention is implemented.

[0040] Beneficial effects of the present invention:

[0041] ① The present invention can realize the reasoning function of temporal knowledge graphs, and can also be applied to traditional static knowledge graph reasoning tasks;

[0042] ② The present invention fuses the timestamp and predicate of the temporal knowledge graph to generate a temporal predicate sequence, which can combine the traditional static knowledge graph reasoning method with the idea of ​​the present invention, broadening the idea of ​​solving the temporal knowledge graph reasoning task;

[0043] ③ The overall framework uses Markov logic network MLN for knowledge reasoning and variational EM method for optimization, which can effectively utilize first-order logic and domain knowledge to achieve knowledge-driven reasoning tasks and improve the interpretability of reasoning. At the same time, the probability graph model is used to solve the uncertainty of logical rules;

[0044] ④ Use the data-driven knowledge graph reasoning method TransE to perform knowledge reasoning and update reasoning parameters, thereby avoiding the problem of low efficiency of Markov logic network using first-order logic for knowledge reasoning when facing large and complex knowledge graphs, improving learning efficiency, improving the accuracy and explainability of reasoning, and simulating the human cognitive process. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative labor. Among them:

[0046] Figure 1 The overall flow chart of the temporal knowledge graph reasoning method and system based on Markov logic network provided by the present invention;

[0047] Figure 2 A variational EM method flow chart of the temporal knowledge graph reasoning method and system based on Markov logic network provided by the present invention;

[0048] Figure 3 The Markov logic network-based temporal knowledge graph reasoning method and system provided by the present invention use LSTM to obtain temporal predicate embedding representation Schematic diagram of

[0049] Figure 4 A schematic diagram of the Markov logic network-based temporal knowledge graph reasoning method and system provided by the present invention for performing temporal knowledge reasoning based on the ICEWS14 dataset. DETAILED DESCRIPTION

[0050] In order to make the above-mentioned purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the drawings of the specification. Obviously, the described embodiments are part of the embodiments of the present invention, but not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary persons in the art without creative work should fall within the scope of protection of the present invention.

[0051] In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention may also be implemented in other ways different from those described herein, and those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.

[0052] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The term "in one embodiment" that appears in different places in this specification does not necessarily refer to the same embodiment, nor does it refer to a separate or selective embodiment that is mutually exclusive with other embodiments.

[0053] The present invention is described in detail with reference to schematic diagrams. When describing the embodiments of the present invention, for the sake of convenience, the cross-sectional diagrams showing the device structure will not be partially enlarged according to the general scale, and the schematic diagrams are only examples, which should not limit the scope of protection of the present invention. In addition, in actual production, the three-dimensional dimensions of length, width and depth should be included.

[0054] At the same time, in the description of the present invention, it should be noted that the directions or positional relationships indicated by the terms "upper, lower, inner and outer" are based on the directions or positional relationships shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific direction, be constructed and operated in a specific direction, and therefore cannot be understood as limiting the present invention. In addition, the terms "first, second or third" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance.

[0055] In the present invention, unless otherwise clearly specified and limited, the terms "install, connect, connect" should be understood in a broad sense, for example: it can be a fixed connection, a detachable connection or an integral connection; it can also be a mechanical connection, an electrical connection or a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0056] Example 1

[0057] Reference Figures 1 to 3 As an embodiment of the present invention, a temporal knowledge graph reasoning method based on a Markov logic network is provided, comprising:

[0058] S1: Read the time series knowledge graph and process it to generate a time series predicate sequence. It should be noted that:

[0059] Read the time series knowledge graph to be processed;

[0060] If the triple of the time series knowledge graph contains a timestamp element, the predicate of the triple is connected with the timestamp element to generate a time series predicate sequence p of length N seq , and then transform the triple (h,p,t,time) of the temporal knowledge graph into (h,p seq ,time) form;

[0061] If the triple of the temporal knowledge graph does not contain a timestamp element, the original predicate is directly regarded as the temporal predicate sequence p seq .

[0062] S2: Establish the joint distribution of known triplets and hidden triplets through the Markov logic network, and reason and learn the joint distribution based on the variational expectation maximization algorithm combined with the knowledge graph embedding technology. It should be noted that:

[0063] The Markov logic network is used to establish the joint distribution of known triplets and hidden triplets, and the formula is expressed as:

[0064]

[0065] Among them, V O Represents a known triple, V H represents the hidden triplet, Z represents the normalization factor of the entire joint space, ensuring that the joint probability distribution satisfies the basic properties of probability, and w l represents the weight of the logical rule l, n l Indicates based on V O and V H Logical rules that conform to actual conditions;

[0066] It should be noted that Markov logic network (MLN) is used for reasoning and inference. It combines the characteristics of first-order logic and Markov random fields, and can handle the problems of uncertainty and incomplete information through probabilistic reasoning. In temporal knowledge graph reasoning, MLN can be used to reason about the relationship between entities, the inference of entity attributes, and the answering of questions in the knowledge graph. MLN effectively solves the uncertainty of logical rules, uses probabilistic reasoning technology to infer the relationship between unknown entities, fills in the missing information in the temporal knowledge graph, and generates new knowledge; at the same time, the reasoning process of MLN is based on logical rules, which makes the reasoning results easier to explain and understand, and it can generate interpretable results about entity relationships and reasoning processes. However, MLN is inefficient when facing large-scale temporal knowledge graph reasoning, and the data-driven knowledge graph embedding method can just use a large amount of data to improve its reasoning accuracy. Therefore, the present invention combines MLN with knowledge graph embedding technology to effectively improve the accuracy and efficiency of MLN reasoning on large-scale temporal knowledge graphs, and solves the problem of lack of interpretability of knowledge graph embedding technology in knowledge reasoning.

[0067] Further, such as Figure 2 As shown in the figure, the joint distribution is optimized based on the variational expectation maximization algorithm combined with the knowledge graph embedding technology, that is, the joint distribution is learned by maximizing the variational lower bound of the log-likelihood of the observed facts. The formula is expressed as:

[0068]

[0069] Among them, logp w (V O ) represents the maximum log-likelihood of the observed facts for the known triples, L(q θ ,p w ) represents the variational lower bound, q θ (V H |V o ) represents a variational distribution for the posterior distribution of hidden triplets.

[0070] S3: Use LSTM to obtain the embedded representation of the temporal predicate sequence. It should be noted that:

[0071] like Figure 3 As shown, the temporal predicate sequence p seq Input to the linear layer of LSTM to obtain the time series predicate sequence p seq The corresponding embedding vector is used as the input of LSTM.

[0072] The last hidden state of LSTM is represented by h N As a temporal predicate sequence p seq The final embedding of The head entity and tail entity of the temporal knowledge graph are embedded respectively to obtain the corresponding embedding representation e h and e t ;

[0073] It should be noted that LSTM is a neural network structure that is particularly suitable for modeling sequence data. Its structure can be defined using the following equation:

[0074] i=σ g (h n-1 U i +x n W i )

[0075] f=σ g (h n-1 U f +x n W f )

[0076] o=σ g (h n-1 U o +x n W o )

[0077] g=σ c (h n-1 U g +x n W g )

[0078]

[0079]

[0080] Among them, i is the input gate, f is the forget gate, o is the output gate, c is the cell state, h is the hidden state, and U is the hidden state h at the previous moment. n-1 and input x n The weight matrix W is the connection between the current input x n and the weight matrix of each gate and cell of LSTM, σ is the activation function.

[0081] S4: Inference step: fix the model parameters to be learned and update the variational distribution q θ (V H |V o ), and then approximate the posterior distribution p of the hidden triples w (V H |V O), and use the embedded representation of the acquired temporal predicate sequence to parameterize the variational distribution, learn the vector representation of entities and relations by minimizing the loss function of the triples of the training temporal knowledge graph, and perform knowledge graph reasoning, taking the scoring function of each triple as the standard, and parameterizing the q θ (V H |V o ) to update;

[0082] Optionally, TransE learns vector representations of entities and relations by minimizing a loss function over triplets (head entity, relation, tail entity) in the training data. The goal of this loss function is to make correct triplets as close as possible in the vector space, while incorrect triplets are far away. TransE's loss function defines a constraint: for a given triple (head entity, relation, tail entity), add the head entity vector representation to the relation vector representation to obtain a vector that is as close as possible to the tail entity vector representation. This constraint can be measured by a cosine distance or Euclidean distance.

[0083] The score function of TransE is as follows:

[0084] f(s,p,o)=‖e s +e pseq -e o ‖2

[0085] During the training process, the vector representation of entities and temporal predicates is continuously adjusted through the gradient descent optimization algorithm to minimize the loss function, so that the learned vector representation can perform knowledge reasoning tasks. The scoring function of each triple is used as the standard to parameterize the q θ (V H |V o ) is updated, thus completing the reasoning step (E-step) of the variational EM method;

[0086] It should be noted that the inference step first calculates the posterior distribution of the hidden triples under the known triples and the current parameters. This posterior distribution represents the uncertainty of the hidden triples and the distribution of possible values. Variational inference is usually used to approximate this posterior distribution; this involves calculating the expectation of the latent variable, that is, calculating the mean value of the latent variable according to the posterior distribution.

[0087] S5: Learning step: fix the updated variational distribution, update the model parameters to be learned, and then learn the weight of the logical formula by maximizing the log-likelihood function. To improve the optimization efficiency, the pseudo-log-likelihood function is used instead of the optimization of maximizing the log-likelihood function, that is, Among them, V (h,r,t) represents a triple, and MB(h,r,t) represents a triple V (h,r,t)The Markov blanket consists of the triples that appear with (h, r, t) in any instantiation of the logic rule;

[0088] It should be noted that the learning step uses the hidden triple expectation calculated by the E-step to update the model parameters. The model parameters can be updated by maximizing the expectation of the log-likelihood function of the complete data.

[0089] S6: Iterate S4 and S5 until convergence.

[0090] In summary, the beneficial effects of the present invention are:

[0091] ① The present invention can realize the reasoning function of temporal knowledge graphs, and can also be applied to traditional static knowledge graph reasoning tasks;

[0092] ② The present invention fuses the timestamp and predicate of the temporal knowledge graph to generate a temporal predicate sequence, which can combine the traditional static knowledge graph reasoning method with the idea of ​​the present invention, broadening the idea of ​​solving the temporal knowledge graph reasoning task;

[0093] ③ The overall framework uses Markov logic network MLN for knowledge reasoning and variational EM method for optimization, which can effectively utilize first-order logic and domain knowledge to achieve knowledge-driven reasoning tasks and improve the interpretability of reasoning. At the same time, the probability graph model is used to solve the uncertainty of logical rules;

[0094] ④ Use the data-driven knowledge graph reasoning method TransE to perform knowledge reasoning and update reasoning parameters, thereby avoiding the problem of low efficiency of Markov logic network using first-order logic for knowledge reasoning when facing large and complex knowledge graphs, improving learning efficiency, improving the accuracy and explainability of reasoning, and simulating the human cognitive process.

[0095] The second aspect of the present invention is disclosed,

[0096] Provides a time-series knowledge graph reasoning system based on Markov logic networks, including:

[0097] A data processing unit, used to read the time series knowledge graph and process it to generate a time series predicate sequence;

[0098] A joint distribution establishment unit is used to obtain the embedded representation of the temporal predicate sequence using LSTM, and to establish the joint distribution of known triples and hidden triples through a Markov logic network;

[0099] The reasoning learning unit is used to reason and learn the joint distribution based on the variational expectation maximization algorithm combined with the knowledge graph embedding technology to complete the time series knowledge graph reasoning task.

[0100] The third aspect of the present invention is disclosed,

[0101] Provided is a device comprising:

[0102] processor;

[0103] a memory for storing processor-executable instructions;

[0104] The processor is configured to call instructions stored in the memory to execute any one of the aforementioned methods.

[0105] The fourth aspect of the present invention is disclosed,

[0106] A computer-readable storage medium is provided, on which computer program instructions are stored, including:

[0107] When the computer program instructions are executed by a processor, any of the above methods is implemented.

[0108] The present invention may be a method, an apparatus, a system and / or a computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for executing various aspects of the present invention.

[0109] A computer-readable storage medium may be a tangible device that can hold and store instructions used by an instruction execution device. A computer-readable storage medium may be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. More specific examples of computer-readable storage media (a non-exhaustive list) include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disk read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, such as a punch card or a raised structure in a groove on which instructions are stored, and any suitable combination of the foregoing. As used herein, a computer-readable storage medium is not to be interpreted as a transient signal per se, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagating through a waveguide or other transmission medium (e.g., a light pulse through a fiber optic cable), or an electrical signal transmitted through a wire.

[0110] Example 2

[0111] Reference Figure 4 This is the second embodiment of the present invention. Different from the first embodiment, this embodiment provides a verification test of a temporal knowledge graph reasoning method and system based on a Markov logic network, in order to verify and illustrate the technical effects adopted in this method.

[0112] This embodiment uses the time series knowledge graph dataset ICEWS14, which is widely used in the field of time series knowledge reasoning, and divides the dataset into a training set, a validation set, and a test set according to the ratio of 80% / 10% / 10%. The elements in the dataset are four-tuples in the format of (head entity h, relationship predicate p, tail entity t, timestamp time). The problem solved by the present invention is to infer the tail entity t when the head entity h, relationship predicate p, and timestamp time are given, or to infer the head entity h when the relationship predicate p, tail entity t, and timestamp time are given.

[0113] like Figure 4 As shown, in a subgraph of the dataset ICEWS14, the entities are A, B, C and D (considering the sensitivity of the entity data of the dataset ICEWS14, this embodiment displays the selected four example entities as A, B, C, and D), and the timestamp is expressed in the format of yyyy / mm / dd. The dotted line represents the result of inference (A, consult,?, 2014 / 08 / 09). The multiple relationships between A and B can be used as an explanation for this inference. First, the relationship predicates and timestamp elements are extracted respectively, and relation.txt and time.txt files are generated respectively. Each element in these two .txt files occupies a line alone, so the relationship predicates and timestamps that are located in a quadruple in the original data have the same line number in the two newly generated .txt files. The time information of the time.txt file is decomposed into time series, and y, m, and d are used to represent the year, month, and day information corresponding to the numbers, specifically:

[0114] The time series corresponding to year is: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9;

[0115] The time series corresponding to month is: 01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11, 12;

[0116] The time series corresponding to day is: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9;

[0117] For example, in this example, (A, visit, D, 2014 / 07 / 04), the timestamp is decomposed into [2y, 0y, 1y, 4y, 07m, 0d, 4d];

[0118] Furthermore, the predicates in relation.txt are connected with the corresponding time series in the time.txt file processed in the previous step to generate a pseq.txt file. Each element in this file occupies a line. Therefore, for (A, visit, D, 2014 / 07 / 04), after processing, the generated pseq.txt file isseq is [visit,2y,0y,1y,4y,07m,0d,4d].

[0119] For a logic rule, instantiate it to get its groundings. For example, for a rule: One of his instantiations: is a grounding of this logic rule. In the above formula, The left side represents "premise" and the right side represents "conclusion". The grounding is valid only when the premise of a logic rule belongs to a known triple and the conclusion does not belong to a known triple. The hidden (to be predicted) triple is extracted from the conclusion of the valid grounding.

[0120] Then, LSTM is used to obtain the embedded representation of the temporal predicate sequence, and the joint distribution of known triples and hidden triples is established through the Markov logic network. The joint distribution is inferred and learned based on the variational expectation maximization algorithm combined with the knowledge graph embedding technology to complete the temporal knowledge graph reasoning task.

[0121] Therefore, from the above, it can be seen that the method proposed by the present invention is a temporal knowledge graph reasoning method driven by the collaboration of knowledge and data. While improving the accuracy of reasoning, it also makes the reasoning explainable, and the present invention can also be used for static knowledge graph reasoning.

[0122] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention can be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should be included in the scope of the claims of the present invention.

Claims

1. A temporal knowledge graph reasoning method based on Markov logic network, characterized in that: include: Read the time series knowledge graph and process it to generate a time series predicate sequence; Using LSTM to obtain the embedded representation of the temporal predicate sequence, and establishing the joint distribution of known triples and hidden triples through a Markov logic network; Based on the variational expectation maximization algorithm combined with the knowledge graph embedding technology, the joint distribution is inferred and learned to complete the time series knowledge graph reasoning task; The generation of the temporal predicate sequence includes: Read the time series knowledge graph to be processed; If the triple of the temporal knowledge graph contains a timestamp element, the predicate of the triple is connected with the timestamp element to generate a temporal predicate sequence p of length N. seq , and then convert the triple (h, p, t, time) of the temporal knowledge graph into (h, p seq ,time) form; If the triple of the temporal knowledge graph does not contain a timestamp element, the original predicate is directly regarded as a temporal predicate sequence p seq ; The acquisition of the embedded representation of the temporal predicate sequence includes: The temporal predicate sequence p seq Input to the linear layer of LSTM to obtain the temporal predicate sequence p seq The corresponding embedding vector is used as the input of LSTM. The last hidden state of LSTM is represented by h N As the temporal predicate sequence p seq The final embedding of The head entity and the tail entity of the temporal knowledge graph are embedded respectively to obtain the corresponding embedding representation e h and e t ; The steps of the reasoning include: Fix the model parameters to be learned and update the variational distribution q θ (V H |V o ), and then approximate the posterior distribution p of the hidden triples w (V H |V O ), and use the obtained embedding representation of the temporal predicate sequence to parameterize the variational distribution, where V O Represents a known triple, V H represents hidden triples; The vector representation of entities and relations is learned by minimizing the loss function of the triples of the training time series knowledge graph, and the knowledge graph reasoning is performed. The scoring function of each triple is used as the criterion to parameterize the q θ (V H |V o ) to update; The steps of learning include: Fix the updated variational distribution, update the model parameters to be learned, and then learn the weights of the logical formula by maximizing the log-likelihood function; In order to improve the optimization efficiency, a pseudo log-likelihood function is used instead of the optimization of the maximum log-likelihood function, that is, Among them, V (h,r,t) represents a triple, and MB(h,r,t) represents a triple V (h,r,t) The Markov blanket.

2. The temporal knowledge graph reasoning method based on Markov logic network according to claim 1, characterized in that: The establishment of the joint distribution includes: The Markov logic network is used to establish the joint distribution of known triplets and hidden triplets, and the formula is expressed as: Among them, Z represents the normalization factor of the entire joint space, w l represents the weight of the logical rule l, n l Indicates based on V O and V H Logical rules that conform to actual conditions.

3. The temporal knowledge graph reasoning method based on Markov logic network as claimed in claim 2, characterized in that: include, The joint distribution is optimized based on the variational expectation maximization algorithm combined with the knowledge graph embedding technology, that is, the joint distribution is learned by maximizing the variational lower bound of the log-likelihood of the observed facts. The formula is expressed as: Among them, logp w (V O ) represents the maximum log-likelihood of the observed facts for the known triples, L(q θ ,p w ) represents the variational lower bound, q θ (V H |V o ) represents a variational distribution for the posterior distribution of hidden triplets.

4. A system using the temporal knowledge graph reasoning method based on Markov logic network as claimed in claim 1, characterized in that: include: A data processing unit, used to read the time series knowledge graph and process it to generate a time series predicate sequence; A joint distribution establishment unit, used for obtaining an embedded representation of the temporal predicate sequence by using LSTM, and establishing a joint distribution of known triples and hidden triples by using a Markov logic network; The reasoning learning unit is used to reason and learn the joint distribution based on the variational expectation maximization algorithm combined with the knowledge graph embedding technology to complete the time series knowledge graph reasoning task.

5. A device, characterized in that: The device comprises, processor; a memory for storing processor-executable instructions; The processor is configured to call the instructions stored in the memory to execute the method according to any one of claims 1 to 3.

6. A computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the computer program instructions are executed by a processor, the method according to any one of claims 1 to 3 is implemented.