Knowledge graph link prediction task negative sample generation method and device of recommendation system

By introducing Gaussian noise and conditional embedding-guided reverse denoising model in the knowledge graph link prediction task, negative samples are generated, and bottleneck problems in negative samples generation in the existing technology are solved, achieving more accurate and reasonable negative samples generation.

CN119862419AActive Publication Date: 2025-04-22SOUTHERN UNIVERSITY OF SCIENCE AND TECHNOLOGY
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411939666.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-26
Publication Date
2025-04-22
Estimated Expiration
2044-12-26

AI Technical Summary

Technical Problem

The prior art faces bottlenecks in negative sample generation in the knowledge graph link prediction task, resulting in sparse data and sample selection bias, which is more obvious in complex or large-scale knowledge graphs.

Method used

By introducing Gaussian noise into the initial embedding representation, a forward noise addition model is established, and noise is removed through conditional embedding guidance during the reverse denoising process, a negative sample of the knowledge graph link prediction task is generated.

Benefits of technology

The generated negative samples not only overcome the problems of data sparseness and sample imbalance, but also fully consider the semantic information of the knowledge graph, making the generated negative samples more accurate and reasonable.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119862419A_ABST
    Figure CN119862419A_ABST
Patent Text Reader

Abstract

The invention relates to a knowledge graph link prediction task negative sample generation method and device of a recommendation system. The method comprises the steps of performing initial embedding on a to-be-reasoned entity in a knowledge graph in a recommendation system according to a preset embedding model to obtain an initial embedding representation, gradually adding Gaussian noise into the initial embedding representation at each time step, establishing a forward noise adding model, and calculating a to-be-reasoned entity in the knowledge graph according to the forward noise adding model. And step-by-step noise removal is carried out on the noiseized embedded entity output by the forward noise adding model by setting condition embedding guidance at each time step, a reverse noise removal model is established, and sampling is carried out in the reverse noise removal process of the reverse noise removal model to obtain a knowledge graph link prediction task negative sample of the recommendation system. By adopting the method, the prediction capability of the knowledge graph link prediction task in the recommendation system can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of knowledge graph technology, and in particular to a method and device for generating negative samples for a knowledge graph link prediction task of a recommendation system. Background Art

[0002] With the development of big data and artificial intelligence technology, knowledge graphs have gradually become an important basic tool in many fields. Knowledge graphs represent entities and their relationships to build complex semantic networks, and are widely used in search engines, recommendation systems, intelligent assistants and other scenarios. Recommendation systems rely on knowledge graphs to parse the semantics of user queries and provide accurate recommendation results. The integrity and accuracy of knowledge graphs directly determine the service quality and user experience of recommendation systems. The knowledge graph link prediction task is to predict potential, yet-to-appear associations through existing entities and relationships to complete the missing links in the graph. It is crucial to improving the accuracy and integrity of knowledge graphs and directly affects the performance of recommendation systems.

[0003] Existing technologies face the bottleneck of negative sample generation in knowledge graph link prediction tasks. Due to the limited number of positive samples in knowledge graphs and the imbalanced data distribution, negative samples must be relied on to optimize performance during model training. However, traditional negative sample generation methods mostly select entities from existing entity sets to replace existing triples, which makes the selection of negative samples limited by the current knowledge graph sample space, leading to problems such as data sparsity and sample selection bias. These problems are particularly evident in complex or large-scale knowledge graphs. Although some virtual negative sample generation methods have been proposed in recent years, breaking the limitations of traditional negative sample generation methods and exploring a broader negative sample space, these methods ignore the semantic information of the knowledge graph, thereby limiting the further optimization of the model. Summary of the invention

[0004] Based on this, it is necessary to provide a method and device for generating negative samples for the knowledge graph link prediction task of a recommendation system in response to the above technical problems.

[0005] A method for generating negative samples for a knowledge graph link prediction task of a recommendation system, the method comprising:

[0006] According to the preset embedding model, the entities to be inferred in the knowledge graph of the recommendation system are initially embedded to obtain the initial embedding representation;

