Knowledge graph completion method for online incremental learning scene

Through the generative ERC_VAE model and influence factor sampling technology, combined with the knowledge distillation method, the problem of difficulty in retaining historical knowledge in online education knowledge graphs is solved, and the efficient learning and representation improvement of the knowledge graph in dynamic changing scenarios is achieved.

CN119226523APending Publication Date: 2024-12-31BEIHANG UNIV
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411058843.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2024-03-11
Filing Date
2024-08-02
Publication Date
2024-12-31

AI Technical Summary

Technical Problem

Existing online education knowledge graph embedding methods cannot effectively retain historical knowledge when the graph structure or content changes, resulting in catastrophic forgetting problems, and mainstream offline training methods require a lot of time and resources to retrain entities, relationships, and triples.

Method used

A generative ERC_VAE model for online incremental learning scenarios is proposed, combining the empirical playback method and knowledge distillation method based on influence factor sampling, and the smooth transition and history of the knowledge graph are realized through transfer learning and generative model sampling triplets. Effective retention of knowledge.

Benefits of technology

It improves the online learning effect of knowledge graphs in dynamic changing scenarios, reduces training time and resource requirements, avoids catastrophic forgetting problems, and improves the representation learning performance of knowledge graphs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119226523A_ABST
    Figure CN119226523A_ABST
Patent Text Reader

Abstract

The invention discloses a knowledge graph completion method for an online incremental learning scene, and the method comprises the steps: training an original knowledge graph in an online education platform to obtain a reference knowledge graph, representing entities and relationships in the reference knowledge graph through numeralization, and mapping the entities and relationships to a low-dimensional vector space; secondly, performing experience playback sampling processing on the original knowledge graph and the continuously input incremental knowledge graph based on influence factors; and finally, obtaining representations of entities and relationships of incomplete triads from the incremental knowledge graph, sorting candidate entities according to the size of an energy function to obtain complemented sequence data, and supplementing the complemented sequence data into an online education platform to obtain a complemented knowledge graph. The knowledge graph completion method aims to alleviate the problem of disastrous forgetting, is helpful to better adapt to the dynamic change requirement of the knowledge graph, and improves the online learning effect of the knowledge graph, so that the knowledge graph completion method has a wide application prospect in the field of knowledge representation learning.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a knowledge graph completion method for an online education platform, and more particularly, to a knowledge graph completion method for an online incremental learning scenario. Background Art

[0002] Knowledge graph was first proposed by Google and is used by Internet companies to organize network data from a semantic perspective, thereby providing a large knowledge base for intelligent search services. Formally, it is a knowledge carrier represented by a graph data structure, describing things in the objective world and their relationships, where nodes represent things in the objective world and edges represent the relationships between things. As knowledge graph technology has developed to date, its connotation has far exceeded the scope of semantic networks. In different application scenarios, knowledge engineering in the big data era has emerged, such as the online education knowledge graph system, which is a continuation of traditional knowledge engineering in the big data era.

[0003] In the Internet age, humans have generated an extremely large amount of data in their interactions with nature and society. These data exist in various modes such as text, pictures, audio, and video. How to enable computers to automatically read, analyze, and understand these massive, complex, and overflowing data, extract valuable information from them, and provide users with accurate information services is one of the core goals of building the next generation of information services.

[0004] As the name suggests, online education is a teaching method that uses the Internet as a medium. Through the Internet, students and teachers can carry out teaching activities even if they are thousands of miles apart. In addition, with the help of online courseware, students can also study anytime and anywhere, truly breaking the limitations of time and space. For busy working people with irregular study time, online distance education is the most convenient way to learn. At present, there are many forms of online education, and the resources of various online schools are uneven. In order to promote the healthy development of online education and significantly improve the level of infrastructure construction of online education, modern information technologies such as the Internet, big data, and artificial intelligence are more widely used in the field of education, the online education model is more perfect, and the resources and services are more abundant.

[0005] With the deepening of deep learning and graph neural network research, online education knowledge graphs as a special heterogeneous graph have gradually become a hot research field. Since knowledge graphs have rich semantic content and knowledge characteristics that can be reasoned about, knowledge graphs are composed of multiple entities and relationships, and entities are connected and transmit information through relationships. Its representation method is very effective in representing structured data and can express richer semantic information than homogeneous graphs, but its multidimensional structure and potential symbolic nature make operations based on knowledge graphs difficult.

[0006] The existence of online education knowledge graph embedding technology is to solve the above problems. Knowledge graph embedding maps entities in the knowledge graph to a continuous vector space, and regards relations as the transformation of entities in the vector space. This embedding method simplifies operations based on the knowledge graph while retaining the inherent information of the elements, providing a simple data processing foundation for a variety of knowledge graph-based technologies, such as knowledge graph completion, relationship extraction, entity classification, and entity resolution.

[0007] Although current online education knowledge graph embedding methods have achieved remarkable results, there is still a lack of effective solutions for dynamically evolving graph data. Existing embedding methods are limited by the isolated learning paradigm and cannot effectively retain historical knowledge and experience. Therefore, when the graph structure or content in the online education knowledge graph changes, the mainstream offline training method can only retrain all entities, relations, and triples, which requires a lot of training time and resources. Using only updated data for model training often leads to a significant drop in performance on old data in the online education knowledge graph, that is, the catastrophic forgetting problem. Summary of the invention

[0008] One of the purposes of the present invention is to propose an online education knowledge graph training method for online incremental learning scenarios, that is, a method for constructing a generative ERC_VAE model. During the construction process, an experience replay method based on influence factor sampling is first introduced to effectively sample and retain the triple information formed by entities and relationships in the original knowledge graph of the online education platform; then the triple information is used for the training of continuous input tasks to alleviate the technical problem of catastrophic forgetting in the knowledge graph; finally, an online education knowledge graph representation learning model for online incremental learning scenarios is obtained, referred to as a generative ERC_VAE model.

[0009] The second purpose of the present invention is to propose a knowledge graph completion method for online incremental learning scenarios, which is to introduce a generative ERC_VAE model into the online education knowledge graph to complete the benchmark knowledge graph. In the use scenario of the online education platform, by means of embedding migration, new elements are introduced into the new task using existing entities, and the knowledge learned by the teacher model is transferred to the student model according to the knowledge distillation method, so that the model can learn new knowledge while gaining experience in historical tasks. This achieves the goal of smooth transition from old knowledge to new tasks. In addition, by adopting a method of sampling triples based on a generative model, a generative model is introduced to capture the probability distribution of triplets in the historical graph to improve the knowledge distillation strategy and promote a smooth transition between historical embedding and current task embedding. The newly proposed incremental learning framework helps online education platforms better adapt to the needs of dynamic changes in graph structures in knowledge graphs, improves the online learning effect of online education knowledge graphs, and thus has broad application prospects in the field of knowledge representation learning on online education platforms.

[0010] The technical effects achieved by the technical solution of the present invention are:

[0011] In the first part, by combining the VAE model with the knowledge graph representation model, the method can better capture the implicit topological information in the knowledge graph and provide more learning content for incremental learning.

[0012] In step 3 of the second part, by converting gradient information into importance information and influence factors, highly influential triples in the historical knowledge graph are identified as historical triples used in the incremental learning process (recorded as buffers), thereby improving the model's sensitivity to historical knowledge retention. In step 4, by combining the representation model with the knowledge distillation method, the information implicit in the historical parameters is distilled to the incremental task to improve the performance of knowledge graph completion in the incremental task; in step 4, through the sampling of the VAE model, additional information related to the topological structure is obtained and distilled to the incremental task to improve the performance of knowledge graph completion in the incremental task. BRIEF DESCRIPTION OF THE DRAWINGS

