Item recommendation method and device based on collaborative filtering recommendation model
By using a collaborative filtering recommendation model and vector fusion of similar item selection strategy and attention mechanism, the problem of poor item recommendation performance is solved. This approach achieves accurate recommendation of long-tail items and calculation of user preference, thereby improving the recommendation effect.
Patent Information
- Application Number
- CN202210421086.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-20
- Publication Date
- 2025-11-18
- Estimated Expiration
- 2042-04-20
AI Technical Summary
Existing technologies have poor item recommendation performance, especially for long-tail items, and cannot accurately calculate users' preferences for items.
This paper adopts a collaborative filtering-based recommendation model. By acquiring the historical behavior data of the target user, a data sequence is constructed. A vector fusion method using similar item selection strategy and attention mechanism is used to determine the enhanced vector representation of the target item, and the user's liking for the item is calculated based on this representation to make recommendations.
It improves the recommendation performance of the item recommendation model, enables better recommendations for long-tail target items, and accurately calculates users' preferences for items.
Smart Images

Figure CN114943039B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a method and apparatus for item recommendation based on a collaborative filtering recommendation model. Background Technology
[0002] With the development of internet technology, personalized recommendation systems have been widely applied to many specific problems such as e-commerce, online advertising, and social media. The core of a personalized recommendation system is to model user interests and preferences based on user behavior, and then provide personalized recommendation services to each user based on their individual interests, thereby optimizing the user's experience and efficiency.
[0003] Currently, various technologies are used to solve the personalized recommendation problem. Among these methods, collaborative filtering models are a highly effective and widely applied approach. Collaborative filtering models are divided into two types: user-based collaborative filtering and item-based collaborative filtering. Research shows that item-based collaborative filtering models have advantages in accuracy, real-time performance, and interpretability. Traditional item-based collaborative filtering models represent each item as a vector based on the user's item behavior records and measure the similarity between vectors by calculating the inner product, cosine, or Pearson correlation coefficient. When making recommendations to a user, the model predicts the user's preference for each item and ranks them, selecting the items with the highest preference levels for recommendation. The predicted preference level for a user on a particular item is obtained by calculating the weighted average of the user's ratings on a set of similar items for the target item. Later, in the collaborative filtering model based on matrix factorization, a vector representation is provided for each item based on its ID. The user's vector representation is obtained by fusing the vector representations of items that the user has interacted with in their historical behavior. The inner product of the item vector and the user vector is calculated as the user's preference for the item. After sorting, the item with the highest preference is selected and recommended to the user. This method further improves the recommendation performance of the collaborative filtering model.
[0004] In recent years, artificial intelligence technology has made significant progress in the field of data mining. Neural networks have been used to further improve collaborative filtering models and automatically learn the vector representations of items. Neural networks can automatically adjust the parameter weights in the model based on the loss function value, fully mining the semantic information in user-item interaction data to obtain better item vector representations. However, user-item interaction data in recommendation systems often follows a long-tail distribution, with many long-tail items having only a few user interaction records. This results in limited directly usable semantic information, increasing the difficulty of vector representation learning and making it impossible to accurately calculate user preferences for items, leading to poor item recommendation performance. Summary of the Invention
[0005] This application provides a method and apparatus for item recommendation based on a collaborative filtering recommendation model, which addresses the shortcomings of poor item recommendation performance in existing technologies, enables more accurate calculation of user preferences for items, and improves the recommendation performance of the item recommendation model.
[0006] This application provides an item recommendation method based on a collaborative filtering recommendation model, including:
[0007] Acquire historical behavior data of the target user, and construct a data sequence based on the historical behavior data. The data sequence includes initial vector representations of multiple items that interacted with the target user.
[0008] The data sequence is input into the item recommendation model to determine the user vector representation of the target user, and the enhanced vector representation of the target item is determined based on the similar item selection strategy and the vector fusion method based on the attention mechanism. The item recommendation model is trained based on the collaborative filtering recommendation model.
[0009] Based on the enhanced vector representation of the target item and the user vector representation of the target user, a predicted value of the target user's liking for the target item is determined, and the target item is recommended based on the predicted value of liking.
[0010] According to the item recommendation method based on a collaborative filtering recommendation model provided in this application, the enhanced vector representation of the target item is determined by a vector fusion method based on a similar item selection strategy and an attention mechanism, including:
[0011] Based on the user item interaction database, the second-order neighbor items of the target item are determined. The user item interaction database is constructed based on the historical behavior data of multiple users.
[0012] Using the Neighbor Uniform Selector (NUS), Neighbor Relevance Selector (NRS), Neighbor Similarity Selector (NSS), or Global Similarity Selector (GSS), similar items to the target item are determined from its second-order neighbor items.
[0013] Based on the initial vector representations of the similar items, an enhanced vector representation of the target item is determined using an attention-based vector fusion method.
[0014] According to the item recommendation method based on a collaborative filtering recommendation model provided in this application, the step of determining the enhanced vector representation of the target item based on the initial vector representation of the similar items and using a vector fusion method based on an attention mechanism includes:
[0015] Based on the attention mechanism, the attention coefficient of each of the similar items is determined;
[0016] Based on the attention coefficient and the initial vector representation of each of the similar items, an enhanced vector representation of the target item is determined.
[0017] According to the item recommendation method based on a collaborative filtering recommendation model provided in this application, the step of determining the attention coefficient of each similar item based on an attention mechanism includes:
[0018] Based on the initial vector representations of the similar items, the initial vector representation of the target item, and the attention calculation formula, the attention coefficient of each of the similar items is determined;
[0019] The formula for calculating attention is as follows:
[0020]
[0021] in, Let O be the attention coefficient for similar item j. i Let j be the set of similar items to the target item, and q be any one of the similar items to the target item. j Let q be the initial vector representation of similar item j. i Let be the initial vector representation of the target item, l be any similar item to the target item, and q be the vector representation of the target item. l Let l be the initial vector representation of similar items.
[0022] According to the item recommendation method based on a collaborative filtering recommendation model provided in this application, the step of determining the enhanced vector representation of the target item based on the attention coefficient and the initial vector representation of each similar item includes:
[0023] Based on the initial vector representations of the similar items and the initial vector representation of the target item, the enhanced vector representation of the target item is determined using the enhanced vector calculation formula and the vector fusion method based on the attention mechanism.
[0024] The formula for calculating the enhancement vector is as follows:
[0025]
[0026] Among them, e i For the enhanced vector representation of the target item, O i Let j be the set of similar items to the target item, and j be any one of the similar items to the target item. Let q be the attention coefficient for similar item j. j Let be the initial vector representation of similar item j.
[0027] The item recommendation method based on a collaborative filtering recommendation model provided in this application further includes:
[0028] Acquire historical behavior data from multiple users, and construct multiple data sequence samples based on the historical behavior data in chronological order. Each data sequence sample includes N data points, where N is a positive integer.
[0029] The data sequence sample of length N is input into the collaborative filtering recommendation model. The first N-1 data in the data sequence sample are used to obtain the predicted Nth data. Based on the predicted Nth data and the Nth data in the data sequence sample, the parameters of the collaborative filtering recommendation model are updated.
[0030] If the loss function converges, the parameters of the collaborative filtering recommendation model are saved to obtain the item recommendation model.
[0031] This application also provides an item recommendation device based on a collaborative filtering recommendation model, comprising:
[0032] The data acquisition module is used to acquire historical behavior data of the target user and construct a data sequence based on the historical behavior data. The data sequence includes initial vector representations of multiple items that have interacted with the target user.
[0033] The vector representation module is used to input the data sequence into the item recommendation model, determine the user vector representation of the target user, and determine the enhanced vector representation of the target item based on the similar item selection strategy and the vector fusion method based on the attention mechanism. The item recommendation model is trained based on the collaborative filtering recommendation model.
[0034] The item recommendation module is used to determine the predicted value of the target user's liking for the target item based on the enhanced vector representation of the target item and the user vector representation of the target user, and to recommend the target item based on the predicted value of liking.
[0035] This application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the item recommendation method based on the collaborative filtering recommendation model as described above.
[0036] This application also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the item recommendation method based on the collaborative filtering recommendation model as described above.
[0037] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the item recommendation method based on the collaborative filtering recommendation model as described above.
[0038] The item recommendation method and apparatus based on the collaborative filtering recommendation model provided in this application determine the user vector representation of the target user through the item recommendation model, and determine the enhanced vector representation of the target item based on the similar item selection strategy and the vector fusion method based on the attention mechanism. It uses the high-quality feature representation of similar items to supplement and enhance the semantics of the target item, achieves better recommendation effect for long-tail target items, realizes more accurate calculation of the user's preference for items, and improves the recommendation effect of the item recommendation model. Attached Figure Description
[0039] To more clearly illustrate the technical solutions in this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0040] Figure 1 This is a flowchart illustrating the item recommendation method based on the collaborative filtering recommendation model provided in this application;
[0041] Figure 2 This is a flowchart illustrating the enhanced vector representation of the target item determined by the vector fusion method based on similar item selection strategy and attention mechanism provided in this application.
[0042] Figure 3 This is a schematic diagram of the item recommendation model provided in this application;
[0043] Figure 4 This is a flowchart illustrating the process of determining the enhanced vector representation of the target item based on the initial vector representation of the similar items provided in this application, using a vector fusion method based on an attention mechanism.
[0044] Figure 5 This is a flowchart illustrating the process of training the item recommendation model provided in this application;
[0045] Figure 6 This is a schematic diagram of the item recommendation device based on the collaborative filtering recommendation model provided in this application;
[0046] Figure 7 This is a schematic diagram of the structure of the electronic device provided in this application. Detailed Implementation
[0047] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0048] Figure 1 This is a flowchart illustrating the item recommendation method based on a collaborative filtering recommendation model provided in an embodiment of this application, as shown below. Figure 1 As shown, the item recommendation method based on the collaborative filtering recommendation model includes steps 100, 101, and 102.
[0049] Step 100: Obtain the target user's historical behavior data, and construct a data sequence based on the historical behavior data. The data sequence includes initial vector representations of multiple items that interacted with the target user.
[0050] Historical behavior data can include data on users' browsing behavior.
[0051] Optionally, the historical behavior data is arranged in chronological order and divided into target lengths. The target length can be a preset length or a length determined based on the size of the target user's historical behavior data, thus obtaining the target user's data sequence.
[0052] Step 101: Input the data sequence into the item recommendation model, determine the user vector representation of the target user, and determine the enhanced vector representation of the target item based on the similar item selection strategy and the vector fusion method based on the attention mechanism. The item recommendation model is trained based on the collaborative filtering recommendation model.
[0053] Understandably, determining the target user's level of liking for the target item requires determining the enhanced vector representation of the target item and the vector representation of the target user. The calculation methods for these two vectors are explained below:
[0054] I. Calculate the enhanced vector representation of the target item.
[0055] like Figure 2 As shown, in some embodiments, the enhanced vector representation of the target item is determined based on a similar item selection strategy and an attention-based vector fusion method, including steps 200, 201 and 202.
[0056] Step 200: Based on the user item interaction database, determine the second-order neighbor items of the target item.
[0057] The user item interaction database is built based on the historical behavior data of multiple users.
[0058] Figure 3 This is a schematic diagram of the item recommendation model provided in an embodiment of this application. For example... Figure 3 As shown, the item recommendation model first constructs a user-item interaction database. This database includes information on multiple items and interactions between multiple users.
[0059] The target item and a set of similar items are input into an attention encoder to obtain an item vector representation. The user's vector representation is then calculated based on the item representations from the user's behavior records. Finally, the user's level of liking for the item is determined using both the item and user vector representations.
[0060] Step 201: Using the Neighbor Uniform Selector (NUS), Neighbor Relevance Selector (NRS), Neighbor Similarity Selector (NSS), or Global Similarity Selector (GSS), determine the similar items of the target item from its second-order neighbor items.
[0061] For a target item in the user item interaction database, select multiple similar items from the second-order neighbor items of the target item to form a set of similar items.
[0062] like Figure 2 As shown, this application provides four selectable similar item selection strategies to calculate the probability of each neighboring item within the second-order neighbor range of the target item being selected. These strategies are the Neighbor Uniform Selector (NUS), Neighbor Relevance Selector (NRS), Neighbor Similarity Selector (NSS), and Global Similarity Selector (GSS). These four selection strategies are described in detail below:
[0063] 1) In NUS, the probability of each neighboring item being selected is calculated using the following formula:
[0064]
[0065] in, S represents the probability that item j is selected. i Let |S| represent the set of neighboring items of the target item i. i | represents the number of neighboring items of the target item i.
[0066] 2) In NRS, the probability of each neighboring item being selected is calculated using the following formula:
[0067]
[0068]
[0069] in, Let j represent the probability that item k is selected, and j be the neighboring items of the target item i. This represents the number of times the target item i and its neighboring item k co-occur. This represents the total number of times neighbor item k appears in the dataset.
[0070] 3) In NSS, the probability of each neighboring item being selected is calculated using the following formula:
[0071]
[0072] in, m represents the probability that item k is selected. i It is a multi-hot vector, m i Each element in the vector represents the number of interactions between the target item i and each user. U represents the number of users, m k It is a multi-hot vector, m k Each element in the vector represents the number of interactions between item k and each user.
[0073] 4) In GSS, the probability of each neighboring item being selected is calculated using the following formula:
[0074]
[0075] Where I represents the set of all items in the dataset, m i It is a multi-hot vector, m i Each element in the vector represents the number of interactions between the target item i and each user, m k It is a multi-hot vector, m k Each element in the vector represents the number of interactions between item k and each user.
[0076] This method also calculates cosine similarity, but the range of candidate items is expanded from second-order neighbors to the entire dataset.
[0077] The probability of each candidate neighbor item being selected can be calculated using any of the four methods mentioned above. M neighbor items are then randomly selected according to the calculated probabilities to form a set of similar items for the target item.
[0078] Understandably, candidate neighbor items with higher probabilities are more likely to be selected as similar items, while candidate neighbor items with lower probabilities are less likely to be selected as similar items. The selection formula is as follows:
[0079]
[0080] in, Let represent the probability that a neighboring item j of the target item i, calculated by any of the above methods, is selected as a similar item. arg Top_N represents the probability calculated according to the above methods. Select M items and output their indices, O(m). i This represents the set of items most similar to the target item i.
[0081] Step 202: Based on the initial vector representation of the similar items, determine the enhanced vector representation of the target item using a vector fusion method based on an attention mechanism.
[0082] Optionally, the vector representation of the target item and the vector representations of similar items are input into the attention encoder to obtain an enhanced vector representation of the target item.
[0083] like Figure 4 As shown, in some embodiments, step 202 includes steps 400 and 401.
[0084] Step 400: Based on the attention mechanism, determine the attention coefficient of each of the similar items.
[0085] Optionally, an attention coefficient for each of the similar items is determined based on the initial vector representations of the similar items, the initial vector representation of the target item, and the attention calculation formula.
[0086] The formula for calculating attention is as follows:
[0087]
[0088] in, Let O be the attention coefficient for similar item j. i Let j be the set of similar items to the target item, and q be any one of the similar items to the target item. j Let q be the initial vector representation of similar item j. i Let be the initial vector representation of the target item, l be any similar item to the target item, and q be the vector representation of the target item. l Let l be the initial vector representation of similar items.
[0089] Step 401: Based on the attention coefficient and the initial vector representation of each similar item, determine the enhanced vector representation of the target item.
[0090] Optionally, based on the initial vector representations of the similar items and the initial vector representation of the target item, the enhanced vector representation of the target item is determined using an attention-based vector fusion method and an enhanced vector calculation formula.
[0091] The formula for calculating the enhancement vector is as follows:
[0092]
[0093] Among them, e i For the enhanced vector representation of the target item, O i Let j be the set of similar items to the target item, and j be any one of the similar items to the target item. Let q be the attention coefficient for similar item j. j Let be the initial vector representation of similar item j.
[0094] 2. Calculate the vector representation of the target user.
[0095] The vector representation of each user can be calculated using the following formula:
[0096]
[0097] Among them, e u Let be the vector representation of target user u for target item i. It should be noted that user u may have different vector representations for different target items.
[0098] O u Let be the set of items that user u has interacted with, s be any item that user u has interacted with, and q be the set of items that user u has interacted with. s Let be the initial vector representation of item s. Let be the attention coefficient of item s for target item i.
[0099] Step 102: Based on the enhanced vector representation of the target item and the user vector representation of the target user, determine the predicted value of the target user's liking for the target item, and recommend the target item based on the predicted value of liking.
[0100] Optionally, based on the results of step 101, the target user's preference for the target item is obtained by calculating the inner product. The formula for calculating the inner product is as follows:
[0101]
[0102] in, e represents the degree of user u's preference for item i. u Let e be the vector representation of user u.i Let i be the enhanced vector representation of item i.
[0103] By calculating the inner product, we obtain the degree of user u's liking for item i. Based on this degree of liking, we determine whether to recommend the target item to the target user.
[0104] Optionally, if the degree of preference is greater than the target value, the target item can be recommended to the target user. Alternatively, the degree of preference of the target user for multiple target items can be calculated, and the target item with the highest degree of preference can be recommended to the target user.
[0105] The item recommendation method based on the collaborative filtering recommendation model provided in this application determines the user vector representation of the target user through the item recommendation model, and determines the enhanced vector representation of the target item based on the similar item selection strategy and the vector fusion method based on the attention mechanism. It uses the high-quality feature representation of similar items to supplement and enhance the semantics of the target item, achieves better recommendation effect for long-tail target items, realizes more accurate calculation of the user's preference for items, and improves the recommendation effect of the item recommendation model.
[0106] In some embodiments, the item recommendation method based on the collaborative filtering recommendation model further includes training an item recommendation model, such as... Figure 5 As shown, the trained item recommendation model includes steps 500, 501, and 502.
[0107] Step 500: Obtain historical behavior data of multiple users, and construct multiple data sequence samples based on the historical behavior data in chronological order. The data sequence samples include N data points, where N is a positive integer.
[0108] Optionally, collect item information data and user historical behavior data, import the data into a database, and build a user item information database.
[0109] Based on collaborative filtering recommendation knowledge, outlier data points are removed from the user item information database, and the format of valid data is converted. To ensure the model functions correctly, data with too few user interactions can be deleted.
[0110] The scale of user feedback ratings is normalized and discretized. Specifically, the highest-rated data in the original user feedback is relabeled as 1, while the ratings of other user feedback data are relabeled as 0. The normalization and discretization methods differ for different datasets.
[0111] Optionally, this embodiment selects four real-world datasets, including the Amazon-Beauty, Amazon-Clothing, Epinions, and Book-Crossing datasets. Table 1 shows the statistical information for these datasets. For the Epinions dataset, only items with more than 4 interactions are retained, and the ratings of user feedback with a score of 5 are reset to 1, while the ratings of other feedback are set to 0. For the Book-Crossing dataset, only items with more than 5 interactions are retained, and the ratings of user feedback with a score of 9 are reset to 1, while the ratings of other feedback are set to 0.
[0112] Table 1. Statistical Information of Dataset
[0113]
[0114] Optionally, the time series length N is set to 200, and the cleaned user item interaction data is sorted by time and divided into sequence samples of length 200.
[0115] Step 501: Input the data sequence sample of length N into the collaborative filtering recommendation model, use the first N-1 data in the data sequence sample to obtain the predicted Nth data, and update the parameters of the collaborative filtering recommendation model based on the predicted Nth data and the Nth data in the data sequence sample.
[0116] Arrange the user's historical behavior data in chronological order, and then divide it into sequences of fixed length N. For each sequence [i1, i2, ..., i...], ... N ].
[0117] During the training phase, [i1, i2, ..., i N-1 As a user's historical record, and predicting the Nth item the user will visit, the model parameters are updated based on the model's predictions and the actual results in the data sequence, and the model is trained.
[0118] Alternatively, during the training phase, [i1,i2,…,i] can be used. N-2 The model is trained using [i1, i2, ..., i] as the user's historical records and to predict the (N-1)th item the user will visit. During the testing phase, [i1, i2, ..., i] are used as the references. N-1 The training results are tested by using the user's historical records and predicting the Nth item the user will visit.
[0119] Optionally, for each sample, the 199th item is predicted using the first 198 interaction pieces during training, and the 200th item is predicted using the first 199 interaction pieces during testing. To select appropriate model hyperparameters, half of the test samples are selected as the validation set, and the remaining test samples are selected as the test set.
[0120] Update the parameters of the collaborative filtering recommendation model based on the loss function, and train the collaborative filtering recommendation model.
[0121] Step 502: If the loss function converges, save the parameters of the collaborative filtering recommendation model to obtain the item recommendation model.
[0122] The loss function is used to measure the predictive performance of the model (Bayes Personalized Ranking, BPR) during training. The formula for calculating the loss function is as follows:
[0123]
[0124] Among them, O u Let σ represent the set of items that have been interacted with by user u, and let σ represent the sigmoid function. Let {q} be the initial vector of all items in the model. i The matrix consisting of ,i=1,2,…,|I|} represents all trainable parameters in the model, where |I| represents the number of items, d is the dimension of each item vector, and λ is the coefficient of the L2 regularization term, used to avoid overfitting of the model.
[0125] The sample data was input into the model for training. The model was used to predict recommended items for each user interaction sequence. The Recall and NDCG metrics were observed to obtain the performance of the existing model (baseline) on four datasets.
[0126] Select new sequence samples and repeat step 501 until the model converges. The parameters obtained at this point optimize the model relative to the training data. Save the parameters of the collaborative filtering recommendation model when training stops to obtain the item recommendation model.
[0127] Table 2 shows the performance metrics of the item recommendation model on the dataset, including recall and normalized discounted cumulative gain (NDCG).
[0128] Table 2 Performance Indicators of Recommendation Results
[0129]
[0130] The experimental results are shown in Table 2. Using the item recommendation model proposed in this application to predict recommended items, the Recall and NDCG indices obtained on the four datasets were 0.0987, 0.0453, 0.0473, 0.0203, 0.0862, 0.0361, 0.0168, and 0.0093, respectively. Compared with the baseline model, the indices of this application were improved by 8.3%, 18.6%, 7.3%, 7.4%, 63.9%, 67.9%, 12.0%, and 20.8%, respectively. This model achieved better recommendation performance on all datasets.
[0131] The item recommendation device based on the collaborative filtering recommendation model provided in this application is described below. The item recommendation device based on the collaborative filtering recommendation model described below can be referred to in correspondence with the item recommendation method based on the collaborative filtering recommendation model described above.
[0132] Figure 6 This is a schematic diagram of the item recommendation device based on a collaborative filtering recommendation model provided in the embodiments of this application, as shown below. Figure 6 As shown, the item recommendation device based on the collaborative filtering recommendation model includes a data acquisition module 610, a vector representation module 620, and an item recommendation module 630.
[0133] The data acquisition module 610 is used to acquire historical behavior data of the target user and construct a data sequence based on the historical behavior data. The data sequence includes initial vector representations of multiple items that have interacted with the target user.
[0134] The vector representation module 620 is used to input the data sequence into the item recommendation model, determine the user vector representation of the target user, and determine the enhanced vector representation of the target item based on the similar item selection strategy and the vector fusion method based on the attention mechanism. The item recommendation model is trained based on the collaborative filtering recommendation model.
[0135] The item recommendation module 630 is used to determine the predicted value of the target user's liking for the target item based on the enhanced vector representation of the target item and the user vector representation of the target user, and to recommend the target item based on the predicted value of liking.
[0136] Optionally, the vector fusion method based on similar item selection strategy and attention mechanism determines the enhanced vector representation of the target item, including:
[0137] Based on the user item interaction database, the second-order neighbor items of the target item are determined. The user item interaction database is constructed based on the historical behavior data of multiple users.
[0138] Using the Neighbor Uniform Selector (NUS), Neighbor Relevance Selector (NRS), Neighbor Similarity Selector (NSS), or Global Similarity Selector (GSS), similar items to the target item are determined from its second-order neighbor items.
[0139] Based on the initial vector representations of the similar items, an enhanced vector representation of the target item is determined using an attention-based vector fusion method.
[0140] Optionally, the step of determining the enhanced vector representation of the target item based on the initial vector representation of the similar items using an attention-based vector fusion method includes:
[0141] Based on the attention mechanism, the attention coefficient of each of the similar items is determined;
[0142] Based on the attention coefficient and the initial vector representation of each of the similar items, an enhanced vector representation of the target item is determined.
[0143] Optionally, determining the attention coefficient for each of the similar items based on the attention mechanism includes:
[0144] Based on the initial vector representations of the similar items, the initial vector representation of the target item, and the attention calculation formula, the attention coefficient of each of the similar items is determined;
[0145] The formula for calculating attention is as follows:
[0146]
[0147] in, Let O be the attention coefficient for similar item j. i Let j be the set of similar items to the target item, and q be any one of the similar items to the target item. j Let q be the initial vector representation of similar item j. i Let be the initial vector representation of the target item, l be any similar item to the target item, and q be the vector representation of the target item. l Let l be the initial vector representation of similar items.
[0148] Optionally, determining the enhanced vector representation of the target item based on the attention coefficient and the initial vector representation of each similar item includes:
[0149] Based on the initial vector representations of the similar items and the initial vector representation of the target item, the enhanced vector representation of the target item is determined using the enhanced vector calculation formula and the vector fusion method based on the attention mechanism.
[0150] The formula for calculating the enhancement vector is as follows:
[0151]
[0152] Among them, e i For the enhanced vector representation of the target item, O i Let j be the set of similar items to the target item, and j be any one of the similar items to the target item. Let q be the attention coefficient for similar item j. j Let be the initial vector representation of similar item j.
[0153] Optionally, the item recommendation device 600 based on the collaborative filtering recommendation model further includes a model training module for:
[0154] Acquire historical behavior data from multiple users, and construct multiple data sequence samples based on the historical behavior data in chronological order. Each data sequence sample includes N data points, where N is a positive integer.
[0155] The data sequence sample of length N is input into the collaborative filtering recommendation model. The first N-1 data in the data sequence sample are used to obtain the predicted Nth data. Based on the predicted Nth data and the Nth data in the data sequence sample, the parameters of the collaborative filtering recommendation model are updated.
[0156] If the loss function converges, the parameters of the collaborative filtering recommendation model are saved to obtain the item recommendation model.
[0157] It should be noted that the apparatus provided in this application embodiment can implement all the method steps implemented in the above method embodiment and can achieve the same technical effect. Here, the parts that are the same as those in the method embodiment and the beneficial effects will not be described in detail.
[0158] Figure 7 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 7 As shown, the electronic device may include: a processor 710, a communication interface 720, a memory 730, and a communication bus 740, wherein the processor 710, the communication interface 720, and the memory 730 communicate with each other via the communication bus 740. The processor 710 can call logical instructions in the memory 730 to execute an item recommendation method based on a collaborative filtering recommendation model, the method including:
[0159] Acquire historical behavior data of the target user, and construct a data sequence based on the historical behavior data. The data sequence includes initial vector representations of multiple items that interacted with the target user.
[0160] The data sequence is input into the item recommendation model to determine the user vector representation of the target user, and the enhanced vector representation of the target item is determined based on the similar item selection strategy and the vector fusion method based on the attention mechanism. The item recommendation model is trained based on the collaborative filtering recommendation model.
[0161] Based on the enhanced vector representation of the target item and the user vector representation of the target user, a predicted value of the target user's liking for the target item is determined, and the target item is recommended based on the predicted value of liking.
[0162] Furthermore, the logical instructions in the aforementioned memory 730 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0163] On the other hand, this application also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer is able to execute the item recommendation method based on the collaborative filtering recommendation model provided by the above methods, the method including:
[0164] Acquire historical behavior data of the target user, and construct a data sequence based on the historical behavior data. The data sequence includes initial vector representations of multiple items that interacted with the target user.
[0165] The data sequence is input into the item recommendation model to determine the user vector representation of the target user, and the enhanced vector representation of the target item is determined based on the similar item selection strategy and the vector fusion method based on the attention mechanism. The item recommendation model is trained based on the collaborative filtering recommendation model.
[0166] Based on the enhanced vector representation of the target item and the user vector representation of the target user, a predicted value of the target user's liking for the target item is determined, and the target item is recommended based on the predicted value of liking.
[0167] Furthermore, this application also provides a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, is implemented to perform the item recommendation method based on the collaborative filtering recommendation model provided by the methods described above, the method comprising:
[0168] Acquire historical behavior data of the target user, and construct a data sequence based on the historical behavior data. The data sequence includes initial vector representations of multiple items that interacted with the target user.
[0169] The data sequence is input into the item recommendation model to determine the user vector representation of the target user, and the enhanced vector representation of the target item is determined based on the similar item selection strategy and the vector fusion method based on the attention mechanism. The item recommendation model is trained based on the collaborative filtering recommendation model.
[0170] Based on the enhanced vector representation of the target item and the user vector representation of the target user, a predicted value of the target user's liking for the target item is determined, and the target item is recommended based on the predicted value of liking.
[0171] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0172] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0173] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A method for item recommendation based on a collaborative filtering recommendation model, characterized in that, include: Acquire historical behavior data of the target user, and construct a data sequence based on the historical behavior data. The data sequence includes initial vector representations of multiple items that interacted with the target user. The data sequence is input into the item recommendation model to determine the user vector representation of the target user, and the enhanced vector representation of the target item is determined based on the similar item selection strategy and the vector fusion method based on the attention mechanism. The item recommendation model is trained based on the collaborative filtering recommendation model. The inner product between the enhanced vector representation of the target item and the user vector representation of the target user is used as the predicted value of the target user's liking for the target item, and the target item is recommended based on the predicted value of liking. The vector fusion method based on similar item selection strategy and attention mechanism determines the enhanced vector representation of the target item, including: Based on the user item interaction database, the second-order neighbor items of the target item are determined. The user item interaction database is constructed based on the historical behavior data of multiple users. Using the Neighbor Uniform Selector (NUS), Neighbor Relevance Selector (NRS), Neighbor Similarity Selector (NSS), or Global Similarity Selector (GSS), similar items to the target item are determined from its second-order neighbor items. Based on the initial vector representations of the similar items, an enhanced vector representation of the target item is determined using an attention-based vector fusion method.
2. The item recommendation method based on a collaborative filtering recommendation model according to claim 1, characterized in that, The process of determining the enhanced vector representation of the target item based on the initial vector representation of the similar items using an attention-based vector fusion method includes: Based on the attention mechanism, the attention coefficient of each of the similar items is determined; Based on the attention coefficient and the initial vector representation of each of the similar items, an enhanced vector representation of the target item is determined.
3. The item recommendation method based on a collaborative filtering recommendation model according to claim 2, characterized in that, The determination of the attention coefficient for each of the similar items based on the attention mechanism includes: Based on the initial vector representations of the similar items, the initial vector representation of the target item, and the attention calculation formula, the attention coefficient of each of the similar items is determined; The formula for calculating attention is as follows: in, Let O be the attention coefficient for similar item j. i Let j be the set of similar items to the target item, and q be any one of the similar items to the target item. j Let q be the initial vector representation of similar item j. i Let be the initial vector representation of the target item, l be any similar item to the target item, and q be the vector representation of the target item. l Let l be the initial vector representation of similar items.
4. The item recommendation method based on a collaborative filtering recommendation model according to claim 2, characterized in that, The process of determining the enhanced vector representation of the target item based on the attention coefficient and the initial vector representation of each similar item includes: Based on the initial vector representations of the similar items and the initial vector representation of the target item, the enhanced vector representation of the target item is determined using the enhanced vector calculation formula and the vector fusion method based on the attention mechanism. The formula for calculating the enhancement vector is as follows: Among them, e i For the enhanced vector representation of the target item, O i Let j be the set of similar items to the target item, and j be any one of the similar items to the target item. Let q be the attention coefficient for similar item j. j Let be the initial vector representation of similar item j.
5. The item recommendation method based on a collaborative filtering recommendation model according to claim 1, characterized in that, Also includes: Acquire historical behavior data from multiple users, and construct multiple data sequence samples based on the historical behavior data in chronological order. Each data sequence sample includes N data points, where N is a positive integer. A data sequence sample of length N is input into the collaborative filtering recommendation model. The first N-1 data points in the data sequence sample are used to obtain the predicted Nth data point. Based on the predicted Nth data point and the Nth data point in the data sequence sample, the parameters of the collaborative filtering recommendation model are updated. If the loss function converges, the parameters of the collaborative filtering recommendation model are saved to obtain the item recommendation model.
6. An item recommendation device based on a collaborative filtering recommendation model, characterized in that, include: The data acquisition module is used to acquire historical behavior data of the target user and construct a data sequence based on the historical behavior data. The data sequence includes initial vector representations of multiple items that have interacted with the target user. The vector representation module is used to input the data sequence into the item recommendation model, determine the user vector representation of the target user, and determine the enhanced vector representation of the target item based on the similar item selection strategy and the vector fusion method based on the attention mechanism. The item recommendation model is trained based on the collaborative filtering recommendation model. The item recommendation module is used to use the inner product between the enhanced vector representation of the target item and the user vector representation of the target user as the predicted value of the target user's liking for the target item, and to recommend the target item based on the predicted value of liking. The vector fusion method based on similar item selection strategy and attention mechanism determines the enhanced vector representation of the target item, including: Based on the user item interaction database, the second-order neighbor items of the target item are determined. The user item interaction database is constructed based on the historical behavior data of multiple users. Using the Neighbor Uniform Selector (NUS), Neighbor Relevance Selector (NRS), Neighbor Similarity Selector (NSS), or Global Similarity Selector (GSS), similar items to the target item are determined from its second-order neighbor items. Based on the initial vector representations of the similar items, an enhanced vector representation of the target item is determined using an attention-based vector fusion method.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the item recommendation method based on the collaborative filtering recommendation model as described in any one of claims 1 to 5.
8. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the item recommendation method based on the collaborative filtering recommendation model as described in any one of claims 1 to 5.
9. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the item recommendation method based on the collaborative filtering recommendation model as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Article recommendation method based on collaborative filtering
CN110781409A
Article recommendation method based on generalized nerve attention
CN111127142A