A temporal graph reasoning method based on variational autoencoder

The variational autoencoder is used to learn the static and dynamic characteristics of entities in the temporal knowledge graph, which solves the problem of poor future fact prediction accuracy in the existing technology and achieves high-quality entity embedding representation and accurate future fact prediction.

CN116739089BActive Publication Date: 2024-10-01HUAZHONG NORMAL UNIV
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202310497845.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-05
Publication Date
2024-10-01
Estimated Expiration
2043-05-05

AI Technical Summary

Technical Problem

The existing technology mainly focuses on past fact prediction in temporal knowledge graph reasoning, and it is difficult to effectively capture the evolution of entity semantics over time, especially the changes in static features, resulting in poor accuracy of future fact prediction.

Method used

The temporal graph inference method based on variational autoencoder is used to learn the static and dynamic latent variables of the entity through the inference network and the generation network respectively, and is combined with Gaussian distribution for re-parameterization and decoding to generate the entity embedding representation at the next moment, which solves the problem Unified modeling problem of static and dynamic features.

Benefits of technology

A high-quality entity embedding representation is achieved, which can accurately capture the static and dynamic characteristics of entity semantics and improve the accuracy of future fact prediction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116739089B_ABST
    Figure CN116739089B_ABST
Patent Text Reader

Abstract

The present invention discloses a temporal graph reasoning method based on a variational autoencoder, comprising: constructing a temporal graph reasoning model, the temporal graph reasoning model comprising: a reasoning network and a generating network; based on the reasoning network, obtaining static latent variables and dynamic latent variables of entity semantics in the temporal graph, wherein the reasoning network comprises: a static reasoning network and a dynamic reasoning network; re-parameterizing the static latent variables and the dynamic latent variables and combining them into a unified representation, and obtaining an embedding representation of the entity at the next moment based on the generating network; calculating the loss function of the temporal graph reasoning model, training the temporal graph reasoning model based on the loss function, and obtaining a quadruple embedding. The present invention solves the technical problem that the prior art only focuses on the dynamic evolution process of entities over time and ignores the static attributes of entities that remain unchanged over time, and can obtain high-quality entity embedding representations.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of temporal knowledge graph reasoning, and in particular relates to a temporal graph reasoning method based on variational autoencoder. Background Art

[0002] Temporal knowledge graph reasoning aims to complete the missing links (facts) in the knowledge graph, where each fact is bound to a timestamp. With the rapid development of artificial intelligence technology, temporal knowledge graph reasoning plays an increasingly important role in many fields such as recommendation systems, question-answering systems, and prediction systems, and has become a hot topic in current research.

[0003] Currently, most reasoning methods focus on reasoning about past facts with missing timestamps, and few studies explore reasoning about future facts. The main challenge in predicting future facts is how to effectively model historical facts and capture the evolution of entity semantics over time, so as to make accurate predictions about the future, which is even more challenging. However, in the existing technology, new models such as DBKGE Figure 1 As shown in the figure, the facts on the left (person A, born in, place A) and (person A, children, person B) have static features and remain unchanged in TKG; while the facts on the right (person A, played for, team A, 2003-2010) and (person A, played for, team B, 2011-2014) have dynamic features and change over time. It can be seen that DBKGE focuses on learning the dynamic representation of temporal knowledge graphs, and rarely considers static features that remain unchanged over time. Summary of the invention

[0004] The present invention proposes a temporal graph reasoning method based on variational autoencoder to solve the technical problems existing in the above-mentioned prior art.

[0005] To achieve the above object, the present invention provides a temporal graph inference method based on variational autoencoder, comprising:

[0006] Obtain a time series graph dataset, wherein the time series graph dataset is represented as a four-tuple (s, r, o, t), wherein s represents a head entity, o represents a tail entity, r represents a relationship between the head entity and the tail entity, and t represents the time when the fact occurs, and the four-tuple is text data;

[0007] Constructing a temporal graph reasoning model, wherein the temporal graph reasoning model includes: a reasoning network and a generation network;

[0008] Based on the inference network, static latent variables and dynamic latent variables of entity semantics in the time series graph are obtained, wherein the inference network includes: a static inference network and a dynamic inference network;

[0009] Re-parameterizing the static latent variables and the dynamic latent variables and combining them into a unified representation, and obtaining an embedding representation of the entity at the next moment based on the generative network;

[0010] The loss function of the temporal graph reasoning model is calculated, and the temporal graph reasoning model is trained based on the loss function to obtain a quadruple embedding.

[0011] Preferably, obtaining the static latent variables and dynamic latent variables of the entity semantics in the time series graph includes:

[0012] The posterior distribution probabilities of the static latent variables and the dynamic latent variables are calculated, and the posterior distribution probabilities are approximated based on variational inference to obtain static variables and dynamic variables that follow Gaussian distribution.

[0013] Preferably, the calculation formula of the posterior distribution is:

[0014] p(Z s , Z d:≤T+1 |X ≤T )=p(Z s |X ≤T )·p(Z d:≤T+1 |X ≤T )