[0007] Gaussian noise is gradually added to the initial embedding representation at each time step to establish a forward noisy model;

[0008] At each time step, the noise-added embedding entity output by the forward denoising model is gradually de-noised by setting a conditional embedding guide, thereby establishing a reverse denoising model;

[0009] By sampling in the reverse denoising process of the reverse denoising model, negative samples of the knowledge graph link prediction task of the recommendation system are obtained.

[0010] In one embodiment, the method further includes: gradually adding Gaussian noise to the initial embedding representation to be inferred at each time step, and establishing a forward noise adding model as follows:

[0011]

[0012]

[0013] Among them, β t represents the noise intensity at each time step, t is the time step, T is the total number of time steps, E d,t represents the noisy embedded entity at time step t, E d,0 represents the initial embedding representation, represents normal distribution, α t =1-β t , True noise ∈ t Normal distribution normal distribution Medium E d,t is the mean, is the standard deviation, β t I is the covariance and I is the identity matrix.

[0014] In one embodiment, the method further includes: gradually removing noise from the noisy embedded entity output by the forward noisy model at each time step by setting a conditional embedding guide, and establishing a reverse denoising model as follows:

[0015]

[0016] Among them, p θ (E d,t-1 |E d,t ,E c ) is the probability distribution of the reverse denoising process, describing the denoising process from time step t to time step t-1, μ θ (E d,t ,t,E c ) is the embedding E according to the time step t and the noise in the reverse process of the diffusion model d,t and conditional embedding E c The predicted mean, is the variance of the time step, ∈ θ is the prediction noise.

[0017] In one embodiment, it also includes: constructing the real noise ∈ in the forward noise model t and prediction noise ∈θ The loss function between is:

[0018]

[0019] Among them, ||·|| represents the Euclidean distance, L D represents the loss function;

[0020] A diffusion model for noise prediction is trained according to the loss function.

[0021] In one embodiment, it also includes: constructing the real noise ∈ of the model in the forward noise addition process t and the prediction noise ∈ in the reverse process θ The loss function between is:

[0022]

[0023] in, represents the Gaussian noise used in the sampling process, σ t is the standard deviation at time step t;

[0024] At the set acquisition time step, the embedding representation of the negative sample of the knowledge graph link prediction task of the recommendation system is calculated according to the denoising embedding representation model.

[0025] In one of the embodiments, the method further includes: inputting the negative samples and pre-constructed positive samples into the embedding model for training until the embedding model converges.

[0026] A device for generating negative samples for a knowledge graph link prediction task of a recommendation system, the device comprising:

[0027] The initial embedding module is used to perform initial embedding on the entities to be inferred in the knowledge graph of the recommendation system according to the preset embedding model to obtain the initial embedding representation;

[0028] A forward noise adding module is used to gradually add Gaussian noise to the initial embedding representation at each time step to establish a forward noise adding model;

[0029] A reverse denoising module, used for gradually removing noise from the noisy embedded entity output by the forward denoising model at each time step by setting conditional embedding guidance, and establishing a reverse denoising model;

[0030] The negative sample generation module is used to obtain negative samples of the knowledge graph link prediction task of the recommendation system by sampling in the reverse denoising process of the reverse denoising model.

[0031] In one embodiment, the forward noise adding module is further used to gradually add Gaussian noise to the initial embedding representation to be inferred at each time step, and the forward noise adding model is established as follows:

[0032]

[0033]

[0034] Among them, β t represents the noise intensity at each time step, t is the time step, T is the total number of time steps, E d,t represents the noisy embedded entity at time step t, E d,0 represents the initial embedding representation, represents normal distribution, α t =1-β t , True noise ∈ t Normal distribution normal distribution Medium E d,t is the mean, is the standard deviation, β t I is the covariance and I is the identity matrix.

[0035] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0036] According to the preset embedding model, the entities to be inferred in the knowledge graph of the recommendation system are initially embedded to obtain the initial embedding representation;