[0013] Figure 1 It is a flow chart of the knowledge graph completion method for online incremental learning scenarios of the present invention.

[0014] Figure 2 It is a processing flow chart for obtaining a benchmark knowledge graph in the present invention.

[0015] Figure 3 It is a flow chart of the experience playback sampling method based on impact factors in the present invention.

[0016] Figure 4 It is a flowchart of the online incremental learning method of the knowledge graph numerical representation based on the knowledge distillation method in the present invention. DETAILED DESCRIPTION

[0017] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. The various parameter demonstrations listed are only preferred embodiments of the present invention. It should be noted that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention, and these improvements and modifications should also be considered as the protection scope of the present invention.

[0018] The graph structure of an online education knowledge graph in an online education platform is denoted as MKG, and MKG=<ME,MR,MS>, wherein MKG=<ME,MR,MS> is composed of the entity set ME={E1,E2,…,E i ,…,E h ,…,E δ ,…,E |ME|}、Relation set MR={R1,R2,…,R j ,…,R r ,…,R |MR|} and triple set MS = {S1, S2, ..., S k ,…,S ζ ,…,S |MS|}constitute.

[0019] The subscript |ME| is the entity set ME={E1,E2,…,E i ,…,E h ,…,E |ME|} length.

[0020] The subscript |MR| is the relation set MR={R1,R2,…,R j ,…,R r ,…,R |MR|} length.

[0021] The subscript |MS| is the triple set MS={S1,S2,…,S k ,…,S ζ ,…,S |MS|} length.

[0022] E1 represents the first entity.

[0023] E2 represents the second entity.

[0024] E i represents the i-th entity.

[0025] E h represents the hth entity.

[0026] E δ represents the δth entity.

[0027] E ME Indicates the last entity.

[0028] For the convenience of explanation, the E δ Also called any entity. i Entity E h and entity E δ Not the same entity.

[0029] R1 represents the first relationship.

[0030] R2 represents the second relationship.

[0031] R j represents the jth relationship.

[0032] R r Represents the rth relationship.

[0033] R MR Indicates the last kind of relationship.

[0034] For the convenience of explanation, the R r Also called any relation. j With the relationship R r It's not the same kind of relationship.

[0035] S1 represents the first triple.

[0036] S2 represents the second triple.

[0037] S k represents the kth triplet.

[0038] S ζ represents the ζ-th triplet.

[0039] S MS Represents the last triple.

[0040] For the convenience of explanation, the S ζ Also called any triple. k With triple S ζ Not the same triplet.

[0041] Any triple S ζ Contains the head entity SE 头 , Relationship SR 关系 and the tail entity SE 尾 , that is, S ζ (SE 头 ,SR 关系 ,SE 尾 ). In the present invention, the head entity SE 头 With the tail entity SE 尾 can be the same entity. For example, the triple S ζ (SE 头 ,SR 关系 ,SE 尾 )=S ζ (E i ,R j ,E h ). For example, the triple S k (SE 头 ,SR 关系 ,SE 尾 )=S k (E h ,R r ,E h). To make the triples clear, we use examples. For example, course-subordinate-subject forms a triple of entity relationships in online education. For example, course-includes-knowledge points forms a triple of entity relationships in online education. For example, teacher-employment-school forms a triple of entity relationships in online education.

[0042] Part 1: Constructing the ERC-VAE knowledge graph representation learning model that integrates multiple information for online incremental learning scenarios

[0043] See also Figure 1 , Figure 2 As shown, the present invention proposes an online education knowledge graph training method for online incremental learning scenarios. First, the digital representation matrix of the training entities and training relationships of the online education knowledge graph is calculated by the TransE algorithm, and the gradient importance matrix of the training entities and training relationships is calculated based on the gradient accumulation value in the iterative training process. In addition, a generative model VAE is trained on the online education knowledge graph using the DGR method to capture the topological information of the knowledge graph. Finally, the representation matrix, the gradient importance matrix and the VAE model are combined to obtain an online education knowledge graph representation learning model for online incremental learning scenarios, referred to as the generative ERC_VAE model.

[0044] Construction step A, initialize a numerical representation for each entity and relationship in the original knowledge graph;

[0045] During the iteration process, the current iteration number is recorded as ξ, the number of rounds before ξ is recorded as ξ-1 (the previous round number), and the number of rounds after ξ is recorded as ξ+1 (the next round number). The maximum number of iteration rounds is recorded as ξ max , and max =1000.

[0046] In this invention, the original knowledge graph in the current online education platform is recorded as MKG old , and MKG old =<ME old ,MR old ,MS old >.

[0047] ME old Represents the entity set in the original knowledge graph.

[0048] MR old Represents the relationship set in the original knowledge graph.

[0049] MS old Represents the set of triples in the original knowledge graph.

[0050] In the present invention, MKGold =<ME old ,MR old ,MS old > As a training knowledge graph, denoted as MKG 训练 , and MKG 训练 =<ME 训练 ,MR 训练 ,MS 训练 >.

[0051] ME 训练 Represents the set of training entities in the training knowledge graph.

[0052] MR 训练 Represents the set of training relations in the training knowledge graph.

[0053] MS 训练 Represents the set of training triples in the training knowledge graph.

[0054] Training entity set ME 训练 The set is represented as ME 训练 ={E 训练1 ,E 训练2 ,…,E 训练i ,…,E 训练h ,…,E 训练|ME|}, the subscript training |ME| is the entity set ME 训练 Length.

[0055] E 训练1 Represents the first training entity.

[0056] E 训练2 Represents the second training entity.

[0057] E 训练i represents the i-th training entity.

[0058] E 训练h represents the hth training entity.

[0059] E 训练δ represents the δth training entity.

[0060] E 训练ME Represents the last training entity.

[0061] For the convenience of explanation, the E 训练δ Also called any training entity. Training entity E 训练i , training entity E 训练h and training entity E 训练δ Not the same training entity.

[0062] Training relation set MR 训练The set is represented as MR 训练 = {R 训练1 ,R 训练2 ,…,R 训练j ,…,R 训练r ,…,R 训练|MR|}, the subscript training |MR| is the training relation set MR 训练 Length.

[0063] R 训练1 Represents the first training relationship.

[0064] R 训练2 Represents the second training relationship.

[0065] R 训练j represents the jth training relationship.

[0066] R 训练r represents the rth training relationship.

[0067] R 训练MR Represents the last training relationship.

[0068] For the convenience of explanation, the R 训练r Also called any training relation. 训练j Relationship with training 训练r It’s not the same kind of training relationship.

[0069] Initially, ξ is assigned a value of 0 (i.e., ξ=0), and the Xavier method is used to calculate MKG 训练 =<ME 训练 ,MR 训练 ,MS 训练 >ME 训练 Initialize and assign values. ME after the assignment 训练 The digital representation matrix is ​​recorded as and The superscript T means matrix transpose.

[0070] For the training entity E 训练1 The numerical entity representation vector of .

[0071] For the training entity E 训练2 The numerical entity representation vector of .

[0072] For training entities The numerical entity representation vector of .

[0073] For the training entity E 训练ME The numerical entity representation vector of .