[0015] Among them, Z s and Z d:≤T+1 Represent static latent variables and dynamic latent variables respectively, X ≤T is a historical fact, p(Z s |X ≤T ) is a static prior probability distribution, corresponding to the fact that it remains unchanged over time, p(Z d:≤T+1 |X ≤T ) is a dynamic prior probability distribution, corresponding to the fact that it changes over time.

[0016] Preferably, the process of re-parameterizing the static latent variables and the dynamic latent variables includes:

[0017] The means and variances of the static latent variables and the dynamic latent variables are obtained respectively, and based on the means and variances, the static latent variables and the dynamic latent variables are reparameterized respectively through a neural network to obtain a static approximate distribution and a dynamic approximate distribution.

[0018] Preferably, the approximate distribution calculation formula is:

[0019]

[0020] in, represents Gaussian distribution, diag() represents diagonal matrix, and represent the mean and variance of the static latent variables, respectively. and represent the mean and variance of the dynamic latent variables, respectively; represents the parameters related to the inference network, represents the static posterior probability distribution p(Z s |X ≤T ), Denotes the dynamic posterior distribution p(Z d:≤T+1 |X ≤T ) is an approximate distribution of .

[0021] Preferably, the process of obtaining the embedding representation of the entity at the next moment includes:

[0022] Based on the reparameterization technique, the static approximate distribution and the dynamic approximate distribution are sampled respectively to obtain sampling results. Based on the sampling results, the embedding representation of the entity at the next moment is obtained through the decoder.

[0023] Preferably, the process of training the temporal graph inference model based on the loss function includes:

[0024] Based on the loss function, the time series graph inference model is trained by an Adam optimizer, wherein the Adam optimizer comprehensively considers the mean and variance of static latent variables and dynamic latent variables.

[0025] Preferably, the quadruple embedding is also subjected to a testing process:

[0026] Get the embedding of the quadruple to be tested, calculate the embedding of the quadruple based on the scoring function to get the quadruple score, and evaluate the performance of the temporal graph reasoning model based on the quadruple score through MRR, Hits@N and time-aware filtering settings, where MRR is the average of the last ranked quadruple, Hits@N is the proportion of the top N in the quadruple, and the time-aware filtering setting is used to filter out the fact list that occurred at time t in the damaged quadruple list.

[0027] Compared with the prior art, the present invention has the following advantages and technical effects:

[0028] The present invention proposes a temporal graph reasoning method based on a variational autoencoder, obtains two independent latent variables based on inference network coding, and respectively learns the dynamic and static characteristics of entity semantics over time; decodes based on a generative network and combines the dynamic latent variables and the static latent variables into a unified representation to jointly generate the embedding of the entity at the next moment. The present invention also solves the technical problem that the prior art only focuses on the dynamic evolution of entities over time and ignores the static attributes of entities that remain unchanged over time, and can obtain high-quality entity embedding representations. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] The drawings constituting a part of the present application are used to provide a further understanding of the present application. The illustrative embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0030] Figure 1 This is a TKG example diagram of an embodiment of the present invention;

[0031] Figure 2 A schematic diagram of a temporal knowledge graph model according to an embodiment of the present invention;

[0032] Figure 3 A diagram showing the re-parameterization technique of an embodiment of the present invention;

[0033] Figure 4 Graphs showing experimental results of an embodiment of the present invention at different embedding dimensions on four data sets;

[0034] Figure 5 This is a schematic diagram of a query comparison case of DSTKG and DBKGE on the Yago11k dataset according to an embodiment of the present invention. DETAILED DESCRIPTION

[0035] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0036] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0037] Embodiment 1

[0038] The temporal knowledge graph is a knowledge graph based on time sequence, which is composed of a series of facts arranged in chronological order. Each fact can be represented by a four-tuple (s, r, o, t). Among them, s represents the head entity, o represents the tail entity, r represents the relationship between the head entity and the tail entity, and t represents the time when the fact occurred. The temporal knowledge graph can be represented by a set of ordered facts, in which each fact has a timestamp to identify the time when it occurred. This embodiment uses Represents the set of all facts at time t:

[0039]

[0040] in, Respectively represent the set of all entities, relations and timestamps in the temporal knowledge graph, Represents the set of all facts at and before time T. The main symbols of this embodiment are shown in Table 1.

[0041] Table 1

[0042]

[0043]

[0044] The main task of this embodiment is to learn the semantic changes of entities through known historical facts and make effective predictions for the future. Learn the fact sequence distribution at time T and every moment before And based on these distributions, future facts are predicted. Specifically, the goal of this embodiment is to predict the missing head entity (?, r, o, T+1) or tail entity (s, r, ?, T+1) at time T+1.

[0045] In the learning process at each moment, this embodiment assumes that the learned sequence embedding at time t is X t =(ε t , R t ), where ε t , R t represent the embedding representation of entities and relations at time t (1≤t≤T) respectively. Next, the problem is transformed into ≤T To infer the latent representations of entities and relations at time T+1:

[0046] X T+1 =F(X ≤T ) (2)

[0047] Among them, F represents the ≤T To X T+1 The mapping function of .

[0048] like Figure 2 As shown, this embodiment provides a temporal graph reasoning method based on variational autoencoder, which learns the dynamic and static representations of entities based on variational autoencoder. The model name is DSTKG (Dynamic and Static Representations For Temporal Knowledge Graph Reasoning). The DSTKG model is divided into three modules: an encoder based on an inference network, a decoder based on a generation network, and a loss function.

[0049] First, for all historical facts occurring at time T and before, DSTKG transforms the historical sequence X ≤TAs the input part of the model; then, the encoder generates static and dynamic latent representations of entity semantics through two independent reasoning networks, among which the static reasoning network captures the commonalities and regularities in historical facts, and it uses a bidirectional gated recurrent unit (Bi-GRU) to learn the static latent representation of historical facts; the dynamic reasoning network captures the changes of entities over time, and it uses an inference network based on nonlinear discrete time transformation to track the dynamic representation of entities; finally, this embodiment uses multiple normal distributions with a standard deviation of 1 to reparameterize these latent variables so that the model can better handle the uncertainty in the evolution of entity semantics over time. Specifically, this embodiment reparameterizes the static and dynamic latent variables multiple times, and combines the dynamic latent variables and the static latent variables into a unified representation through the decoder, and finally obtains the embedded representation of the entity at time T+1.

[0050] For each quadruple at time t, this embodiment regards the relationship as an element rotation from the subject entity to the object entity. Similar to the RotatE model proposed by sun et al., the scoring function is as follows:

[0051] f(s,r,o,t)=||s t ☉r t -o t || (3)

[0052] where ⊙ is the Hamiltonian (or element-wise) product, s t , o t and r t They represent the embeddings of the head entity, tail entity, and relation at time t, respectively.

[0053] For model optimization, the existing method DBKGE uses a unified way to generate negative samples. However, this method does not take into account the special properties of each positive sample, so there may be many invalid samples that cannot provide meaningful information during the training process. Therefore, this paper adopts the Negative Log-Likelihood (NLL) method proposed by Rossi et al. This method can better generate negative samples, thereby improving the training efficiency of the model. The probability distribution of historical facts occurring at time t is as follows:

[0054]

[0055] in, represents the set of all negative samples that appeared at time t and before; if Then l (s,r,o,t) =1; if Then l (s,r,o,t) =-1.

[0056] 1. Encoder based on inference network

[0057] In the TKG reasoning task, both the dynamic and static features of entities are very important. Dynamic features are usually time-related, for example, the attributes of an entity may change over time, or the relationship between entities may be created or disappear at a certain moment. Static features are usually the state under normal conditions, that is, the relationships and attributes between entities usually remain unchanged. The dynamic and static features of entities provide different messages, which help to better understand and predict the relationships between entities. Therefore, in the TKG reasoning task, combining the dynamic and static properties of entities can capture more expressive representations and improve future link predictions. The main challenge of the model in this embodiment is how to design a unified way to better simulate these two characteristics.

[0058] For a given historical fact X ≤T , the goal is to obtain the embedding representation of entities and relations at time T+1. To this end, this embodiment introduces two latent variables Z s and They represent static latent variables and dynamic latent variables respectively. Next, this embodiment will p(Z s |X ≤T ) is defined as a static prior probability distribution, which corresponds to the fact that it remains constant over time. d:≤T+1 |X ≤T ) is defined as a dynamic prior probability distribution, which corresponds to the fact that it changes over time. However, these prior probability distributions cannot be directly represented. Therefore, this embodiment calculates the posterior distribution p(Z) of these two latent variables s , Z d:≤T+1 |X ≤T ) to complete this task. This posterior distribution represents the ≤T The joint probability distribution of the dynamic latent variable and the static latent variable under the condition of . The calculation of the posterior distribution is as follows:

[0059] p(Z s , Z d:≤T+1 |X ≤T )=p(Z s |X ≤T )·p(Z d:≤T+1 |X ≤T ) (5)

[0060] However, the calculation of this posterior distribution is very complicated, so this embodiment uses variational inference to approximate the posterior distribution. Specifically, this embodiment initializes an approximate distribution and then uses KL divergence to approximate the true posterior probability distribution. Approximate distribution The calculation of is as follows:

[0061]

[0062] in, represents the parameters related to the inference network, represents the static posterior probability distribution p(Z s |X ≤T ), Denotes the dynamic posterior distribution p(Z d:≤T+1 |X ≤T ) is an approximate distribution of .

[0063] The static latent variable Z obtained by the inference network s The purpose is to capture the static characteristics of the entity, which is obtained under the historical fact sequence. In contrast, the dynamic latent variable Z d:≤T+1 It is designed to capture the evolution of the semantics of an entity over time, and it is closely related to the semantics of the entity at the previous moment. Therefore, this embodiment decomposes the above formula as follows:

[0064]

[0065] Among them, Z obtained by the posterior distribution in this embodiment s and Z d:t+1 They follow independent Gaussian distributions and are parameterized by neural networks. Specifically, for each RHS (right side) term, the calculation is as follows:

[0066]

[0067] in represents Gaussian distribution, diag() represents diagonal matrix, and represent the mean and variance of the static latent variables, respectively. and represent the mean and variance of the dynamic latent variables, respectively.

[0068] The static latent variable depends on the entire sequence, and the purpose is to learn the static properties of the sequence that change over time. This embodiment uses a bidirectional gated recurrent unit (Bi-GRU) to capture this long-term dependency. Compared with the unidirectional GRU, the bidirectional GRU considers both the forward and backward representations, and can capture richer contextual information about the entity semantics. For a given historical fact X ≤T = {X1, X2…X t , …X T}, this embodiment uses forward GRU and backward GRU to obtain the hidden state at each moment, and then performs a splicing operation. Finally, after merging, the hidden state h at time T isT As shown below:

[0069] h T =Bi-GRU(h T-1 , X T ) (10)

[0070] Where Bi-GRU(·) represents the non-deterministic transfer function implemented by Bi-GRU. h is obtained by the above formula T Afterwards, this embodiment uses h T To construct the static latent variable Z s The mean and variance and The calculation of is as follows:

[0071]

[0072] Where W1 and W2 represent learnable weight parameters, b1 and b2 represent learnable bias parameters, and exp(·) represents an exponential function.

[0073] Dynamic latent variables are used to capture the dynamic characteristics of entities that change over time. The goal is to learn the smooth change process of entity embedding from time t to time t+1. This embodiment uses a Bayesian inference-based method to recursively model dynamic latent variables, and accurately describes the dynamic characteristics of entities by calculating the mean and variance of dynamic latent variables. Specifically, this embodiment uses the dynamic inference posterior of the previous timestamp to recursively estimate the latest inference posterior of the current timestamp, thereby constructing the mean and variance of the dynamic latent variable. Therefore, the dynamic latent variable Z d:t+1 The mean and variance The calculation method of is as follows:

[0074]

[0075] Among them, W3 and W4 represent learnable weight parameters, b3 and b4 represent learnable bias parameters, and [·;·] represents the concatenation between two vectors. For the initialization of recursive estimation, this paper sets That is the standard normal distribution.

[0076] 2. Decoder based on generative network

[0077] For a given historical fact sequence X ≤T After obtaining the distribution of static latent variables and dynamic latent variables through the inference network, the goal of this embodiment is to generate the embedding representation X of the quadruple at the next moment T+1Both dynamic latent variables and static latent variables contain sufficient historical information, which has an important impact on the prediction of facts at future timestamps. Based on these two latent variables, this embodiment formulates a generation process for the quadruple embedding at time T+1: T+1 The static latent variable Z at the previous timestamp can be s and the dynamic latent variable Z d:T+1 The probability distribution of the whole process can be decomposed as follows:

[0078]

[0079] Here, θ represents all parameters related to the generative network.

[0080] After obtaining the mean and variance of the static latent variables and the dynamic latent variables through the inference network, it is necessary to use the reparameterization technique to sample from the corresponding distribution. The reparameterization technique is a method for sampling from a Gaussian distribution, which can avoid the problem of training instability caused by noise when calculating the gradient. Unlike the traditional method of sampling only once, this embodiment samples the latent variables multiple times according to the reparameterization technique used by Xiao et al. to obtain better expected results. Each sampling process is as follows Figure 3 As shown in the figure, the re-parameterization technique is demonstrated, where Gaussian noise refers to data sampled from a Gaussian distribution. The calculation of each term on the right side of formula (15) is as follows:

[0081]

[0082] Where J represents reparameterizing the static latent variables and dynamic latent variables J times, Represent the dynamic and static latent variables obtained at the i-th sampling, respectively, and θ represents all parameters related to the generation network. Then, this paper uses the long short-term memory network (LSTM) as a decoder to obtain the embedding representation of the next timestamp quadruple. The calculation of each item on the right side of formula (16) is as follows:

[0083]

[0084] Among them, [·;·] represents the concatenation between two vectors, is the hidden state of the decoder, N1 and N2 represent learnable parameters, and softmax represents the activation function. As shown in the above formula, the dynamic latent variables and static latent variables obtained by the jth sampling can be combined into a unified representation after sampling and processing by the decoder. Next, we combine them into a final vector representation by taking the average The calculation of is as follows:

[0085]

[0086] Finally, this embodiment combines the dynamic latent variables and static latent variables obtained by multiple reparameterization techniques into a unified representation through the decoder, thereby obtaining the quadruple embedding at the next moment. The calculation method of each term on the right side of formula (15) is as follows:

[0087]

[0088] Among them, softmax represents the activation function.

[0089] In this embodiment, the training process of the temporal graph inference model based on the variational autoencoder is shown in Table 2.

[0090] Table 2

[0091]

