Temporal knowledge graph completion method and device under extrapolation setting, equipment and medium
By using a entity representation learning model based on graph neural network, time semantic perception and cross-time aggregation in tense knowledge graph completion, predicting missing information in future events, the problem of insufficient prediction accuracy in the existing technology is solved, and more efficient entity association relationships and time evolution law capture is achieved, and prediction accuracy is improved.
Patent Information
- Application Number
- CN202411700339.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-26
- Publication Date
- 2025-04-11
AI Technical Summary
In the completion of tense knowledge graphs, the accuracy of predicting missing information in future events is insufficient, and it fails to effectively capture the correlation relationship between entities and the law of time evolution.
A tense knowledge graph completion method under extrapolated settings is proposed. By obtaining the knowledge graph to be predicted, it is input to the entity representation learning model based on graph neural network, time semantic perception and cross-time aggregation relationship time-awareness to predict missing events. This model is able to learn relationship-specific entity embeddings and the evolutionary laws of entities in time.
It improves the prediction accuracy of missing events, can more effectively capture the correlation relationship between entities and the laws of temporal evolution, and enhances the predictive ability of future events.
Smart Images

Figure CN119808909A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a method, device, equipment and medium for completing a temporal knowledge graph under an extrapolation setting. Background Art
[0002] Temporal Knowledge Graph Completion (TKGC) in the extrapolation setting focuses on completing missing events (subjects, relations, "predicted objects", timestamps) in future subgraphs based on the information contained in historical subgraphs. In order to accurately predict the missing information in future events, more and more research focuses on mining the evolution patterns of historical subgraphs in temporal knowledge graphs.
[0003] Temporal knowledge graph completion in related technologies mainly uses recent historical subgraphs to encode entities and relationships, and then predicts missing events in future subgraphs. However, the actual prediction effect of this method is not satisfactory. Summary of the invention
[0004] The main purpose of the embodiments of the present application is to provide a method, device, equipment and medium for completing a temporal knowledge graph under an extrapolation setting, aiming to improve the prediction accuracy of missing events.
[0005] To achieve the above purpose, one aspect of an embodiment of the present application proposes a temporal knowledge graph completion method under an extrapolation setting, comprising the following steps:
[0006] Obtaining a knowledge graph to be predicted, wherein the knowledge graph to be predicted includes missing events to be predicted and target connection relationships;
[0007] Inputting the knowledge graph to be predicted into a relational time-aware entity representation learning model to obtain a prediction result of the missing event;
[0008] Determine the complete event of the knowledge graph to be predicted according to the prediction result of the missing event;
[0009] Among them, the relational time-aware entity representation learning model is obtained through training based on graph neural network, time semantic perception and cross-time aggregation, and the graph neural network is used to learn the feature representation under the target connection relationship.
[0010] In some embodiments, the relational time-aware entity representation learning model is trained by the following steps:
[0011] Obtaining a sub-knowledge graph, where the sub-knowledge graph is used to represent a connection relationship graph of candidate entities of the missing event at multiple historical timestamps;
[0012] Inputting the sub-knowledge graph into the graph neural network to obtain a first entity code, where the first entity code is used to characterize a feature representation of the candidate entity under the target connection relationship;
[0013] Determining a second entity code by using the time semantic perception and the first entity code, wherein the second entity code is used to characterize a feature representation of the candidate entity under the target connection relationship including time perception;
[0014] Aggregating the second entity codes under the multiple historical timestamps across time to obtain dynamic evolution information of the candidate entity within a preset time range, wherein the preset time range includes the multiple historical timestamps;
[0015] The dynamic evolution information and the target connection relationship are input into a decoder and trained based on a scoring function to determine a prediction result of a missing event.
[0016] In some embodiments, inputting the sub-knowledge graph into the graph neural network to obtain a first entity encoding includes:
[0017] The sub-knowledge graph is input into a relational graph convolutional network to obtain the first entity encoding.
[0018] In some embodiments, inputting the sub-knowledge graph into a relational graph convolutional network to obtain the first entity encoding includes:
[0019] According to the relationship r i The semantic relevance of the target connection relationship determines the weight parameter of the adjacent connection relationship, wherein the relationship r i Indicates the connection relationship between the target connection relationship and the candidate entity;
[0020] Determine a similar relationship according to the weight parameter, wherein the similar relationship is used to characterize a connection relationship that is semantically similar to the target connection relationship;
[0021] Entities connected with the close relationship are aggregated based on the weight parameter to obtain the first entity code.
[0022] In some embodiments, the relationship r i The semantic relevance of the target connection relationship to determine the weight parameter of the adjacent connection relationship includes:
[0023] By embedding the connection relationship of the subject entity in the target connection relationship i,t , the connection relationship set R of the main entity at timestamp t s,t , the non-target connection relationship embedding r of the candidate entity connection t and the relationshipi Determining the attention weight of the adjacent connection relationship based on the semantic relevance to the target connection relationship;
[0024] Among them, the relationship r i The semantic relevance to the target connection relation is determined by the target connection relation and the relation r i The number of identical entities connected together is determined by the ratio of the number of all entities connected to each.
[0025] In some embodiments, determining the second entity code by using the temporal semantic perception and the first entity code includes:
[0026] Determine periodic time vectors and non-periodic time vectors;
[0027] The periodic time vector and the non-periodic time vector are added to the first entity code to obtain the second entity code.
[0028] In some embodiments, aggregating the second entity codes under the multiple historical timestamps across time to obtain dynamic evolution information of the candidate entity within a preset time range includes:
[0029] Determine the degree of correlation between the relationship of the candidate entity connection at the historical timestamp and the target connection relationship at the predicted timestamp;
[0030] Setting the degree of correlation as a weight coefficient;
[0031] The candidate entities at different timestamps are dynamically embedded and weighted according to the weight coefficients to obtain dynamic evolution information of the candidate entities within a preset time range.
[0032] To achieve the above purpose, another aspect of the embodiment of the present application provides a temporal knowledge graph completion device under an extrapolation setting, the device comprising:
[0033] An acquisition module, used to acquire a knowledge graph to be predicted, wherein the knowledge graph to be predicted includes missing events to be predicted and target connection relationships;
[0034] An input module, used for inputting the knowledge graph to be predicted into the relational time-aware entity representation learning model to obtain the prediction result of the missing event;
[0035] A determination module, used to determine the complete event of the knowledge graph to be predicted according to the prediction result of the missing event;
[0036] Among them, the relational time-aware entity representation learning model is obtained through training based on graph neural network, time semantic perception and cross-time aggregation, and the graph neural network is used to learn the feature representation under the target connection relationship.
[0037] To achieve the above objective, another aspect of an embodiment of the present application provides an electronic device, the electronic device comprising a memory and a processor, the memory storing a computer program, and the processor implementing the above method when executing the computer program.
[0038] To achieve the above objective, another aspect of an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and the computer program implements the above method when executed by a processor.
[0039] The embodiments of the present application include at least the following beneficial effects:
[0040] The present application provides a method and device, electronic device and storage medium for completing a temporal knowledge graph under an extrapolation setting. The scheme obtains a knowledge graph to be predicted, which includes missing events to be predicted and target connection relationships; inputs the knowledge graph to be predicted into a relational time-aware entity representation learning model to obtain a prediction result of the missing event; determines the complete event of the knowledge graph to be predicted based on the prediction result of the missing event; wherein the relational time-aware entity representation learning model is obtained through training based on a graph neural network, temporal semantic perception and cross-time aggregation, and the graph neural network is used to learn feature representations under target connection relationships. In an embodiment of the present application, missing events are predicted by a relational time-aware entity representation learning model. Since the relational time-aware entity representation learning model is obtained through training based on a graph neural network, temporal semantic perception and cross-time aggregation, it can fully capture the relationship information between entities, learn entity embedding specific to the relationship, and further learn the evolution law of entities in time. By combining the association relationship and the evolution law, the prediction accuracy of missing events can be improved.
[0041] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:
[0043] Figure 1 is a flowchart of a temporal knowledge graph completion method under an extrapolation setting provided by some embodiments of the present application;
[0044] Figure 2 is another flow chart of a temporal knowledge graph completion method under an extrapolation setting provided in some embodiments of the present application;
[0045] Figure 3 It is a schematic block diagram of modules of a temporal knowledge graph completion device under an extrapolation setting provided in some embodiments of the present application;
[0046] Figure 4 This is a schematic diagram of the hardware structure of the temporal knowledge graph completion under the extrapolation setting provided in some embodiments of the present application. DETAILED DESCRIPTION
[0047] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the reference to "embodiment" in this article means that the specific features, structures or characteristics described in conjunction with the embodiment may be included in at least one embodiment of the present application. The appearance of this phrase in various positions in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the embodiments of the present application. They are only examples of devices and methods consistent with some aspects of the embodiments of the present application as detailed in the attached claims.
[0048] It is understood that the terms "first", "second", etc. used in this application can be used to describe various concepts in this article, but unless otherwise specified, these concepts are not limited by these terms. These terms are only used to distinguish one concept from another concept. For example, without departing from the scope of the embodiment of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the words "if" and "if" as used herein can be interpreted as "at the time of" or "when" or "in response to determination".
[0049] The terms "at least one", "multiple", "each", "any", etc. used in this application, at least one includes one, two or more, multiple includes two or more, each refers to each of the corresponding multiple, and any refers to any one of the multiple.
[0050] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0051] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0052] In order to make the inventive concept of the present application easy to understand, before describing the embodiments of the present application in detail, the English abbreviations (terms) / related concepts involved in the embodiments of the present application are first described. The English abbreviations (terms) / related concepts involved in the embodiments of the present application are subject to the following explanations.
[0053] TKGC: TKGC stands for Temporal Knowledge Graph Completion, which refers to temporal knowledge graph completion, also known as temporal knowledge graph completion. TKGC is a method for processing and completing temporal knowledge graphs (TKGs). Temporal knowledge graphs are a data representation that extends traditional knowledge graphs and are used to describe the temporal relationships between entities, relationships, and events. Traditional knowledge graphs mainly focus on static relationships between entities, while temporal knowledge graphs introduce a time dimension that can describe the changes in entities and relationships at different time points.
[0054] RGCN: RGCN stands for Relation Graph Convolutional Network, which refers to the relational graph convolutional network. The relational graph convolutional network is a neural network architecture used to process relational graphs (i.e., knowledge graphs). RGCN captures the relational patterns in the graph through convolution operations and encodes this relational information into the embedding vector of the entity.
[0055] RReLU: RReLU stands for Randomized Leaky Rectified Linear Unit, which is an activation function. It is a variant of Leaky ReLU (LReLU). Leaky ReLU is an improved ReLU (Rectified Linear Unit) activation function.
[0056] Temporal Knowledge Graph Completion (TKGC) in the extrapolation setting aims to predict missing entities in the future based on facts. Existing studies mainly use recent historical subgraphs to encode entities and relations, however, these methods often ignore the dependence of entity encoding on relational information and neglect the importance of temporal numerical information.
[0057] The extrapolation setting focuses on predicting entity relationships at future time points. Under the extrapolation setting, TKGC needs to handle a wider time range, including the past, present, and future. Temporal knowledge graph completion under the extrapolation setting focuses on completing missing events (subjects, relationships, "predicted objects", timestamps) in future subgraphs based on the information contained in historical subgraphs. In order to accurately predict missing information in future events, more and more research is focused on mining the evolutionary patterns of TKG historical subgraphs. This is a graph sequence modeling problem, which requires considering not only the structural information within each subgraph, but also the temporal evolution of the subgraph sequence. There are two more problems to be solved for the problem of graph sequence modeling.
[0058] 1. The dependency of entities on relationships.
[0059] Existing methods associate valid related information by aggregating subgraph structures to obtain accurate entity representations. For example, when answering the query (Ao, campaign, information to be queried, 2012), the model must first know "who is Ao", which indicates that the representation of the "Ao" entity needs to be obtained. To this end, the encoder needs to obtain information related to the entity "Ao" from historical information, such as (Ao, studying law, university, 1988), (Ao, teaching, university, 2000), (Ao, elected, middle-level cadre, 2000), (Ao, campaign, senior cadre, 2008). Most current methods learn a general entity embedding through all historical information related to "Ao", and then use the embedding to answer all queries related to the "Ao" entity, which makes the entity embedding contain too many irrelevant features when facing different queries. We only consider historical information related to the query relation (target connection relation) "election" (Ao Mou, elected, middle-level cadre, 2000) and (Ao Mou, campaigned, senior cadre, 2008), so that the encoder learns entity embeddings specific to the query relation, which will be more helpful in answering the corresponding query information.
[0060] 2. The importance of time numerical information.
[0061] The current method only considers the time dependency between each static subgraph in the temporal evolution of the subgraph sequence. The model can only know which timestamp occurs first and which timestamp occurs later, but cannot know the specific time when the event occurred, which will lead to the loss of a lot of key information. After obtaining the specific time when the past event occurred, we can obtain the following key information:
[0062] 1) The impact of a historical event on a future event can be more accurately quantified by the specific time difference between the historical event and the future event.
[0063] 2) The properties of the same entity will change at different timestamps. For example, the properties of the entity "Ao" are different at the timestamps of November 2009 and November 2017, because in November 2009, Ao served as a senior cadre; but in November 2017, Ao is no longer a senior cadre.
[0064] 3) Time numerical information contains the laws of event cycle evolution. For example, the election of senior cadres occurs once every four years. Retaining time numerical information can effectively learn the event cycle evolution pattern.
[0065] In view of this, the present application proposes a method, device, equipment and medium for completing a temporal knowledge graph under an extrapolation setting. In an embodiment of the present application, by obtaining a knowledge graph to be predicted, the knowledge graph to be predicted includes missing events to be predicted and target connection relationships; the knowledge graph to be predicted is input into a relational time-aware entity representation learning model to obtain a prediction result of the missing event; the complete event of the knowledge graph to be predicted is determined according to the prediction result of the missing event; wherein the relational time-aware entity representation learning model is obtained through training based on a graph neural network, temporal semantic perception and cross-time aggregation, and the graph neural network is used to learn feature representations under target connection relationships. In an embodiment of the present application, missing events are predicted by a relational time-aware entity representation learning model. Since the relational time-aware entity representation learning model is obtained through training based on a graph neural network, temporal semantic perception and cross-time aggregation, it can fully capture the relationship information between entities, learn relationship-specific entity embedding, and further learn the evolution law of entities in time. By combining the association relationship and the evolution law, the prediction accuracy of missing events can be improved.
[0066] The temporal knowledge graph completion method under the extrapolation setting provided in the embodiment of the present application relates to the field of artificial intelligence technology. It can be applied to the electronic device provided in the embodiment of the present application. The electronic device can be a terminal or a server.
[0067] In some embodiments, the terminal may be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, a car terminal, etc., but is not limited thereto.
[0068] The server side can be configured as an independent physical server, or as a server cluster or distributed system consisting of multiple physical servers. It can also be configured as a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The server can also be a node server in the blockchain network.
[0069] The present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.
[0070] The following will describe in detail the implementation steps of a temporal knowledge graph completion method under an extrapolation setting provided by an embodiment of the present application in conjunction with the accompanying drawings.
[0071] Please refer to Figure 1 , Figure 1 A flowchart of a temporal knowledge graph completion method under an extrapolation setting provided for some embodiments of the present application. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and, although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that here.
[0072] The method of the embodiment of the present application comprises the following steps:
[0073] Step 101: Obtain a knowledge graph to be predicted, where the knowledge graph to be predicted includes missing events to be predicted and target connection relationships;
[0074] Step 102: Input the knowledge graph to be predicted into the relational time-aware entity representation learning model to obtain the prediction result of the missing event;
[0075] Step 103: Determine the complete events of the knowledge graph to be predicted according to the prediction results of the missing events;
[0076] Among them, the relational time-aware entity representation learning model is obtained through training based on graph neural network, temporal semantic perception and cross-time aggregation. The graph neural network is used to learn feature representation under the target connection relationship.
[0077] In steps 101 to 103 shown in the embodiment of the present application, missing events are predicted through a relational time-aware entity representation learning model. Since the relational time-aware entity representation learning model is obtained through training based on graph neural networks, time semantic awareness, and cross-time aggregation, it is able to fully capture the relational information of the associations between entities, learn relation-specific entity embeddings, and further learn the evolution laws of entities over time. By combining association relationships and evolution laws, the prediction accuracy of missing events can be improved.
[0078] In step 101, a knowledge graph to be predicted is obtained, where the knowledge graph to be predicted includes missing events to be predicted and target connection relationships.
[0079] The knowledge graph to be predicted refers to the knowledge graph that needs to be predicted and queried, including some missing information that needs to be completed.
[0080] Typically, in a temporal knowledge graph, each fact can be represented by a quadruple (s, r, o, t). Let ε, R, and T represent a finite set of entities, relationship types, and timestamps, respectively, where s∈ε is the subject entity, o∈ε is the object entity, and r∈R is the relationship between s and o occurring at timestamp t∈T. The goal of TKGC in the extrapolation setting is to obtain a known historical snapshot {G0,G1,...,G tq-1}, predict query q = (s, r q , "prediction object", t q ) or q=(“prediction object”, r q ,o,t q ). Typically, the inverse of each quadruple is added to the dataset, so all subject entity prediction problems q = (“predicted object”, r q ,o,t q ) is transformed into the object entity prediction problem q = (s, r q , "prediction object", t q ).
[0081] The knowledge graph to be predicted can be expressed as q = (s, r q , "prediction object", t q ), where the missing event to be predicted is represented as the “prediction object” and the target connection relationship can be represented as r q .
[0082] Exemplarily, the knowledge graph to be predicted can be expressed as q=(Ao, election, "prediction object", 2025), where "prediction object" is the information we need to predict and is also the object entity, the subject entity is Ao, the timestamp is 2025, and the target connection relationship is the election, that is, the relationship between Ao and the information to be predicted that occurs at the timestamp 2025.
[0083] This application obtains the knowledge graph to be predicted, which includes the missing events to be predicted and the target connection relationship, to provide data support for subsequent predictions.
[0084] In step 102, the acquired knowledge graph to be predicted is input into the relational time-aware entity representation learning model to obtain the prediction result of the missing event; wherein, the relational time-aware entity representation learning model is obtained through training based on graph neural network, time semantic perception and cross-time aggregation, and the graph neural network is used to learn the feature representation under the target connection relationship.
[0085] Relation-Time Aware Entity Representation Learning (RTER) is an entity representation learning method that combines relational and temporal information. In knowledge graphs, the relationships between entities usually have temporal properties, that is, these relationships may change at different time points. The goal of RTER is to learn entity representations that can capture these temporal dynamics.
[0086] The RTER method usually includes the following key steps:
[0087] Temporal embedding: embedding temporal information into entity representations. This can be achieved in many ways, such as converting timestamps into vector representations, or using time-dependent functions to adjust entity representations.
[0088] Relationship modeling: Modeling relationships between entities while taking into account temporal information. This may involve learning the temporal dependencies of relationships, or modeling how relationships change over time.
[0089] Joint learning: learning entity representation and relation representation simultaneously so that the entity representation can reflect their relations at different time points.
[0090] Temporal dynamic modeling: Capturing how entities and relationships change over time, which may involve analysis of historical data to predict future states.
[0091] Optimization goal: Define an optimization goal to minimize the prediction error or maximize some performance metric, such as link prediction accuracy.
[0092] RTER is obtained through training based on graph neural network, temporal semantic perception and cross-temporal aggregation. Graph neural network is used to learn feature representation under target connection relationship.
[0093] Among them, graph neural networks are a type of neural network model specifically used to process graph structured data. They extract feature representations on the graph by learning the relationships between nodes.
[0094] The graph neural network can be a relation graph convolutional network (RGCN) or a relation-aware attention mechanism (RAM), both of which can be used to process graph data. This application does not limit the type of graph neural network.
[0095] RGCN is a neural network architecture for processing relational graphs (i.e., knowledge graphs). RGCN captures relational patterns in graphs through convolution operations and encodes this relational information into the embedding vectors of entities.
[0096] In some implementations, the relational time-aware entity representation learning model is trained by the following steps:
[0097] Obtain a sub-knowledge graph, where the sub-knowledge graph is used to represent the connection relationship graph of candidate entities of the missing event at multiple historical timestamps;
[0098] Input the sub-knowledge graph into the graph neural network to obtain the first entity encoding, which is used to characterize the feature representation of the candidate entity under the target connection relationship;
[0099] Determine a second entity code through time semantic perception and the first entity code, the second entity code is used to characterize a feature representation of the candidate entity including time perception under the target connection relationship;
[0100] Aggregating the second entity codes under multiple historical timestamps across time to obtain dynamic evolution information of the candidate entity within a preset time range, wherein the preset time range includes multiple historical timestamps;
[0101] The dynamic evolution information and target connectivity relations are input into the decoder and trained based on the scoring function to determine the prediction results of missing events.
[0102] Exemplarily, according to the above example, the candidate entity of the missing event ("prediction object") may be a department-level cadre, a mid-level cadre, or a senior cadre, and the multiple historical timestamps may be time points before 2025, for example, from 2005 to 2024. Multiple connection relationship graphs (sub-knowledge graphs) of the candidate entities of the missing event between 2005 and 2024 may be obtained.
[0103] These multiple connection relationship graphs are input into the graph neural network to obtain a first entity encoding, wherein the first entity encoding is used to characterize the feature representation of the candidate entity under the target connection relationship.
[0104] Optionally, multiple connection relationship graphs may be input into RGCN to obtain a first entity code.
[0105] Optionally, multiple connection relationship graphs can be input into the relationship-aware attention mechanism to obtain the first entity encoding.
[0106] In some embodiments of the present application, multiple connection relationship graphs are input into RGCN to obtain the first entity code: i The semantic relevance of the target connection relationship determines the weight parameter of the adjacent connection relationship, where the relationship r i Represents the connection relationship between the target connection relationship and the candidate entity; determines the similarity relationship according to the weight parameter, and the similarity relationship is used to characterize the connection relationship that is semantically similar to the target connection relationship; aggregates the entities connected with the similarity relationship based on the weight parameter to obtain the first entity code.
[0107] For example, in order to obtain the feature representation (first entity encoding) of the candidate entity u (e.g., department-level cadres, mid-level cadres, or senior cadres) under the target connection relationship, that is, the embedding of the candidate entity u under the relationship r, where r can also be expressed as r q , refers to the timestamp t q (e.g., 2005) under the target connection relationship (e.g., campaign).
[0108] We can use the relation-aware attention mechanism to find the relationship r between the relation r and the entity u. i The semantic correlation between neighbors is used to assign weights and then aggregate them.
[0109] For example, the overall framework of embedded coding can adopt RGCN, and the ω-layer RGCN can be used for encoding. The specific formula is as follows:
[0110]
[0111] Where f(·) is the RReLU activation function, N u,t is the neighborhood set of entity u in the static subgraph at timestamp t, is the relation-aware attention weight, and is the weight parameter, is the encoding of entity o after l layers of RGCN. Entity o is the neighbor node connected to entity u. is the encoding of entity u after l layers of RGCN, and t represents timestamp t.
[0112] r i,t To predict the relationship r connected to the subject entity s in the query q i In the embedded representation of timestamp t, the specific encoding form is as follows:
[0113]
[0114] Among them, pooling represents the mean pooling operation, Represents the relationship r at timestamp t i The initial embedding set of connected entities, r i is the initial relation embedding, and || represents vector concatenation.
[0115] It should be understood that q is the timestamp to be predicted. The corresponding static snapshot is missing some entities. We only know the relationship r i , so for the relationship r i At timestamp t q The embedded representation of can consider the information of the latest historical timestamp and can be expressed as follows:
[0116]
[0117] in, For the relationship i At timestamp t q The initial embedding of the known partially connected entities, t q -1 indicates timestamp t q The previous timestamp of , GRU is a gated recurrent unit.
[0118] In some embodiments of the present application, the weight parameter of the adjacent connection relationship is determined according to the semantic relevance between the target connection relationship and the connection relationship between the candidate entities, which can be: embedding the connection relationship of the subject entity in the target connection relationship into r i,t , the connection relationship set R of the main entity at timestamp t s,t , the non-target connection relation embedding r of the candidate entity connection t and the relationship i The semantic relevance of the target connection relationship determines the attention weight of the adjacent connection relationship; among them, the relationship r i The semantic relevance of the target connection relation is determined by the target connection relation and relation r i The number of identical entities connected together is determined by the ratio of the number of all entities connected to each.
[0119] Learning relation-aware static embeddings of entities requires perceiving relations that are semantically similar to relation r (e.g., election), and focusing on aggregating entities connected by these relations. In equation (1), the normalized attention mechanism is used. To allocate attention weights (i.e., weight parameters of adjacent connection relationships), where The calculation method is as follows:
[0120]
[0121] In formula (4), R s,t represents the set of relationships connected to the subject entity s at timestamp t, fc is the fully connected layer, || represents vector concatenation, r i,t and r t is the relation embedding learned by equation (2), which contains the information of the interaction between the relation and the entity. t It is other relationships connected to the candidate entity u (such as failed, appointed, etc.). is the relational semantic weight, which is used to evaluate the target connection relation r and relation r i The semantic relevance of Used to evaluate the target connection relationship r and relationship r j The semantic relevance of j,t Represents the relationship r connected to the main entity s j The embedded representation at timestamp t.
[0122] By calculating the relationship r and r i The semantic weight of the relationship is calculated by the ratio of the number of entities that are commonly connected to the total number of entities that are individually connected, which can be expressed as formula (5).
[0123]
[0124] In formula (5), N r,t , Respectively represent the number of entities connected to relation r and the number of entities connected to relation r in the static subgraph at timestamp t. i The number of connected entities. The calculated semantic weight of the relationship The larger the value, the closer the relationship between the two relations is and the stronger the semantic relevance is.
[0125] In some embodiments, determining the second entity code through time semantic perception and the first entity code may be to determine a periodic time vector and a non-periodic time vector; adding the periodic time vector and the non-periodic time vector to the first entity code to obtain the second entity code.
[0126] Time information can reflect the periodicity and non-periodicity of events. For example, the election of senior cadres is a periodicity, and the birth and death of a person are non-periodic. Therefore, it is meaningful to consider the periodicity and non-periodicity of historical facts.
[0127] The periodic time vector and the non-periodic time vector can be designed separately, as shown below:
[0128]
[0129] Among them, tq -t is the difference between the timestamps of the historical event and the predicted event. The size of this difference can accurately quantify the impact of the historical event on future events. and are d-dimensional periodic and non-periodic vectors, β t , γ t ,φ c ,φ t is a learnable parameter.
[0130] Adding the periodic time vector and the non-periodic time vector to the relation-specific static entity embedding (the first entity encoding) yields the second entity encoding. This process can be expressed as:
[0131]
[0132] in, is the code (first entity code) of the candidate entity u obtained by RGCN encoding at the ω layer obtained by equation (1). After the above processing, the time-aware entity code can be obtained The entity encoding is still static and cannot reflect the dynamic evolution of the candidate entity u in the time dimension.
[0133] The information of different historical snapshots can be combined to obtain the final candidate entity u, which is specific to the time-aware dynamic entity encoding of the relation r.
[0134] In some embodiments of the present application, the second entity codes under multiple historical timestamps are aggregated across time to obtain dynamic evolution information of candidate entities within a preset time range, which can be to determine the degree of correlation between the relationship between the candidate entity connection under the historical timestamp and the target connection relationship under the predicted timestamp; set the degree of correlation as a weight coefficient, and then dynamically embed and weight the candidate entities under different timestamps according to the weight coefficient to obtain the dynamic evolution information of the candidate entity within the preset time range.
[0135] For example, in the prediction query q=(s, r q , "prediction object", t q ), it is necessary to consider [t q-len , t q-1 ] within the historical range of snapshot information, t q-1 Represents the timestamp t q The last timestamp, len is the preset time length, t q-len Represents the timestamp t q The last len timestamps.
[0136] Not all historical snapshots are relevant to the query. In order to ignore irrelevant historical snapshots to improve prediction accuracy, the entity u at timestamp t i The embeddings of all the relations connected under are averaged and pooled as the overall relation proxy, and then the overall relation proxy and the relation embedding r are calculated. q,t The similarity of the timestamp t i The relationship and predicted relationship of entity u in the historical snapshot The degree of relevance, Indicates that at timestamp t q The predicted relationship under q .
[0137] This can be expressed as:
[0138]
[0139] in, Indicates that at timestamp t i Next, the embedding set of all relations connected to entity u is: Indicates that at timestamp t q Next q The embedding representation of Relation embedding representing the connection between entity u With entity u at historical time t i The similarity of the overall relationship agent.
[0140] Will As the weight coefficient, the dynamic embeddings of entities at different timestamps are weighted together to obtain the final entity embedding, which can be specifically expressed as:
[0141]
[0142] in, It reflects the dynamic evolution of the candidate entity u in the recent time range of len (dynamic entity coding), Indicates that at timestamp t q Next, the embedding set of all relations connected to entity u is: refers to the candidate entity u being specific to the relation r q Time-aware entity encoding under
[0143] Afterwards, the dynamic evolution information (dynamic entity encoding) and target connection relations are input into the decoder and trained based on the scoring function to determine the prediction results of missing events.
[0144] For example, ConvTransE can be used as the scoring function, and the model can be trained as a classification problem. Each prediction result (s, r q ,u,tq ) is expressed as follows:
[0145]
[0146] If the classification is correct, z c The value of will be 1, otherwise it is 0. The training goal is to minimize the total loss for all queries, Represents subject s at timestamp t q Specific to relation q Dynamic entity encoding, Represents the relationship q At timestamp t q The embedding representation of . , σ represents the sigmoid activation function. L is the loss function.
[0147] The above embodiment introduces the training process of the relational time-aware entity representation learning model. By inputting the knowledge graph to be predicted into the relational time-aware entity representation learning model, the prediction result of the missing event can be obtained.
[0148] The embodiment of the present application obtains the prediction results of missing events by inputting the knowledge graph to be predicted into the relational time-aware entity representation learning model, and predicts the missing events through the relational time-aware entity representation learning model, which can improve the accuracy of the prediction.
[0149] In step 103, the complete events of the knowledge graph to be predicted can be determined based on the prediction results of the missing events. The prediction results of the missing events are added to the query knowledge graph, and the complete events of the knowledge graph to be predicted can be obtained.
[0150] Combine the following Figure 2 , the method provided in the embodiments of the present application is further described.
[0151] Figure 2 This is another flow chart of the temporal knowledge graph completion method under the extrapolation setting provided by some embodiments of the present application. Figure 2 In the process, the sub-knowledge graph is input into the relation-aware attention mechanism. The relation-aware attention mechanism can aggregate the relations with similar semantics and the entities connected by the relations in the sub-graph to obtain the relation-specific static embedding representation of the candidate entity. Then, the relation-specific static embedding representation output by the relation-aware attention mechanism is combined with the time information output by the temporal semantic module and input into the cross-time aggregation module. The historical sub-graph sequence is evolutionarily encoded in chronological order, and then the score is calculated by the decoder. Finally, the temporal change law of the event is learned, and the final relation-specific dynamic entity embedding representation is obtained, so as to obtain the prediction result of the missing event.
[0152] The implementation scheme of the temporal knowledge graph completion device under the extrapolation setting provided in the embodiments of the present application will be described in detail below with reference to the accompanying drawings.
[0153] For the temporal knowledge graph completion method under the extrapolation setting provided in the above embodiment, the embodiment of the present application also provides a temporal knowledge graph completion device under the extrapolation setting, which is used to implement the above method, such as Figure 3 As shown, Figure 3 : is a schematic block diagram of a module of a temporal knowledge graph completion device 300 under an extrapolation setting according to an embodiment of the present application. The temporal knowledge graph completion device 300 under an extrapolation setting includes:
[0154] An acquisition module 301 is used to acquire a knowledge graph to be predicted, where the knowledge graph to be predicted includes missing events to be predicted and target connection relationships;
[0155] An input module 302 is used to input the knowledge graph to be predicted into the relational time-aware entity representation learning model to obtain the prediction result of the missing event;
[0156] A determination module 303 is used to determine the complete events of the knowledge graph to be predicted according to the prediction results of the missing events;
[0157] Among them, the relational time-aware entity representation learning model is obtained through training based on graph neural network, temporal semantic perception and cross-time aggregation. The graph neural network is used to learn feature representation under the target connection relationship.
[0158] It can be understood that the contents of the above method embodiments are all applicable to the present device embodiments, the functions specifically implemented by the present device embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0159] Reference Figure 4 The embodiment of the present application further provides an electronic device, the electronic device 400 includes a memory 401, one or more processors 402 ( Figure 4 Only one is shown) and a computer program stored in the memory 401 and executable on the processor 402. Wherein: the memory 401 is used to store software programs and units, and the processor 402 executes various functional applications and data processing by running the software programs and units stored in the memory to obtain the resources corresponding to the above-mentioned preset events. Optionally, the processor 402 implements the temporal knowledge graph completion method under the above-mentioned extrapolation setting by running the above-mentioned computer program stored in the memory 401.
[0160] The memory, as a non-transitory computer-readable medium, can be used to store non-transitory software programs and non-transitory computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transitory memory, such as at least one disk storage device, a flash memory device, or other non-transitory solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via a network.
[0161] It can be understood that the contents of the above method embodiments are all applicable to the electronic device embodiment, the functions specifically implemented by the electronic device embodiment are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0162] An embodiment of the present application also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the temporal knowledge graph completion method under the above-mentioned extrapolation setting.
[0163] It can be understood that the contents of the above method embodiments are all applicable to the present storage medium embodiments, the functions specifically implemented by the present storage medium embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0164] An embodiment of the present application also provides a computer program product, which includes a computer program. When the computer program is executed by one or more processors, it can implement the steps of the temporal knowledge graph completion method under the above-mentioned extrapolation setting.
[0165] It can be understood that the contents of the above method embodiments are all applicable to the present computer program product, the functions specifically implemented by the present computer program product embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0166] The temporal knowledge graph completion method, device, electronic device, medium and computer program product under the extrapolation setting provided in the embodiment of the present application, by obtaining the knowledge graph to be predicted, the knowledge graph to be predicted includes the missing events to be predicted and the predicted relations; inputting the knowledge graph to be predicted into the relational time-aware entity representation learning model to obtain the prediction results of the missing events; determining the complete events of the knowledge graph to be predicted according to the prediction results of the missing events; wherein the relational time-aware entity representation learning model is obtained through training based on graph neural network, temporal semantic perception and cross-time aggregation, and the graph neural network is used to learn the feature representation under the predicted relations. In the embodiment of the present application, the missing events are predicted by the relational time-aware entity representation learning model. Since the relational time-aware entity representation learning model is obtained through training based on graph neural network, temporal semantic perception and cross-time aggregation, it can fully capture the relational information of the association between entities, learn the entity embedding specific to the relationship, and further learn the evolution law of the entity in time. By combining the association relationship and the evolution law, the prediction accuracy of the missing events can be improved.
[0167] The temporal knowledge graph completion method, device, electronic device, medium and computer program product under the extrapolation setting provided in the embodiments of the present application can learn entity embeddings specific to the query relationship when predicting queries, thereby effectively avoiding interference from irrelevant information; by adding time numerical information to the entity embedding, it is possible to more effectively capture the evolution law of events in time series, thereby improving prediction accuracy.
[0168] The embodiments described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0169] Although specific embodiments are described herein, those of ordinary skill in the art will recognize that many other modifications or alternative embodiments are also within the scope of the present disclosure. For example, any of the functions and / or processing capabilities described in conjunction with a particular device or component may be performed by any other device or component. In addition, although various exemplary implementations and architectures have been described according to embodiments of the present disclosure, those of ordinary skill in the art will recognize that many other modifications to the exemplary implementations and architectures described herein are also within the scope of the present disclosure.
[0170] Some aspects of the present disclosure are described above with reference to the block diagram and flow chart of the system, method, system and / or computer program product according to the exemplary embodiments.It should be understood that the combination of one or more blocks in the block diagram and the flow chart and the blocks in the block diagram and the flow chart can be realized by executing computer executable program instructions respectively.Equally, according to some embodiments, some blocks in the block diagram and the flow chart may not need to be executed in the order shown, or may not need to be executed in full.In addition, additional components and / or operations beyond those components and / or operations shown in the blocks in the block diagram and the flow chart may be present in certain embodiments.
[0171] Therefore, the blocks in the block diagrams and flow charts support the combination of devices for performing the specified functions, the combination of elements or steps for performing the specified functions, and the program instruction devices for performing the specified functions. It should also be understood that each block in the block diagrams and flow charts and the combination of blocks in the block diagrams and flow charts can be implemented by a special-purpose hardware computer system or a combination of special-purpose hardware and computer instructions that performs a specific function, element or step.
[0172] The program modules, applications, etc. described herein may include one or more software components, including, for example, software objects, methods, data structures, etc. Each such software component may include computer-executable instructions that, in response to execution, cause at least a portion of the functionality described herein (e.g., one or more operations of the illustrative methods described herein) to be performed.
[0173] Software components can be encoded with any of various programming languages. An exemplary programming language can be a low-level programming language, such as an assembly language associated with a specific hardware architecture and / or an operating system platform. The software component comprising assembly language instructions may need to be converted to executable machine code by an assembler before being executed by hardware architecture and / or platform. Another exemplary programming language can be a higher-level programming language, which can be transplanted across multiple architectures. The software component comprising a higher-level programming language may need to be converted to an intermediate representation by an interpreter or a compiler before execution. Other examples of programming languages include but are not limited to macro languages, shells or command languages, job control languages, scripting languages, database queries or search languages or report writing languages. In one or more exemplary embodiments, the software component comprising the instruction of one of the above-mentioned programming language examples can be directly executed by an operating system or other software components, without first being converted into another form.
[0174] Software components may be stored as files or other data storage structures. Software components of similar type or related functions may be stored together, such as in a specific directory, folder, or library. Software components may be static (e.g., preset or fixed) or dynamic (e.g., created or modified at execution time).
[0175] The embodiments of the present application are described in detail above in conjunction with the accompanying drawings, but the present application is not limited to the above embodiments, and various changes can be made within the knowledge scope of ordinary technicians in the relevant technical field without departing from the purpose of the present application.
Claims
1. A temporal knowledge graph completion method under extrapolation setting, characterized in that: The following steps are involved: Obtaining a knowledge graph to be predicted, wherein the knowledge graph to be predicted includes missing events to be predicted and target connection relationships; Inputting the knowledge graph to be predicted into a relational time-aware entity representation learning model to obtain a prediction result of the missing event; Determine the complete event of the knowledge graph to be predicted according to the prediction result of the missing event; Among them, the relational time-aware entity representation learning model is obtained through training based on graph neural network, time semantic perception and cross-time aggregation, and the graph neural network is used to learn the feature representation under the target connection relationship.
2. The temporal knowledge graph completion method under extrapolation setting according to claim 1, characterized in that: The relational time-aware entity representation learning model is trained through the following steps: Obtaining a sub-knowledge graph, where the sub-knowledge graph is used to represent a connection relationship graph of candidate entities of the missing event at multiple historical timestamps; Inputting the sub-knowledge graph into the graph neural network to obtain a first entity code, where the first entity code is used to characterize a feature representation of the candidate entity under the target connection relationship; Determining a second entity code by using the time semantic perception and the first entity code, wherein the second entity code is used to characterize a feature representation of the candidate entity under the target connection relationship including time perception; Aggregating the second entity codes under the multiple historical timestamps across time to obtain dynamic evolution information of the candidate entity within a preset time range, wherein the preset time range includes the multiple historical timestamps; The dynamic evolution information and the target connection relationship are input into a decoder and trained based on a scoring function to determine a prediction result of a missing event.
3. The temporal knowledge graph completion method under extrapolation setting according to claim 2 is characterized in that: The step of inputting the sub-knowledge graph into the graph neural network to obtain a first entity encoding includes: The sub-knowledge graph is input into a relational graph convolutional network to obtain the first entity encoding.
4. The temporal knowledge graph completion method under extrapolation setting according to claim 3 is characterized in that: The step of inputting the sub-knowledge graph into a relational graph convolutional network to obtain the first entity encoding includes: According to the relationship r i The semantic relevance of the target connection relationship determines the weight parameter of the adjacent connection relationship, wherein the relationship r i Indicates the connection relationship between the target connection relationship and the candidate entity; Determine a similar relationship according to the weight parameter, wherein the similar relationship is used to characterize a connection relationship that is semantically similar to the target connection relationship; Entities connected with the close relationship are aggregated based on the weight parameter to obtain the first entity code.
5. The temporal knowledge graph completion method under extrapolation setting according to claim 4 is characterized in that: According to the relationship r i The semantic relevance of the target connection relationship to determine the weight parameter of the adjacent connection relationship includes: By embedding the connection relationship of the subject entity in the target connection relationship i,t , the connection relationship set R of the main entity at timestamp t s,t , the non-target connection relationship embedding r of the candidate entity connection t and the relationship i Determining the attention weight of the adjacent connection relationship based on the semantic relevance to the target connection relationship; Among them, the relationship r i The semantic relevance to the target connection relation is determined by the target connection relation and the relation r i The number of identical entities connected together is determined by the ratio of the number of all entities connected to each.
6. The temporal knowledge graph completion method under extrapolation setting according to claim 2, characterized in that: The determining the second entity code by using the temporal semantic perception and the first entity code comprises: Determine periodic time vectors and non-periodic time vectors; The periodic time vector and the non-periodic time vector are added to the first entity code to obtain the second entity code.
7. The temporal knowledge graph completion method under extrapolation setting according to claim 2, characterized in that: The step of aggregating the second entity codes under the plurality of historical timestamps across time to obtain dynamic evolution information of the candidate entity within a preset time range includes: Determine the degree of correlation between the relationship of the candidate entity connection at the historical timestamp and the target connection relationship at the predicted timestamp; Setting the degree of correlation as a weight coefficient; The candidate entities at different timestamps are dynamically embedded and weighted according to the weight coefficients to obtain dynamic evolution information of the candidate entities within a preset time range.
8. A temporal knowledge graph completion device under extrapolation setting, characterized in that: The device comprises: An acquisition module, used to acquire a knowledge graph to be predicted, wherein the knowledge graph to be predicted includes missing events to be predicted and target connection relationships; An input module, used for inputting the knowledge graph to be predicted into the relational time-aware entity representation learning model to obtain the prediction result of the missing event; A determination module, used to determine the complete event of the knowledge graph to be predicted according to the prediction result of the missing event; Among them, the relational time-aware entity representation learning model is obtained through training based on graph neural network, time semantic perception and cross-time aggregation, and the graph neural network is used to learn the feature representation under the target connection relationship.
9. An electronic device, characterized in that: The electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the temporal knowledge graph completion method under the extrapolation setting as described in any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method for completing the temporal knowledge graph under the extrapolation setting as described in any one of claims 1 to 7 is implemented.
Citation Information
Cited By
Spatial relation completion method and system based on BIM model
CN122020821A
A method and system for completing spatial relationships based on BIM models
CN122020821B