[0074] Initially, ξ is assigned a value of 0 (i.e., ξ=0), and the Xavier method is used to calculate MKG 训练 =<ME 训练 ,MR 训练 ,MS 训练 >MR 训练 Initialize the value, and the MR after the value assignment 训练 The digital representation matrix is ​​recorded as and The superscript T means matrix transpose.

[0075] For the training relation R 训练1 The numerical relationship representation vector of .

[0076] For the training relation R 训练2 The numerical relationship representation vector of .

[0077] For training relationship The numerical relationship representation vector of .

[0078] For the training relation R 训练MR The numerical relationship representation vector of .

[0079] In the present invention, the Xavier method used for initialization is performed with reference to the Xavier initialization method in the paper "Understanding the difficulty of training deep feedforward neural networks" in Volume 9 of the Proceedings of the Thirteenth International Conference on Artificial Intelligence and Statistics published at the PMLR conference in 2010. The authors are Xavier Glorot and Yoshua Bengio.

[0080] In step B, the TransE model is used to calculate the loss function of the training knowledge graph.

[0081] Using TransE model to analyze MKG 训练 =<ME 训练 ,MR 训练 ,MS 训练 >MS 训练 ={S 训练1 ,S 训练2 ,…,S 训练k ,…,S 训练ζ,…,S 训练|MS|}、 and Calculate the loss function and get the total loss function SS under ξ=0 ξ=0 .

[0082] Training triple set MS 训练 The set representation is MS 训练 ={S 训练1 ,S 训练2 ,…,S 训练k ,…,S 训练ζ ,…,S 训练|MS|}, the subscript training |MS| is the training triple set MS 训练 Length.

[0083] S 训练1 Represents the first training triplet.

[0084] S 训练2 Represents the second training triplet.

[0085] S 训练k represents the kth training triplet.

[0086] S 训练ζ represents the ζ-th training triplet.

[0087] S 训练MS Represents the last training triplet.

[0088] For the convenience of explanation, the S 训练ζ It is also called any training triplet. Training triplet S 训练k With the training triplet S 训练ζ Not the same training triplet.

[0089] The TransE model refers to the "Research Review of Representation Learning Methods Based on TransE" published in Volume 38, Issue 3, March 2021, written by Zhang Zhenghang et al. Section 2 of the document introduces the representation learning method based on TransE.

[0090] Construct step C to calculate the gradient of each entity according to the sum of loss functions;

[0091] Use the Autograd mechanism of the pytorch framework and follow the SS ξ=0 calculate The gradient of each training entity in is obtained

[0092] express gradient.

[0093] for The gradient calculated by summing the loss function.

[0094] for The gradient calculated by summing the loss function.

[0095] for The gradient calculated by summing the loss function.

[0096] for The gradient calculated by summing the loss function.

[0097] In the present invention, the Autograd mechanism of the pytorch framework refers to "Automatic differentiation in PyTorch" published on October 28, 2017, by Adam Paszke, Sam Gross, Soumith Chintala, Gregory Chanan, Edward Yang, Zachary D eVito, Zeming Lin, Alban Desmaison, Luca Antiga, and Adam Lerer.

[0098] Construction step D, updating the training entity representation matrix according to the entity gradient;

[0099] use renew The updated training entity numerical representation vector is obtained, denoted as

[0100] use renew The updated training entity numerical representation vector is obtained, denoted as

[0101] use renew The updated training entity numerical representation vector is obtained, denoted as

[0102] use renew The updated training entity numerical representation vector is obtained, denoted as

[0103] Use the entity's gradient pair Processing is performed to obtain the transformed entity numerical representation matrix

[0104] Construct step E, calculate the cumulative value of the gradient change of the training entity;

[0105] When ξ=0, calculate the cumulative value of the gradient change of the training entity. The cumulative value of the gradient change of the first training entity is The cumulative value of the gradient change of the second training entity The cumulative value of the gradient change of the δth training entity The cumulative value of the gradient change of the last training entity There is a corresponding The cumulative value of the training entity gradient change

[0106] Construct step F to calculate the gradient of each relation according to the sum of loss functions;

[0107] Use the Autograd mechanism of the pytorch framework and follow the SS ξ=0 calculate The gradients of each relationship in

[0108] express gradient.

[0109] for The gradient calculated by summing the loss function.

[0110] for The gradient calculated by summing the loss function.

[0111] for The gradient calculated by summing the loss function.

[0112] for The gradient calculated by summing the loss function.

[0113] Constructing step G, updating the training relation representation matrix according to the relation gradient;

[0114] use renew The updated training entity numerical representation vector is obtained, denoted as

[0115] use renew The updated training entity numerical representation vector is obtained, denoted as

[0116] use renew The updated training entity numerical representation vector is obtained, denoted as

[0117] use renew The updated training entity numerical representation vector is obtained, denoted as

[0118] Use the gradient of the relationship After processing, the transformed relationship numerical representation matrix is ​​obtained

[0119] Construct step H, calculate the cumulative value of the gradient change of the training relationship;

[0120] When ξ = 0, calculate the cumulative value of the gradient change of the training relationship. The cumulative value of the gradient change of the first training relationship is The cumulative value of the gradient change of the second training relationship The cumulative value of the gradient change of the δth training relationship The cumulative value of the gradient change of the last training relationship There is a corresponding The cumulative value of the training relationship gradient change

[0121] Construct step I, and conduct the next round of training after initialization until the maximum number of rounds is reached;

[0122] After ξ=0, the iteration round ξ is assigned a value of 1, that is, ξ=1.

[0123] When ξ=1, Assign to Assign to Repeat step B.

[0124] Construct step H and get

[0125] Until max , Assign to Assign to Repeat construction steps B to H to obtain

[0126] In order to facilitate the implementation of the gradient regularization operation of the parameter dimension in the subsequent incremental process, the cumulative value of the gradient change of the training entity and training relationship representation matrix is ​​counted and recorded as CGRE ξ ,CGRR ξ .

[0127] The cumulative value of the training entity gradient change in the current round ξ

[0128] The cumulative value of the training relation gradient change of the current round ξ

[0129] Constructing step J, calculating the entity gradient importance matrix of the training entity;

[0130] Entity Gradient Importance Matrix

[0131] Construction step K, calculate the relation gradient importance matrix of the training relation;

[0132] Relationship Gradient Importance Matrix

[0133] Build step L and train the VAE model;

[0134] Using DGR method to analyze MKG 训练 =<ME 训练 ,MR 训练 ,MS 训练 > After processing, a VAE model for training the knowledge graph is obtained. The VAE model remains unchanged during the knowledge graph completion process.

[0135] Construction step M, generating ERC-VAE model;

[0136] The VAE model is combined with OMGE 训练 and OMGR 训练 Combined with the above, a benchmark knowledge graph representation learning model is constructed, denoted as ERC-VAE.

[0137] In the present invention, the VAE model in the DGR method is based on the structure and training method of the VAE model in the DGR method of "Continual Learning of Knowledge Graph Embeddings" published on February 1, 2021. The authors are Angel Daruna, Mehul Gupta, Mohan Sridharan and Sonia Chernova.

[0138] Part 2: Knowledge graph completion for online incremental learning scenarios based on the ERC-VAE model

[0139] A knowledge graph completion method for online incremental learning scenarios of the present invention comprises the following steps:

[0140] The current moment is recorded as t. For the convenience of explanation, the moment before moment t is recorded as t-1 (referred to as the previous moment), and the moment after moment t is recorded as t+1 (referred to as the next moment).

[0141] The current knowledge graph in the online education platform is denoted as MKG t , and MKG t =<ME t ,MR t ,MS t >.

