A Hybrid Dynamic Negative Sampling Method for Knowledge Graph Recommendation Models
By constructing a user-item collaboration graph in the knowledge graph recommendation model, and using the node2vec algorithm and positive mixture technique to optimize negative sample selection, the problem of low negative sample quality is solved, thereby improving the recommendation performance and flexibility of the model.
Patent Information
- Application Number
- CN202310329459.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-30
- Publication Date
- 2025-10-31
- Estimated Expiration
- 2043-03-30
AI Technical Summary
Existing knowledge graph recommendation models suffer from low-quality negative samples in negative sampling techniques, and most methods lack specificity and flexibility, failing to effectively correct errors in initial assumptions during training.
A hybrid dynamic negative sampling method is adopted, which constructs a user-item collaboration graph by combining a user-item bipartite graph and a knowledge graph. The node2vec algorithm is used to select candidate negative samples, and positive mixing and hard negative sample construction are carried out during model training. The BPR loss function is used to optimize the model.
It significantly improves the quality of negative samples and the performance of model recommendations, enhancing the accuracy and flexibility of the recommendation system, especially with remarkable results on different datasets.
Smart Images

Figure CN116340501B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of knowledge graph recommendation systems, and more specifically to a hybrid dynamic negative sampling method for knowledge graph recommendation models. Background Technology
[0002] Knowledge graph recommendation models have become a highly popular area within the recommender systems branch in recent years. The rich auxiliary information in knowledge graphs provides more feature information for item entities in the recommendation model. Knowledge graphs not only contain item entities but also various relationships between entities, which can bring a degree of interpretability to the recommendation results. Therefore, leveraging knowledge graphs to improve the metrics of recommendation tasks is a natural approach.
[0003] However, most models overlook the importance of negative sampling techniques. When training a model, positive samples are easy to collect, but the number of negative samples is often large. Moreover, due to the ambiguity of the data, it is difficult to select a reliable negative sample for the user, which will limit the accuracy of the model to a certain extent.
[0004] Currently, most negative sampling techniques in knowledge graph recommendation models directly adopt those used in recommendation models without knowledge graphs, lacking specificity. Other negative sampling methods that leverage knowledge graphs often employ a single approach, such as selecting entities as negative samples based on popularity within the knowledge graph and then directly feeding them into the model for training. The problem with these methods is that if the initial assumptions are flawed, the model cannot correct them during training. Therefore, improving negative sampling techniques in knowledge graph recommendation models is a key research focus.
[0005] Existing negative sampling methods in knowledge graph recommendation models often select negative samples of low quality. First, most models directly use negative sampling algorithms from recommendation models without knowledge graphs, such as random negative sampling and bias-reduced negative sampling. These methods are not specifically designed for knowledge graph recommendation models, and the selected negative samples lack specificity, often resulting in poor performance. Second, some models that use knowledge graphs for negative sampling ignore the entire model training framework, typically selecting negative samples from a single perspective—such as proposing a hypothesis and then determining the negative samples—without considering how the negative samples change during subsequent model training. Summary of the Invention
[0006] To overcome the problems in the prior art, the purpose of this invention is to propose a hybrid dynamic negative sampling method for knowledge graph recommendation models.
[0007] To achieve the above objectives, the present invention employs the following technical solution:
[0008] A hybrid dynamic negative sampling method for knowledge graph recommendation models includes the following steps:
[0009] The process involves acquiring user-item bipartite graph and knowledge graph data, then combining them to construct a user-item collaboration graph. A fixed-size candidate negative sample set is selected for each user within this graph. The positive sample data and candidate negative sample set data for each user are input into a knowledge graph-based recommendation model, and each negative sample within the set is positively mixed to obtain an enhanced negative sample set. This enhanced negative sample set is then selected and aggregated to construct hard negative samples.
[0010] Furthermore, the specific steps include:
[0011] Step 1: Obtain the user-item bipartite graph and knowledge graph data. Based on the user-item bipartite graph and knowledge graph data, construct interaction triples (u, r) for the items the user has interacted with. b i), integrate all interaction triples with the knowledge graph to form a user item collaboration graph;
[0012] Step 2: Use the node2vec algorithm to select a fixed-size set of candidate negative samples for all users in the user-item collaboration graph;
[0013] Step 3: Input the positive sample data and candidate negative sample set data of each user into the knowledge graph-based recommendation model. During the training of the knowledge graph-based recommendation model, mix the positive sample information with each negative sample in the set to obtain the enhanced negative sample set.
[0014] Step 4: Select and aggregate the enhanced negative sample set to construct difficult negative samples.
[0015] Furthermore, in step 1, the user-item collaboration graph G = {(h,r,t)|h,t∈V∪U,r∈P∪{r b}}
[0016] Where, Y∈E n*m For user item interaction information, {(h,r,t)|h,t∈V,r∈P} is knowledge graph data;
[0017] U is the user set, n and m are the number of users and the number of items, respectively, (h, r, t) is a triple, h is the head entity, r is the relation, t is the tail entity, V is the entity set, P is the relation set, I is the item set, r b The established interaction relationship.
[0018] Furthermore, the specific process of step 2 is as follows:
[0019] Step 2.1: First, generate weights for all edges in the user item collaboration graph;
[0020] Step 2.2: Loop through the user set and take out one user that has not yet been processed. If all users have been processed, the candidate negative sample selection process ends.
[0021] Step 2.3: Take an unprocessed user node as the starting point, then normalize the weights of the edges between the user node and its neighbors, and use them as the probability that each neighbor node will be visited in the first step; use the calculated visit probability of each neighbor to perform the first step.
[0022] Step 2.4: Continue the subsequent walks, and perform negative sampling during this process;
[0023] In step 2.4, if the current neighbor node is an item entity and the item entity has never interacted with the user, then the item is added to the candidate negative sample set; if the current node is a non-item entity or an item that the user has interacted with, then it is considered an invalid node, and the process continues until the length of the candidate negative sample set reaches a fixed threshold.
[0024] Furthermore, in step 2.1, the weights are calculated using the following formula:
[0025] w ht =(deg(h)·deg(t)) 3 / 4
[0026] Where deg(·) represents the degree of the node, w ht For weights.
[0027] Furthermore, the probability is calculated using the following formula:
[0028]
[0029] Among them, softmax(w ht Let t' be the probability of walking from entity h to entity t, t' be the neighboring nodes of entity h, G be the user-item collaboration graph, and w be the probability of walking from entity h to entity t. ht′ Let h be the weight of the edge between entity h and entity t′.
[0030] Furthermore, in step 2.4, assume l x If the current node is the x-th node in the user item collaboration graph, then the x-th node l x It is generated through the following probability distribution:
[0031]
[0032] Among them, T ijZ is the non-normalized transition probability from node i to node j, and Z is the normalization constant. x It is the x-th node in the walking process, l x-1 It is the (x-1)th node in the traversal process, where i and j are entities in the user collaboration graph; T ij Represented as:
[0033] T ij =f ab (o,j)w ij
[0034] Where o represents the previous node of the wandering node i, w ij f represents the weight of the edge between node i and node j. ab The calculation method for (o,j) is as follows:
[0035]
[0036] Among them, dist o,j This represents the shortest path length between node o and node j, where a and b are hyperparameters.
[0037] Furthermore, the specific process of step 3 is as follows: During the training of the knowledge graph-based recommendation model, each input data unit consists of one user, one positive sample, and K negative samples selected for each user. After the convolution operation of each layer is completed, a certain amount of positive sample information is inserted into all K negative samples to enhance the embedding representation of the candidate negative samples.
[0038] Furthermore, during the training of the knowledge graph-based recommendation model, the following formula is used to perform positive mixing on each negative sample in the candidate negative sample set;
[0039]
[0040] α∈(0,1)
[0041] In the formula, e z These are positive sample embeddings and negative sample embeddings, respectively. α is a moderating factor used to adjust the proportion of positive sample information, e′ z It is an enhanced negative sample embedding representation after positive mixing.
[0042] Furthermore, the process of step 4 is as follows:
[0043] Step 4.1: After each convolutional layer is completed, the user representation and the representation of the augmented negative sample are obtained. Then, the inner product operation is performed on the user embedding representation and the embedding representation of each augmented negative sample to obtain the score of each augmented negative sample. The score is then normalized and used as the probability of the augmented negative sample being selected.
[0044] Step 4.2: In each layer, select an enhanced negative sample based on the probability of the enhanced negative sample being selected;
[0045] Step 4.3: Use an attention mechanism to aggregate the enhanced negative samples selected from each layer to obtain hard negative samples;
[0046] The aggregation formula is as follows:
[0047]
[0048]
[0049] Where L is the number of convolutional layers, and l and l * It is the convolutional layer number. It is the final constructed hard negative sample embedding representation. It is the embedding representation of the enhanced negative sample selected from the l-th layer, β(l) is the attention weight that controls the acquisition of information of the enhanced negative sample from the l-th layer, x is a trainable parameter, and T is the transpose.
[0050] Compared with the prior art, the present invention has the following beneficial effects:
[0051] This invention proposes a hybrid dynamic negative sampling method for knowledge graph recommendation models, which is comprehensive in its approach. The entire negative sampling process is divided into two steps: First, in the candidate negative sample selection, a random walk hypothesis is made based on the relationship between users and entities in the knowledge graph to select a set of negative samples that are relatively good for users. Second, in the generation of hybrid hard negative samples, since the samples in the candidate negative sample set cannot be guaranteed to be completely reliable, the negative samples are positively mixed during the training of the knowledge graph-based recommendation model to make them closer to the features of good negative samples and improve their reliability. Through this progressive process, the quality of the constructed negative samples is relatively high. Experiments show that using the constructed negative samples in the training process of existing knowledge graph recommendation models can significantly improve recommendation performance. Compared with existing negative sampling methods for knowledge graph recommendation models, this invention offers a more significant improvement and greater flexibility. Attached Figure Description
[0052] Figure 1 This is an explanatory diagram of the candidate negative sample selection module of the present invention;
[0053] Figure 2 This is a flowchart of the dynamic construction of difficult negative samples according to the present invention;
[0054] Figure 3 This is a flowchart illustrating the training process within the knowledge graph recommendation model framework of this invention. Detailed Implementation
[0055] The present invention will now be described in detail with reference to the accompanying drawings.
[0056] See Figure 1 , Figure 2 and Figure 3 The present invention provides a hybrid dynamic negative sampling method for knowledge graph recommendation models, comprising the following steps:
[0057] First, obtain arbitrary user-item bipartite graph and knowledge graph data. Then, combine the user-item bipartite graph and knowledge graph to construct a user-item collaboration graph. Use the node2vec algorithm to select a fixed-size candidate negative sample set for all users in the user-item collaboration graph. Next, in the dynamic part, input the positive sample data and candidate negative sample set data of each user into the existing knowledge graph-based recommendation model. During model training, perform positive mixing on each negative sample in the candidate negative sample set to obtain an augmented negative sample set. Then, select and aggregate the augmented negative sample set to construct hard negative samples. Finally, use BPR loss to learn the model to evaluate the quality of the negative samples. Specifically, the following steps are included:
[0058] Step 1: As Figure 1 As shown, the user's item interaction information Y∈R is first obtained. n*m and knowledge graph data {(h,r,t)|h,t∈V,r∈P}, where Y ui =1 indicates that user u has interacted with item i, Y ui =0 means user u has not interacted with item i. Then, for Y... ui User items with a value of 1 construct an interaction triple (u, r) b ,i), where r b The established interaction relationships are then defined. Finally, by leveraging the relationship that item set I is a subset of entity set V, all interaction triples are integrated with the knowledge graph to form a user-item collaboration graph G = {(h,r,t)|h,t∈V∪U,r∈P∪{r b}}.
[0059] Where U is the set of users, n and m are the number of users and the number of items, respectively, (h,r,t) is a triple, h is the head entity, r is the relation, t is the tail entity, V is the set of entities, P is the set of relations, and I is the set of items.
[0060] Step 2: Use the node2vec algorithm to select a fixed-size set of candidate negative samples for all users in the user-item collaboration graph. The specific process is as follows:
[0061] Step 2.1: First, generate weights for all edges in the user-item collaboration graph, as follows:
[0062] In a knowledge graph, each entity represents something in the real world, and the degree of a node indicates its importance and influence within the graph. When sampling negative samples, entities with higher degrees but with which users have not yet interacted are more suitable as negative samples. Therefore, when establishing weights for edges between entities, they can be constructed based on the entity's degree. Specifically, the following formula is used:
[0063] w ht =(deg(h)·deg(t)) 3 / 4
[0064] Where deg(·) represents the degree of the node, w ht For weights.
[0065] Step 2.2: Loop through the user set and take out one user that has not yet been processed. If all users have been processed, the selection of candidate negative samples ends.
[0066] Step 2.3: As Figure 1 As shown in the user-item collaboration graph, we take an unprocessed user node as the starting point, and then normalize the weights of the edges between that user node and its neighbors, treating them as the probability that each neighbor node will be visited in the first step. The normalization formula is:
[0067]
[0068] softmax(w ht Let t' be the probability of walking from entity h to entity t, t' be the neighboring nodes of entity h, G be the user-item collaboration graph, and w be the probability of walking from entity h to entity t. ht′ Let h be the weight of the edge between entity h and entity t′.
[0069] The first step of the walk is performed using the calculated walk probability of each neighbor.
[0070] Step 2.4: Continue the walk, performing negative sampling in the process. Specifically, if the current node is an item entity that has never been interacted with by the user, then add the item to the candidate negative sample set. If the current node is a non-item entity, or an item that the user has interacted with, then treat it as an invalid node and do not process it, until the length of the candidate negative sample set reaches a fixed threshold K.
[0071] In this step, a probability distribution different from that in step 2.3 is used to calculate the probability that a neighbor is walked to. Specifically: Assume l x If the current node is the x-th node in the user item collaboration graph, then the x-th node l x It is generated through the following probability distribution:
[0072]
[0073] Where T ij Z is the non-normalized transition probability from node i to node j, and Z is the normalization constant. x It is the x-th node in the walking process, l x-1 It is the (x-1)th node in the traversal process, and i and j are entities in the user collaboration graph. ij Represented as:
[0074] T ij =f ab (o,j)w ij
[0075] Where o represents the previous node of the wandering node i, w ij f represents the weight of the edge between node i and node j. ab The calculation method for (o,j) is as follows:
[0076]
[0077] Among them, dist o,j This represents the shortest path length between node o and node j, where a and b are hyperparameters.
[0078] Step 3: In the dynamic module, the positive sample data of each user and the previously selected candidate negative sample set are input into the existing knowledge graph-based recommendation model. During model training, a positive mixing operation is performed on each negative sample in the set to obtain an enhanced negative sample set. The specific process is as follows: Figure 2 As shown, during the training of the knowledge graph convolution, each input data unit consists of one user, one positive sample, and K candidate negative samples selected for each user. After each convolution operation, a certain amount of positive sample information is inserted into all K negative samples to enhance the embedding representation of the negative samples. The specific method is as follows:
[0079]
[0080] α∈(0,1)
[0081] In the formula, e z These are positive sample embeddings and negative sample embeddings, respectively. α is a moderating factor used to adjust the proportion of positive sample information, e′ z It is an enhanced negative sample embedding representation after positive mixing.
[0082] Step 4: Select and aggregate the augmented negative sample set to construct hard negative samples. Details are as follows:
[0083] Step 4.1: After each convolutional layer is completed, the user representation and the representation of the augmented negative sample are obtained. Then, the inner product operation is performed on the user embedding representation and the embedding representation of each augmented negative sample to obtain the score of each augmented negative sample. The score is then normalized and used as the probability of the augmented negative sample being selected.
[0084] Step 4.2: In each layer, select an enhanced negative sample based on the probability of the enhanced negative sample being selected.
[0085] Step 4.3: Use an attention mechanism to aggregate the enhanced negative samples selected from each layer to obtain hard negative samples. The aggregation formula is as follows:
[0086]
[0087]
[0088] Where L is the number of convolutional layers, and l and l * It is the convolutional layer number. It is the final constructed hard negative sample embedding representation. It is the embedding representation of the enhanced negative sample selected from the l-th layer, β(l) is the attention weight that controls the acquisition of information of the enhanced negative sample from the l-th layer, x is a trainable parameter, and T is the transpose.
[0089] Step 5: To verify the quality of constructing difficult negative samples, the model is trained using BPR loss. Specifically, after constructing difficult negative samples for each positive sample, the goal is to maximize the user's score relative to positive samples and minimize their score relative to negative samples. In other words, to maximize the difference between the user's scores on positive and negative samples. Therefore, BPR loss is directly used for training. The BPR loss function is defined as follows:
[0090]
[0091] Among them, O + For the set of positive samples, O - Let be the set of negative samples, where each element is a hard negative sample constructed through the above steps. σ is the sigmoid function. Here, stochastic gradient descent is used to optimize the model parameters, gradually reducing the value of the loss function, and finally obtaining the embedding representations of users and items.
[0092] Step 6: Obtain the embedding vectors of users and items using the trained model. Then, perform an inner product operation between the user's embedding vector and the embedding vectors of all items to obtain the user's liking score for each item. These scores are then sorted, and the top-ranked items are selected as the final recommendation list. Experiments show that the recommendation list obtained by the model trained with difficult negative samples is more in line with user preferences, demonstrating the superiority of this negative sampling strategy.
[0093] This invention proposes a hybrid dynamic negative sampling method for knowledge graph recommendation models. This technique improves the ability of knowledge graph recommendation models to select high-quality negative samples, effectively enhancing the model's recommendation metrics. The invention mainly involves two parts: first, using the structural information of the knowledge graph, a set of excellent candidate negative samples is selected for each user; then, a hybrid method is used to further optimize the negative samples in the candidate set; finally, reliable hard negative samples are constructed for model training and learning.
[0094] The following are specific implementation examples.
[0095] The table below shows the datasets used in the experiments of this method, which include different scenarios: books, music, clothing, and datasets of different sizes.
[0096]
[0097] For each dataset in the table, the method described in this invention is applied. Figure 3 The flowchart of the method proposed in this invention can be found here. Figure 3 Specifically, it includes the following steps:
[0098] Step 1: Process the user-item interaction information in the dataset into a 0-1 interaction matrix, and then combine the user-item interaction information with the knowledge graph information to construct a user-item collaboration graph. This graph is constructed based on the mapping relationship between item entities in the knowledge graph and the items that the user has interacted with.
[0099] Step 2: Generate weights for all edges in the user item collaboration graph, using the following formula:
[0100] w ht =(deg(h)·deg(t)) 3 / 4
[0101] Then, a node2vec-based random walk strategy is used to select a fixed-size set of candidate negative samples for all users in the user-item collaboration graph. The walk process is as follows: starting from the user node, the probability of walking to a neighbor node in the first step is calculated using the following formula:
[0102]
[0103] After the first step, the process continues, and negative sampling begins. Specifically, if the current node is an item entity that has never interacted with the user, the item is added to the candidate negative sample set. If the current node is a non-item entity, or an item that the user has interacted with, it is considered an invalid node and no further processing is performed. This continues until the length of the candidate negative sample set reaches a fixed threshold K.
[0104] In this step, the formula for calculating the probability of traversing to a neighboring node changes. Specifically, assuming l x If the current node is the x-th node in the random walk of the collaborative knowledge graph, then the x-th node l x It is generated through the following probability distribution:
[0105]
[0106] Where T ij Z is the non-normalized transition probability from node i to node j, and Z is the normalization constant.
[0107] Step 3: Input the user, positive samples, and candidate negative samples generated in the above steps into the recommendation model. Then, after each layer of knowledge graph convolution, the negative samples are mixed using the positive sample information. The method is as follows: After performing L convolutional layers, one enhanced negative sample is selected from each layer for subsequent use. The probability of each enhanced negative sample being selected is obtained by performing an inner product operation between the enhanced negative sample embedding and the user embedding to generate a score, which is then normalized.
[0108] Step 4: Aggregate the enhanced negative samples selected from each layer into the final hard negative samples using an attention mechanism. The aggregation formula is as follows:
[0109] The formula for calculating attention weights is:
[0110] Step 5: The model uses BPR loss to maximize the difference in scores between positive samples and hard negative samples. The BPR loss function is defined as follows:
[0111]
[0112] Step Six: Obtain the embedding vectors of users and items using the trained model. Then, perform an inner product operation between the user's embedding vector and the embedding vectors of all items to obtain the user's liking score for each item. Next, sort these scores and select the top-ranked items as the final recommendation list.
[0113] To verify the effectiveness of the proposed negative sampling method—SDNS—this paper selects three classic knowledge graph-based recommendation models: KGAT, CKAN, and KGIN. The SDNS negative sampling method is then added to these models and compared with their original models. Experiments are conducted on three datasets, and the results are shown in the table below:
[0114]
[0115] As can be seen from the table, on all types of datasets, the classic knowledge graph-based recommendation models KGAT, CKAN, and KGIN all showed significant improvements in recall and ndcg metrics after using the negative sampling method proposed in this invention, which strongly demonstrates the universality and effectiveness of this method.
[0116] This invention proposes a novel negative sampling strategy for knowledge graph recommendation systems, comprising two modules: candidate negative sample selection and mixing. In the candidate negative sample selection module, a user-item collaboration graph is constructed using a user-item bipartite graph and the knowledge graph. Then, a node2vec-based random walk strategy is used to select a fixed-size set of candidate negative samples for each user within the collaboration graph. In the mixing module, the candidate negative sample sets selected by each user are input into the recommendation model. During model training, each negative sample within the candidate negative sample set is positively mixed. This operation embeds the negative samples closer to the positive samples and users in a lower-dimensional space, thus constructing enhanced negative samples. Finally, the model is trained using BPR loss. This method improves the model's accuracy and convergence efficiency. Compared to previous negative sampling methods for knowledge graph recommendation models, the improvement is more significant and the flexibility is higher.
Claims
1. A hybrid dynamic negative sampling method for knowledge graph recommendation models, characterized in that, Specifically, the following steps are included: Step 1: Obtain user item bipartite graph and knowledge graph data. Based on the user item bipartite graph and knowledge graph data, construct interaction triples for items that the user has interacted with. Merge the interaction triples with the knowledge graph to form a user item collaboration graph. Step 2: Use the node2vec algorithm to select a fixed-size set of candidate negative samples for all users in the user-item collaboration graph; Step 3: Input the positive sample data and candidate negative sample set data of each user into the knowledge graph-based recommendation model. During the training of the knowledge graph-based recommendation model, perform positive mixing on each negative sample in the set to obtain the enhanced negative sample set. Step 4: Select and aggregate the enhanced negative sample set to construct difficult negative samples; The specific process of step 2 is as follows: Step 2.1: First, generate weights for all edges in the user item collaboration graph; Step 2.2: Loop through the user set and take out one user that has not yet been processed. If all users have been processed, the selection of candidate negative samples ends. Step 2.3: Take an unprocessed user node as the starting point, then normalize the weights of the edges between the user node and its neighbors, and use them as the probability that each neighbor node will be visited in the first step; use the calculated visit probability of each neighbor to perform the first step. Step 2.4: Continue the subsequent walks, and perform negative sampling during this process; In step 2.4, if the current neighbor node is an item entity and the item entity has never interacted with the user, then the item is added to the candidate negative sample set. If the current node is a non-item entity or an item that the user has interacted with, it is considered an invalid node, and the process continues until the length of the candidate negative sample set reaches a fixed threshold K.
2. The hybrid dynamic negative sampling method for knowledge graph recommendation models according to claim 1, characterized in that, In step 1, the user item collaboration graph in, For user item interaction information, Knowledge graph data; For user collection, For users, the number of items, It is a triplet. For the head entity, For the relationship, For tail entities, It is a collection of entities. It is a set of relations. For a collection of items, The established interaction relationship.
3. The hybrid dynamic negative sampling method for knowledge graph recommendation models according to claim 1, characterized in that, In step 2.1, the weights are calculated using the following formula: in Represents the degree of a node. For weights.
4. The hybrid dynamic negative sampling method for knowledge graph recommendation models according to claim 1, characterized in that, The probability is calculated using the following formula: in, To be from the entity Wandering to the physical world The probability magnitude, For entities The neighboring nodes, For user item collaboration diagrams, For entities With entity The weight of the edges between them.
5. The hybrid dynamic negative sampling method for knowledge graph recommendation models according to claim 1, characterized in that, In step 2.4, it is assumed that... This is the current random walk in the user item collaboration graph. The nth node, then the nth Nodes It is generated through the following probability distribution: in, It is a node To the node The nonnormalized transition probability, It is a normalization constant. It is the first time during the wandering process 1 node It is the first time during the wandering process 1 node It is an entity in the user collaboration graph; Represented as: in, Represents a wandering node The previous node, Represents a node With nodes The weight of the edges between them. The calculation method is as follows: in, Represents a node With nodes The shortest path length between them. This is a hyperparameter.
6. The hybrid dynamic negative sampling method for knowledge graph recommendation models according to claim 1, characterized in that, The specific process of step 3 is as follows: During the training of the knowledge graph-based recommendation model, each input data unit consists of one user, one positive sample, and K negative samples selected for each user. After the convolution operation of each layer is completed, a certain amount of positive sample information is inserted into all K negative samples to enhance the embedding representation of the negative samples.
7. The hybrid dynamic negative sampling method for knowledge graph recommendation models according to claim 6, characterized in that, During the training of the knowledge graph-based recommendation model, the following formula is used to perform positive mixing on each negative sample in the set; In the formula, These are positive sample embeddings and negative sample embeddings, respectively. It is a regulatory factor used to adjust the proportion of positive sample information. It is an enhanced negative sample embedding representation after positive mixing.
8. The hybrid dynamic negative sampling method for knowledge graph recommendation models according to claim 1, characterized in that, The process of step 4 is as follows: Step 4.1: After each convolutional layer is completed, the user representation and the representation of the augmented negative sample are obtained. Then, the inner product operation is performed on the user embedding representation and the embedding representation of each augmented negative sample to obtain the score of each augmented negative sample. The score is then normalized and used as the probability of the augmented negative sample being selected. Step 4.2: In each layer, select an enhanced negative sample based on the probability of the enhanced negative sample being selected; Step 4.3: Use an attention mechanism to aggregate the enhanced negative samples selected from each layer to obtain hard negative samples; The aggregation formula is as follows: in, It is the number of convolutional layers. and It is the convolutional layer number. It is the final constructed hard negative sample embedding representation. From the first The embedding representation of the enhanced negative samples selected from the layers. Is it to control the acquisition of the first Layers enhance the attention weights for negative sample information. These are trainable parameters, and T is the transpose.
Citation Information
Patent Citations
Knowledge graph assisted paired sorting personalized e-commerce recommendation method and system
CN112950324A
Novelty enhancement recommendation method based on knowledge graph
CN115760270A