[0092] 3. Loss Function

[0093] As a common strategy for variational inference, this embodiment needs to minimize the KL divergence. The role of the KL divergence is to continuously narrow the gap between the approximate posterior distribution and the true posterior distribution through training, so as to more accurately capture the change process of entity semantics over time. Minimizing the KL divergence is equivalent to maximizing the evidence lower bound (ELOB). In the end, the loss function of the model is as follows:

[0094]

[0095] in, Both θ and θ are learnable and represent parameters related to the inference network and the generation network, respectively. Therefore, the goal of model training is to find the parameters that maximize ELOB through the inference network and the generation network. θ. During the training process, this embodiment uses the Adam optimizer to train the model. The reason is that in order to obtain high-quality quadruple embedding through learning as quickly as possible during the training process, it is necessary to select an optimizer that can converge quickly. The Adam optimizer takes the mean and variance of the gradient into consideration when updating, which not only converges quickly, but also requires less memory and is easy to adjust. Table 2 shows the training process of the model in this embodiment.

[0096] Experimental results and analysis

[0097] 1. Experimental Data

[0098] The statistical results of the data set are shown in Table 3.

[0099] Table 3

[0100]

[0101] This embodiment conducts a large number of link prediction experiments on four public TKG datasets, namely Yago11k, Wikidata12k, ICEWS14 and ICEWS05-15. Among them, the Yago11k dataset is obtained by extracting the 10 most frequent relations from the YAGO dataset; the Wikidata12k dataset is extracted by selecting the first 24 time relations from the Wikidata dataset; the ICEWS14 dataset is all events that occurred in 2014 extracted from the ICEWS dataset; and the ICEWS05-15 dataset is all events that occurred from 2005 to 2015 extracted from the ICEWS dataset. These four datasets contain rich time annotation information and are very suitable for evaluating the link prediction function based on TKG.

[0102] Specifically, ICEWS14 and ICEWS05-15 are both databases containing international political events. They record the events and locations where the events occurred, and the time annotations involved are all time points. For example, a quadruple from the ICEWS14 dataset, Yago11k and Wikidata12k has a time granularity of years, and most facts have a continuous time span in the form of: (s, r, o, [τ s , τ e ]). Among them, s and o represent entities, r represents the relationship between the two entities, τ s represents the start time of the event, τ e Represents the end time of the event. This embodiment uses the same method as Zhu et al. to convert each fact into a four-tuple sequence: (s, r, o, τ s ),(s,r,o,τ s +1),…,(s,r,o,τ e ),.

[0103] This embodiment uses the same processing method as Jin et al. to discretize these data sets. The specific statistical results of the four data sets are shown in Table 3.

[0104] 2. Evaluation Metrics

[0105] The link prediction task for future timestamps aims to predict the missing head entity s or tail entity o of the quadruple (s, r, o, t) in the future timestamp sequence. During the test, for a quadruple that needs to be tested, taking the prediction of the head entity as an example, the s in (s, r, o, t) is replaced with an entity that has not appeared before time t in the knowledge graph, and then the score is calculated using the scoring function, and all scores are arranged. In this way, the ranking of the correct answers to the quadruple in a test set is obtained. Obviously, the higher the ranking, the better. This embodiment uses two commonly used evaluation indicators, MRR and Hits@N, for testing. In order to test the accuracy of the results, this embodiment also uses time-aware filtering. The following is an introduction to MRR, Hits@N and time-aware filtering.

[0106] 1.) MRR is the average of the last rankings of all correct quadruplets, and its calculation formula is as follows:

[0107]

[0108] Where n is the number of correct quadruplets in the test set, rank i is the rank of the i-th correct quadruple. The higher the MRR, the better the performance of the model.

[0109] 2.) Hits@N is the proportion of the top N correct quadruplets, and its calculation formula is as follows:

[0110]

[0111] Among them, rank i ≤N, l(rank i , N)=1; otherwise, l(rank i , N) = 0. In the experiment of this embodiment, N = 1, 3, 10 are selected.

[0112] 3.) Time-aware filter setting: During the test process, the fact that a quadruple occurs at time t may be ranked as a corrupted quadruple, which will affect the ranking of the correct quadruple. The traditional static filtering used in CyGNet, RE-Net, and DBKGE is not suitable for temporal knowledge graphs because the setting deletes all quadruple in the data set without considering the time information. Therefore, following the previous work, this embodiment adopts the time-aware filtering setting during the test process. The role of the time-aware filtering setting is to filter out the list of facts that occurred at time t from all the lists of corrupted quadruple. For example, for two quadruple (character A, played for, team B, 2013) and (character A, played for, team C, 2016), the quadruple (character A, played for, team B, 2013) did not appear in 2016. Therefore, at the timestamp of 2016, time-aware filtering will filter out (character A, played for, team B, 2013), while traditional static filtering will filter out both.

[0113] 3. Parameter settings

