A Sequential Recommendation Method Based on Information Propagation and Attention Mechanism
By introducing an information dissemination model to calculate the object dissemination power in the sequence recommendation model, and combining deep learning technology to extract feature information, the problem of failure to effectively utilize the object dissemination power in the existing technology is solved, and a more accurate and personalized sequence recommendation is achieved. Effect.
Patent Information
- Application Number
- CN202210357247.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-06
- Publication Date
- 2025-02-14
- Estimated Expiration
- 2042-04-06
AI Technical Summary
The existing deep learning-based sequence recommendation model fails to consider the dissemination information of popular items, resulting in a lack of effective utilization of item popularity and reputation when recommending.
By introducing an information dissemination model, the propagation force of each item is calculated and integrated into the deep learning model, the user score data is corrected, and the feature information is extracted in combination with the Transformer encoder and CNN convolution is used to predict the next one using matrix decomposition and Softmax function. Probability of an item.
It improves the accuracy and effectiveness of sequence recommendations, can better capture user preferences and time dependencies, while taking into account the dissemination and popularity of items, thereby improving the personalization and accuracy of recommendations.
Smart Images

Figure CN114691995B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of neural networks and machine learning, and in particular to a sequence recommendation method based on information propagation and attention mechanism. Background Art
[0002] With the continuous development of the Internet, the various types of data and information that people can receive have increased exponentially, causing the problem of information overload. In order to solve the problem of information overload, recommendation systems have emerged. Part of this information data is time series data about user behavior. Time series data is a sequence of data recorded at certain time intervals. We can mine useful information from the user's historical behavior sequence data to improve the personalized recommendation experience for the user. In real scenarios, users often make different decisions in different time periods. Usually, the shorter the time interval, the greater the correlation between behaviors. Based on the user's historical behavior sequence data, the development trend of user behavior can be mined. Therefore, it is of great significance to study sequence recommendation.
[0003] The mainstream sequence recommendation methods now include machine learning-based methods and deep learning-based methods. Machine learning-based methods usually use machine learning models to model user behavior sequences in order to mine time series features. Machine learning-based methods mainly include frequent pattern mining, K-nearest neighbor method, Markov chain and matrix decomposition. Typical models include PopRec and BPR. Although these methods are easy to implement, they can only mine limited sequence features and are not effective when facing sequence data with complex dependencies between internal items. The deep learning-based model can autonomously learn internal sequence features and dependencies based on sequence data, so the deep learning model can be better applied to sequence recommendation tasks. RNN, a neural network that can capture sequence features, has been widely used in sequence recommendation, such as GRU4Rec and Parallel-RNN. At the same time, in order to better capture the dependency between user preferences and time, CNN and GNN are also used in sequence recommendation, such as Caser, SR-GNN and SGNN-HN models. In recent years, due to the low computational efficiency of RNN, sequence recommendation models based on attention mechanisms have emerged, such as SASRec, ComiRec and AttRec. However, the current sequence recommendation model based on deep learning does not take into account the spreadability information of popular items. For example, a product with a wide spread and good quality will have a good reputation among the public, and users who have not purchased the product are more likely to pay attention to this product rather than other products. Summary of the invention
[0004] The purpose of the present invention is to provide a sequence recommendation method based on information propagation and attention mechanism to solve the problem that the prior art lacks information on the spread of popular items based on user behavior sequence data, and to use the information propagation model to model the spread of items, thereby helping the deep learning model to obtain auxiliary information.
[0005] The present invention provides a sequence recommendation method based on information propagation and attention mechanism, comprising the following steps:
[0006] S1. Calculate the corresponding spread power of each item based on the input user behavior sequence;
[0007] S2. Use the spread of each item to modify the user's rating data;
[0008] S3. Use Transformer encoder and CNN convolution to extract features from the above corrected user behavior sequence data;
[0009] S4. Calculate the correlation between the current item and the items before the current time node using matrix decomposition, input the correlation result into the Softmax function, and use the output of the Softmax function to predict the probability of the next item;
[0010] S5. A binary cross entropy loss function is established based on the above probability. When the loss function does not meet the given conditions, the information is re-transmitted into the neural network model for training until the output result meets the given conditions. The trained model is used as the final model for sequence recommendation.
[0011] The present invention discloses a sequence recommendation method based on information propagation and attention mechanism. This technology can calculate the spread information of items based on the historical behavior sequence data of users, add the spread information of items to the deep model, and help the sequence recommendation to obtain better performance. Compared with the prior art, the advantages of the present invention are:
[0012] 1. The information propagation model and the sequence recommendation model are integrated to establish a sequence recommendation method based on information propagation and attention mechanism.
[0013] 2. A method for extracting feature information based on the attention mechanism combining Transformer encoder and CNN convolution is designed. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] In order to more clearly illustrate the technical solution of the present invention, the drawings required for use in the implementation manner are briefly introduced below.
[0015] Figure 1 is a schematic diagram of the flow chart of the sequence recommendation method of the present invention;
[0016] Figure 2 It is a schematic diagram of the overall architecture of the present invention based on the information propagation and attention mechanism model;
[0017] Figure 3 It is a schematic diagram comparing the performance of the sequence recommendation method of the present invention with other methods. DETAILED DESCRIPTION
[0018] The technical solution of the present invention will be further described in detail below in conjunction with the accompanying drawings of the present invention. In a preferred embodiment of the present invention, a sequence recommendation method based on information propagation and attention mechanism is provided.
[0019] like Figure 1 The flowchart shown in the figure shows a sequence recommendation method based on information propagation and attention mechanism, which includes the following steps:
[0020] S1. Calculate the corresponding spread power of each item for the input user behavior sequence. In order to calculate the corresponding spread power of each item, we first use the SI (Sensitive Infected) model in the information diffusion model to simulate the proportion of users that each item can influence in the corresponding time series, and then we need to use the proportion of the items that can be influenced to calculate the influence of each item.
[0021] In this embodiment, step S1 specifically includes the following steps:
[0022] S11. First, the SI (Sensitive Infected) model is used to take the recommended items as "infection sources" and divide users into susceptible and affected states. By calculating the proportion of people "infected" by each item at a specific time, the proportion of people affected by a certain item at time t is calculated:
[0023]
[0024] Where i(t) represents the proportion of people affected by the item at time t, i 0 represents the proportion of users affected at the initial moment, β represents the probability of each user being influenced by each other, and e is a natural constant. In this embodiment, the probability of users being influenced by each other is set to β = 0.5, and the proportion of users affected at the initial moment is i 0 =0.05.
[0025] S12. Multiply the user's rating of a specific item at time t by the influence ratio of the item at time t to obtain the spread power. The greater the influence ratio of the user, the more consistent the user group's rating of the item is. Therefore, for an item with a low rating, if the influence ratio of users is greater, the rating of the item will be lower; conversely, for an item with a high rating, if the influence ratio of users is greater, the rating of the item will be higher. The formula for calculating the spread power is:
[0026]
[0027] where t now -t origin Indicates the time interval between the current score and the first score, and score(t) indicates the current score. In the formula, for items with the same score, the longer the interval, the greater the influence, and the shorter the interval, the smaller the influence. In this embodiment, the value range of score(t) is 1-5, and we stipulate that data less than or equal to 2 will be cleared.
[0028] S2. Use the spread power of each item to modify the user's rating data. Based on S1, the results of the spread power of the item are obtained and the scores of each item are modified according to the popularity of the item. The popularity of the item is combined to better reflect the information of the spread power of the item in the scoring results, so that the scores of different items at different time points are obviously different, so as to help the subsequent S3 to extract more meaningful feature information.
[0029] In this embodiment, step S2 specifically includes the following steps:
[0030] S21. Calculate the popularity of the item. The popularity is calculated by the ratio of the number of times a certain item is rated to the total number of times it is rated:
[0031]
[0032] Where sum(click(i)) represents the total number of times an item is rated, and sum(click) represents the number of times all items are rated.
[0033] S22. Modify the item score; integrate popularity and spread into the final score through two weight parameters:
[0034]
[0035] Where μ 1 and μ 2is the weight parameter, score(i) represents the score of the current item, pop(i) represents the spread of the current item, hot(i) represents the popularity of the current item, and the final corrected score result is res(i). 1 and μ 2 They are 0.5 and 0.5 respectively.
[0036] S3. Use Transformer encoder and CNN convolution to extract features from the modified user behavior sequence data. Use two attention mechanism implementations to help the model extract more comprehensive user preference information.
[0037] In this embodiment, step S3 specifically includes the following steps:
[0038] S31, pre-process and segment the user behavior sequence data. Set the maximum length of the sequence that can be processed to k, and perform pre-processing on the user behavior sequence data (a 1 ,a 2 ,…,a k ,…,a n ) is split, if the sequence length itself does not meet k, data is added to one end of the sequence to make the sequence length meet k; if the sequence length itself is greater than k, the nk sequence with the longest time is removed. In this embodiment, the maximum length k is set to 100.
[0039] S32. Embed the user behavior sequence data. Construct an embedding matrix E, in which each row is a user-item embedding vector, and then add a position embedding p to the back of each row of the embedding vector so that the embedding matrix can learn the front and back position information of the user behavior sequence to obtain the embedding matrix E. * .
[0040] S33. Use the Transformer encoder in the attention layer to extract the user's long-term preferences from the embedding matrix. The Transformer encoder can extract global temporal information and help the neural network model capture the user's long-term interests:
[0041]
[0042] Where Q represents the query vector, K represents the key-value vector, and V represents the value vector. These three vectors are obtained by multiplying the initial embedding vector X by matrices with different weights. K T represents the transpose of the key-value vector K, and d represents the dimension of the embedding matrix. * , given three projections are W Q , W K , W V , multiplied by E* And bring it into the Attention formula:
[0043] S = Attention (E * ×W Q ,E * ×W K ,E * ×W V )
[0044] In order to avoid interaction with historical information, two layers of feedforward neural network are added to the results:
[0045]
[0046] Where W i is a d×d matrix, b i is a d-dimensional vector. To prevent overfitting, residual connections, layer regularization and dropout are added to the results:
[0047] h(in)=in+dropout(h(LayerNorm(in)))
[0048] Among them, h(in) represents a layer of feedforward network, and in is the input information.
[0049] S34. Use the convolution in the attention layer to extract the user's short-term preference from the embedding matrix. CNN convolution can perceive edge and detail information, so it can extract layout feature information through convolution. First, add a one-dimensional convolution with a filter of 2 and a kernel size of 100 to the embedding matrix, and then perform maximum pooling on it:
[0050] φ 1 =MaxPool(M 1 (E * ))
[0051] Among them, M 1 For convolution calculation, MaxPool represents maximum pooling. Then the embedding matrix is transposed, and then a one-dimensional convolution with a filter size of 2 and a kernel size of 1 is added:
[0052] φ 2 =M 2 ((E * ) T )
[0053] Among them, M 2 Represents convolution calculation, (E * ) T Indicates E *Finally, the results of the two convolution operations are concatenated to obtain the feature information of horizontal and vertical extraction of the embedding matrix:
[0054] convAttention=concat(φ 1 ,φ 2 )
[0055] Where concat(·) represents the concatenation function.
[0056] S35, fusing the extracted feature information:
[0057]
[0058] Where convAttention is the feature information calculated by the convolution operation, h(in) is the feature information calculated by the Transformer encoder, and α and γ are two weight parameters. In this embodiment, we specify α = 0.8 and γ = 0.2.
[0059] S4. Calculate the correlation between the current item and the item before the current time node by matrix decomposition, input the correlation result into the Softmax function, and use the output of the Softmax function to predict the probability of the next item. In this embodiment, it is assumed that the final result matrix is decomposed into two small matrices, and then the various parameters are learned by gradient descent method: R = F × (E * ) T , where F i is the output of the feedforward network, (E * ) T is the transpose of the embedding matrix. Each element of the R matrix is denoted by r it , which represents the correlation between item i and the previous t items.
[0060] S5. A binary cross entropy loss function is established based on the above probability. When the loss function does not meet the given conditions, the information is re-transmitted into the neural network model for training until the output result meets the given conditions. The trained model is used as the final model for sequence recommendation. In the calculation training process of this embodiment, the loss function is:
[0061] loss=
[0062] ∑ i ∑ t ∑ k [-log(δ(r til ))-log(1-δ(r tik ))]
[0063] where r til represents the prediction of user i for positive sample l at time t, rtik represents the prediction of user i for negative sample k at time t, and δ represents the sigmoid activation function.
[0064] Furthermore, the present invention is based on the overall architecture of the information propagation and attention mechanism model as follows Figure 2 As shown. The model mainly consists of four parts, namely data preprocessing layer, embedding layer, attention layer and prediction layer. The function of the preprocessing layer is to calculate the spread of items and modify the user ratings according to the different spread of items to obtain the rating data considering the spread factor. The embedding layer mainly vectorizes the user-item behavior sequence data and the corresponding rating sequence data respectively, and maps the data into another dimensional space. The role of the attention layer is to capture the dependency relationship of sequence information and the feature information of sequence information. In this layer, the encoding with multi-head self-attention mechanism is used to extract the global dependency, and then two 1-dimensional convolutions are used to extract local feature information, so as to achieve the comprehensive extraction of user interest features. Finally, the prediction layer uses the idea of matrix decomposition for prediction.
[0065] Further, Figure 3 The performance comparison between the present invention and other methods is given. Specifically, based on three different data sets, namely Amazon_Beauty, Amazon_VideoGames, and MovieLens-1M data sets, Recall and NDCG are used as evaluation indicators to evaluate the model performance. It should be noted that Recall represents the recall rate, Recall@K represents the proportion of items predicted to be recalled and ranked in the top K positions, NDCG (Normalized Discounted Cumulative Gain) represents the normalized discounted cumulative gain, and NDCG@K represents the proportion of the total scores of the top K recommended items to all scores, taking the order into consideration. Figure 3 It can be seen that the performance of the sequence recommendation method provided by the present invention is better than other methods, so the present invention can improve the accuracy of sequence recommendation.
Claims
1. A sequence recommendation method based on information propagation and attention mechanism, characterized by The steps include: S1. Calculate the corresponding communication power of each item for the input user behavior sequence. In order to calculate the corresponding communication power of each item, first use the SI model in the information diffusion model to simulate the proportion of users that each item can influence in the corresponding time series, and then use the proportion of the items that can be influenced to calculate the influence of each item. The specific process is: S11. First, the SI model is used to take the recommended items as "infection sources" and divide users into the susceptible state and the affected state; by calculating the proportion of people "infected" by each item at a specific time, the proportion of people affected by a certain item at time t is calculated: i0=i(0) Where i(t) represents the proportion of people affected by the item at time t, i0 represents the proportion of users affected at the initial time, β represents the probability of each user being affected by each other, and e is a natural constant; S12. Multiply the user's rating of a specific item at time t by the influence ratio of the item at time t to obtain the spread power. The greater the influence ratio of the user, the more consistent the user group's rating of the item is. Therefore, for an item with a low rating, if the influence ratio of the user is greater, the rating of the item will be lower; conversely, for an item with a high rating, if the influence ratio of the user is greater, the rating of the item will be higher. The formula for calculating the spread power is: where t now -t origin represents the time interval between the current score and the first score, and score(t) represents the current score. In the above formula, for items with the same score, the longer the interval, the greater the influence, and the shorter the interval, the shorter the influence. S2. Use the spread of each item to modify the user's rating data; The specific process is: S21. Calculate the popularity of the item. The popularity is calculated by the ratio of the number of times a certain item is rated to the total number of times it is rated: Where sum(click(i)) represents the total number of times an item is rated, and sum(click) represents the number of times all items are rated; S22. Modify the item score; integrate popularity and spread into the final score through two weight parameters: Where μ1 and μ2 are weight parameters, score(i) represents the score of the current item, pop(i) represents the spread of the current item, hot(i) represents the popularity of the current item, and the final corrected score result is res(i); S3. Use Transformer encoder and CNN convolution to extract features from the modified user behavior sequence data. Use two attention mechanism implementations to help the model extract more comprehensive user preference information. The specific process is as follows: S31, pre-process and segment the user behavior sequence data, set the maximum length of the sequence that can be processed to k, and perform pre-processing on the user behavior sequence data (a1, a2, ..., a k ,…,a n ) to split the sequence. If the sequence length itself does not meet k, data is added to one end of the sequence to make the sequence length meet k; if the sequence length itself is greater than k, the nk sequence with the longest time is removed; S32, embed the user behavior sequence data and construct an embedding matrix E, in which each row is a user-item embedding vector. Then, a position embedding p is added to the back of each row of the embedding vector so that the embedding matrix can learn the front and back position information of the user behavior sequence to obtain the embedding matrix E * ; S33. Use the Transformer encoder in the attention layer to extract the user's long-term preferences for the embedding matrix. The Transformer encoder can extract global temporal information and help the neural network model capture the user's long-term interests: In the formula, Attention(Q,K,V) is a self-attention mechanism, Q represents the query vector, K represents the key-value vector, and V represents the value vector. These three vectors are obtained by multiplying the initial embedding vector X by matrices with different weights. K T represents the transpose of the key-value vector K, d represents the dimension of the embedding matrix; for the embedding matrix E * , given three projections are W Q , W K , W V , multiplied by E * And bring it into the Attention formula: S=Attention(E * ×W Q ,E * ×W K ,E * ×W V ) In order to avoid interaction with historical information, two layers of feedforward neural network are added to the results: Where W i is a d×d matrix, b i is a d-dimensional vector. In order to prevent overfitting, residual connections, layer regularization and dropout are added to the results: h(in)=in+dropout(h(LayerNorm(in))) Where h(in) represents a layer of feedforward network, and in is the input information; S34. Use the convolution in the attention layer to extract the user's short-term preference from the embedding matrix. CNN convolution can perceive edge and detail information, so layout feature information can be extracted through convolution. First, add a one-dimensional convolution with a filter of 2 and a kernel size of 100 to the embedding matrix, and then perform maximum pooling on it: φ1=MaxPool(M1(E * )) Among them, M1 is the convolution calculation, MaxPool represents the maximum pooling, and then the embedding matrix is transposed, and then a one-dimensional convolution with a filter of 2 and a kernel size of 1 is added: φ2=M2((E * ) T ) Where M2 represents the convolution calculation, (E * ) T Indicates E * Finally, the results of the two convolution operations are concatenated to obtain the feature information for horizontal and vertical extraction of the embedding matrix: convAttention=concat(φ1,φ2) Where concat(·) represents the concatenation function; S35, fusing the extracted feature information: Where convAttention is the feature information calculated by the convolution operation, h(in) is the feature information calculated by the Transformer encoder, and α and γ are two weight parameters; S4. Calculate the correlation between the current item and the items before the current time node using matrix decomposition, input the correlation result into the Softmax function, and use the output of the Softmax function to predict the probability of the next item; S5. A binary cross entropy loss function is established based on the above probability. When the loss function does not meet the given conditions, the information is re-transmitted into the neural network model for training until the output result meets the given conditions. The trained model is used as the final model for sequence recommendation.
2. The sequence recommendation method based on information propagation and attention mechanism according to claim 1 is characterized in that The above step S2 uses the spreadability of each item to correct the user's rating data, obtains the result of the item spreadability based on step S1, and corrects the score of each item according to the popularity of the item. The popularity of the item is combined to better reflect the information of the item's spreadability in the scoring results, so that the scores of different items at different time points have obvious differences.
3. The sequence recommendation method based on information propagation and attention mechanism according to claim 1 is characterized in that The above step S4 uses matrix decomposition to calculate the correlation between the current time item and the items before the current time node, inputs the correlation result into the Softmax function, uses the output of the Softmax function to predict the probability of the next item, and decomposes the final result matrix into two small matrices, and then learns each parameter through the gradient descent method: R = F × (E * ) T , where F i is the output of the feedforward network, (E * ) T is the transpose of the embedding matrix; each element of the R matrix is denoted by r it , which represents the correlation between item i and the previous t items.
4. The sequence recommendation method based on information propagation and attention mechanism according to claim 3 is characterized in that In step S5, a binary cross entropy loss function is established according to the above probability. When the loss function does not meet the given conditions, the information is re-transmitted into the neural network model for training until the output result meets the given conditions. The trained model is used as the final model for sequence recommendation. The loss function is: loss= S i S t S k [-log(δ(r til ))-log(1-δ(r tik ))] where r til represents the prediction of user i for positive sample l at time t, r tik represents the prediction of user i for negative sample k at time t, and δ represents the sigmoid activation function.