[0142] ME t Represents the set of training entities in the current knowledge graph.

[0143] MR t Represents the set of training relations in the current knowledge graph.

[0144] MS t Represents the set of training triples in the current knowledge graph.

[0145] Current entity set ME t The set is represented as The subscript ME| is the entity set ME t Length.

[0146] Represents the first entity in the current knowledge graph.

[0147] Represents the second entity in the current knowledge graph.

[0148] Represents the i-th entity in the current knowledge graph.

[0149] Represents the hth entity in the current knowledge graph.

[0150] Represents the δth entity in the current knowledge graph.

[0151] Represents the last entity in the current knowledge graph.

[0152] For the convenience of explanation, the E 训练δ Also called any training entity. Training entity E 训练i , training entity E 训练h and training entity E 训练δ Not the same training entity.

[0153] Current relationship set MR 训练 The set is represented as MR 训练 = {R 训练1 ,R 训练2 ,…,R 训练j ,…,R 训练r ,…,R 训练|MR|}, the subscript training |MR| is the training relation set MR 训练 Length.

[0154] R 训练1 Represents the first training relationship.

[0155] R 训练2 Represents the second training relationship.

[0156] R 训练j represents the jth training relationship.

[0157] R 训练r represents the rth training relationship.

[0158] R 训练MR Represents the last training relationship.

[0159] For the convenience of explanation, the R 训练r Also called any training relation. 训练j Relationship with training 训练r It’s not the same kind of training relationship.

[0160] Current triple set MS 训练 The set representation is MS 训练 ={S 训练1 ,S 训练2 ,…,S 训练k ,…,S 训练ζ ,…,S 训练|MS|}, the subscript training |MS| is the training triple set MS 训练 Length.

[0161] S 训练1 Represents the first training triplet.

[0162] S 训练2 Represents the second training triplet.

[0163] S 训练k represents the kth training triplet.

[0164] S 训练ζ represents the ζ-th training triplet.

[0165] S 训练MS Represents the last training triplet.

[0166] For the convenience of explanation, the S 训练ζ It is also called any training triplet. Training triplet S 训练k With the training triplet S 训练ζ Not the same training triplet.

[0167] Step 1: Initialize the online education platform and obtain the knowledge graph in the online education platform;

[0168] Initially, the time t is assigned a value of 0, that is, t=0.

[0169] The knowledge graph at time t = 0 is denoted as MKG t=0 =<ME t=0 ,MR t=0 ,MS t=0 >.

[0170] ME t=0 Represents the entity set in the knowledge graph at time t=0.

[0171] MR t=0 Represents the set of relations in the knowledge graph at time t=0.

[0172] MS t=0 Represents the set of triples in the knowledge graph at time t=0.

[0173] Step 2: Application of ERC-VAE model;

[0174] The ERC-VAE model is used to analyze MKG t=0 =<ME t=0 ,MR t=0 ,MS t=0 >Process and obtain OMGE t=0 and OMGR t=0 .

[0175] Represents the entity numerical representation matrix obtained by TransE iterative training in the knowledge graph at time t=0.

[0176] Represents the numerical representation matrix of the relationship in the knowledge graph obtained by TransE iterative training at time t=0.

[0177] OMGE t=0 Represents the entity gradient importance matrix in the knowledge graph at time t=0.

[0178] OMGR t=0 Represents the relation gradient importance matrix in the knowledge graph at time t=0.

[0179] Step 3: empirical replay sampling method based on impact factors;

[0180] See also Figure 3 As shown in Figure 2, the main research content of the knowledge graph embedding knowledge transfer method based on node importance sampling is: how to effectively sample and preserve historical triples with higher importance.

[0181] In incremental learning based on traditional convolutional neural networks and graph neural networks, there is a mainstream method to overcome catastrophic forgetting: experience replay. The main idea of ​​the experience replay method is to save important historical data in a buffer. When training a new task, the data in the buffer is used as a training set for training. After each task is trained, the experience replay algorithm samples the current data set and saves it in the buffer so that it can be added to the data set when training the next task.

[0182] At present, there is no method for using experience replay in the field of incremental learning of knowledge graphs. The present invention uses experience replay to retain the historical information of the knowledge graph and solve the catastrophic forgetting problem caused by incremental learning. The present invention samples triples according to their influence by identifying the influencing factors of entities to retain triples with greater influence on the knowledge graph. The specific implementation steps are as follows:

[0183] Step 301, calculating the entity influence factor according to the gradient importance value;

[0184] After completing the training of the ERC-VAE model, the entity gradient importance matrix OMGE is obtained t=0 , the OMGE t=0 The dimension is |ME|×l.

[0185] In addition, the OMGE t=0 It also represents the same dimension The total gradient of each parameter in .

[0186] l is the length of the entity digital representation vector.

[0187] OMGE t=0 Add each row and calculate the influence factor vector INFE t=0 .INFE t=0 is a vector of length |ME|, representing the influence factor of each entity.

[0188] Step 302, selecting the top n important entities according to the entity influence factor;

[0189] At INFE t=0 In the equation, find the smallest n elements and their corresponding entity sets, denoted as BE t=0 The gradient importance values ​​of these entities are the smallest, which means that they have not been fully trained in the previous model training and there is still knowledge that has not been captured. Therefore, in the next training process, they should be added to the graph again to consolidate the numerical representation of the entity.

[0190] Step 303, sampling triples according to the selected importance entities;

[0191] From MKG t=0 = < ME t=0 , MR t=0 , MS t=0 > in the triple set MS t=0 Find all triples that satisfy the triple structure S k (SE 头 , SR 关系 , SE 尾 ) in SE 头 In the set BE t or SE 尾 In the set BE t=0 in the triple set BS t=0 . Store the triple set BS t=0 into the buffer BF t=0 .

[0192] At the beginning, assign BF t=0 to BS t=0 .

[0193] Step 4, Online incremental learning method for numerical representation of knowledge graph based on knowledge distillation and experience replay method;

[0194] See Figure 4 As shown, the main research content of the online incremental learning method for numerical representation of knowledge graph by knowledge distillation method is: how to transfer the historical knowledge in the knowledge graph to the new task by using knowledge distillation and experience replay. That is: the numerical representation matrix learned by the knowledge graph MKG at time t = 0 t=0 and as the teacher model, learn the numerical representation matrix of the knowledge graph MKG at time t = 1 and t=1 The new model obtains the experience of the teacher model on the old task and learns new knowledge in the new model. and

[0195] The core of the experience replay task is to add the triples stored in the buffer to the incremental graph for joint training and save the new incremental graph according to the entity influence vector. The core of the knowledge distillation task is how to use historical information to initialize and regularize the parameters. Based on TransE, this method introduces the way of knowledge transfer and regularization distillation to preserve the historical knowledge in the historical knowledge graph to the greatest extent, while allowing the model to fully learn and capture the new knowledge in the new task. The specific operation steps are as follows:

[0196] Step 401, Merge the triples in the buffer with the incremental graph to construct a new graph;

[0197] The triplet BF in the buffer at time t = 0 t=0 With incremental graph MKG t=1 =<ME t=1 ,MR t=1 ,MS t=1 > The triple MS in t=1 Sets are merged to form a new triple set NMS t=1 =MS t=1 ∪BF t=0 .

[0198] Step 402, using knowledge transfer to construct new knowledge representation for new elements in the knowledge graph;

