Negative sample generation method and device for knowledge graph link prediction task of recommendation system
By introducing Gaussian noise into the knowledge graph link prediction task and performing reverse denoising processing, negative samples that conform to the embedding space distribution and absorb semantic information are generated, solving the problems of data sparsity and sample selection bias and improving the optimization effect of the model.
Patent Information
- Application Number
- CN202411939666.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-26
- Publication Date
- 2025-09-23
- Estimated Expiration
- 2044-12-26
AI Technical Summary
Existing negative sample generation methods in knowledge graph link prediction tasks are limited by data sparsity and sample selection bias, and ignore the semantic information of the knowledge graph, resulting in limited model optimization.
By introducing Gaussian noise into the initial embedding representation, a forward denoising model is established, and in the backward denoising process, conditional embedding guidance is set to generate negative samples that conform to the embedding space distribution and absorb semantic information.
The generated negative samples overcome the problems of data sparsity and sample imbalance, ensure the accuracy and rationality of negative samples, and improve the integrity of the knowledge graph and the performance of the recommendation system.
Smart Images

Figure CN119862419B_ABST
Abstract
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 technologies, knowledge graphs have gradually become an important foundational tool in many fields. Knowledge graphs represent entities and their relationships, constructing complex semantic networks and are widely used in scenarios such as search engines, recommendation systems, and intelligent assistants. Recommendation systems rely on knowledge graphs to interpret the semantics of user queries and provide accurate recommendations. The completeness and accuracy of the knowledge graph directly determine the service quality and user experience of the recommendation system. The knowledge graph link prediction task, on the other hand, uses existing entities and relationships to predict potential, yet-to-be-discovered connections, thereby completing missing links in the graph. This task is crucial to improving the accuracy and completeness of the knowledge graph and directly impacts the performance of the recommendation system.
[0003] Existing technologies face a bottleneck in generating negative samples for knowledge graph link prediction tasks. Due to the limited number of positive samples in knowledge graphs and the imbalanced data distribution, the model training process must rely on negative samples to optimize performance. However, traditional negative sample generation methods mostly select entities from an existing entity set to replace existing triples. This restricts the selection of negative samples to 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, thus limiting further model optimization. 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 in a recommendation system, the method comprising:
[0006] According to the pre-set 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 addition model as follows:
[0011]
[0012]
[0013] Among them, β t Indicates 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 embedding entity at time step t, E d,0 represents the initial embedding representation, represents the normal distribution, α t =1-β t , True noise ∈ t Normal distribution normal distribution China 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 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 a 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 embodiment, 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 in 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] The forward noise module is used to gradually add Gaussian noise to the initial embedding representation at each time step to establish a forward noise model;
[0029] A reverse denoising module is used to gradually remove noise from the noisy embedded entity output by the forward noisy model by setting conditional embedding guidance at each time step to establish 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 addition module is further configured to gradually add Gaussian noise to the initial embedding representation to be inferred at each time step, and establish a forward noise addition model as follows:
[0032]
[0033]
[0034] Among them, β t Indicates 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 embedding entity at time step t, E d,0 represents the initial embedding representation, represents the normal distribution, α t =1-β t , True noise ∈ t Normal distribution normal distribution China 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 includes 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 pre-set 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 the negative sample 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 pre-set 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, apparatus, computer device, and storage medium for generating negative samples for the knowledge graph link prediction task in the recommendation system described above first introduce noise into the initial embedding representation through a forward denoising process. Then, during a backward denoising process, conditional embedding guidance is set to ensure that the recovered target embedding not only conforms to the distribution of the embedding space but also incorporates the semantic information of the knowledge graph, ensuring semantic rationality. The generated negative samples 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 flowchart of a method for generating negative samples for a knowledge graph link prediction task in 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. 1 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0049] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0050] In one embodiment, Figure 1 As shown, a method for generating negative samples for a knowledge graph link prediction task in a recommendation system is provided. This 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: Initially embed the entities to be inferred in the knowledge graph in the recommendation system according to the preset embedding model 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 relationships, thereby improving the completeness and prediction ability of the knowledge graph. Based on a given entity set E and relationship set R, the knowledge graph can be defined as a set of triples where s i and o k are the head entity and the tail entity respectively, r j For the relationship between them. Link prediction is a key task in knowledge graphs. Its goal is to predict missing entities and relations based on known entities and relations. Specifically, link prediction typically 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] In step 104, Gaussian noise is gradually added to the initial embedding representation at each time step to establish a forward noisy 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 denoising 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, negative samples of the knowledge graph link prediction task of the recommendation system are obtained.
[0057] In the aforementioned recommendation system's negative sample generation method for the knowledge graph link prediction task, noise is first introduced into the initial embedding representation through a forward denoising process. Then, during the backward denoising process, conditional embedding guidance is set to ensure that the recovered target embedding not only conforms to the distribution of the embedding space but also incorporates the semantic information of the knowledge graph, ensuring semantic rationality. The generated negative samples not only overcome data sparsity and sample imbalance issues, 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 the forward noise addition model is established as follows:
[0059]
[0060] Among them, β t Indicates 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 embedding entity at time step t, E d,0 represents the initial embedding representation, represents the normal distribution, α t =1-β t , True noise ∈ t Normal distribution normal distribution China 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, 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 as follows:
[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 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 noise at each time step. After training, the diffusion model can learn the intrinsic connection between the conditions (and the fusion of the head entity and the relationship) and the tail entity. D Represents the loss function; the diffusion model for noise prediction is trained according to the loss function.
[0068] Specifically, the diffusion model can be an encoder consisting of two serial blocks.
[0069] In one embodiment, according to the forward denoising model and the backward 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 denoising 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 a noise term sampled from a standard normal distribution, introducing additional randomness to simulate the actual noise sampling process. Sampling is performed at intermediate steps in the backpropagation process to obtain the required virtual negative samples. Specifically, the results of, for example, 20 time points are uniformly sampled along the backpropagation timeline as negative samples. Because the distance from the initial noise to some extent indicates the difficulty of negative samples, samples farther away are multiplied by a larger coefficient, while samples closer are multiplied by a smaller coefficient.
[0073] In one embodiment, 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 scoring function can adopt various scoring 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. In addition, 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 addition module 204 is used to gradually add Gaussian noise to the initial embedding representation at each time step to establish a forward noise addition model;
[0081] A reverse denoising module 206 is configured to gradually remove noise from the noisy embedded entity output by the forward noisy model at each time step by setting conditional embedding guidance to 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 configured to gradually add Gaussian noise to the initial embedding representation to be inferred at each time step, and establish a forward noise adding model as follows:
[0084]
[0085] Among them, β t Indicates 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 embedding entity at time step t, Ed,0 represents the initial embedding representation, represents the normal distribution, α t =1-β t , True noise ∈ t Normal distribution normal distribution China 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 configured 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 follows:
[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 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 further configured to construct the real noise ∈ 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, according to the forward denoising model and the reverse denoising model, a denoising embedding representation model in the denoising process:
[0095]
[0096] in, represents the Gaussian noise used in the sampling process, σ t is the standard deviation at time step t;
[0097] At a 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 embodiment, 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] Regarding 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. The various modules 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 their combination. 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, memory, network interface, display screen and input device connected via a system bus. 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 via 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 covering the display screen, or a key, trackball or touchpad provided on the computer device housing, or an external keyboard, touchpad or mouse.
[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 shown in the figure, or combine certain components, or have a different component arrangement.
[0102] In one embodiment, a computer device is provided, including a memory and a processor. 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 will appreciate that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. 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. By way of illustration and not limitation, RAM is available in various 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 can 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-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that a person skilled in the art could make various modifications and improvements without departing from the spirit of the present application, all of which fall within the scope of protection of the present application. Therefore, the scope of protection of the present patent application shall be determined by the appended claims.
Claims
1. A method for generating negative samples for the knowledge graph link prediction task of a recommendation system, characterized by: The method comprises: According to the pre-set 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; 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 follows: ; ; in, represents the noise intensity at each time step, t is the time step, T is the total number of time steps, represents the noisy embedded entity at time step t, represents the initial embedding representation, represents a normal distribution, , , real noise Normal distribution ,normal distribution middle is the mean, is the standard deviation, is the covariance, I is the identity matrix; 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-added embedding entity output by the forward denoising model is gradually de-noised by setting conditional embedding guidance, and the reverse denoising model is established as follows: ; ; in, is the probability distribution representing the reverse denoising process, describing the denoising process from time step t to time step t-1, is the reverse process of the diffusion model according to the time step t , noisy embedding and conditional embedding The predicted mean, is the variance at that time step, is the prediction noise.
2. The method according to claim 1, characterized in that The method further comprises: Constructing the real noise of the model during the forward noise addition process and the prediction noise in the reverse process The loss function between is: ; in, represents the Euclidean distance, represents the loss function; A diffusion model for noise prediction is trained according to the loss function.
3. The method according to claim 2, 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, is the time step t The standard deviation of At a 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.
4. The method according to any one of claims 1 to 3, 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.
5. A negative sample generation device for a knowledge graph link prediction task in 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; The forward noise module is used to gradually add Gaussian noise to the initial embedding representation at each time step to establish a forward noise model; A reverse denoising module is used to gradually remove noise from the noisy embedded entity output by the forward noisy model by setting conditional embedding guidance at each time step to establish a reverse denoising model; A negative sample generation module, configured to obtain negative samples for the knowledge graph link prediction task of the recommendation system by sampling in the reverse denoising process of the reverse denoising model; The forward noise addition 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 addition model is established as follows: ; ; in, represents the noise intensity at each time step, t is the time step, T is the total number of time steps, represents the noisy embedded entity at time step t, represents the initial embedding representation, represents a normal distribution, , , real noise Normal distribution ,normal distribution middle is the mean, is the standard deviation, is the covariance, I is the identity matrix; The reverse denoising module is also used to gradually remove noise from the noisy embedded entity output by the forward noisy model at each time step by setting conditional embedding guidance, and establish a reverse denoising model as: ; ; in, is the probability distribution representing the reverse denoising process, describing the denoising process from time step t to time step t-1, is the reverse process of the diffusion model according to the time step t , noisy embedding and conditional embedding The predicted mean, is the variance at that time step, is the prediction noise.
6. 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 4 are implemented.
7. 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 4 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