[0114] This embodiment uses NVIDIA GTX A5000 GPU to implement the model. In the experiment, the Adam optimizer is used to learn the parameters. For these two data sets, the parameters are adjusted using a grid search strategy to find the best value on the validation subset. Specifically, the embedding dimension dim = {100, 150, 200, 250}, the learning rate lr = {0.00001, 0.00003, 0.00005, 0.00008, 0.0001}, the number of negative samples eta = {100, 150, 200}, the batch size batch during training = {256, 512, 1, 024}, and the number of times the latent variables are re-parameterized J = {5, 8, 10}. Table 4 shows the best settings for the model on the four data sets.

[0115] Table 4

[0116]

[0117] 4. Introduction to the Baseline Model

[0118] This example compares DSTKG with two types of baselines: the traditional KG model and the TKG model.

[0119] The traditional KG model ignores time information. Its representative models include TransE, DistMult, R-GCN, ConvE, ConvTransE and RotaE. The experimental results of this part are from Li et al. The following is an introduction to the traditional KG baseline model:

[0120] The TransE model was proposed by Bordes et al. in 2013. The model maps entities and relations into the same low-dimensional vector space, and then measures the semantic similarity between different entities by calculating the semantic distance between them.

[0121] The DistMult model was proposed by Yang et al. in 2015. The model calculates the semantic similarity between different entities through a diagonal matrix.

[0122] The R-GCN model was proposed by Schlichtkrull et al. in 2018. The model learns the information of entities and neighboring entities through graph convolutional neural networks.

[0123] The ConvE model was proposed by Dettmers et al. in 2018. The model uses a convolutional neural network to learn the interaction between entities and relations, thereby capturing the semantic relationships between different entities.

[0124] The ConvTransE model was proposed by Shang et al. in 2019. The model maps entities and relations into a high-dimensional vector space, then reduces the dimension through convolution operations while modeling the interactions between entities and relations.

[0125] The RotaE model was proposed by Sun et al. in 2019. The model maps entities and relations into a three-dimensional hypersphere, and then represents the relations as rotation matrices to capture the semantic relationships between entities.

[0126] The TKG model consists of two parts: interpolation and extrapolation. The interpolation-based model is for the time range [t0, t T ], and its representative models mainly include TTransE, HyTE and TA-DisMult. The experimental results of this part are from Li et al. The extrapolation method is used for the time range [t T ,∞] are used to predict future facts, and its representative models mainly include RE-NET, CyGNet and TITer, DBKGE, and EvoKG. For the baselines RE-NET, CyGNet, TITer, and EvoKG, this embodiment uses the original code and optimal parameter settings in the original paper to regenerate the results. For DBKGE, the author did not release the code. After reproducing the code of this method, this embodiment reports the experimental results of the DBKGE model. For NLSM, the author did not publish the code and used a static perceptual filtering method, so this embodiment is not compared with it. The following is an introduction to the TKG baseline model:

[0127] The TTransE model was proposed by Leblay et al. in 2018. The model maps time, entities, and relationships into the same vector space to reflect the evolution of entities and relationships over time.

[0128] The HyTE model was proposed by Dasgupta et al. in 2018. The model maps entities and relations onto specific hyperplanes, where different hyperplanes represent different times.

[0129] The TA-DisMult model was proposed by Garcia et al. in 2018. The model uses a recurrent neural network to encode relationships at different times to obtain a temporal relational representation.

[0130] The RE-NET model was proposed by Jin et al. in 2020. The model uses a recursive event encoder to encode historical facts at different timestamps (global representation), and uses a neighborhood aggregator to learn facts at the same timestamp (local representation), which are then used to jointly infer future facts.

[0131] The CyGNet model was proposed by Zhu et al. in 2021. The model uses a replication network to create corresponding copies of repeated facts, and then uses a generative network to infer the probability of predicting entities from the entire historical vocabulary.

[0132] The TITer model was proposed by Sun et al. in 2021. The model uses reinforcement learning algorithms to find the optimal strategy in historical facts to predict future results.

[0133] The DBKGE model was proposed by Liao et al. in 2021. The model uses a dynamic Bayesian network to model each entity and relationship in the form of a Gaussian distribution, thereby capturing the evolution process of entities and relationships.

[0134] The EvoKG model was proposed by Park et al. in 2022. The model first uses an evolutionary network to model the relationship between different facts, then uses a neighborhood aggregator to learn the relationship between different entities, and finally predicts the future based on the two modules.

[0135] 5. Results Analysis

[0136] Tables 5 and 6 show the experimental results of the model of this embodiment on the Yago11k, Wikidata12k, ICEWS14 and ICEWS05-15 datasets. The baselines in the table are divided into three categories, the first category is static methods; the second category is interpolation-based methods; and the third category is extrapolation-based methods. From Tables 5 and 6, there are four important findings:

[0137] 1.) Compared with traditional KG models, DSTKG beats these baselines by a large margin, which shows that temporal information plays an important role in TKG tasks. Taking the R-GCN model as an example, for the evaluation index Hits@10, DSTKG achieved 7.54% and 8.34% improvements on the Yago11k and Wikidata12k datasets, respectively, and 24.85% and 23.56% improvements on the ICEWS14 and ICEWS05-15 datasets, respectively (R-GCN vs DSTKG).