[0199] As the knowledge graph is constantly updated and growing, new entities and new relations will continue to emerge with the emergence of new triples. Learning these new elements that appear for the first time in the knowledge graph and obtaining high-quality numerical representations is crucial for online incremental learning. However, these newly emerged entities and relations are not included in any learned tasks. Therefore, it is impossible to convert the acquired knowledge into their embeddings by inheriting the learned embedding parameters.

[0200] To solve this problem, the present invention proposes a representation transfer method. The representation transfer method aims to use the learned representation to help initialize and represent these unseen entities and relations. Specifically, the representation of each unseen element is initialized by aggregating the triples related to the new element to avoid learning from scratch, thereby better transferring the acquired knowledge to the representation of new entities and relations. This method is expected to improve the efficiency of online incremental learning of knowledge graphs.

[0201] Defining NME t=1 =ME t=1 -ME t=0 is the set of newly appeared entities at time t = 1;

[0202] For a NME t=1 Entity E in δ , define NNH t=1 (E δ ) is the new element at time t = 1, which contains only the head entity E δ The set of triples, NNT t=1 (E δ ) means that the new element contained at time t = 1 is only the tail entity E δ The set of triples.

[0203] Said

[0204] Said

[0205] The method of aggregating new elements is through two functions FH t=1 (R r ,E δ ),FT t=1 (E δ ,R r ) to achieve it.

[0206] The header function

[0207] The tail function

[0208] The numerical representation vector is initialized using formula (1):

[0209]

[0210] This method can initialize new entities that appear in new tasks. This method successfully utilizes the knowledge learned in previous tasks. By performing operations on the numerical representation learned in previous tasks, this method provides an initialization value for the new element in the vector space that is relatively close to where it should exist. The application of this initialization value effectively shortens the time required for the model to train new entities and improves the efficiency of online incremental learning of knowledge graphs.

[0211] Step 403, using the TransE model to calculate the loss function of the current knowledge graph;

[0212] Use the TransE model to perform NMS on the expanded triple set t=1 , the entity numerical representation matrix AAE at time t = 1 ξ=0,t=1 and AAR ξ=0,t=1 Calculate the loss function and get the total loss function SS under ξ=0 ξ=0,t=1 .

[0213] Step 404, calculating the gradient regularization value of the parameter dimension of the entity and relationship representation matrix in knowledge distillation;

[0214] The purpose of knowledge distillation is to use the knowledge graph MKG at time t = 0 t=0 The learned numerical representation matrix as well as As the teacher model, the regularization value of the parameter dimension measures the numerical representation matrix AAE of the current round ξ=0,t=1 、AAR ξ=0,t=1 and teacher model as well as The distance between.

[0215] According to the calculated gradient importance matrix OMGE at the last moment t = 0 t=0 ,OMGR t=0 , calculate the gradient regularization value of the parameter dimension of the current round ξ=0 as:

[0216]

[0217] Step 405: Sample the distribution of triples in the knowledge graph according to the generative model VAE

[0218] This step uses the generative model VAE trained in step L of the first part to perform the generation task. This step uses VAE to generate samples of the sn group triple distribution, denoted as

[0219] SP1 ξ=0,t=1 Represents the distribution of the first generated triples.

[0220] Represents the distribution of the second generated triples.

[0221] represents the distribution of the ψth generated triplet.

[0222] represents the distribution of the sn-th generated triplet.

[0223] For the convenience of explanation, the It is also called the distribution of any triple.

[0224] Any triple Contains head entity relation and a set of candidate tail entities and their probability logical values Right now in and They are the head entities and relations generated by VAE, is a set of generated tail entities and their probability logical values, denoted as The subscript rn is the length of the generated candidate tail entity set, which is a fixed value. In this method, rn=5.

[0225] Represents the first alternative tail entity.

[0226] Represents the second alternative tail entity.

[0227] represents the σth candidate tail entity.

[0228] Indicates the rnth candidate tail entity.

[0229] For the convenience of explanation, the Also known as any alternative tail entity, including the tail entity And the probability logical value of sampling the entity as the tail entity

[0230] Step 406, calculating the energy function of each candidate entity according to the distribution of the sampled triples, and sorting the candidate entities according to the energy function;

[0231] The distribution of each triple The head entity, relationship, and tail entity of the candidate tail entity are combined to obtain the distribution of triples. The triple set of remember

[0232] Using TransE model to analyze MSPS ξ=0,t=1 , the current entity representation matrix AAE ξ=0,t=1 and relationship matrix AAR ξ=0,t=1 Calculate the energy function and distribute each triple The set of candidate entities in The candidate entities in By sorting the energy function of and

[0233] Represents the first alternative tail entity.

[0234] Represents the second alternative tail entity.

[0235] represents the μth candidate tail entity.

[0236] Indicates the rnth candidate tail entity.

[0237] For the convenience of explanation, the Also known as any alternative tail entity. Contains the tail entity The logical value of the probability of sampling this entity as a tail entity And its triple energy value This arrangement satisfies that the triples of the candidate tail entities ranked first are more suitable, that is, The energy function corresponding to the tail entity is lower than

[0238] Step 407, calculating a ranking loss function according to the ranked candidate entity sequence;

[0239] In order to verify the convergence effect of the current entity and relationship matrix, it is necessary to compare the loss between the ranking of triples calculated by the energy score and the ranking of triples generated by VAE.

[0240] The specific method is to Sorting of candidate entities in calculate The difference in energy values ​​between groups of cells with a ranking difference of 1, and the difference in logical values ​​is used as the marginal value. The calculation method is:

[0241]

[0242] According to formula (3), the sum of the distribution statistics loss functions of all sampled triplets is denoted as This value is the loss based on the generative model ranking loss.

[0243] Step 408, combining the knowledge graph embedding loss with the gradient regularization loss and the generative model ranking loss to calculate the total loss function in the current round;

[0244] In the current round ξ=0, the total loss function LOSS of the incremental model is ξ=0,t=1 Calculate using formula (4):

[0245] LOSS ξ=0,t=1 =SS ξ=0,t=1 +βSI ξ=0,t=1 +γLLSE ξ=0,t=1 (4);

[0246] In this method, β=0.1 and γ=0.1 are set.

[0247] Step 409, using the ERC-VAE model, calculate the changed entity representation matrix and relationship representation matrix according to the total loss function, as well as the cumulative value of entity gradient change and the cumulative value of relationship change;

[0248] The total loss function LOSS for the current round ξ=0 ξ=0,t=1 Refer to the steps C to H in the ERC-VAE model (i.e. the first part) to obtain the changed entity numerical representation matrix Relational numerical representation matrix AAR ξ=0,t=1 , Entity gradient change cumulative value CGRE ξ=0,t=1 And the cumulative value of the relationship gradient change CGRR ξ=0,t=1 .

[0249] Step 410, continue with the next round of training until the maximum number of rounds is reached;

[0250] After ξ=0, the iteration round ξ is assigned a value of 1, that is, ξ=1.

[0251] When ξ=1, Assign to AAE ξ=1,t=1 ; Assign to AAR ξ=1,t=1 ; Repeat step 403~

[0252] Step 409, get CGRE ξ=1,t=1 , CGRR ξ=1,t=1 .

[0253] Until max , Assign to Assign to Repeat steps 403 to 409 to obtain

[0254] Step 411, calculating the entity gradient importance matrix of the training entity;

[0255] Entity Gradient Importance Matrix

[0256] Step 412, calculating the relation gradient importance matrix of the training relation;

[0257] Relationship Gradient Importance Matrix

[0258] Step 413, sampling triples using an empirical replay sampling algorithm based on impact factors;