[0037] Gaussian noise is gradually added to the initial embedding representation at each time step to establish a forward noisy model;

[0038] At each time step, the noise-added embedding entity output by the forward denoising model is gradually de-noised by setting a conditional embedding guide, thereby establishing a reverse denoising model;

[0039] By sampling in the reverse denoising process of the reverse denoising model, an embedding representation of negative samples of the knowledge graph link prediction task of the recommendation system is obtained.

[0040] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the following steps:

[0041] According to the preset embedding model, the entities to be inferred in the knowledge graph of the recommendation system are initially embedded to obtain the initial embedding representation;

[0042] Gaussian noise is gradually added to the initial embedding representation at each time step to establish a forward noisy model;

[0043] At each time step, the noise-added embedding entity output by the forward denoising model is gradually de-noised by setting a conditional embedding guide, thereby establishing a reverse denoising model;

[0044] By sampling in the reverse denoising process of the reverse denoising model, negative samples of the knowledge graph link prediction task of the recommendation system are obtained.

[0045] The method, device, computer equipment and storage medium for generating negative samples of the knowledge graph link prediction task of the recommendation system first introduce noise into the initial embedding representation in the process of forward denoising, and then in the process of reverse denoising, conditional embedding guidance is set to ensure that the recovered target embedding not only conforms to the distribution of the embedding space, but also absorbs the semantic information of the knowledge graph to ensure the rationality of the semantics. The negative samples generated in this way not only overcome the problems of data sparsity and sample imbalance, but also fully consider the semantic information of the knowledge graph, making the generated negative samples more accurate and reasonable. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] Figure 1 A schematic diagram of a process for generating negative samples for a knowledge graph link prediction task of a recommendation system in one embodiment;

[0047] Figure 2 A structural block diagram of a negative sample generation device for a knowledge graph link prediction task of a recommendation system in one embodiment;

[0048] Figure 3 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0049] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0050] In one embodiment, Figure 1 As shown, a method for generating negative samples for a knowledge graph link prediction task of a recommendation system is provided. The method can be applied to a recommendation system that needs to perform a knowledge graph link prediction task, and includes the following steps:

[0051] Step 102, based on the preset embedding model, initially embed the entities to be inferred in the knowledge graph in the recommendation system to obtain an initial embedding representation.

[0052] First, the knowledge graph link prediction task in the search system aims to infer the missing links in the graph through known entities and relations, thereby improving the completeness and prediction ability of the knowledge graph. Based on the given entity set E and relationship set R, the knowledge graph can be defined as a set of triples where s i and k are the head entity and the tail entity respectively, r j is the relationship between them. In the knowledge graph, link prediction is a key task, which aims to predict missing entities and relations based on known entities and relations. Specifically, link prediction usually involves two modes: (s, r, ?) and (?, r, o), which predict the missing head entity or tail entity respectively. In this step, the entity to be inferred can be either the head entity or the tail entity.

[0053] Step 104, Gaussian noise is gradually added to the initial embedding representation at each time step to establish a forward noise addition model.

[0054] Step 106, at each time step, conditional embedding guidance is set to gradually remove noise from the noisy embedded entity output by the forward noisy model, and a reverse denoising model is established.

[0055] In this step, for the triples in the knowledge graph, after obtaining the embedding representation corresponding to each triple, the head entity embedding and the relationship embedding are vector fused to obtain the information contained in both. The fusion method can be any of the following three methods: s +E r , E s *E r , E s ||E r , where “+” represents vector addition, “*” represents vector dot product, and “||” represents vector concatenation. The new embedding representation obtained after fusion is used as the conditional embedding to guide tail entity denoising in this step.

[0056] Step 108, by sampling in the reverse denoising process of the reverse denoising model, a negative sample of the knowledge graph link prediction task of the recommendation system is obtained.