[0138] 2.) Compared with the interpolation-based TKG inference models (TTransE, HyTE, and TA_DistMult), the extrapolation-based TKG inference models achieve better performance, which indicates that the extrapolation-based methods can effectively predict future facts (e.g., TTransE vs DSTKG).

[0139] 3.) Compared with extrapolation-based methods (such as RE-NET, CyGNet, and TITer), DBKGE and DSTKG perform better on the four datasets with respect to different metrics. This is because DBKGE and DSTKG can effectively model the distribution of all historical facts (e.g., RE-NET vs DBKGE and DSTKG).

[0140] 4.) Compared with DBKGE, DSTKG achieves state-of-the-art performance on all four datasets. This comparison once again verifies that jointly learning static and dynamic features of entities can accurately capture the evolution of entity semantics in TKG over time when modeling dynamic changes over time (DBKGE vs DSTKG).

[0141] Table 5

[0142]

[0143]

[0144] Table 6

[0145]

[0146] 6. Ablation Study

[0147] To explore the benefits of DSTKG over TKG embedding at future timestamps, an ablation study is conducted in this section.

[0148] Table 7 compares DSTKG with three variant models: “DSTKGw / o Dynamic”, “DSTKGw / o Static” and “DSTKG-RNNw / o Static”. Among them, “DSTKGw / o Dynamic” represents the model by removing the dynamic latent variables, that is, the model only considers the static features of the facts; “DSTKGw / o Static” represents the model by removing the static latent variables, that is, the model only considers the dynamic features of the facts; “DSTKG-RNNw / o Static” replaces the static latent variables with a simple recurrent neural network (RNN) and does not use Gaussian distribution for modeling.

[0149] As shown in Table 7, both static and dynamic latent variables play an important role for link prediction on TKG. “DSTKGw / o Dynamic” achieves the worst performance under various metrics on the four datasets. This is because, after removing the dynamic latent variables, “DSTKGw / o Dynamic” cannot model the dynamic characteristics of entity semantics evolving over time (DSTKGw / o Dynamic vs. DSTKG). Both “DSTKGw / o Static” and “DSTKG-RNNw / o Static” perform worse than the standard “DSTKG” on the four datasets. This is because, after removing the static latent variables, “DSTKGw / o Static” cannot effectively consider the static characteristics of facts (DSTKGw / o Static vs. DSTKG); modeling with Gaussian distribution can not only improve the intuitive representation of entity distribution, but also achieve more accurate modeling (DSTKG-RNNw / o Static vs. DSTKG). The experimental results show that both the static and dynamic latent variables proposed in this embodiment have a positive impact on the model, which indicates that simultaneously modeling the static and dynamic representations of entities can achieve more accurate entity semantic modeling, thereby making better predictions for the future.

[0150] Table 7

[0151]

[0152]

[0153] 7. Impact of Embedding Dimension

[0154] In order to better understand the superiority of the DSTKG model proposed in this example, Figure 4 The comparison results of DSTKG and the strongest baseline DBKGE on four datasets for different embedding dimensions are shown. Through the experimental results, this example summarizes the following two points:

[0155] 1.) For the evaluation indicator MRR, when the embedding dimension is less than 200, MRR will continue to increase as the embedding dimension increases. When the embedding dimension reaches 200, the performance of MRR on the four datasets will become stable or even decrease. This shows that as the embedding dimension increases, DSTKG can better capture the semantic and structural information of the entity. However, as the dimension increases, the model may overfit, which leads to lower-than-expected experimental results.

[0156] 2.) For different embedding dimensions, the DSTKG proposed in this embodiment is always better than DBKGE. This once again shows the superiority of the model in this embodiment, that is, modeling both the static and dynamic representations of entities can better capture semantic changes.

[0157] 8. Example Analysis