[0259] Using the method in step 3 of the second part of this method, according to the entity gradient importance matrix OMGE t=1 , and the knowledge graph MKG at the current time t = 1 t=1 =<ME t=1 ,MR t=1 ,MS t=1 The triple set MS in > t=1 , sample the triple set BS t=1 .

[0260] Step 414, updating the experience playback buffer according to the sampled triples;

[0261] Update the experience replay buffer to BF t=1 =BF t=0 ∪BS t=1 .

[0262] Step 5: sort the candidate entities according to the size of the energy function, and then add them to the incremental knowledge graph;

[0263] The representation of entities and relations of incomplete triples and the candidate information composed of incomplete triple information are obtained from the fused knowledge graph.

[0264] The candidate entities are sorted according to the size of the energy function to obtain the completed sequence data; then the completed sequence is added to the knowledge graph to obtain the completed knowledge graph of the online education platform

[0265] Step 6: After the first incremental task, conduct training for the next incremental task;

[0266] After t=1, when there are new incremental tasks and new incremental knowledge graphs that need to be expanded, the current moment is assigned a value of 2, that is, t=2.

[0267] At t = 2, the incremental knowledge graph of the online platform is obtained, denoted as MKG t=2 =<ME t=2 ,MR t=2 ,MS t=2 >;

[0268] Will Assign to AAE ξ=0,t=2 ; Assign to AAR ξ=0,t=2 Repeat steps 4 and 5 to obtain the completed knowledge graph. And the entity numerical representation matrix Relational numerical representation matrix Entity Gradient Importance Matrix OMGE t=2 , relationship gradient importance matrix OMGR t=2 , Buffer BF t=2 .

[0269] Until the last task time t max , obtain the incremental knowledge graph of the online platform, denoted as Will Assign to Will Assign to Repeat steps 4 and 5 to obtain the completed knowledge graph. And the entity numerical representation matrix Relational numerical representation matrix Entity Gradient Importance Matrix Relationship Gradient Importance Matrix Buffer

[0270] Example 1

[0271] The method of the present invention for completing the knowledge graph for online incremental learning scenarios is called the ER-DGRF method.

[0272] All codes for simulation are implemented in Python on the deep learning platform PyTorch.

[0273] The dataset used for simulation is WN 18RR, which is a dataset commonly used to test knowledge graph embedding models. The knowledge graph embedding evaluation indicators used in this paper are Hits@10 and MRR. These two indicators rely on the evaluation score ranking of a certain element in the triple among all elements and are used to evaluate model performance. Hits@10 indicates whether the proportion of real entities is included in the top 10 recommended entities, which measures the accuracy of the model. MRR (Mean Reciprocal Rank) averages the reciprocal values ​​of all the reciprocal values ​​of the ranking, that is, the average value of the reciprocal values ​​of the ranking that puts the real entities in front, and pays more attention to the ranking ability of the model. The higher the two indicators are, the more reasonably the embedding learned by the model can express the corresponding knowledge.

[0274] The ER-DGRF method of the present invention is compared with the existing online incremental learning method based on knowledge graph embedding. On the WN 18RR dataset, TransE is used as the benchmark model for incremental model training. The results are shown in Table 1.

[0275] Table 1. ER-DGRF online incremental learning accuracy results

[0276]

[0277] As can be seen from Table 1, the ER-DGRF method has a significant performance improvement over other methods. Specifically, the ER-DGRF framework performs well on the WN 18RR dataset, and has achieved significant improvements in learning new tasks while retaining the knowledge of the historical knowledge graph. This fully demonstrates that the ER-DGRF framework has excellent performance in online incremental learning tasks for knowledge graph embedding.

[0278] PNN is a model augmentation algorithm, L2 is a naive knowledge distillation algorithm, SI is a gradient-related knowledge distillation algorithm, DGR is a generative experience augmentation algorithm, ABIE is an algorithm based on anchor parsing knowledge graphs, and LKGE is an aggregation-based knowledge distillation algorithm.

[0279] Table 2 ER-DGRF ablation experimental results

[0280]

[0281] The experimental results are shown in Table 2. It can be observed that ER-DGRF still outperforms the ER-SI-G algorithm and the DGRF algorithm in most cases under the two datasets and two benchmark models, which shows that the framework successfully combines the advantages of the experience replay algorithm and the knowledge distillation algorithm to learn a more effective representation vector. At the same time, this also proves that the experience replay and knowledge distillation algorithms can complement each other in incremental learning tasks and jointly improve model performance.

[0282] The scenario in which the method of the present invention is applied not only involves knowledge graph embedding learning, but also incremental learning of knowledge graph embedding in the online incremental learning task scenario. In view of the current scarcity of dynamic knowledge graph data, the present invention adopts a common practice similar to that in the field of dynamic knowledge graphs, and constructs an incremental data set by segmenting the data set.

Claims