[0057] In the negative sample generation method of the knowledge graph link prediction task of the above recommendation system, noise is first introduced into the initial embedding representation through the forward denoising process, and then in the reverse denoising process, conditional embedding guidance is set to ensure that the restored target embedding not only conforms to the distribution of the embedding space, but also absorbs the semantic information of the knowledge graph to ensure the rationality of the semantics. The negative samples generated in this way not only overcome the problems of data sparsity and sample imbalance, but also fully consider the semantic information of the knowledge graph, making the generated negative samples more accurate and reasonable.

[0058] In one embodiment, Gaussian noise is gradually added to the initial embedding representation to be inferred at each time step, and a forward noise adding model is established as follows:

[0059]

[0060] Among them, β t represents the noise intensity at each time step, t is the time step, T is the total number of time steps, E d,t represents the noisy embedded entity at time step t, E d,0 represents the initial embedding representation, represents normal distribution, α t =1-β t , True noise ∈ t Normal distribution normal distribution Medium E d,t is the mean, is the standard deviation, β t I is the covariance and I is the identity matrix.

[0061] In another embodiment, the noise is gradually removed from the noisy embedded entity output by the forward noisy model at each time step by setting a conditional embedding guide, and a reverse denoising model is established as:

[0062]

[0063]

[0064] Among them, p θ (E d,t-1 |E d,t , E c ) is the probability distribution of the reverse denoising process, describing the denoising process from time step t to time step t-1, μ θ (E d,t , t, E c ) is the embedding E according to the time step t and the noise in the reverse process of the diffusion model d,t and conditional embedding E c The predicted mean, is the variance of the time step, ∈ θ is the prediction noise.

[0065] In one embodiment, the real noise ∈ in the forward noise model is constructed t and prediction noise ∈ θ The loss function between is:

[0066]

[0067] Among them, ||·|| represents the Euclidean distance. By minimizing this distance, the model learns how to accurately predict the noise at each time step. After training, the diffusion model can learn the intrinsic connection between the condition (and the fusion of the head entity and the relationship) and the tail entity, L D represents the loss function; a diffusion model for noise prediction is trained according to the loss function.

[0068] Specifically, the diffusion model can be an encoder consisting of two serially connected blocks.

[0069] In one embodiment, according to the forward denoising model and the reverse denoising model, the denoising embedding representation model in the denoising process is obtained as follows:

[0070]

[0071] in, represents the Gaussian noise used in the sampling process, σ t is the standard deviation of time step t; at the set acquisition time step, the denoised embedding representation model is calculated to obtain the embedding representation of the negative sample of the knowledge graph link prediction task of the recommendation system.

[0072] In this embodiment, Represents the noise term sampled from the standard normal distribution, which introduces additional randomness to simulate the real noise sampling process. Sampling is performed in the middle step of the back propagation process to obtain the required virtual negative samples. Specifically, the results of, for example, 20 time points are uniformly sampled on the time axis of back propagation as negative samples. Since the distance from the initial noise represents the difficulty of negative samples to a certain extent, samples with a longer distance are multiplied by a larger coefficient, while samples with a closer distance are multiplied by a smaller coefficient.

[0073] In one of the embodiments, negative samples and pre-constructed positive samples are input into an embedding model for training until the embedding model converges.

[0074] Specifically, the loss function of the embedding model is:

[0075]

[0076] Among them, d r (h, t) represents the score of the head entity matching the target entity under the relation r; the score function can adopt various score functions proposed by existing knowledge graph embedding models, such as TransE, ComplEX, Dismult and RotatE; γ is a fixed margin; σ(·) is the sigmoid function; n1 represents the number of negative samples generated by the random replacement method, and n2 represents the number of negative samples generated by this method; (h′ i , r, t′ i) is the i-th negative sample triplet; w i is the weight corresponding to each negative sample generated.

[0077] It should be understood that although Figure 1 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.

[0078] In one embodiment, Figure 2 As shown, a negative sample generation device for a knowledge graph link prediction task of a recommendation system is provided, comprising: an initial embedding module 202, a forward denoising module 204, a reverse denoising module 206 and a negative sample generation module 208, wherein:

[0079] An initial embedding module 202 is used to perform initial embedding on the entity to be inferred in the knowledge graph of the recommendation system according to a preset embedding model to obtain an initial embedding representation;

[0080] A forward noise adding module 204, used to gradually add Gaussian noise to the initial embedding representation at each time step to establish a forward noise adding model;

[0081] A reverse denoising module 206, configured to gradually remove noise from the noisy embedded entity output by the forward denoising model at each time step by setting a conditional embedding guide, and establish a reverse denoising model;

[0082] The negative sample generation module 208 is used to obtain negative samples of the knowledge graph link prediction task of the recommendation system by sampling in the reverse denoising process of the reverse denoising model.

[0083] In one embodiment, the forward noise adding module 204 is further used to gradually add Gaussian noise to the initial embedding representation to be inferred at each time step, and establish the forward noise adding model as follows:

[0084]

[0085] Among them, β t represents the noise intensity at each time step, t is the time step, T is the total number of time steps, E d,t represents the noisy embedded entity at time step t, Ed,0 represents the initial embedding representation, represents normal distribution, α t =1-β t , True noise ∈ t Normal distribution normal distribution Medium E d,t is the mean, is the standard deviation, β t I is the covariance and I is the identity matrix.

[0086] In one embodiment, the reverse denoising module 206 is further used to gradually remove noise from the noisy embedded entity output by the forward noisy model at each time step by setting a conditional embedding guide, and establish a reverse denoising model as:

[0087]

[0088]

[0089] Among them, p θ (E d,t-1 |E d,t , E c ) is the probability distribution of the reverse denoising process, describing the denoising process from time step t to time step t-1, μ θ (E d,t , t, E c ) is the embedding E according to the time step t and the noise in the reverse process of the diffusion model d,t and conditional embedding E c The predicted mean, is the variance of the time step, ∈ θ is the prediction noise.

[0090] In one embodiment, the reverse denoising module 206 is also used to construct the real noise ∈ in the forward denoising model t and prediction noise ∈ θ The loss function between is:

[0091]

[0092] Among them, ||·|| represents the Euclidean distance, L D represents the loss function;

[0093] A diffusion model for noise prediction is trained according to the loss function.

[0094] In one embodiment, the negative sample generation module 208 is further configured to obtain a denoised embedding representation model in the denoising process according to the forward denoising model and the reverse denoising model:

[0095]

[0096] in, represents the Gaussian noise used in the sampling process, σ t is the standard deviation at time step t;

[0097] At the set acquisition time step, the embedding representation of the negative sample of the knowledge graph link prediction task of the recommendation system is calculated according to the denoising embedding representation model.

[0098] In one of the embodiments, a training module is further included, for inputting the negative samples and pre-constructed positive samples into the embedding model for training until the embedding model converges.

[0099] For the specific definition of the negative sample generation device for the knowledge graph link prediction task of the recommendation system, please refer to the definition of the negative sample generation method for the knowledge graph link prediction task of the recommendation system above, which will not be repeated here. Each module in the above-mentioned negative sample generation device for the knowledge graph link prediction task of the recommendation system can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0100] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 3 As shown. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method for generating negative samples for a knowledge graph link prediction task of a recommendation system is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a key, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.

[0101] Those skilled in the art will understand that Figure 3The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0102] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method in the above embodiment when executing the computer program.

[0103] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method in the above embodiment are implemented.

[0104] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0105] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0106] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

Claims

1. A method for generating negative samples for a knowledge graph link prediction task in a recommendation system, characterized in that: The method comprises: According to the preset embedding model, the entities to be inferred in the knowledge graph of the recommendation system are initially embedded to obtain the initial embedding representation; Gaussian noise is gradually added to the initial embedding representation at each time step to establish a forward noisy model; At each time step, the noise-added embedding entity output by the forward denoising model is gradually de-noised by setting a conditional embedding guide, thereby establishing a reverse denoising model; By sampling in the reverse denoising process of the reverse denoising model, negative samples of the knowledge graph link prediction task of the recommendation system are obtained.