[0158] To further illustrate how the DSTKG model proposed in this example can predict future facts by combining the dynamic and static features of entities, Figure 5 A query comparison example of DSTKG and DBKGE on the Yago11k dataset is shown in Figure 1. Figure 5 As shown on the left, the quadruple (person F, wasBornIn, place G, 1907) shows the static characteristics of the entity person F, because the birthplace of person F does not change over time; the quadruple (person F, isMarriedTo, person E, 1933-1945) and (person F, isMarriedTo, person H, 1946-1954) show the dynamic characteristics of the entity person F, because the wife of person F has changed. Figure 5 The right side shows a comparison of the top 5 entities among the candidate entities of DBKGE and the DSTKG proposed in this embodiment for future predictions (person F, dieIn,?, 1979). Among them, the query entity ranks third among the candidate entities of DBKGE and first among the candidate entities of DSTKG. This is because, when predicting future facts, DBKGE can only capture the dynamic features of entities, and it is difficult to use the static features of entities that remain unchanged over time (person F's birthplace). Therefore, DBKGE cannot make accurate predictions for queries. Unlike DBKGE, the DSTKG proposed in this embodiment not only considers the dynamic features of entities when predicting future facts, but also uses the static features of entities that remain unchanged over time. This enables DSTKG to learn richer entity features when predicting the future, thereby producing better prediction results. This example verifies the effectiveness of the model proposed in this embodiment.

[0159] Beneficial effects of this embodiment:

[0160] This embodiment proposes a temporal graph reasoning model based on a variational autoencoder. The model obtains two independent latent variables based on the inference network encoding, and learns the dynamic features and static features of the entity semantics over time respectively. Then, this embodiment decodes based on the generative network and combines the dynamic latent variables and the static latent variables into a unified representation to jointly generate the embedding of the entity at the next moment. This embodiment conducted comparative experiments and ablation studies on four public data sets of TKG to prove the effectiveness of the method. At the same time, it solves the technical problem that the prior art only focuses on the dynamic evolution process of the entity over time, and ignores the static properties of the entity that remain unchanged over time.

[0161] The above is only a preferred specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A temporal graph inference method based on variational autoencoder, characterized in that: The following steps are involved: Obtain a time series graph dataset, wherein the time series graph dataset consists of a series of fact sequences arranged in chronological order, each fact is represented as a quadruple (s, r, o, t), where s represents the head entity, o represents the tail entity, r represents the relationship between the head entity and the tail entity, and t represents the time when the quadruple occurs, and the quadruple is text data; Constructing a temporal graph reasoning model, wherein the temporal graph reasoning model includes: a reasoning network and a generation network; Based on the temporal graph dataset, static latent variables and dynamic latent variables of entity semantics in the temporal graph are obtained through the inference network, wherein the inference network includes: a static inference network and a dynamic inference network; Re-parameterizing the static latent variables and the dynamic latent variables and combining them into a unified representation, and obtaining an embedding representation of the entity at the next moment based on the generative network; Calculating the loss function of the temporal graph reasoning model, training the temporal graph reasoning model based on the loss function, and obtaining a quadruple embedding; After obtaining the static latent variables and dynamic latent variables of entity semantics in the time series graph, it includes: Calculating the posterior distribution probabilities of the static latent variables and the dynamic latent variables, and approximating the posterior distribution probabilities based on variational inference to obtain static variables and dynamic variables that follow Gaussian distribution; The calculation formula of the posterior distribution is: p(Z s ,Z d:≤T+1 |X ≤T )=p(Z s |X ≤T )·p(Z d:≤T+1 |X ≤T ) Among them, Z s and Z d:≤T+1 Represent static latent variables and dynamic latent variables respectively, X ≤T is a historical fact, p(Z s |X ≤T ) is a static posterior probability distribution, corresponding to the fact that it remains unchanged over time, p(Z d:≤T+1 |X ≤T ) is a dynamic posterior probability distribution, corresponding to the fact that it changes over time; The process of re-parameterizing the static latent variables and the dynamic latent variables includes: Respectively obtaining means and variances of static latent variables and dynamic latent variables, and re-parameterizing the static latent variables and the dynamic latent variables through a neural network based on the means and variances to obtain static approximate distribution and dynamic approximate distribution; Approximate distribution calculation formula: in, represents Gaussian distribution, diag() represents diagonal matrix, and represent the mean and variance of the static latent variables, respectively. and represent the mean and variance of the dynamic latent variables, respectively; represents the parameters related to the inference network, represents the static posterior probability distribution p(Z s |X ≤T ), X t represents the quadruple embedding at time t; The process of obtaining the embedding representation of the entity at the next moment includes: Based on the reparameterization technique, the static approximate distribution and the dynamic approximate distribution are sampled respectively to obtain sampling results. Based on the sampling results, the embedding representation of the entity at the next moment is obtained through the decoder.

2. The temporal graph inference method based on variational autoencoder according to claim 1, characterized in that: The process of training the temporal graph inference model based on the loss function includes: Based on the loss function, the time series graph inference model is trained by an Adam optimizer, wherein the Adam optimizer comprehensively considers the mean and variance of static latent variables and dynamic latent variables.

3. The temporal graph inference method based on variational autoencoder according to claim 1, characterized in that: The test process is also performed on the quadruple embedding: Get the embedding of the quadruple to be tested, calculate the embedding of the quadruple based on the scoring function to get the quadruple score, and evaluate the performance of the temporal graph reasoning model based on the quadruple score through MRR, Hits@N and time-aware filtering settings, where MRR is the average of the last ranked quadruple, Hits@N is the proportion of the top N in the quadruple, and the time-aware filtering setting is used to filter out the fact list that occurred at time t in the damaged quadruple list.

Citation Information

Patent Citations

  • Self-adaptive reasoning question and answer method and system based on industrial cognitive map

    CN113010663A

  • A knowledge graph-combined variational auto-encoder zero sample image recognition method

    CN113505701A

  • Soft measurement method and device based on supervised multi-potential variable structure

    CN115169629A