1. A method for constructing a knowledge graph representation learning model ERC-VAE that integrates multiple information for online incremental learning scenarios, characterized by The build steps include: Construction step A, initialize a numerical representation for each entity and relationship in the original knowledge graph; The original knowledge graph in the current online education platform is denoted as MKG old , and MKG old =<ME old ,MR old ,MS old >; ME old Represents the entity set in the original knowledge graph; MR old Represents the relationship set in the original knowledge graph; MS old Represents the set of triples in the original knowledge graph; MKG old =<ME old ,MR old ,MS old > As a training knowledge graph, denoted as MKG 训练 , and MKG 训练 =<ME 训练 ,MR 训练 ,MS 训练 >; ME 训练 Represents the set of training entities in the training knowledge graph; MR 训练 Represents the set of training relations in the training knowledge graph; MS 训练 Represents the set of training triples in the training knowledge graph; Training entity set ME 训练 The set is represented as ME 训练 ={E 训练1 ,E 训练2 ,…,E 训练i ,…,E 训练h ,…,E 训练|ME| }, the subscript training |ME| is the entity set ME 训练 Length; E 训练1 represents the first training entity; E 训练2 represents the second training entity; E 训练i represents the i-th training entity; E 训练h represents the hth training entity; E 训练δ represents the δth training entity; E 训练|ME| Represents the last training entity; Training relation set MR 训练 The set is represented as MR 训练 = {R 训练1 ,R 训练2 ,…,R 训练j ,…,R 训练r ,…,R 训练|MR| }, the subscript training |MR| is the training relation set MR 训练 Length; R 训练1 Indicates the first training relationship; R 训练2 represents the second training relationship; R 训练j represents the jth training relationship; R 训练r represents the rth training relationship; R 训练|MR| Indicates the last training relationship; Initially, the iteration number ξ is set to 0, and the Xavier method is used to 训练 =<ME 训练 ,MR 训练 ,MS 训练 >ME 训练 Initialize and assign values. ME after the assignment 训练 The digital representation matrix is ​​recorded as and The superscript T means matrix transpose; For the training entity E 训练1 The numerical entity representation vector of ; For the training entity E 训练2 The numerical entity representation vector of ; For training entities The numerical entity representation vector of ; For the training entity E 训练|ME| The numerical entity representation vector of ; Initially, the iteration number ξ is set to 0, and the Xavier method is used to 训练 =<ME 训练 ,MR 训练 ,MS 训练 >MR 训练 Initialize the value, and the MR after the value assignment 训练 The digital representation matrix is ​​recorded as and The superscript T means matrix transpose; For the training relation R 训练1 The numerical relationship representation vector of For the training relation R 训练2 The numerical relationship representation vector of For training relationship The numerical relationship representation vector of For the training relation R 训练|MR| The numerical relationship representation vector of In step B, the TransE model is used to calculate the loss function of the training knowledge graph. Using TransE model to analyze MKG 训练 =<ME 训练 ,MR 训练 ,MS 训练 >MS 训练 ={S 训练1 ,S 训练2 ,…,S 训练k ,…,S 训练ζ ,…,S 训练|MS| }、 and Calculate the loss function and get the total loss function SS under ξ=0 ξ=0 ; Training triple set MS 训练 The set representation is MS 训练 ={S 训练1 ,S 训练2 ,…,S 训练k ,…,S 训练ζ ,…,S 训练|MS| }, the subscript training |MS| is the training triple set MS 训练 Length; S 训练1 represents the first training triplet; S 训练2 represents the second training triplet; S 训练k represents the kth training triplet; S 训练ζ represents the ζ-th training triplet; S 训练|MS| represents the last training triplet; Construct step C to calculate the gradient of each entity according to the sum of loss functions; Use the Autograd mechanism of the pytorch framework and follow the SS ξ=0 calculate The gradient of each training entity in is obtained express The gradient of for The gradient calculated by summing the loss functions; for The gradient calculated by summing the loss functions; for The gradient calculated by summing the loss functions; for The gradient calculated by summing the loss functions; Construction step D, updating the training entity representation matrix according to the entity gradient; use renew The updated training entity numerical representation vector is obtained, denoted as use renew The updated training entity numerical representation vector is obtained, denoted as use renew The updated training entity numerical representation vector is obtained, denoted as use renew The updated training entity numerical representation vector is obtained, denoted as Use the gradient of the entity Processing is performed to obtain the transformed entity numerical representation matrix Construct step E, calculate the cumulative value of the gradient change of the training entity; When ξ=0, calculate the cumulative value of the gradient change of the training entity; the cumulative value of the gradient change of the first training entity The cumulative value of the gradient change of the second training entity The cumulative value of the gradient change of the δth training entity The cumulative value of the gradient change of the last training entity There is a corresponding The cumulative value of the training entity gradient change Construct step F to calculate the gradient of each relation according to the sum of loss functions; Use the Autograd mechanism of the pytorch framework and follow the SS ξ=0 calculate The gradients of each relationship in express The gradient of for The gradient calculated by summing the loss functions; for The gradient calculated by summing the loss functions; for The gradient calculated by summing the loss functions; for The gradient calculated by summing the loss functions; Constructing step G, updating the training relation representation matrix according to the relation gradient; use renew The updated training entity numerical representation vector is obtained, denoted as use renew The updated training entity numerical representation vector is obtained, denoted as use renew The updated training entity numerical representation vector is obtained, denoted as use renew The updated training entity numerical representation vector is obtained, denoted as Use the gradient of the relationship After processing, the transformed relationship numerical representation matrix is ​​obtained Construct step H, calculate the cumulative value of the gradient change of the training relationship; When ξ=0, calculate the cumulative value of the gradient change of the training relationship; the cumulative value of the gradient change of the first training relationship The cumulative value of the gradient change of the second training relationship The cumulative value of the gradient change of the δth training relationship The cumulative value of the gradient change of the last training relationship There is a corresponding The cumulative value of the training relationship gradient change Construct step I, and conduct the next round of training after initialization until the maximum number of rounds is reached; After ξ=0, the iteration round ξ is assigned the value of 1, i.e. ξ=1; When ξ=1, Assign to Assign to Repeated structure Construct steps B to H, and get Until max , Assign to Assign to Repeat construction steps B to H to obtain In the process of implementing the gradient regularization operation of the parameter dimension, the cumulative value of the gradient change of the training entity and training relationship representation matrix is ​​statistically calculated, denoted as CGRE ξ ,CGRR ξ ; The cumulative value of the training entity gradient change in the current round ξ The cumulative value of the training relation gradient change of the current round ξ Constructing step J, calculating the entity gradient importance matrix of the training entity; Entity Gradient Importance Matrix Construction step K, calculate the relation gradient importance matrix of the training relation; Relationship Gradient Importance Matrix Build step L and train the VAE model; Using DGR method to analyze MKG 训练 =<ME 训练 ,MR 训练 ,MS 训练 > Processing is performed to obtain a VAE model for training the knowledge graph; the VAE model remains unchanged during the knowledge graph completion process; Construction step M, generating ERC-VAE model; The VAE model is combined with OMGE 训练 and OMGR 训练 Combined with the above, a benchmark knowledge graph representation learning model is constructed, denoted as ERC-VAE.