2. The method according to claim 1, characterized in that Gaussian noise is gradually added to the initial embedding representation to be inferred at each time step to establish a forward noise model, including: Gaussian noise is gradually added to the initial embedding representation to be inferred at each time step, and the forward noise model is established as: Among them, β t represents the noise intensity at each time step, t is the time step, T is the total number of time steps, E d,t represents the noisy embedded entity at time step t, E d,0 represents the initial embedding representation, represents normal distribution, α t =1-β t , True noise ∈ t Normal distribution normal distribution Medium E d,t is the mean, is the standard deviation, β t I is the covariance and I is the identity matrix.

3. The method according to claim 1, characterized in that At each time step, the noise-added embedding entity output by the forward denoising model is gradually de-noised by setting a conditional embedding guide, and a reverse denoising model is established, including: At each time step, the noise is gradually removed from the noisy embedded entity output by the forward noisy model by setting conditional embedding guidance, and the reverse denoising model is established as: Among them, p θ (E d,t-1 |E d,t , E c ) is the probability distribution of the reverse denoising process, describing the denoising process from time step t to time step t-1, μ θ (E d,t , t, E c ) is the embedding E according to the time step t and noise in the reverse process of the diffusion model d,t and conditional embedding E c The predicted mean, is the variance of the time step, ∈ θ is the prediction noise.

4. The method according to claim 3, characterized in that The method further comprises: Construct the real noise of the model in the forward noise addition process ∈ t and the prediction noise ∈ in the reverse process θ The loss function between is: Among them, ||·|| represents the Euclidean distance, L D represents the loss function; A diffusion model for noise prediction is trained according to the loss function.

5. The method according to claim 4, characterized in that By sampling in the reverse denoising process of the reverse denoising model, negative samples of the knowledge graph link prediction task of the recommendation system are obtained, including: According to the forward denoising model and the reverse denoising model, the denoising embedding representation model in the denoising process is obtained as follows: in, represents the Gaussian noise used in the sampling process, σ t is the standard deviation at time step t; At the set acquisition time step, the embedding representation of the negative sample of the knowledge graph link prediction task of the recommendation system is calculated according to the denoising embedding representation model.

6. The method according to any one of claims 1 to 5, characterized in that: The method further comprises: The negative samples and pre-constructed positive samples are input into the embedding model for training until the embedding model converges.

7. A negative sample generation device for a knowledge graph link prediction task of a recommendation system, characterized in that: The device comprises: The initial embedding module is used to perform initial embedding on the entities to be inferred in the knowledge graph of the recommendation system according to the preset embedding model to obtain the initial embedding representation; A forward noise adding module is used to gradually add Gaussian noise to the initial embedding representation at each time step to establish a forward noise adding model; A reverse denoising module, used for gradually removing noise from the noisy embedded entity output by the forward denoising model at each time step by setting conditional embedding guidance, and establishing a reverse denoising model; The negative sample generation module is used to obtain negative samples of the knowledge graph link prediction task of the recommendation system by sampling in the reverse denoising process of the reverse denoising model.

8. The device according to claim 7, characterized in that The forward noise adding module is also used to gradually add Gaussian noise to the initial embedding representation to be inferred at each time step, and the forward noise adding model is established as follows: Among them, β t represents the noise intensity at each time step, t is the time step, T is the total number of time steps, E d,t represents the noisy embedded entity at time step t, E d,0 represents the initial embedding representation, represents normal distribution, α t =1-β t , True noise ∈ t Normal distribution normal distribution Medium E d,t is the mean, is the standard deviation, β t I is the covariance and I is the identity matrix.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

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

Citation Information

Patent Citations

  • Time sequence knowledge graph reasoning method based on diffusion probability distribution

    CN116401377A

  • Knowledge graph completion method and equipment based on attention penalty and noise sampling

    CN118734947A

  • Time sequence knowledge graph reasoning method based on diffusion process

    CN119168060A