A decoupled negative sampling method based on contrastive learning and system thereof
By using contrastive learning and decoupling negative sampling through gating networks, relevant and irrelevant factors in user interactions are separated, and model parameters are optimized. This solves the problem of limited negative sampling performance in existing technologies and enables more efficient recommendation model training and user preference learning.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-27
- Publication Date
- 2026-03-17
AI Technical Summary
Existing negative sampling methods fail to effectively distinguish various factors of user interaction in implicit collaborative filtering, resulting in limited training performance of recommendation models.
A decoupled negative sampling method based on contrastive learning is adopted. By using a gating network to separate relevant and irrelevant factors of user interaction, contrastive learning is used to optimize the loss and update the model parameters, and the optimal negative sample is selected for training.
It improves the accuracy and performance of recommendation models, enabling them to better learn users' true preferences and enhance the effectiveness of recommendation systems.
Smart Images

Figure CN116340647B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of personalized recommendation, specifically relating to a decoupled negative sampling method and system based on contrastive learning. Background Technology
[0002] With the continuous development of information technology, the internet plays an increasingly important role in today's society. People spend a significant amount of time online every day for various activities such as shopping, socializing, watching videos, and listening to music. As the amount of information available online continues to increase, people need to spend more time finding content that truly interests them, which causes considerable inconvenience. Therefore, in this era of information overload, how to present useful information to the right users is a highly challenging and urgent problem. Effectively solving the problem of information overload can improve the experience of information recipients and enhance the economic benefits for information providers, and recommendation systems are widely recognized as one of the most powerful tools for addressing information overload. Recommendation systems can accurately predict user preferences and recommend content that best matches their interests, greatly facilitating users and alleviating the burden of choosing from a vast amount of information.
[0003] As one of the most fundamental tools in recommender systems, collaborative filtering aims to predict user preferences using historical feedback. Based on the different types of historical feedback, collaborative filtering can be divided into two types: explicit collaborative filtering and implicit collaborative filtering. Explicit collaborative filtering utilizes explicit user feedback, such as comments and ratings, which accurately reflect user preferences. Implicit collaborative filtering, on the other hand, utilizes implicit user feedback, such as clicks and purchases, which lack explicit labels reflecting user preferences. In daily life, implicit user feedback is often abundant and easy to collect; therefore, implicit collaborative filtering is closer to real-world scenarios and should receive more attention and research. For implicit user feedback, the data lacks explicit labels reflecting user preferences. To train the model, it is generally assumed that items interacted with by the user are positive samples, and a subset of items not interacted with by the user is selected as negative samples through sampling. This process of selecting negative samples from the set of uninterrupted items based on a certain strategy is called negative sampling.
[0004] Recently, with the deepening research on negative sampling, methods can be broadly classified into two categories: heuristic negative sampling and model-based negative sampling. Heuristic negative sampling uses heuristic rules to set the sampling distribution, which is usually fixed. These methods have low overhead, are easy to understand and implement, but may have limitations in performance. Representative heuristic negative sampling methods include random negative sampling and popularity-based negative sampling. Random negative sampling samples items as negative samples from a set of items that the user has not interacted with, with equal probability. Popularity-based negative sampling sets different sampling probabilities based on the popularity of items, with highly popular items being more likely to be sampled as negative samples. Unlike heuristic negative sampling methods with a fixed sampling distribution, model-based negative sampling dynamically sets the sampling distribution by considering information from the recommendation model. These methods are more likely to collect high-quality negative samples and are currently considered cutting-edge sampling algorithms. Representative model-based negative sampling methods include dynamic negative sampling, negative sampling based on generative adversarial networks, and generative negative sampling. Dynamic negative sampling adaptively samples items with high ratings from the recommendation model as negative samples during training. These negative samples are generally considered hard negative samples, providing more information for the recommendation model training. IRGAN, a negative sampling model based on adversarial generative networks, comprises two recommendation models: a generator and a discriminator, trained based on an adversarial approach. The generator aims to sample negative samples and mix them into the positive samples to confuse the discriminator, while the discriminator distinguishes between positive samples and the generator-mixed negative samples, providing feedback to the generator. Generative negative sampling MixGCF further improves recommendation performance by mixing information from positive samples into negative samples to synthesize hard negative samples. Existing negative sampling methods treat items as an indivisible whole. However, in daily life, user interactions may be driven by specific factors related to an item, not necessarily by the user's overall liking for that item. Summary of the Invention
[0005] This invention provides a decoupled negative sampling method and system based on contrastive learning to solve the negative sampling problem in implicit collaborative filtering scenarios in the prior art. It uses gating networks, contrastive learning and other techniques to fully consider and explore the various relationships in user interactions.
[0006] This invention is achieved through the following technical solution:
[0007] A decoupling negative sampling method based on contrastive learning, the decoupling negative sampling method comprising the following steps:
[0008] Step 1: Initialize the parameters of the selected implicit collaborative filtering model;
[0009] Step 2: Randomly select a certain number of items from the items that the user has not interacted with to construct a negative sample candidate set;
[0010] Step 3: Decouple and separate relevant and irrelevant factors from the negative samples in the candidate set of Step 2 using a gating network;
[0011] Step 4: Use the relevant and irrelevant factors separated in Step 3 to determine the optimal negative sample;
[0012] Step 5: Use the optimal negative samples determined in Step 4 to train the implicit collaborative filtering model, use contrastive learning to ensure the accuracy of decoupling, and optimize the loss to update the parameters of the gating network.
[0013] Step 6: Using the final parameters of the implicit collaborative filtering model obtained from Step 5, calculate the scores of users and items and make recommendations to users.
[0014] A decoupling negative sampling method based on contrastive learning, wherein step 3 specifically includes the following steps:
[0015] Step 3.1: Decouple the relevant and irrelevant factors of the interactive positive samples through a positive gating network;
[0016] Step 3.2: Decouple the relevant and irrelevant factors of candidate negative samples using a negative gating network;
[0017] Step 3.3: Calculate the irrelevant factors for positive and negative samples based on Step 3.1 and Step 3.2.
[0018] A decoupled negative sampling method based on contrastive learning, wherein step 3.1 specifically involves, for a positive sample pair (u, v) + ), where u represents the user, v + Represents positive interactive samples; e u ∈R d and Let u and v represent user u and positive sample v, respectively. + The formula for the embedded positive gate network operation is:
[0019]
[0020] in It is a positive sample v + Related factors, W p W u ∈R d×d and b p ∈R d These are the trainable parameters of the positive gated network, and σ(·) is the sigmoid function. It is an element-wise product;
[0021] Step 3.2 specifically involves, for the candidate negative sample set... Each embedding in The formula for negative gated network operations is:
[0022]
[0023] in It is a negative sample v m Related factors, W n W r ∈R d×d and b n ∈R d These are the trainable parameters of the negatively gated network, and σ(·) is the sigmoid function. It is an element-wise product.
[0024] A decoupling negative sampling method based on contrastive learning, wherein step 3.3 determines the optimal negative sample by separating the relevant and irrelevant factors. This is achieved by element-wise subtraction between the original embedding and the decoupled relevant factors to decouple the corresponding irrelevant factors. The formula is as follows:
[0025]
[0026] in and These represent positive samples v respectively. + and negative sample v m Unrelated factors This represents element-wise subtraction.
[0027] A decoupling negative sampling method based on contrastive learning, wherein step 4 specifically includes the following steps:
[0028] Step 4.1: Calculate the difference between the scores of positive and negative samples under the relevant and irrelevant factors using the obtained positive samples and candidate negative samples;
[0029] Step 4.2: Use pre-set parameters to balance the difference between positive and negative sample scores under relevant and irrelevant factors to obtain the final score of each candidate negative sample;
[0030] Step 4.3: Determine the optimal negative sample based on the final score from Step 4.2.
[0031] A decoupled negative sampling method based on contrastive learning, wherein step 4.1 uses the difference between predicted scores, and the formula is as follows:
[0032]
[0033] Where s r and s i These are measures of positive sample v + and candidate negative samples vm The score for the difference between relevant and irrelevant factors.
[0034] A decoupled negative sampling method based on contrastive learning, wherein step 4.2 introduces a hyperparameter α, the formula of which is:
[0035] s=α*s r -(1-α)*s i .
[0036] A decoupled negative sampling method based on contrastive learning, wherein step 4.3 selects the sample with the largest s in the candidate negative sample set as the final negative sample; according to the formulas in steps 3.3 and 4.1, and the distributive property of vector multiplication, the operation in step 4.3 is finally simplified to:
[0037]
[0038] A decoupling negative sampling method based on contrastive learning, wherein step 5 specifically includes the following steps:
[0039] Step 5.1: Using the optimal negative sample obtained in Step 4.3, calculate the recommendation loss with the positive sample, optimize the loss, and update the model parameters:
[0040]
[0041] in This represents L2 regularization, used to address overfitting issues, where λ is a coefficient controlling the intensity.
[0042] Step 5.2: Using the relevant and irrelevant factors of the interacted items and candidate negative samples obtained in Step 3, construct four different contrastive learning tasks:
[0043] Using users as the anchor, four comparative learning tasks were designed:
[0044]
[0045]
[0046]
[0047]
[0048] These four contrastive learning tasks respectively supervise the decoupling of positive samples, the decoupling of negative samples, the decoupling of relevant factors, and the decoupling of irrelevant factors;
[0049] Step 5.3: Based on the task designed in Step 5.2, calculate the decoupling loss and optimize the loss to update the parameters of the gating network:
[0050] The loss for the contrastive learning task is calculated using the following formula:
[0051]
[0052] The vector inner product is used to measure the similarity of the embeddings, i.e., sim(·,·). Therefore, the decoupling loss is:
[0053]
[0054] A decoupled negative sampling method based on contrastive learning, wherein step 6 specifically involves: fully training the model to obtain the final parameters, i.e., the embeddings of users and items; calculating the score of the item to be recommended for the user; and recommending the item to the user based on the recommendation score.
[0055] By calculating user embedding e u and the embedding of each candidate item v The similarity score between items is used to generate a recommendation list. Similarly, the vector inner product is used to measure the similarity of the embeddings. Finally, the top K candidate items with the highest similarity scores are selected and recommended to the user.
[0056] A decoupled negative sampling system based on contrastive learning is provided. The decoupled negative sampling system is implemented using a decoupled negative sampling method and includes an initialization unit, a construction unit, a processing unit, an update unit, and a recommendation unit.
[0057] The initialization unit initializes the parameters of the selected implicit collaborative filtering model.
[0058] The construction unit randomly selects a certain number of items from the items that the user has not interacted with to construct a negative sample candidate set;
[0059] The processing unit decouples and separates relevant and irrelevant factors from the negative samples in the candidate set through a gating network; and uses the separated relevant and irrelevant factors to determine the optimal negative sample.
[0060] The update unit uses the determined optimal negative samples to train the implicit collaborative filtering model, uses contrastive learning to ensure the accuracy of decoupling, and optimizes the loss to update the parameters of the gated network.
[0061] The recommendation unit uses the final parameters of the fully trained implicit collaborative filtering model to calculate user and item scores and recommend items to the user.
[0062] The beneficial effects of this invention are:
[0063] The unique feature of this invention lies in its full consideration of the formation characteristics of user interactions, enabling the sampling of more suitable negative samples so that the recommendation model can better learn the user's true preferences. Simultaneously, it employs a gating network to provide decoupling direction and proposes a contrastive learning task to ensure decoupling accuracy, resulting in a significant improvement in the performance of the recommendation system. Attached Figure Description
[0064] Figure 1 This is a flowchart of the method of the present invention.
[0065] Figure 2 This is a model diagram of the present invention.
[0066] Figure 3 The diagram shows the decoupling situation with and without a contrastive learning task, where (a) is the decoupling situation with a contrastive learning task and (b) is the decoupling situation without a contrastive learning task. Detailed Implementation
[0067] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0068] The present invention provides that existing negative sampling methods in the background art all treat an item as an indivisible whole. However, in daily life, a user's interaction may only be driven by certain specific factors of an item, but not by liking the item as a whole. This inspires the need to perform negative sampling by decoupling the relevant and irrelevant factors of an item.
[0069] A decoupling negative sampling method based on contrastive learning, the decoupling negative sampling method comprising the following steps:
[0070] Step 1: Initialize the parameters of the selected implicit collaborative filtering model;
[0071] Step 1, which initializes the selected implicit collaborative filtering model, specifically includes the following steps:
[0072] Step 1.1: Preprocess the raw data to filter out users with too few interaction records and overly unpopular items, such as users with less than 5 interaction records and items with less than 5 interactions. Randomly divide the data into training and test sets in an 80 / 20 ratio, that is, randomly select 80% of the interactions as the training set and the remaining 20% as the test set.
[0073] Step 1.2: Select an implicit collaborative filtering model, such as LightGCN, BPR-MF, etc., and initialize all parameters of the model, such as the embeddings of all users and items, and the parameters of the gating network;
[0074] Step 2: Randomly select a certain number of items from the items that the user has not interacted with to construct a negative sample candidate set; For each interaction of user items, randomly select M items from the items that the user has not interacted with to construct a negative sample candidate set;
[0075] Step 3: Decouple and separate relevant and irrelevant factors from the negative samples in the candidate set of Step 2 using a gating network;
[0076] Step 4: Use the relevant and irrelevant factors separated in Step 3 to determine the optimal negative sample;
[0077] Step 5: Use the optimal negative samples determined in Step 4 to train the implicit collaborative filtering model, use contrastive learning to ensure the accuracy of decoupling, and optimize the loss to update the parameters of the gating network.
[0078] Step 6: Using the final parameters of the implicit collaborative filtering model obtained from Step 5, calculate the scores of users and items and make recommendations to users.
[0079] A decoupling negative sampling method based on contrastive learning, wherein step 3 decouples and separates relevant and irrelevant factors by using a gating network to decouple negative samples in the candidate set, specifically includes the following steps:
[0080] Step 3.1: Decouple the relevant and irrelevant factors of the interactive positive samples through a positive gating network;
[0081] Step 3.2: Decouple the relevant and irrelevant factors of candidate negative samples using a negative gating network;
[0082] Step 3.3: Calculate the irrelevant factors for positive and negative samples based on Step 3.1 and Step 3.2.
[0083] A decoupled negative sampling method based on contrastive learning, wherein step 3.1 specifically involves, for a positive sample pair (u, v) + ), where u represents the user, v + Represents positive interactive samples; e u ∈R d and Let u and v represent user u and positive sample v, respectively. + The formula for the embedded positive gate network operation is:
[0084]
[0085] in It is a positive sample v + Related factors, W p W u ∈R d×d and b p ∈R d These are the trainable parameters of the positive gated network, and σ(·) is the sigmoid function. It is an element-wise product;
[0086] Step 3.2 specifically involves, for the candidate negative sample set Each embedding in The formula for negative gated network operations is:
[0087]
[0088] in It is a negative sample v m Related factors, W n W r ∈R d×d and b n ∈R d These are the trainable parameters of the negatively gated network, and σ(·) is the sigmoid function. It is an element-wise product.
[0089] A decoupling negative sampling method based on contrastive learning, wherein step 3.3 determines the optimal negative sample using the separated relevant and irrelevant factors. Intuitively, factors other than relevant factors should be considered irrelevant. The above-mentioned gating operation for decoupling relevant factors can be interpreted as assigning a corresponding weight to each factor of the item. Therefore, the corresponding irrelevant factors can be decoupled by element-wise subtraction between the original embedding and the decoupled relevant factors, with the following formula:
[0090]
[0091] in and These represent positive samples v respectively. + and negative sample v m Unrelated factors This represents element-wise subtraction.
[0092] A decoupled negative sampling method based on contrastive learning, wherein step 4, which uses the relevant and irrelevant factors separated in step 3 to determine the optimal negative sample, specifically includes the following steps:
[0093] Step 4.1: Calculate the difference between the scores of positive and negative samples under the relevant and irrelevant factors using the obtained positive samples and candidate negative samples;
[0094] Step 4.2: Use pre-set parameters to balance the difference between positive and negative sample scores under relevant and irrelevant factors to obtain the final score of each candidate negative sample;
[0095] Step 4.3: Determine the optimal negative sample based on the final score from Step 4.2.
[0096] A decoupled negative sampling method based on contrastive learning is proposed. In step 4.1, a suitable negative sample should satisfy the condition that the relevant factors of the positive and negative samples are as different as possible, while the irrelevant factors are as similar as possible. To achieve this, it is necessary to first measure the difference between the positive and negative samples in terms of relevant and irrelevant factors. For efficiency and applicability considerations, this method uses the difference between predicted scores, and the formula is:
[0097]
[0098] Where s r and s i These are measures of positive sample v + and candidate negative samples v m The score for the difference between relevant and irrelevant factors.
[0099] A decoupled negative sampling method based on contrastive learning, in step 4.2, selects the most suitable negative sample by maximizing the difference between relevant factors and minimizing the difference between irrelevant factors. To clearly balance the different contributions of these two types of factors, this method introduces a hyperparameter α, whose formula is:
[0100] s=α*s r -(1-α)*s i .
[0101] A decoupled negative sampling method based on contrastive learning, wherein step 4.3 selects the sample with the largest s in the candidate negative sample set as the final negative sample. Based on the formulas in steps 3.3 and 4.1, and the distributive property of vector multiplication, the operation in step 4.3 is finally simplified to:
[0102]
[0103] exist Figure 2 The process of the decoupling negative sampling method based on contrastive learning can be clearly understood from the text.
[0104] A decoupling negative sampling method based on contrastive learning, wherein step 5 uses the optimal negative samples determined in step 4 to train an implicit collaborative filtering model, and contrastive learning is used to ensure the accuracy of decoupling. The optimization of the loss and updating of the gated network parameters specifically includes the following steps:
[0105] Step 5.1: Using the optimal negative sample obtained in Step 4.3, calculate the recommendation loss with the positive sample, optimize the loss, and update the model parameters:
[0106]
[0107] in This represents L2 regularization, used to address overfitting issues, where λ is a coefficient controlling the intensity.
[0108] Step 5.2: Using the relevant and irrelevant factors of the interacted items and candidate negative samples obtained in Step 3, construct four different contrastive learning tasks:
[0109] The decoupling process is supervised using a contrastive learning approach; specifically, four contrastive learning tasks are designed with the user as the anchor:
[0110]
[0111]
[0112]
[0113]
[0114] These four contrastive learning tasks respectively supervise the decoupling of positive samples, the decoupling of negative samples, the decoupling of relevant factors, and the decoupling of irrelevant factors;
[0115] Step 5.3: Based on the task designed in Step 5.2, calculate the decoupling loss and optimize the loss to update the parameters of the gating network:
[0116] To achieve the task designed in step 5.2, this method refers to the Bayesian personalized ranking loss function to calculate the loss for the contrastive learning task. It aims to make anchor point a more similar to positive sample p rather than negative sample q. The specific formula is as follows:
[0117]
[0118] The vector inner product is used to measure the similarity of the embeddings, i.e., sim(·,·). Therefore, the decoupling loss is:
[0119]
[0120] exist Figure 3 The actual effect of the contrastive learning task on supervised decoupling learning can be observed very intuitively.
[0121] A decoupled negative sampling method based on contrastive learning, wherein step 6 uses the final parameters of the implicit collaborative filtering model obtained by fully training in step 5 to calculate the user and item scores for recommendation to the user. Specifically, the final parameters of the model are obtained by fully training, namely the embeddings of the user and the item, the score of the item to be recommended for the user is calculated, and the item is recommended to the user based on the recommendation score.
[0122] Specifically, by calculating the user embedding e u and the embedding of each candidate item v The similarity score between items is used to generate a recommendation list. Similarly, the vector inner product is used to measure the similarity of the embeddings. Finally, the top K candidate items with the highest similarity scores are selected and recommended to the user.
[0123] A decoupled negative sampling system based on contrastive learning is provided. The decoupled negative sampling system is implemented using a decoupled negative sampling method and includes an initialization unit, a construction unit, a processing unit, an update unit, and a recommendation unit.
[0124] The initialization unit initializes the parameters of the selected implicit collaborative filtering model.
[0125] The construction unit randomly selects a certain number of items from the items that the user has not interacted with to construct a negative sample candidate set;
[0126] The processing unit decouples and separates relevant and irrelevant factors from the negative samples in the candidate set through a gating network; and uses the separated relevant and irrelevant factors to determine the optimal negative sample.
[0127] The update unit uses the determined optimal negative samples to train the implicit collaborative filtering model, uses contrastive learning to ensure the accuracy of decoupling, and optimizes the loss to update the parameters of the gated network.
[0128] The recommendation unit uses the final parameters of the fully trained implicit collaborative filtering model to calculate user and item scores and recommend items to the user.
Claims
1. A decoupled negative sampling method based on contrastive learning, characterized in that, The decoupling negative sampling method comprises the following steps: Step 1: initializing parameters for the selected implicit collaborative filtering model; Step 2: randomly selecting a certain number of items from the items that the user has not interacted with to construct a negative sample candidate set; Step 3: decoupling the negative samples in the candidate set of step 2 through a gating network to separate relevant factors and irrelevant factors; Step 4: determining the optimal negative sample using the relevant and irrelevant factors separated in step 3; Step 5: training the implicit collaborative filtering model using the optimal negative sample determined in step 4, using contrastive learning to ensure the accuracy of decoupling and optimizing the loss to update the parameters of the gating network; Step 6: using the final parameters of the implicit collaborative filtering model obtained by sufficient training in step 5 to calculate the scores of users and items and recommending items to users; Step 3 specifically comprises the following steps: Step 3.1: decoupling the relevant factors and irrelevant factors of the interactive positive samples through a positive gating network; Step 3.2: decoupling the relevant factors and irrelevant factors of the candidate negative samples through a negative gating network; Step 3.3: calculating the irrelevant factors of the positive and negative samples based on steps 3.1 and 3.2; The step 3.1 is specifically, for a positive sample pair , wherein represents a user, represents an interactive positive sample; and respectively represent the embedding of the user and the positive sample , and the formula for the operation of the positive gate network is: wherein is a positive sample of a related factor, and are trainable parameters of a positive gating network, is a sigmoid function, is an element-wise product; Step 3.2 is in particular for each embedding in the candidate negative sample set the formula for the negative gating network operation is: the formula for the negative gating network operation is: wherein is a negative sample of a relevant factor, and are trainable parameters of a negative gating network, is a sigmoid function, is an element-wise product; The step 3.3 determines the optimal negative sample using the separated relevant and irrelevant factors by performing element-wise subtraction between the original embedding and the relevant factors decoupled, and the formula is: wherein and represent non-correlated factors of positive samples and negative samples respectively, represents element-wise subtraction.
2. The decoupled negative sampling method based on contrastive learning according to claim 1, wherein, Step 4 specifically comprises the following steps: Step 4.1: calculating the difference in scores of the positive and negative samples under the relevant and irrelevant factors using the relevant and irrelevant factors of the obtained positive samples and candidate negative samples; Step 4.2: balancing the difference in scores of the positive and negative samples under the relevant and irrelevant factors using pre-set parameters to obtain the final score of each candidate negative sample; Step 4.3: determining the optimal negative sample through the final score in step 4.
2.
3. The decoupled negative sampling method based on contrastive learning according to claim 2, characterized in that, The step 4.1 uses the difference between the predicted scores, and the formula is: wherein and are measures of positive samples and candidate negative samples are the scores of the relevant and irrelevant factors gap.
4. The decoupled negative sampling method based on contrastive learning according to claim 2, characterized in that, The step 4.2 introduces a hyperparameter , which is formulated as ; In step 4.3, select from the candidate negative sample set. The largest sample is used as the final negative sample; based on the formulas in steps 3.3 and 4.1, and the distributive property of vector multiplication, the operation in step 4.3 is finally simplified to: 。 5. The decoupled negative sampling method based on contrastive learning according to claim 1, wherein, Step 5 specifically comprises the following steps: Step 5.1: calculating the loss of the recommendation using the optimal negative sample obtained in step 4.3 and the positive sample to optimize the loss and update the model parameters: wherein denotes regularization, to solve the problem of overfitting, is a coefficient that controls the strength; Step 5.2: constructing four different contrastive learning tasks using the relevant and irrelevant factors of the interacted items and candidate negative samples obtained in step 3: Designing four contrastive learning tasks with the user as the anchor point: ; ; ; ; These four contrastive learning tasks supervise the decoupling of the positive samples, the decoupling of the negative samples, the decoupling of the relevant factors, and the decoupling of the irrelevant factors, respectively; Step 5.3: calculating the decoupling loss according to the tasks designed in step 5.2 to optimize the loss and update the parameters of the gating network: The loss of the contrastive learning task is calculated, and the specific formula is: , where the vector inner product is used to measure the similarity of the embeddings, i.e. ; thus, the decoupling loss is:
6. The decoupled negative sampling method based on contrastive learning according to claim 1, wherein, Step 6 is to sufficiently train the final parameters of the model, i.e., the embedding of the user and the item, to calculate the score of the recommended item for the user and recommend the item to the user according to the recommendation score. By computing the similarity score between the user embedding and the embedding of each candidate item to generate a list of recommendations, again using the vector inner product to measure the similarity of the embeddings, the top candidate items with the highest similarity score are ultimately selected to recommend to the user.
7. A contrastive learning based decoupled negative sampling system, characterized in that, The decoupling negative sampling system uses the decoupling negative sampling method based on contrastive learning according to any one of claims 1-6, and is implemented by using the decoupling negative sampling method. The decoupling negative sampling system comprises an initialization unit, a construction unit, a processing unit, an updating unit and a recommendation unit. The initialization unit initializes parameters of the selected implicit collaborative filtering model. The construction unit randomly selects a certain number of items from the items that have not been interacted with by the user to construct a negative sample candidate set. The processing unit decouples and separates relevant factors and irrelevant factors from the negative samples in the candidate set by using a gating network; and determines the optimal negative sample by using the separated relevant and irrelevant factors. The updating unit trains the implicit collaborative filtering model by using the determined optimal negative sample, ensures the accuracy of decoupling by using contrastive learning, and optimizes the parameters of the gating network by using loss. The recommendation unit calculates the scores of the user and the items by using the final parameters of the sufficiently trained implicit collaborative filtering model, and recommends the items to the user.
Citation Information
Patent Citations
Negative sample selection method against single-type collaborative filtering problems
CN107423335A
A graph collaborative filtering recommendation method based on decoupling and memory
CN113378062A