2. A knowledge graph completion method for online incremental learning scenarios, characterized by Contains the following steps: Step 1: Initialize the online education platform and obtain the knowledge graph in the online education platform; Initially, the time t is assigned a value of 0, i.e., t = 0; The knowledge graph at time t = 0 is denoted as MKG t=0 =<ME t=0 ,MR t=0 ,MS t=0 >; ME t=0 Represents the entity set in the knowledge graph at time t=0; MR t=0 Represents the set of relations in the knowledge graph at time t=0; MS t=0 Represents the set of triples in the knowledge graph at time t=0; Step 2: Application of ERC-VAE model; The ERC-VAE model is used to analyze MKG t=0 =<ME t=0 ,MR t=0 ,MS t=0 >Process and obtain OMGE t=0 and OMGR t=0 ; Represents the entity numerical representation matrix obtained by TransE iterative training in the knowledge graph at time t=0; Represents the numerical representation matrix of the relationship obtained by TransE iterative training in the knowledge graph at time t=0; OMGE t=0 Represents the entity gradient importance matrix in the knowledge graph at time t=0; OMGR t=0 Represents the relation gradient importance matrix in the knowledge graph at time t=0; Step 3: empirical replay sampling method based on impact factors; Step 301, calculating the entity influence factor according to the gradient importance value; After completing the training of the ERC-VAE model, the entity gradient importance matrix OMGE is obtained t=0 , the OMGE t=0 The dimension is |ME|×l; In addition, the OMGE t=0 It also represents the same dimension The total gradient of each parameter in ; l is the length of the entity digital representation vector; OMGE t=0 Add each row and calculate the influence factor vector INFE t=0 ;INFE t=0 is a vector of length |ME|, representing the influence factor of each entity; Step 302, selecting the top n important entities according to the entity influence factor; At INFE t=0 In the equation, find the smallest n elements and their corresponding entity sets, denoted as BE t=0 ; Step 303, sampling triples according to the selected importance entities; From MKG t=0 = <ME t=0 , MR t=0 , MS t=0 > in the triple set MS t=0 Find all triples that satisfy the triple structure S k (SE 头 , SR 关系 , SE 尾 ) where SE 头 In the set BE t or SE 尾 In the set BE t=0 in the triple set BS t=0 ; Store the triple set BS t=0 into the buffer BF t=0 ; Initially, BF t=0 Assign value to BS t=0 ; Step 4: Online incremental learning method based on knowledge distillation and experience replay method to numerically represent knowledge graph; The knowledge graph MKG at time t = 0 t=0 The learned numerical representation matrix as well as As a teacher model, learn the knowledge graph MKG at time t = 1 t=1 The numerical representation matrix as well as The new model gains experience from the teacher model on the old task and learns new knowledge in the new model; Step 401, merging the triples in the buffer with the incremental graph to construct a new graph; The triplet BF in the buffer at time t = 0 t=0 With incremental graph MKG t=1 =<ME t=1 ,MR t=1 ,MS t=1 > The triple MS in t=1 Sets are merged to form a new triple set NMS t=1 =MS t=1 ∪BF t=0 ; Step 402, using knowledge transfer to construct new knowledge representation for new elements in the knowledge graph; Defining NME t=1 =ME t=1 -ME t=0 is the set of newly appeared entities at time t = 1; For a NME t=1 Entity E in δ , define NNH t=1 (E δ ) is the new element at time t = 1, which contains only the head entity E δ The set of triples, NNT t=1 (E δ ) means that the new element contained at time t = 1 is only the tail entity E δ The set of triples of ; Said Said The method of aggregating new elements is through two functions FH t=1 (R r ,E δ ),FT t=1 (E δ ,R r ) to achieve; The header function The tail function The numerical representation vector is initialized using formula (1): Step 403, using the TransE model to calculate the loss function of the current knowledge graph; Use the TransE model to perform NMS on the expanded triple set t=1 , the entity numerical representation matrix AAE at time t = 1 ξ=0,t=1 and AAR ξ=0,t=1 Calculate the loss function and get the total loss function SS under ξ=0 ξ=0,t=1 ; Step 404, calculating the gradient regularization value of the parameter dimension of the entity and relationship representation matrix in knowledge distillation; The purpose of knowledge distillation is to use the knowledge graph MKG at time t = 0 t=0 The learned numerical representation matrix as well as As the teacher model, the regularization value of the parameter dimension measures the numerical representation matrix AAE of the current round ξ=0,t=1 、AAR ξ=0,t=1 and teacher model as well as The distance between According to the calculated gradient importance matrix OMGE at the last moment t=0 t=0 ,OMGR t=0 , calculate the gradient regularization value of the parameter dimension of the current round ξ=0 as: Step 405: Sample the distribution of triples in the knowledge graph according to the generative model VAE Use VAE to generate samples of sn group triple distribution, denoted as represents the distribution of the first generated triples; represents the distribution of the second generated triples; represents the distribution of the ψth generated triples; represents the distribution of the sn-th generated triplet; Any triple Contains head entity relation and a set of candidate tail entities and their probability logical values Right now in and They are the head entities and relations generated by VAE, is a set of generated tail entities and their probability logical values, denoted as The subscript rn is the length of the generated candidate tail entity set; Indicates the first candidate tail entity; Indicates the second alternative tail entity; represents the σth candidate tail entity; Indicates the rnth candidate tail entity; Contains tail entity And the probability logical value of sampling the entity as the tail entity Step 406, calculating the energy function of each candidate entity according to the distribution of the sampled triples, and sorting the candidate entities according to the energy function; The distribution of each triple The head entity, relationship, and tail entity of the candidate tail entity are combined to obtain the distribution of triples. The triple set of remember Using TransE model to analyze MSPS ξ=0,t=1 , the current entity representation matrix AAE ξ=0,t=1 The relationship matrix AAR ξ=0,t=1 Calculate the energy function and distribute each triple The set of candidate entities in The candidate entities in By sorting the energy function of and Indicates the first candidate tail entity; Indicates the second alternative tail entity; represents the μth candidate tail entity; Indicates the rnth candidate tail entity; Contains tail entity The logical value of the probability of sampling this entity as a tail entity And its triple energy value This arrangement satisfies that the triples of the candidate tail entities ranked first are more suitable, that is, The energy function corresponding to the tail entity is lower than Step 407, calculating a ranking loss function according to the ranked candidate entity sequence; In order to verify the convergence effect of the current entity and relationship matrix, it is necessary to compare the loss between the ranking of triples calculated by the energy score and the ranking of triples generated by VAE; The specific method is to Sorting of candidate entities in calculate The difference in energy values ​​between groups of cells with a ranking difference of 1, and the difference in logical values ​​is used as the marginal value; the calculation method is: According to formula (3), the sum of the distribution statistics loss functions of all sampled triplets is: This value is the loss based on the ranking loss of the generative model; Step 408, combining the knowledge graph embedding loss with the gradient regularization loss and the generative model ranking loss to calculate the total loss function in the current round; In the current round ξ=0, the total loss function LOSS of the incremental model is ξ=0,t=1 Calculate using formula (4): LOSS ξ=0,t=1 =SS ξ=0,t=1 +βSI ξ=0,t=1 +γLLSE ξ=0,t=1 (4); Step 409, using the ERC-VAE model, calculate the changed entity representation matrix and relationship representation matrix according to the total loss function, as well as the cumulative value of entity gradient change and the cumulative value of relationship change; The total loss function LOSS for the current round ξ=0 ξ=0,t=1 Refer to steps C to H in the ERC-VAE model to obtain the changed entity numerical representation matrix Relational numerical representation matrix AAR ξ=0,t=1 , Entity gradient change cumulative value CGRE ξ=0,t=1 And the cumulative value of the relationship gradient change CGRR ξ=0,t=1 ; Step 410, continue with the next round of training until the maximum number of rounds is reached; After ξ=0, the iteration round ξ is assigned the value of 1, i.e. ξ=1; When ξ=1, Assign to AAE ξ=1,t=1 ; Assign to AAR ξ=1,t=1 Repeat steps 403 to 409 to obtain CGRE ξ=1,t=1 , CGRR ξ=1,t=1 ; Until max , Assign to Assign to Repeat steps 403 to 409 to obtain Step 411, calculating the entity gradient importance matrix of the training entity; Entity Gradient Importance Matrix Step 412, calculating the relation gradient importance matrix of the training relation; Relationship Gradient Importance Matrix Step 413, sampling triples using an empirical replay sampling algorithm based on impact factors; According to the entity gradient importance matrix OMGE t=1 , and the knowledge graph MKG at the current time t = 1 t=1 =<ME t=1 ,MR t =1 ,MS t=1 The triple set MS in > t=1 , sample the triple set BS t=1 ; Step 414, updating the experience playback buffer according to the sampled triples; Update the experience replay buffer to BF t=1 =BF t=0 ∪BS t=1 ; Step 5: sort the candidate entities according to the size of the energy function, and then add them to the incremental knowledge graph; Obtain the representation of entities and relations of incomplete triples from the fused knowledge graph, as well as candidate information composed of incomplete triple information; The candidate entities are sorted according to the size of the energy function to obtain the completed sequence data; then the completed sequence is added to the knowledge graph to obtain the completed knowledge graph of the online education platform Step 6: After the first incremental task, conduct training for the next incremental task; After t=1, when there are new incremental tasks and new incremental knowledge graphs that need to be expanded, the current moment is assigned a value of 2, that is, t=2; At t = 2, the incremental knowledge graph of the online platform is obtained, denoted as MKG t=2 =<ME t=2 ,MR t=2 ,MS t=2 >; Assign to AAE ξ=0,t=2 ; Assign to AAR ξ=0,t=2 ; Repeat steps 4 and 5 to obtain the completed knowledge graph And the entity numerical representation matrix Relational numerical representation matrix Entity Gradient Importance Matrix OMGE t=2 , relationship gradient importance matrix OMGR t=2 , Buffer BF t=2 ; Until the last task time t max , obtain the incremental knowledge graph of the online platform, denoted as Will Assign to Will Assign to Repeat steps 4 and 5 to obtain the completed knowledge graph. And the entity numerical representation matrix Relational numerical representation matrix Entity Gradient Importance Matrix Relationship Gradient Importance Matrix Buffer

Citation Information

Cited By

  • Knowledge graph representation learning system, method, device and medium

    CN119623605A