Recommendation Method, Terminal and Medium Based on Feedback-Aware Local and Global Models
Through the feedback-perceived self-attention model and positional attention layer combined with the local intention model, the problems of feedback distinction, preference capture and intention modeling in heterogeneous sequence recommendations are solved, and the prediction accuracy is improved.
Patent Information
- Application Number
- CN202111497038.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-08
- Publication Date
- 2025-07-29
- Estimated Expiration
- 2041-12-08
AI Technical Summary
The existing heterogeneous sequence recommendation algorithms are difficult to distinguish different types of feedback, cannot effectively capture the user's local and global preferences, and fail to accurately model the user's true intentions, resulting in insufficient prediction accuracy.
The feedback-perceptual self-attention model is used to capture local preferences, combine the positional attention layer to learn global preferences, and model real intentions through the local intention model, and use the self-attention mechanism to make predictions.
It realizes effective modeling of multiple user behaviors, can accurately distinguish different types of feedback, capture the user's local and global preferences, and improves the accuracy of prediction.
Smart Images

Figure CN114490784B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data mining applications, and particularly relates to a recommendation method, a terminal, and a medium based on a local and global model with feedback perception. Background Art
[0002] In sequential single-class collaborative filtering, many homogeneous sequence recommendation algorithms have emerged, such as the RNN-based method GRU4Rec, the CNN-based methods Caser and NextItNet, and the attention-based algorithm SASRec, etc. However, these methods cannot distinguish different behaviors for the same item in a sequence because these algorithms are designed to model only a single type of behavior.
[0003] To solve this problem, some recent sequential heterogeneous single-class collaborative filtering algorithm works attempt to model heterogeneous sequences, such as RLBL, RIB, and BINN. The Recurrent Log-Bilinear Model (RLBL) divides a sequence into multiple time windows, uses the Log-Bilinear Model (LBL) to aggregate the interaction information of each time window, introduces a behavior-related transition matrix to distinguish different behaviors, and thus obtains the short-term preference within the window. Since a sequence is divided into multiple windows, RLBL further uses an RNN to aggregate the preferences of different windows, thereby obtaining the long-term preference of the user. The Recommendation with Integrated Behavior Sequence Modeling (RIB) considers the heterogeneous behavior sequence of the user, concatenates the behavior feature vector corresponding to each item in the heterogeneous sequence with the feature vector of the item, and inputs the whole into an LSTM, so that the LSTM can capture the transition pattern between different behaviors in step-by-step modeling. The Behavior Intensive Neural Network (BINN) proposes a new type of context-aware long short-term memory network (CLSTM) based on the RNN structure, introduces the modeling of heterogeneous behaviors into the LSTM, and thus enables BINN to distinguish and retain behavior-related memories during operation. They are all methods based on recurrent neural networks and distinguish different behaviors through a behavior latent feature matrix.
[0004] Recently, many existing works such as RLBL, RIB, BINN, etc. use RNN to model heterogeneous sequences. Although RNN is an effective method for modeling sequence information, it has disadvantages such as difficult parallel training and easy occurrence of gradient disappearance. However, most of them are based on RNN and may not be very competitive in capturing users' complex and dynamic preferences. Most existing advanced sequence recommendation algorithms, such as the self-attention-based algorithm FISSA, cannot be directly applied to the heterogeneous sequence recommendation problem. In addition, most existing heterogeneous sequence recommendation methods do not consider modeling the user's current intention. Since there are various different behaviors mixed in the heterogeneous sequence, such as click, purchase, add to cart, favorite, etc., it is also important to model the intention of what behavior the user will perform next.
[0005] For the modeling of user intention in heterogeneous sequence recommendation, there are the following three challenges: (1) Heterogeneity of feedback. For heterogeneous sequence recommendation algorithms, it is very important to distinguish different types of feedback in the historical interaction sequence. (2) Complexity of user preferences. How to make heterogeneous sequence recommendation algorithms better distinguish and utilize users' local and global preferences is also an important issue. (3) Uncertainty of user intention. In homogeneous sequence recommendation, the model trained with the historical purchase sequence can predict the possible products to be purchased next. However, in a sequence that contains both clicks and purchases, it is difficult to predict the possible products to be interacted with next for the real next feedback at each step.
[0006] Therefore, the existing technology still needs to be improved. Summary of the Invention
[0007] The technical problem to be solved by the present invention is that, aiming at the defects of the existing technology, the present invention provides a recommendation method, a terminal and a medium based on a feedback-aware local and global model to solve the technical problem of difficult heterogeneous prediction training in the existing technology.
[0008] The technical solutions adopted by the present invention to solve the technical problems are as follows:
[0009] In the first aspect, the present invention provides a recommendation method based on a feedback-aware local and global model. The recommendation method based on a feedback-aware local and global model includes the following steps:
[0010] Capture the local preferences of the target object through a feedback-aware self-attention model;
[0011] Perform global preference learning according to the position attention layer and the local preferences, and capture the global preferences of the target object;
[0012] Learn through the self-attention mechanism and the local intention model, and model the real intention of the target object to obtain a real intention model;
[0013] Predict according to the true intention model, the local preference, and the global preference to obtain the prediction result of the next behavior of the target object.
[0014] In one implementation, before capturing the local preference of the target object through the feedback-aware self-attention model, it includes:
[0015] Convert the preset item sequence into an item embedding matrix:
[0016]
[0017] where, represents the potential feature vector related to item ;
[0018] Model the position information at each time step l according to the position-related potential feature vector P l ∈R 1×d to obtain a position embedding matrix:
[0019] P = [P1;...P l ;...P L ∈ R L×d ;
[0020] Use element-wise addition to fuse the item information and the position information at each time step l, and represent the resulting vector as
[0021]
[0022] In one implementation, before capturing the local preference of the target object through the feedback-aware self-attention model, it also includes:
[0023] Determine the input matrix of the local preference learning module according to the obtained vector:
[0024]
[0025] Input the input matrix into the stacked feedback-aware self-attention layers:
[0026]
[0027] In one implementation, before capturing the local preference of the target object through the feedback-aware self-attention model, it also includes:
[0028] Determine the feedback information in the feedback-aware self-attention layer:
[0029] Q, K, V = FIL(X);
[0030]
[0031]
[0032]
[0033] wherein, is element-wise multiplication;
[0034] M e ∈ R L×d is the mask matrix of browsing behavior;
[0035] M p ∈ R L×d is the mask matrix of purchase behavior;
[0036] W eq ∈ R d×d 、W ek ∈ R d×d and W ev ∈ R d×d are all the projection matrices of the said browsing behavior;
[0037] W pq ∈ R d×d 、W pk ∈ R d×d and W pv ∈ R d×d are all the projection matrices of the said purchase behavior;
[0038] Determine the expression of the feedback-aware self-attention layer according to the said feedback information:
[0039]
[0040] wherein, Q ∈ R d×d is the query matrix;
[0041] K ∈ R d×d is the key matrix;
[0042] V ∈ R d×d is the value matrix;
[0043] Δ is the causal mask matrix.
[0044] In one implementation, capturing the local preference of the target object by the self-attention model with feedback awareness includes:
[0045] Input the feedback information in the feedback-aware self-attention layer into the feed-forward layer:
[0046] FFL(X') = ReLU(X'W1 + 1 T b1)W2 + 1 T b2;
[0047] where \(W_1\in\mathbb{R}\) d×d and \(W_2\in\mathbb{R}\) d×d are the weights of the first - layer neural network and the second - layer neural network, respectively;
[0048] \(b_1\in\mathbb{R}\) 1×d and \(b_2\in\mathbb{R}\) 1×d are the biases of the first - layer neural network and the second - layer neural network, respectively;
[0049] \(\mathbf{1}\in\mathbb{R}\) 1×L is a vector of all 1s;
[0050] ReLU is a non - linear activation function;
[0051] Obtain the local preference according to the input of the feed - forward layer:
[0052]
[0053] where is the local preference of the target object \(u\) at time step \(l\) obtained from the FSAB of the \(B\) - th layer.
[0054] In one implementation, the global preference learning based on the position attention layer and the local preference, and capturing the global preference of the target object, includes:
[0055] Model the global preference of the target object according to the position attention layer to obtain a global preference model:
[0056] \(\mathbf{z}\) gp \(=\text{LAL}(\mathbf{E})=\text{softmax}(\mathbf{q}\) s (\mathbf{E}\mathbf{W}\) K ) T )\mathbf{E}\mathbf{W}\) V ;
[0057] where \(\mathbf{W}\) K \(\in\mathbb{R}\) d×d is the projection matrix that maps the item embedding matrix \(\mathbf{E}\) of the target object to the key matrix;
[0058] \(\mathbf{W}\) V \(\in\mathbb{R}\) d×d is the projection matrix that maps the item embedding matrix \(\mathbf{E}\) of the target object to the value matrix;
[0059] \(\mathbf{q}\) s \(\in\mathbb{R}\) 1×d is a shared query vector for extracting representative item information;
[0060] Capture the global preference of the target object according to the shared query vector.
[0061] In one implementation, learning is performed through the self-attention mechanism and the local intention model, and the true intention of the target object is modeled to obtain a true intention model, including:
[0062] Construct the input of the feedback attention layer through element-wise addition:
[0063]
[0064] where, is the latent feature vector of the item ;
[0065] p l ∈ R 1×d is the latent feature vector at position l;
[0066] is the latent feature vector of the feedback ;
[0067] Obtain the input matrix of the feedback attention layer according to the constructed input:
[0068]
[0069] Use the embedding of the next true feedback of the target object as the query vector to obtain a query matrix:
[0070]
[0071] where, W' Q ∈ R d×d is the projection matrix;
[0072] Q i ∈ R L×d is the query matrix;
[0073] Obtain the local intention of the target object according to the query matrix:
[0074]
[0075] where, Q il ∈ R 1×d is the query vector of Q i at time step l;
[0076] Δ is the causal mask matrix;
[0077] W' K ∈ R d×d is the key projection matrix;
[0078] W' V ∈ R d×d is the value projection matrix.
[0079] In one implementation, the predicting the next behavior prediction result of the target object according to the true intention model, the local preference, and the global preference includes:
[0080] Taking the global preference of the target object, the item interacted at time l, and the target item as inputs, and outputting a balance factor λ ∈ (0, 1):
[0081]
[0082] where, W G ∈ R 3d×1 is the weight of the item similarity gating;
[0083] b G ∈ R is the bias of the item similarity gating;
[0084] Aggregating the global preference and the local preference through the balance factor:
[0085]
[0086] where,
[0087] Obtaining an expression of the heterogeneous sequence at time step l by element-wise addition combining the aggregated preference and the intention feature:
[0088]
[0089] Predicting the preference score of the target object for the target item at time step l according to the obtained expression
[0090]
[0091] Taking the preference score as the next behavior prediction result of the target object.
[0092] In a second aspect, the present invention provides a terminal, including: a processor and a memory, where the memory stores a recommendation program based on a feedback-aware local and global model, and when the recommendation program based on the feedback-aware local and global model is executed by the processor, it is used to implement the recommendation method based on the feedback-aware local and global model as described in the first aspect.
[0093] In a third aspect, the present invention provides a medium, which is a computer-readable storage medium storing a recommendation program based on a feedback-aware local and global model. When the recommendation program based on the feedback-aware local and global model is executed by a processor, it is used to implement the recommendation method based on the feedback-aware local and global model as described in the first aspect.
[0094] The present invention adopts the above technical solutions and has the following effects:
[0095] The present invention differentiates different behaviors of users through a feedback-aware self-attention model, can capture the local preferences of users, and through local preference learning, can obtain the global preferences of users; moreover, based on the matching of the real intention with the corresponding items, and using local intention learning to take the real intention of the user in the next step as a query vector, an accurate prediction result can be obtained. BRIEF DESCRIPTION OF THE DRAWINGS
[0096] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the following drawings are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on the structures shown in these drawings.
[0097] Figure 1 is a flowchart of a recommendation method based on a feedback-aware local and global model in an implementation manner of the present invention.
[0098] Figure 2 is a schematic structural diagram of a recommendation model based on a feedback-aware local and global model in an implementation manner of the present invention.
[0099] Figure 3 is a schematic diagram comparing the prediction results of a recommendation model based on a feedback-aware local and global model with other heterogeneous prediction models in an implementation manner of the present invention.
[0100] Figure 4 is a functional schematic diagram of a terminal in an implementation manner of the present invention.
[0101] The realization, functional characteristics and advantages of the object of the present invention will be further described with reference to the embodiments and the drawings. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0102] To make the object, technical solutions and advantages of the present invention clearer and more definite, the following further describes the present invention in detail with reference to the accompanying drawings and by way of examples. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0103] Exemplary Method
[0104] As Figure 1 shown, an embodiment of the present invention provides a recommendation method based on a feedback-aware local and global model. The recommendation method based on the feedback-aware local and global model includes the following steps:
[0105] Step S100, capturing the local preferences of the target object through a feedback-aware self-attention model.
[0106] In this embodiment, the recommendation method based on the feedback-aware local and global model is applied to a terminal, and the terminal includes but is not limited to: a computer, a mobile terminal, a wearable device, etc.
[0107] In this embodiment, the recommendation method based on the feedback-aware local and global model is applied to application scenarios such as online shopping, course learning, and life entertainment, and can be used to predict the actions that the user may perform next according to the heterogeneous behavior (i.e., multiple different types of behaviors) information of the user in such scenarios, and recommend corresponding item information to the user according to the next action of the user; this embodiment takes online shopping as an application scenario for illustration.
[0108] In the existing online shopping recommendation system, the recommendation method is to recommend items that the user may be interested in in the future according to the user's historical interaction records; this recommendation method only recommends for the interaction sequence of a single behavior type (for example: the user's historical purchase sequence); however, in the actual application scenario, the user's behavior type is often more than one, for example: in a certain shopping website, the user's behaviors usually include clicking, purchasing, adding to the shopping cart, collecting, etc. If only one behavior is considered, a large amount of available information will be lost. In recent years, a large number of excellent sequential recommendation models can still only model the single behavior of the user. When there are multiple behaviors, these models at least face three major challenges: feedback heterogeneity, preference complexity, and intention uncertainty.
[0109] The algorithm proposed in this embodiment aims to model the multiple behaviors of the user, which is called the heterogeneous sequential recommendation problem (HSR). Specifically, for each user u, there is a set of items that he clicks and purchases. Given the historical heterogeneous sequence of the user, the task of this embodiment is to use the heterogeneous sequence formed by these two types of feedback to learn the user's preferences, and select items from the item set to predict the item that the user is most likely to purchase next.
[0110] To address the three challenges of feedback heterogeneity, preference complexity, and intention uncertainty, this embodiment proposes a novel solution, namely a recommendation algorithm based on a feedback-aware local and global model (FLAG).
[0111] First, this embodiment proposes a novel feedback-aware self-attention block based on the traditional self-attention block and applies it to the local preference learning module, enabling the self-attention mechanism to be applied to heterogeneous sequences and also solving the first challenge (i.e., the problem of feedback heterogeneity).
[0112] Second, this embodiment uses a position-based attention layer for global preference learning, and gates the position-based attention layer and the local preference learning module through a similarity gate to obtain complex user preferences, solving the second challenge of difficult-to-model complex user preferences (the problem of preference complexity).
[0113] Finally, this embodiment utilizes the self-attention mechanism of the local intention learning module to directly model the user's true intention during training, thus solving the third challenge (i.e., the problem of intention uncertainty).
[0114] As Figure 2 shown, the feedback-aware local and global recommendation algorithm in this embodiment includes: a local preference learning module, a global preference learning module, a local intention learning module, and a prediction module; among them, the local preference learning module is used to capture the user's short-term interests and consists of a feedback-aware self-attention block, so as to be able to distinguish different types of feedback; the global preference learning module is used to model the user's global preferences; the local intention learning module uses the user's true feedback in the next step, that is, the user's intention at the current time step, as the query vector in the self-attention block to find items that match the user's intention at the current time step; the prediction module is used to aggregate the user's local preferences and global preferences to achieve the final prediction.
[0115] In the modeling of homogeneous sequences, the traditional self-attention block (SAB) is widely used because it can effectively capture the long-range dependencies of the item sequence. However, the traditional self-attention block (SAB) cannot be directly applied to the modeling of heterogeneous sequences because it cannot distinguish different behaviors in the sequence. When the user has different feedback behaviors for an item, these two items at different positions should be treated differently in sequence modeling. However, the traditional self-attention block (SAB) cannot do this. When the user has two types of feedback for the same item, there will be two positions in the heterogeneous sequence with the same item ID but different feedback types, which should be treated differently in heterogeneous sequence modeling.
[0116] To apply the self-attention mechanism to the heterogeneous sequence recommendation scenario, this embodiment proposes a feedback-aware self-attention block (FSAB) to replace the self-attention block (SAB) in the homogeneous sequence recommendation model SASRec; this feedback-aware self-attention block (FSAB) can modify the traditional self-attention block (SAB) to adapt to heterogeneous sequences.
[0117] Specifically, this embodiment sets a series of feedback-aware query matrices, key matrices, and value matrices in the feedback-aware self-attention block (FSAB), enabling the feedback-aware self-attention block (FSAB) to have the ability to distinguish different types of feedback; in this way, the feedback-aware self-attention block (FSAB) can take the latest L items of user u and their corresponding feedback as input, that is and then output the local preference of user u. In this embodiment, L = 50 is fixed, and sequences shorter than L are padded to length L.
[0118] In one implementation manner of this embodiment, before step S100, the following steps are included:
[0119] Step S001, convert the preset item sequence into an item embedding matrix.
[0120] In this embodiment, the preset item sequence is the latest L-item sequence of the above user u, and through the conversion process of the item sequence, the obtained item embedding matrix is:
[0121]
[0122] where represents the latent feature vector related to item .
[0123] Step S002, model the position information of each time step l according to the position-related latent feature vector P l ∈R 1×d to obtain a position embedding matrix.
[0124] In this embodiment, after obtaining the item embedding matrix, a position-related latent feature vector P l ∈R 1×d can also be used to model the position information of each time step l, so there is also an embedding matrix for positions:
[0125] P = [P1;...P l ;...P L ∈R L×d .
[0126] Step S003, fuse the item information and location information at each time step l using element-wise addition, and represent the resulting vector as
[0127] In this embodiment, the item information and its corresponding location information at each time step can be fused by element-wise addition to obtain the corresponding fused vector:
[0128]
[0129] In an implementation manner of this embodiment, before step S100, the following steps are further included:
[0130] Step S004, determine the input matrix of the local preference learning module according to the obtained vector.
[0131] In this embodiment, the input matrix of the local preference learning module can be obtained according to the fused vector, and the input matrix can be expressed as:
[0132]
[0133] Step S005, input the input matrix into the stacked feedback-aware self-attention layers.
[0134] In this embodiment, after inputting the input matrix into the feedback-aware self-attention block (FSAB), the resulting feedback-aware self-attention expression is:
[0135]
[0136] It is worth mentioning that the feedback-aware self-attention block (FSAB) in this embodiment has three parts, including: a self-attention layer (abbreviated as SAL), a feed-forward layer (abbreviated as FFL), and a feedback-aware input layer (abbreviated as FIL); among them, the self-attention layer (SAL) can be used to capture the similarity between different items, the feed-forward layer (FFL) can be used to model the non-linear relationship, and the feedback-aware input layer (FIL) can use the feedback-aware mapping matrix to generate the feedback-aware query matrix, key matrix, and value matrix.
[0137] In this embodiment, ignoring techniques such as layer normalization and residual connection, the feedback-aware self-attention block (FSAB) can be expressed as the following formula:
[0138] FSAB(X) = FFL(SAL(FIL(X))).
[0139] In the traditional self-attention block (SAB), the query matrix, key matrix, and value matrix are obtained by multiplying the input matrix X with three different projection matrices. In this embodiment, the feedback-aware self-attention block (FSAB) can utilize the feedback information in the heterogeneous sequence and enable Q, K, and V to contain feedback information through the feedback-aware self-attention layer therein.
[0140] In one implementation manner of this embodiment, before step S100, the following steps are further included:
[0141] Step S006, determining the feedback information in the feedback-aware self-attention layer.
[0142] Q, K, V = FIL(X);
[0143]
[0144]
[0145] [[ID=ID=18]]
[0146] where is element-wise multiplication;
[0147] M e ∈ R L×d is the mask matrix for browsing behavior;
[0148] M p ∈ R L×d is the mask matrix for purchase behavior;
[0149] W eq ∈ R d×d 、W ek ∈ R d×d and W ev ∈ R d×d are all the projection matrices for the browsing behavior;
[0150] W pq ∈ R d×d 、W pk ∈ R d×d and W pv ∈ R d×d are all the projection matrices for the purchase behavior.
[0151] It is worth mentioning that M e is a filter that can set the row vectors corresponding to the browsing behavior to 1 vectors, thereby erasing the user's purchase behavior; while M p can enable the input matrix X to only retain the item information of the purchase behavior.
[0152] Step S007: Determine the expression of the feedback-aware self-attention layer according to the feedback information.
[0153] In this embodiment, according to the feedback information included in Q, K, and V, the following formula based on the self-attention layer can be obtained:
[0154]
[0155] where Q ∈ R d×d is the query matrix;
[0156] K ∈ R d×d is the key matrix;
[0157] V ∈ R d×d is the value matrix;
[0158] Δ is the causal mask matrix;
[0159] It is worth mentioning that Δ is the causal relationship mask, which is a triangular matrix. By setting the elements in the upper right corner of the matrix to extremely small values, it can ensure that each item at each time step can only see the previous interactive items.
[0160] In an implementation manner of this embodiment, step S100 specifically includes the following steps:
[0161] Step S101: Input the feedback information in the feedback-aware self-attention layer into the feed-forward layer.
[0162] In this embodiment, after obtaining the formula of the self-attention layer (SAL), X' can be input into the feed-forward layer (FFL), which enables the feedback-aware self-attention block (FSAB) to have the ability of non-linear modeling and can capture the relationships of different potential feature dimensions:
[0163] FFL(X') = ReLU(X'W1 + 1 T b1)W2 + 1 T b2;
[0164] where W1 ∈ R d×d and W2 ∈ R d×d are the weights of the first-layer neural network and the second-layer neural network respectively;
[0165] b1 ∈ R 1×d and b2 ∈ R 1×d are the biases of the first-layer neural network and the second-layer neural network respectively;
[0166] 1 ∈ R 1×L is the all-ones vector;
[0167] ReLU is the non-linear activation function.
[0168] Step S102, obtain local preferences according to the input of the feed-forward layer.
[0169] In this embodiment, according to the input feedback information, the local preferences of the user can be obtained:
[0170]
[0171] where is the local preference of the target object u at time step l obtained from the FSAB of the B-th layer.
[0172] In this embodiment, the relationship between any two items in the item sequence is directly modeled by means of self-attention, so that the feedback-aware self-attention block (FSAB) can better capture the long-term dependencies of items. Moreover, with the help of the feedback-aware input layer, the feedback-aware self-attention block (FSAB) can further capture the correlations between different feedbacks, thereby better modeling the local preferences of users.
[0173] As Figure 1 shown, in an implementation manner of the embodiment of the present invention, the recommendation method based on the feedback-aware local and global model further includes the following steps:
[0174] Step S200, perform global preference learning according to the position attention layer and the local preferences, and capture the global preferences of the target object.
[0175] In this embodiment, the feedback-aware self-attention block (FSAB) can capture the local preferences of the user, but lacks consideration of global information. Since the causal mask restricts the influence of future behavior on the current moment through the attention weights, it is also necessary to model the global preferences of the user through the position attention layer (LAL).
[0176] In an implementation manner of this embodiment, step S200 specifically includes the following steps:
[0177] Step S201, model the global preferences of the target object according to the position attention layer to obtain a global preference model.
[0178] In this embodiment, the position attention layer (LAL) is used to model the global preferences of the user, which enables the feedback-aware self-attention block (FSAB) to fully utilize the entire item sequence information of the user at each step. Among them, the formula of the global preference model is as follows:
[0179] z gp = LAL(E) = softmax(q s (EW K ) T)EW V ;
[0180] where W K ∈R d×d is the projection matrix that maps the embedding matrix E of the item by the target object to the key matrix;
[0181] W V ∈R d×d is the projection matrix that maps the embedding matrix E of the item by the target object to the value matrix;
[0182] q s ∈R 1×d is the shared query vector for extracting representative item information.
[0183] Step S202, capture the global preference of the target object according to the shared query vector.
[0184] In this embodiment, a location attention layer (LAL) is obtained by variant based on the self-attention layer (SAL), and a shared query vector q s ∈R 1×d is introduced as the query vector, and the causal mask matrix is removed to capture the global preference of the user.
[0185] As Figure 1 shown, in an implementation manner of the embodiment of the present invention, the recommendation method based on the local and global model with feedback perception further includes the following steps:
[0186] Step S300, learn through the self-attention mechanism and the local intention model, and model the true intention of the target object to obtain a true intention model.
[0187] In this embodiment, in the process of studying how to model heterogeneous sequences, when there are both click and purchase feedbacks in the item sequence, predicting the next possible interactive item actually includes two tasks: "predicting the next possible clicked item" and "predicting the next possible purchased item". As the number of feedback types increases, more tasks need to be predicted. Therefore, heterogeneous sequence recommendation can be regarded as a kind of sequence multi-task learning. Due to the strict chronological order restriction, in the global preference module, the click prediction task and the purchase prediction task actually share the same underlying embedding parameters and sequence modeling module.
[0188] However, both the local preference learning module and the global preference learning module can only obtain sequence information from historical heterogeneous sequences and use the same sequence representation to process different user intents, which may not be very reasonable. Although, when using heterogeneous sequences instead of homogeneous sequences, the item sequence can express the user's current intent to a certain extent, but it still cannot focus on the user's current intent. Additionally, from the perspective of features, it cannot reflect the differences in different user intents because the same features are used for different tasks. Although, through the local preference learning module and the global preference learning module, the local and global preferences of the user at each step can be obtained. However, the local preference learning module and the global preference learning module still cannot well simulate the user's true intent, that is, it is impossible to know whether the user's next intent is to click or purchase a product.
[0189] When the user decides to view or purchase a product, the differences in intent will cause the interactions at different positions in the user's historical heterogeneous sequence to exhibit different importance. For example: Before the user decides to buy a piece of clothing, he / she may browse several relatively relevant clothes and finally decide to buy one of them. For example: When the user clicks on headphones, it may be because he / she just bought a related product, such as a mobile phone. Therefore, for different user intents, a more discriminative module is needed to model more accurate user preferences.
[0190] For this reason, a feedback-based attention layer (FAL) is proposed in this embodiment to model the user's local intent in order to obtain more accurate real-time user preferences. In the heterogeneous sequence, whether the user's next behavior is to click or purchase is an embodiment of the user's current intent. Considering that in the actual scenario, the user's intent cannot be accurately predicted, but this information can be used during training to inform the model of the user's intent in advance. Then, during the inference stage of the model, the model can be restricted to only focus on the "purchase" intent.
[0191] To simulate the contribution of each item in the user's historical heterogeneous sequence to the user's intent, a local intent learning module based on a self-attention block is proposed in this embodiment, where the key matrix and value matrix parts include: item information, behavior information, and position information, and the query part is the next real behavior of the user's intent.
[0192] In one implementation manner of this embodiment, step S300 specifically includes the following steps:
[0193] Step S301, construct the input of the feedback attention layer through element-wise addition.
[0194] In this embodiment, a feedback-related latent feature matrix F is introduced to represent two types of feedback (i.e., click and purchase), specifically including: click feature vector F e and purchase feature vector Fp Similar to the feedback-aware self-attention block (FSAB), in this embodiment, element-wise addition is used to construct the input of the feedback-based attention layer (FAL):
[0195]
[0196] where, is the latent feature vector of the item ;
[0197] p l ∈R 1×d is the latent feature vector at position l;
[0198] is the latent feature vector of the feedback .
[0199] Step S302, obtain the input matrix of the feedback attention layer according to the constructed input.
[0200] In this embodiment, after obtaining each feature vector, the input matrix can be obtained:
[0201]
[0202] In heterogeneous sequence recommendation, it is impossible to accurately know whether the user will click or purchase an item next. However, just like many recommendation models use candidate items as the input of the model, in this embodiment, the true feedback of the next step, that is, the user intention, can be obtained in the data in advance, and the true feedback is used as part of the intention model for training. When the true feedback of the next step is given, the intention model can extract some of the most relevant interactions in the historical interactions according to the user's current intention.
[0203] Step S303, use the embedding of the next true feedback of the target object as the query vector to obtain the query matrix.
[0204] In this embodiment, similar to the location attention layer (LAL), in this embodiment, F e and F p are regarded as two shared query vectors to find out the information that can represent the user's current intention. Specifically, in this embodiment, the embedding corresponding to the user's next true feedback is used as the query vector because it represents the local intention of the user's next step. Therefore, the query matrix of the feedback-based attention layer (FAL) is as follows:
[0205]
[0206] where, W' Q ∈R d×d is the projection matrix;
[0207] Q i ∈R L×d is a query matrix for extracting information in the historical sequence that is more relevant to the target feedback.
[0208] Step S304, obtain the local intention of the target object according to the query matrix.
[0209] In this embodiment, the local intention can be obtained in the following form:
[0210]
[0211] where Q il ∈R 1×d is the query vector of Q i at time step l;
[0212] Δ is a causal mask matrix;
[0213] W' K ∈R d×d is a key projection matrix;
[0214] W' V ∈R d×d is a value projection matrix.
[0215] In this embodiment, the local intention learning module can be regarded as a feedback-aware module for modeling the differences between two different types of feedback (click and purchase), so that the model can extract features that are more in line with the current intention from the historical sequence according to the user's next true feedback, enabling the model to make more accurate predictions.
[0216] As Figure 1 shown, in one implementation manner of the embodiment of the present invention, the recommendation method of the local and global model based on feedback awareness further includes the following steps:
[0217] Step S400, make a prediction according to the true intention model, the local preference, and the global preference to obtain the prediction result of the next behavior of the target object.
[0218] In this embodiment, in order to balance the local preference and the global preference, an item similarity gating (ISG) module is used. This module takes the global preference, the item interacted by the user at time l and the target item
[0219] as inputs and outputs a balance factor.
[0220] Step S401: Using the global preference of the target object, the item interacted at time l, and the target item as inputs, output a balance factor λ ∈ (0, 1).
[0221] In this embodiment, the output balance factor λ ∈ (0, 1) is:
[0222]
[0223] where W G ∈ R 3d×1 is the weight of the item similarity gating;
[0224] b G ∈ R is the bias of the item similarity gating;
[0225] [·, ·, ·] represents the concatenation operation of concatenating multiple feature vectors together;
[0226] The sigmoid function σ(x) = 1 / (1 + e -x ) is an activation function that maps the input x to a real number between 0 and 1.
[0227] Step S402: Aggregate the global preference and the local preference through the balance factor.
[0228] In this embodiment, the local preference and the global preference can be aggregated with the balance factor:
[0229]
[0230] where,
[0231] is the element-wise multiplication.
[0232] Step S403: By element-wise addition, combine the aggregated preference and the intent feature to obtain the expression of the heterogeneous sequence at time step l.
[0233] In this embodiment, through the element-wise addition operation, combine and the intent feature to obtain the final representation z l of the heterogeneous sequence at time step l:
[0234]
[0235] Step S404: Predict the preference score of the target object for the target item
[0236] In this embodiment, according to the above-mentioned ultimate intention, the preference score of user u for the target item at time step l can be predicted. Preference score
[0237]
[0238] Step S405: Use the preference score as the prediction result of the next behavior of the target object.
[0239] In this embodiment, although a local intention learning module is introduced to model different user intentions, this module does not distinguish the importance of different intentions and treats different behaviors equally. To make the model pay more attention to the user's purchase intention during training, a hyperparameter is introduced in this embodiment to adjust the importance of different intentions.
[0240] During the training phase in this embodiment, since the purchase feedback is relatively sparse, weighted cross-entropy loss can be used as the loss function, which emphasizes the importance of the purchase task to a certain extent. Specifically, α p and α e are used to represent the weights of the purchase task and the click task respectively, and the weight of user u at time step l is obtained according to the following formula
[0241]
[0242] where, is the click indication function;
[0243] If belongs to the purchase feedback, its value is 1; if belongs to the click feedback, its value is 0.
[0244] In contrast, is the click indication function.
[0245] Finally, the Feedback-Aware Local and Global model (FLAG) in this embodiment can be optimized using the weighted cross-entropy loss function L through the Adam optimizer:
[0246]
[0247] where j is a negative sample randomly sampled from J\S u .
[0248] The indication function if and only if is a non-padding item; if is a padding item, then
[0249] It is worth mentioning that in this embodiment, for each user u, due to the advantages of the self-attention structure, the loss at each time step l can be calculated in parallel.
[0250] As Figure 3 shown, in order to evaluate the recommendation effect of the recommendation model based on the feedback-aware local and global model, this embodiment conducts experimental research on three widely used real-world datasets, adopts two commonly used ranking-oriented evaluation metrics, and compares with BPRMF, FISM, FPMC, Fossil, GRU4Rec, Caser, SASRec, CAR, FISSA, RLBL, RIB, BINN, etc.; it can be seen from Figure 3 this that compared with existing heterogeneous sequence recommendation algorithms such as RLBL, RIB, BINN, etc. and the advanced homogeneous sequence recommendation algorithm FISSA, the recommendation effect of FLAG is better.
[0251] This embodiment is based on a feedback-aware self-attention block for heterogeneous sequence modeling, obtaining multiple feedback-related projection matrices, enabling the self-attention block to perceive different behaviors of users; and, through a local intention learning module for modeling user intentions, introducing the next real feedback during model training and using it as a query matrix to extract items that match the user's intentions, making the prediction model tend to the weighted cross-entropy loss of purchase feedback, and higher weights can be given to purchase feedback to construct a purchase-oriented recommendation system.
[0252] Exemplary device
[0253] Based on the above embodiments, the present invention also provides a terminal, and its principle block diagram can be as Figure 4 shown.
[0254] The terminal includes: a processor, a memory, an interface, a display screen, and a communication module connected through a system bus; wherein, the processor of the terminal is used to provide computing and control capabilities; the memory of the terminal includes a medium and an internal memory; the medium stores an operating system and a computer program; the internal memory provides an environment for the operation of the operating system and the computer program in the medium; the interface is used to connect to external terminal devices, for example, mobile terminals and computer devices, etc.; the display screen is used to display corresponding recommendation information based on the feedback-aware local and global model; the communication module is used to communicate with a cloud server or a mobile terminal.
[0255] When the computer program is executed by the processor, it is used to implement a recommendation method based on a feedback-aware local and global model.
[0256] Those skilled in the art can understand that Figure 4The principle block diagram shown only shows the block diagram of some structures related to the solution of the present invention, and does not constitute a limitation on the terminal to which the solution of the present invention is applied. The specific terminal may include more or fewer components than those shown in the figure, or combine some components, or have different component arrangements.
[0257] In one embodiment, a terminal is provided, which includes: a processor and a memory. The memory stores a recommendation program based on a feedback-aware local and global model. When the recommendation program based on the feedback-aware local and global model is executed by the processor, it is used to implement the above-mentioned recommendation method based on the feedback-aware local and global model.
[0258] In one embodiment, a medium is provided, where the medium is a computer-readable storage medium, and the medium stores a recommendation program based on a feedback-aware local and global model. When the recommendation program based on the feedback-aware local and global model is executed by the processor, it is used to implement the above-mentioned recommendation method based on the feedback-aware local and global model.
[0259] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable medium. When the computer program is executed, it can include the processes of the above-mentioned method embodiments. Among them, any reference to the memory, storage, database or other media used in the various embodiments provided by the present invention can include non-volatile and / or volatile memories.
[0260] In summary, the present invention provides a recommendation method, a terminal and a medium based on a feedback-aware local and global model. The method includes: capturing the local preference of a target object through a feedback-aware self-attention model; performing global preference learning according to a position attention layer and the local preference, and capturing the global preference of the target object; performing learning through a self-attention mechanism and a local intention model, and modeling the true intention of the target object to obtain a true intention model; making a prediction according to the true intention model, the local preference and the global preference to obtain a prediction result of the next behavior of the target object. The present invention can distinguish different behaviors of users through a feedback-aware self-attention model, capture the local preferences of users, and through local preference learning, obtain the global preferences of users; moreover, based on the true intention to match the corresponding items, and using local intention learning to use the true intention of the user in the next step as a query vector to obtain an accurate prediction result.
[0261] It should be understood that the application of the present invention is not limited to the above examples. For those of ordinary skill in the art, improvements or transformations can be made according to the above description. All such improvements and transformations should fall within the protection scope of the appended claims of the present invention.
Claims
1. A recommendation method based on a local and global model with feedback perception, characterized in that, The recommendation method based on the feedback-aware local and global model includes the following steps: Based on the feedback-aware local and global model, apply the feedback-aware self-attention block to the local preference learning module to learn the feedback-aware self-attention model; the feedback-aware self-attention block is used to adapt to heterogeneous sequences; a series of feedback-aware query matrices, key matrices, and value matrices are set in the feedback-aware self-attention block; the feedback-aware self-attention block includes: a self-attention layer, a feed-forward layer, and a feedback-aware input layer; wherein, the self-attention layer is used to capture the similarity between different items, the feed-forward layer is used to model the non-linear relationship, and the feedback-aware input layer is used to generate the feedback-aware query matrix, key matrix, and value matrix according to the feedback-aware mapping matrix; Capture the local preference of the target object through the feedback-aware self-attention model; Perform global preference learning according to the position attention layer and the local preference, and capture the global preference of the target object; Learn through the self-attention mechanism and the local intention model, and model the true intention of the target object to obtain the true intention model; Make a prediction according to the true intention model, the local preference, and the global preference to obtain the prediction result of the next behavior of the target object.
2. The recommendation method based on the local and global models with feedback perception according to claim 1, wherein Before the step of capturing the local preference of the target object through the feedback-aware self-attention model, it includes: Convert the preset item sequence into an item embedding matrix: ; Among them, represents the potential feature vector related to the article; Based on the location-related potential feature vectors For each time step model the location information to obtain a location embedding matrix: ; Fuse the item information and location information at each time step using element-wise addition, and represent the resulting vector as and represent the resulting vector as : 。 3. The recommendation method based on the local and global models with feedback perception according to claim 2, characterized in that Before the step of capturing the local preference of the target object through the feedback-aware self-attention model, it also includes: Determine the input matrix of the local preference learning module according to the obtained vector: ; Input the input matrix into the stacked feedback-aware self-attention layers: 。 4. The recommendation method based on the local and global models with feedback perception according to claim 3, characterized in that, Before the step of capturing the local preference of the target object through the feedback-aware self-attention model, it also includes: Determine the feedback information in the feedback-aware self-attention layer: ; ; ; ; wherein, is an element-by-element multiplication; is the mask matrix for browsing behavior; is the mask matrix for the purchase behavior; , and are all projection matrices of the browsing behavior; , and are all projection matrices of the purchase behavior; Determine the expression of the feedback-aware self-attention layer according to the feedback information: ; Among them, is the query matrix; is a key matrix; is a value matrix; is a causal masking matrix.
5. The recommendation method based on the local and global models with feedback perception according to claim 4, wherein The step of capturing the local preference of the target object through the feedback-aware self-attention model includes: Input the feedback information in the feedback-aware self-attention layer into the feed-forward layer: ; Among them, and are the weights of the first-layer neural network and the second-layer neural network, respectively. and are the biases of the first-layer neural network and the second-layer neural network, respectively; is a vector of all 1s; is a non-linear activation function; Obtain the local preference according to the input of the feed-forward layer: ; Among them, is the target object obtained from the FSAB of the B-th layer at time step with local preference.
6. The recommendation method based on the local and global models with feedback perception according to claim 5, characterized in that The step of performing global preference learning according to the position attention layer and the local preference, and capturing the global preference of the target object includes: Model the global preference of the target object according to the position attention layer to obtain the global preference model: ; Among them, is the projection matrix that maps the embedding of the item into the matrix E by the target object to the key matrix; A projection matrix that maps the embedding of the article into the matrix E to a value matrix for the target object; A shared query vector for extracting representative item information; Capture the global preference of the target object according to the shared query vector.
7. The recommendation method based on the local and global models with feedback perception according to claim 1, characterized in that The step of learning through the self-attention mechanism and the local intention model, and modeling the true intention of the target object to obtain the true intention model includes: Construct the input of the feedback attention layer through element-wise addition: ; Among them, is the potential feature vector of the article ; is the potential feature vector for the position ; For feedback of potential feature vectors; Obtain the input matrix of the feedback attention layer according to the constructed input: ; Use the embedding of the next true feedback of the target object as the query vector to obtain the query matrix: ; Among them, is a projection matrix; is a query matrix; Obtain the local intention of the target object according to the query matrix: ; Among them, is the query vector at time step ; is a causal masking matrix; is the key projection matrix; is the value projection matrix.
8. The recommendation method based on the local and global models with feedback perception according to claim 1, characterized in that Performing prediction according to the true intention model, the local preference, and the global preference to obtain the prediction result of the next behavior of the target object, including: Based on the global preferences of the target object and the moment Items for interaction And the target item As input, output the balance factor : ; Among them, is the weight of the item similarity gating; Bias for item similarity gating; Aggregating the global preference and the local preference through the balance factor: ; Among them, ; By aggregating the preference and intention features after aggregation through element-wise addition, the expression of the heterogeneous sequence at time step is obtained: ; Predict the target object at the time step according to the obtained expression For the target item Preference score : ; Using the preference score as the prediction result of the next behavior of the target object.
9. A terminal, characterized in that, Including: A processor and a memory, where the memory stores a recommendation program of a local and global model based on feedback perception. When the recommendation program of the local and global model based on feedback perception is executed by the processor, it is used to implement the recommendation method of the local and global model based on feedback perception according to any one of claims 1-8.
10. A medium, characterized in that, The medium is a computer-readable storage medium, and the medium stores a recommendation program of a local and global model based on feedback perception. When the recommendation program of the local and global model based on feedback perception is executed by a processor, it is used to implement the recommendation method of the local and global model based on feedback perception according to any one of claims 1-8.
Citation Information
Patent Citations
Time-aware video-on-demand recommendation method for TV boxes
CN109218767A
Hybrid recommendation algorithm based on local and global representation model joint learning
CN112733027A