Sequence recommendation method and system based on feature fusion and diffusion model
Through the sequential recommendation method of feature fusion and diffusion model, the user-item interaction matrix is constructed using graph convolutional network and self-attention network, combined with multi-layer perceptron and denoising neural network, which solves the problem of insufficient long-term dependency modeling in existing sequential recommendation methods and improves recommendation accuracy and user satisfaction.
Patent Information
- Application Number
- CN202411118190.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-15
- Publication Date
- 2025-10-17
- Estimated Expiration
- 2044-08-15
AI Technical Summary
Existing sequence recommendation methods have limited ability to model long-term dependencies and are unable to fully explore the complex correlations between users and items, resulting in low recommendation accuracy and low user satisfaction.
A sequential recommendation method based on feature fusion and diffusion model is adopted. The user-item interaction matrix is constructed through graph convolutional network and self-attention network. Combined with multi-layer perceptron and denoising neural network, the user embedding representation is reconstructed to improve the generalization ability of the model.
The accuracy of sequential recommendation and user experience are improved. The sequential recommendation method based on feature fusion and diffusion model improves the accuracy of recommendation and user satisfaction.
Smart Images

Figure CN119027215B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the field of sequence recommendation, and particularly relates to a sequence recommendation method and system based on feature fusion and diffusion model. BACKGROUND
[0002] With the vigorous development of information technology and the Internet, electronic devices such as mobile phones and computers have gradually become popular, making the Internet penetrate into all aspects of people's lives, and various resources on the network have shown explosive growth. However, along with this comes the problem of information overload, and it becomes increasingly difficult for people to find the content they are interested in among the vast amount of data resources. Under this background, the role of the recommendation system becomes particularly important. The recommendation system can accurately analyze and extract the user's preferences according to the user's interaction history, and actively recommend content that may arouse the user's interest. This not only can alleviate the problem of information overload, help users quickly locate the required information and save valuable time, but also can improve the user experience, enhance the user's stickiness and loyalty to the platform.
[0003] Sequence recommendation is a technology that uses user historical interaction data, arranges in chronological order, and models the relevance between items. Its main goal is to predict the items that users may be interested in at future time, thereby realizing personalized recommendation services. At present, the mainstream sequence recommendation methods include neural networks, attention mechanisms and other technologies. These methods analyze the user's interaction history and the characteristics of the items to generate recommendations for individual users, in order to improve the accuracy of recommendations and user satisfaction.
[0004] However, the existing sequence recommendation methods have limited modeling ability for long-term dependencies, and often can only consider short-term behavior patterns, resulting in a lack of long-term personalization in the recommendation results. At the same time, traditional methods only focus on the interaction relationship between items, often ignoring the complex association between users and items and the conversion between features, and cannot fully mine the potential rules hidden behind the data, thereby resulting in low recommendation accuracy. That is, there is a problem of low accuracy of sequence recommendation methods and low user satisfaction.
[0005] Therefore, how to improve the accuracy of sequence recommendation methods and improve user satisfaction is a problem to be solved in the field. SUMMARY
[0006] The sequence recommendation method and system based on feature fusion and diffusion model aim at the defects of the prior art, and provide a sequence recommendation method and system based on feature fusion and diffusion model.
[0007] To achieve the above object, the present application adopts the following technical scheme:
[0008] The sequence recommendation method based on feature fusion and diffusion model comprises the following steps:
[0009] S1, constructing a sequence recommendation model based on feature fusion and diffusion model;
[0010] S2, training the sequence recommendation model based on feature fusion and diffusion model by using the historical interaction sequence of the user in the data set and the corresponding item attribute feature information, to obtain a trained sequence recommendation model based on feature fusion and diffusion model; step S2 specifically comprises the following:
[0011] S21, obtaining the historical interaction sequence of the user from the data set;
[0012] S22, inputting the historical interaction sequence into an embedding layer to obtain item embedding representation and user embedding representation, and constructing a user-item interaction matrix;
[0013] S23, inputting the item embedding representation, the user embedding representation and the user-item interaction matrix into a graph convolution network, and obtaining global interaction level user embedding representation through message propagation and layer information fusion operation of the graph convolution network;
[0014] S24, obtaining corresponding item attribute features from the data set based on the item id in the historical interaction sequence, and obtaining attribute feature embedding of each item after encoding and assigning position information to each item attribute feature;
[0015] S25, inputting the attribute feature embedding of the item into a self-attention network to obtain attribute feature conversion level user embedding representation;
[0016] S26, inputting the global interaction level user embedding representation and the attribute feature conversion level user embedding representation into a multi-layer perceptron to obtain user embedding representation fused with global interaction and feature conversion;
[0017] Step S27, randomly sample a time step t, add the embedding representation of the target item to the randomly obtained Gaussian white noise noise through the corresponding proportion at the time step t to obtain a noisy target item embedding representation;
[0018] Step S28, input the fused global interaction and feature converted user embedding representation, time step embedding and the noisy target embedding representation into the denoising neural network to obtain a reconstructed user embedding representation;
[0019] Step S29, calculate the mean square error loss between the reconstructed user embedding representation and the embedding representation of the target item Update the parameters of the denoising neural network and the embedding representation in the embedding table by gradient descent to reduce the mean square error loss to obtain a final updated reconstructed user embedding representation;
[0020] S3, obtain the historical interaction sequence of the to-be-recommended user and the corresponding item attribute feature information, and input the historical interaction sequence of the to-be-recommended user and the corresponding item attribute feature information into the trained sequence recommendation model based on the feature fusion and diffusion model to obtain a user embedding representation of the to-be-recommended user;
[0021] S4, calculate the inner product between the user embedding representation of the to-be-recommended user and all candidate item embeddings to obtain a corresponding prediction score, sort the prediction scores to obtain top-N items with the highest scores, generate a recommended item list, and recommend the recommended item list to the user.
[0022] Further, step S21, obtaining the historical interaction sequence of the user from the data set, specifically including: obtaining the historical interaction sequence of the user u∈U Where each x corresponds to an item v, v∈V, the user set U={u1, u2,..., u M}, the item set V={v1, v2,..., v N}, M represents the number of users, and N represents the number of items;
[0023] Step S22 specifically includes: constructing an initial user embedding and item embedding with embedding dimension d according to the user ID and the item ID, and constructing a user-item interaction matrix Y∈R M ×N , y uv =1 indicates that the user u has interacted with the item v, and y uv =0 indicates that the user u has not interacted with the item v;
[0024] Step S23, the graph convolution network includes a message propagation module and a layer information fusion module, and the formulas are as follows:
[0025] Message propagation module:
[0026] Layer information fusion module:
[0027] Wherein, represents the user embedding representation of the k+1 layer, represents the item embedding representation of the k+1 layer, represents the embedding representation of the user u who has interaction with the item v in the k layer, represents the embedding representation of the item v who has interaction with the user u in the k layer; N v , N u respectively represent the neighbor set of the item v and the user u, which are obtained from the interaction matrix Y; K represents the number of layers of the graph convolution network GCN, and a k is a learnable weight coefficient; represents the user embedding representation fused by all layers, which is the user embedding of the global interaction level.
[0028] Further, in step S24, the corresponding item attribute features are obtained from the data set based on the item id in the historical interaction sequence, including: converting each historical interaction sequence X = [x1, x2,..., x |X| ] into a sequence with a fixed length L, and if the length is greater than L, the sequence is cut, otherwise padding operation is performed on the left side of the sequence; each x in the historical interaction sequence represents an item id, and the corresponding item contains multiple attribute features, the attribute features of the corresponding item are obtained through x, and the multiple attribute features are spliced to form the item attribute feature T;
[0029] In step S24, after each item attribute feature is encoded and given position information, the attribute feature embedding of each item is obtained, which specifically includes:
[0030] (1) word embedding encoding, through a word embedding table Each word in the item attribute feature is represented by embedding, where V w is the number of words, and d is the dimension of embedding;
[0031] (2) word position encoding, each word is given position information, B ∈ R d ;
[0032] (3) item position information, position information is added to each item, through an embedding table C ∈ R L×d , wherein L represents the maximum length of the sequence, and d represents the dimension of embedding;
[0033] (4) a feature is represented as E w = LayerNorm(A w + B w + C w ), the attribute feature embedding of each item is E x = [E w1 , E w2 ,.., E wL ]; wherein, A w is the embedding representation of a word through a word vector table, B w is the embedding representation of a word position, C w is the embedding representation of an item position, LayerNorm represents standardization, E w is the final embedding representation of a word; E x represents the attribute feature embedding representation of an item x, E w1 represents the feature representation of the first word of a sentence composed of the attributes of the item x, E wL represents the feature representation of the Lth word of a sentence composed of the attributes of the item x, and L is the maximum number of words allowed in the sentence.
[0034] Further, in step S25, the attribute feature embedding of the item is input into a self-attention network to obtain an attribute feature conversion level user embedding representation, specifically including:
[0035] (1) the attribute feature embedding of the item is converted through a matrix, Q = EW Q , K = EW K , V = EW V , wherein, W Q , W K , W V ∈ R d×d are learnable parameters;
[0036] (2) dot product calculation obtains attention score, the specific calculation method is as follows:
[0037]
[0038] wherein, E is the embedding representation of each word, K T represents the transpose of K, softmax represents the softmax activation function, is a scaling factor, and d is the embedding dimension of K;
[0039] (3) through a feedforward neural network,
[0040] F = FFN(S) = ReLU(SW (1) + b 1 )W (2) + b2 ;
[0041] where ReLU denotes a ReLU activation function, W (1) , W (2) , b 1 , b 2 are learnable parameters in the neural network;
[0042] To learn more complex feature transformation, multiple self-attention operations are stacked, each of which is defined as:
[0043] S (b) = SA(F (b-1) )
[0044] F (b) = FFN(S (b) );
[0045] where SA() is a self-attention operation function, FFN() is a feedforward neural network, F (b-1) is the output of a b-1 layer feedforward neural network, F (b) is the output of a b layer feedforward neural network, S (b) is the output of a b layer self-attention operation;
[0046] The output of the self-attention network is an Lxd matrix, and the last column of the matrix is taken as the attribute feature transformation level user embedding representation learned by the sequence learning
[0047] Further, in step S26, the global interaction level user embedding representation and the attribute feature transformation level user embedding representation are input to a multi-layer perceptron to obtain a user embedding representation fused with global interaction and feature transformation, specifically including:
[0048] The global interaction level user embedding representation and the attribute feature transformation level user embedding representation are spliced, and then a linear layer is used to obtain a user embedding representation fused with global interaction and feature transformation e u , as follows:
[0049]
[0050] e u is an embedding with dimension d; MLP() is a multi-layer perceptron.
[0051] Further, in step S27, a time step t is randomly sampled, and the embedding representation e yThe target item embedding representation with noise is obtained by adding a random Gaussian white noise, and specifically includes:
[0052] An embedding representation e corresponding to the target item y is obtained y , and a Gaussian white noise noise is randomly generated , a time step t is randomly selected, and the range of the time step t is [1, n], where n is a hyperparameter; the time step t is taken as an index to obtain an embedding e corresponding to the time step t from the time step embedding table t ; and the target item embedding representation with noise is obtained through the following formula
[0053]
[0054] Wherein α t = 1-β t , β t is obtained through the difference table β = [β1, β2,..., β T ]; represents the initial embedding representation, i.e., the embedding representation e corresponding to the target item y y .
[0055] Further, in step S28, the fused global interaction and feature converted user embedding representation, the time step embedding, and the target embedding representation with noise are input into a denoising neural network to obtain a reconstructed user embedding representation, and the specific steps are as follows:
[0056] The fused global interaction and feature converted user embedding representation e u , the time step embedding e t , and the target embedding representation with noise are spliced and input into a denoising neural network f θ to obtain a reconstructed user embedding representation e' u , and the formula is as follows:
[0057]
[0058] Wherein, || is a splicing operation, and MLP() is a multi-layer perceptron.
[0059] Further, in step S29, the reconstructed user embedding representation and the embedding representation of the target item are used to calculate a mean square error loss The parameters of the denoising neural network and the embedding representations in the embedding table are updated through gradient descent to reduce the mean square error loss, so as to obtain a final updated reconstructed user embedding representation, and the specific steps include: the reconstructed user embedding representation e' uan embedding representation e of the target item y mean square error loss as follows:
[0060]
[0061] By means of gradient descent, the parameters θ of the denoising neural network are updated so that is reduced; L2 regularization loss is added to prevent overfitting; λ is a weight coefficient for controlling the size of L2 regularization loss.
[0062] Further, in step S3, the historical interaction sequence of the user to be recommended and the corresponding item attribute feature information are input into the trained sequence recommendation model based on the feature fusion and diffusion model to obtain a user embedding representation of the user to be recommended, including:
[0063] Based on the historical interaction sequence of the user to be recommended and the corresponding item attribute feature information, a user embedding representation fused with global interaction and feature conversion is extracted;
[0064] A Gaussian white noise noise is randomly generated, and n-step denoising operations are performed, taking t = [n, n-1,..., 1], and the embedding corresponding to t is e t ; the input of each step of denoising is the output of the previous step of denoising operation, e t and the obtained user embedding representation fused with global interaction and feature conversion e u , wherein the input of the first step of denoising operation is noise, and the process of each step of denoising operation is as follows:
[0065]
[0066] wherein, α t = 1-β t , β t is obtained through the difference table β = [β1, β2,..., β T ]; w is used to control the strength of the guide signal, thereby changing the reconstructed user embedding difference, Φ is an empty embedding with a dimension of d, used to fill the dimension; z is a randomly generated Gaussian white noise;
[0067] After t times of the above denoising operation, a user embedding representation after t times of denoising operation is obtained a reconstructed user embedding representation is finally obtained The finally obtained reconstructed user embedding representation is the user embedding representation of the user to be recommended.
[0068] The application further provides a sequence recommendation system based on a feature fusion and diffusion model, characterized in that the sequence recommendation system executes the sequence recommendation method based on the feature fusion and diffusion model, and comprises a sequence recommendation model construction module, a sequence recommendation model training module, a user embedding representation acquisition module and an item recommendation module.
[0069] The sequence recommendation model construction module constructs the sequence recommendation model based on the feature fusion and diffusion model.
[0070] The sequence recommendation model training module trains the sequence recommendation model based on the feature fusion and diffusion model by using the historical interaction sequences of users in a data set and corresponding item attribute feature information, and obtains the trained sequence recommendation model based on the feature fusion and diffusion model.
[0071] The user embedding representation acquisition module acquires the historical interaction sequences of a to-be-recommended user and corresponding item attribute feature information, and inputs the historical interaction sequences of the to-be-recommended user and the corresponding item attribute feature information into the trained sequence recommendation model based on the feature fusion and diffusion model to obtain user embedding representation of the to-be-recommended user.
[0072] The item recommendation module obtains corresponding prediction scores by calculating inner products of the user embedding representation of the to-be-recommended user and all candidate item embeddings, sorts the prediction scores, obtains top-N items with the highest scores, generates a recommended item list, and recommends the recommended item list to the user.
[0073] Compared with the prior art, the sequence recommendation method based on the feature fusion and diffusion model has the following beneficial effects:
[0074] 1. The sequence recommendation method based on the feature fusion and diffusion model obtains user embedding representation of a to-be-recommended user based on the trained sequence recommendation model based on the feature fusion and diffusion model, calculates inner products of the user embedding representation of the to-be-recommended user and all candidate item embeddings to obtain corresponding prediction scores, and recommends top-N items with the highest prediction scores to the user, thereby improving the accuracy of the sequence recommendation method and further improving user experience.
[0075] 2, The sequence recommendation method based on feature fusion and diffusion model, user embedding representation of global interaction level obtained by message propagation and layer information fusion operation of the graph convolution network and user embedding representation of feature conversion level obtained based on the self-attention network are input into the multilayer perceptron to obtain user embedding representation of fusion of global interaction and feature conversion, realize fusion of features, the user embedding representation of fusion of global interaction and feature conversion, time step embedding and the target embedding representation with noise are input into the denoising neural network to obtain reconstructed user embedding representation, the generated embedding is reconstructed using the diffusion model, the generalization ability of the model is improved, and therefore the accuracy of the recommendation method is improved. BRIEF DESCRIPTION OF DRAWINGS
[0076] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiment description. Obviously, the drawings in the following description are some embodiments of the present application, and other drawings can also be obtained by those skilled in the art without creative labor on the basis of these drawings.
[0077] Figure 1 The sequence recommendation method based on feature fusion and diffusion model provided by the embodiment of the present application.
[0078] Figure 2 The sequence recommendation model based on feature fusion and diffusion model provided by the embodiment of the present application.
[0079] Figure 3 The global interaction information extraction diagram provided by the embodiment of the present application.
[0080] Figure 4 The item feature encoding diagram provided by the embodiment of the present application.
[0081] Figure 5 The feature fusion diagram provided by the embodiment of the present application.
[0082] Figure 6 The diffusion model diagram provided by the embodiment of the present application.
[0083] Figure 7 The sequence recommendation system based on feature fusion and diffusion model provided by the embodiment of the present application. DETAILED DESCRIPTION
[0084] With reference to the drawings and specific embodiments, the present application will be further described below, but not as a limitation of the present application.
[0085] It should be understood that the terms "comprise" and "include" as used in the specification and the appended claims indicate the presence of the described features, integers, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.
[0086] The present application will be further described below with reference to the drawings and specific embodiments, but not as a limitation of the present application.
[0087] It should be understood that the terms used in the present application specification are only for the purpose of describing specific embodiments and are not intended to limit the present application. As used in the present application specification and the appended claims, the singular forms "a", "an" and "the" are intended to include the plural forms unless the context clearly indicates otherwise.
[0088] It should be further understood that the term "and / or" used in the present application specification and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes these combinations.
[0089] The present application proposes a sequence recommendation method based on feature fusion and diffusion model. As shown in Figure 1 The sequence recommendation method based on feature fusion and diffusion model includes the following steps S1 to S4.
[0090] S1, a sequence recommendation model based on feature fusion and diffusion model is constructed. The sequence recommendation model based on feature fusion and diffusion model is as shown in Figure 2
[0091] S2, the sequence recommendation model based on feature fusion and diffusion model is trained using the historical interaction sequence of the user in the data set and the corresponding item attribute feature information, to obtain the trained sequence recommendation model based on feature fusion and diffusion model; step S2 specifically includes the following:
[0092] Step S21, the historical interaction sequence of the user is obtained from the data set.
[0093] In an embodiment, step S21, the historical interaction sequence of the user is obtained from the data set, specifically including: obtaining the historical interaction sequence of the user u∈U Each x corresponds to a project v, v∈V, and the user set U={u1,u2,...,u M}, the item set V = {v1,v2,...,v N}, M represents the number of users, and N represents the number of items. The items can be commodities, books, movies, etc.
[0094] Step S22: Input the historical interaction sequence into the embedding layer to obtain the item embedding representation and the user embedding representation, and construct a user-item interaction matrix.
[0095] Furthermore, step S22 specifically includes: constructing an initial user embedding with an embedding dimension of d based on the user ID and the project ID and project embedding And construct the user-item interaction matrix Y∈R M×N ,y uv =1 means user u has interacted with item v, y uv =0 means user u has not interacted with item v.
[0096] In step S23, the project embedding representation, the user embedding representation, and the user-project interaction matrix are input into a graph convolutional network. After message propagation and layer information fusion operations of the graph convolutional network, a user embedding representation at the global interaction level is obtained.
[0097] In a specific embodiment, in step S23, the project is embedded into the representation E v , user embedding representation E u The interaction matrix of user-item Y is input into the graph convolutional network;
[0098] Furthermore, the graph convolutional network includes a message propagation module and a layer information fusion module, such as Figure 3 The specific calculation formula is as follows:
[0099] Message propagation module:
[0100] Layer information fusion module:
[0101] in, represents the user embedding representation of the k+1th layer, The k+1-layer item embedding representation represented by represents the embedding representation of user u who interacts with item v at the kth layer, N represents the embedding representation of the item v that has interacted with user u at the kth layer; v , N u They represent the neighbor sets of project v and user u, respectively, obtained from the interaction matrix Y; K represents the number of layers of the graph convolutional network GCN, αk learnable weight coefficients; represents the user embedding representation fused with all layers, which is the global interaction level user embedding.
[0102] In a specific embodiment, the GCN network adopts the network structure of LightGCN.
[0103] Step S24, based on the item id in the historical interaction sequence, the corresponding item attribute feature is obtained from the data set, and each item attribute feature is encoded and given position information to obtain the attribute feature embedding of each item.
[0104] Further, in step S24, based on the item id in the historical interaction sequence, the corresponding item attribute feature is obtained from the data set, including: converting each historical interaction sequence X=[x1, x2,..., x |X| ] into a fixed length L sequence, if the length is greater than L, it is cut, otherwise padding operation is performed on the left side of the sequence; each x in the historical interaction sequence represents an item id, the corresponding item contains multiple attribute features, the attribute features of the corresponding item are obtained through x, and the multiple attribute features are spliced to form the item attribute feature T.
[0105] Among them, the item attribute feature is, for example, the product name, category, description information, etc. in the commodity item.
[0106] The user interaction feature sequence can be represented as X=[T1, T2,..,T L ]. Where each T is a text sequence, the sequence format is {product name||category||description||...}, and || is a splicing operation.
[0107] In step S24, after encoding and giving position information to each item attribute feature, the attribute feature embedding of each item is obtained, which specifically includes:
[0108] (1) word embedding encoding, through the word embedding table Each word in the item attribute feature is represented by embedding, where V w is the number of words, and d is the dimension of the embedding;
[0109] (1) word position encoding, giving each word position information, B∈R d ;
[0110] The sentence is spliced by the item attribute, such as the attributes of a product: title, brand, category, description. The position of each word is the position in the sentence. If the sentence composed of item attributes is too long, it needs to be truncated, and if it is too short, it needs to be filled with empty embedding in front.
[0111] (3) item position information, adding position information for each item, embedding table C ∈ R L×d , where L represents the maximum length of the sequence, and d represents the dimension of the embedding;
[0112] (4) a feature representation is E w = LayerNorm(A w + B w + C w ), and the attribute feature embedding of each item is E x = [E w1 , E w2 , …, E wL ]; wherein, A w is the embedding representation of a word through a word vector table, B w is the word position embedding representation, C w is the item position embedding representation, LayerNorm represents standardization, and E w is the final embedding representation of a word; E x represents the attribute feature embedding representation of item x, E w1 represents the feature representation of the first word of the sentence composed of the attributes of item x, E wL represents the feature representation of the Lth word of the sentence composed of the attributes of item x, and L is the maximum number of words allowed in the sentence.
[0113] wherein, the word position encoding is used to represent the position of each word in the sequence; and the item position information is used to represent the order relationship of the items.
[0114] The item feature encoding diagram is shown in Figure 4 .
[0115] Step S25, input the attribute feature embedding of the item into a self-attention network to obtain an attribute feature conversion level user embedding representation.
[0116] Step S25, input the attribute feature embedding of the item into a self-attention network to obtain an attribute feature conversion level user embedding representation, specifically including:
[0117] (1) converting the attribute feature embedding of the item through a matrix, Q = EW Q , K = EW K , and V = EW V , wherein, W Q , W K , and W V ∈ R d×d are learnable parameters;
[0118] (2) dot product calculation to obtain attention scores, specifically calculated as follows:
[0119]
[0120] where E is the embedding representation of each word, K T denotes the transpose of K, softmax denotes the softmax activation function, is a scaling factor, and d is the embedding dimension of K.
[0121] (3) passing through a feed-forward neural network,
[0122] F = FFN(S) = ReLU(SW (1) + b 1 )W (2) + b 2 ;
[0123] where ReLU denotes the ReLU activation function, W (1) , W (2) , b 1 , b 2 are learnable parameters in the neural network.
[0124] To learn more complex feature transformations, multiple self-attention operations are stacked, each of which is defined as:
[0125] S(b) = SA(F (b-1) )
[0126] F (b) = FFN(S (b) ).
[0127] where SA() is a self-attention operation function, FFN() is a feed-forward neural network, F (b-1) is the output of the b-1 layer feed-forward neural network, F (b) is the output of the b layer feed-forward neural network, S (b) is the output of the b layer self-attention operation.
[0128] The output of the self-attention network is an Lxd matrix, and the last column of the matrix is taken as the attribute feature transformation level user embedding representation learned by the sequence learning
[0129] Step S26, input the global interaction level user embedding representation and the attribute feature transformation level user embedding representation into a multi-layer perceptron to obtain a user embedding representation fused with global interaction and feature transformation.
[0130] Step S26, input the global interaction level user embedding representation and the attribute feature transformation level user embedding representation into a multi-layer perceptron to obtain a user embedding representation fused with global interaction and feature transformation, specifically including:
[0131] the global interaction level user embedding representation and the attribute feature transformation level user embedding representation concatenated and passed through a linear layer to obtain a user embedding representation e that fuses global interaction and feature transformation u as shown in the following formula: Figure 5
[0132]
[0133] e u is an embedding with dimension d; MLP() is a multi-layer perceptron.
[0134] In step S27, a time step t is randomly sampled, and the embedding representation of the target item is added to the randomly obtained Gaussian white noise noise at the time step t according to the corresponding proportion to obtain a target item embedding representation with noise.
[0135] In an embodiment, in step S27, a time step t is randomly sampled, and the embedding representation e y of the target item is added to the randomly obtained Gaussian white noise noise at the time step t according to the corresponding proportion to obtain a target item embedding representation with noise, specifically comprising:
[0136] obtaining the embedding representation e y corresponding to the target item y, and letting a Gaussian white noise noise is randomly generated, a time step t is randomly selected, the range of the time step t is [1, n], where n is a hyperparameter, and is usually set to 1000; the time step t is taken as an index to obtain the embedding e t corresponding to the time step t from the time step embedding table; and the target item embedding representation with noise is obtained through the following formula
[0137]
[0138] wherein α t = 1 - β t , β t is obtained through the difference table β = [β1, β2,..., β T ]; represents the initial embedding representation, i.e., the embedding representation e y corresponding to the target item y.
[0139] The specific diffusion model is shown in the following formula. Figure 6
[0140] Step S28, input the fusion global interaction and feature converted user embedding representation, time step embedding and the target embedding representation with noise into a denoising neural network to obtain a reconstructed user embedding representation.
[0141] In an embodiment, step S28, input the fusion global interaction and feature converted user embedding representation, time step embedding and the target embedding representation with noise into a denoising neural network to obtain a reconstructed user embedding representation, and the specific steps are as follows:
[0142] The fusion global interaction and feature converted user embedding representation e u , time step embedding e t and the target embedding representation with noise are spliced and input into a denoising neural network f θ to obtain a reconstructed user embedding representation e' u , and the formula is as follows:
[0143]
[0144] Wherein, || is a splicing operation, and MLP() is a multi-layer perceptron.
[0145] Step S29, calculate the mean square error loss between the reconstructed user embedding representation and the embedding representation of the target item Update the parameters of the denoising neural network and the embedding representation in the embedding table by gradient descent to reduce the mean square error loss, so as to obtain the final updated reconstructed user embedding representation.
[0146] In an embodiment, step S29, calculate the mean square error loss between the reconstructed user embedding representation and the embedding representation of the target item Update the parameters of the denoising neural network and the embedding representation in the embedding table by gradient descent to reduce the mean square error loss, so as to obtain the final updated reconstructed user embedding representation, and the specific steps include: calculating the mean square error loss between the reconstructed user embedding representation e' u and the embedding representation e y of the target item as follows:
[0147]
[0148] Update the parameters θ of the denoising neural network by gradient descent, so that is reduced; in order to prevent overfitting, an L2 regular loss is added; λ is a weight coefficient for controlling the size of the L2 regular loss.
[0149] S3, obtain the historical interaction sequence of the user to be recommended and the corresponding item attribute feature information, and input the historical interaction sequence of the user to be recommended and the corresponding item attribute feature information into the trained sequence recommendation model based on the feature fusion and diffusion model to obtain a user embedding representation of the user to be recommended.
[0150] Step S3, input the historical interaction sequence of the user to be recommended and the corresponding item attribute feature information into the trained sequence recommendation model based on the feature fusion and diffusion model to obtain a user embedding representation of the user to be recommended, comprising:
[0151] Based on the historical interaction sequence of the user to be recommended and the corresponding item attribute feature information, extract a user embedding representation fused with global interaction and feature conversion;
[0152] Randomly generate a Gaussian white noise noise, let Perform n-step denoising operations, take t = [n, n-1,..., 1], and the embedding corresponding to t is e t ; the input of each step of denoising is the output of the previous step of denoising operation, e t and the obtained user embedding representation fused with global interaction and feature conversion e u , wherein the input of the first step of denoising operation is noise, and the process of each step of denoising operation is as follows:
[0153]
[0154] wherein, α t = 1 - β t , β t is obtained through the difference table β = [β1, β2,..., β T ]; w is used to control the strength of the guide signal, so as to change the reconstructed user embedding difference, φ is an empty embedding with a dimension of d, used to fill the dimension; z is a randomly generated Gaussian white noise;
[0155] After t times of the above denoising operation, the user embedding representation after t times of denoising operation is obtained Finally, a reconstructed user embedding representation is obtained The finally obtained reconstructed user embedding representation is the user embedding representation of the user to be recommended.
[0156] S4, based on the inner product of the user embedding representation of the user to be recommended and all candidate item embeddings, obtain a corresponding prediction score, sort the prediction score, obtain top-N items with the highest score, generate a recommended item list, and recommend the recommended item list to the user.
[0157] The calculation formula of the prediction score is as follows:
[0158] f(u, i) = argmax i∈I (e' u · e i )
[0159] where I denotes a set of candidate items, e i is the candidate item embedding, e' u is the final reconstructed user embedding representation, i.e., the user embedding representation of the user to be recommended.
[0160] Figure 7 is a sequence recommendation system based on a feature fusion and diffusion model provided by an embodiment of the present application. As shown in the figure, the sequence recommendation system based on the feature fusion and diffusion model comprises a sequence recommendation model construction module, a sequence recommendation model training module, a user embedding representation acquisition module, and an item recommendation module. Figure 7
[0161] The sequence recommendation model construction module constructs a sequence recommendation model based on a feature fusion and diffusion model.
[0162] The sequence recommendation model training module trains the sequence recommendation model based on the feature fusion and diffusion model by using the historical interaction sequences of users in a data set and the corresponding item attribute feature information, to obtain a trained sequence recommendation model based on the feature fusion and diffusion model.
[0163] The user embedding representation acquisition module acquires the historical interaction sequence of a user to be recommended and the corresponding item attribute feature information, and inputs the historical interaction sequence of the user to be recommended and the corresponding item attribute feature information into the trained sequence recommendation model based on the feature fusion and diffusion model, to obtain a user embedding representation of the user to be recommended.
[0164] The item recommendation module obtains a corresponding prediction score by calculating the inner product of the user embedding representation of the user to be recommended and all candidate item embeddings, sorts the prediction scores, obtains top-N items with the highest scores, generates a recommended item list, and recommends the recommended item list to the user.
[0165] The application provides a sequence recommendation method and system based on feature fusion and diffusion model, which focuses on the establishment of global interaction relationship, the extraction of feature sequence and the realization of diffusion model reconstruction mechanism. For the interaction relationship between items, graph convolution can be used to learn the interaction relationship between items and aggregate them together. For the conversion between features, attention mechanism can extract important features in the sequence and realize the extraction of information in the feature sequence. In addition, the diffusion model has strong generalization ability, so using the diffusion model to reconstruct the generated embedding can improve the generalization ability of the model and thus improve the accuracy of recommendation.
[0166] The sequence recommendation system based on feature fusion and diffusion model can be implemented in the form of a computer program, which can run on a computer device.
[0167] The computer device can be a server, which can be a standalone server or a server cluster composed of multiple servers.
[0168] The computer device includes a processor, a memory and a network interface connected by a system bus, wherein the memory can include a non-volatile storage medium and an internal memory.
[0169] The non-volatile storage medium can store an operating system and a computer program. The computer program includes program instructions which, when executed, can cause the processor to perform a sequence recommendation method based on feature fusion and diffusion model.
[0170] The processor is used to provide computing and control capabilities to support the operation of the entire computer device.
[0171] The internal memory provides an environment for the running of the computer program in the non-volatile storage medium, which, when executed by the processor, can cause the processor to perform a sequence recommendation method based on feature fusion and diffusion model.
[0172] The network interface is used for network communication with other devices. Those skilled in the art can understand that the above computer device structure is only part of the structure related to the scheme of the present application, and does not constitute a limitation on the computer device to which the scheme of the present application is applied. The specific computer device can include more or fewer components than those shown in the figure, or combine certain components, or have a different component arrangement.
[0173] The processor is used to run the computer program stored in the memory, which realizes the sequence recommendation method based on feature fusion and diffusion model as described in embodiment one.
[0174] It should be understood that, in the embodiments of the present application, the processor can be a central processing unit (CPU), and the processor can also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, and the like. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor.
[0175] It can be understood by those skilled in the art that all or part of the processes in the above-mentioned embodiments can be completed by a computer program instructing related hardware. The computer program includes program instructions, and the computer program can be stored in a storage medium, which is a computer-readable storage medium. The program instructions are executed by at least one processor in the computer system to implement the process steps of the above-mentioned embodiments.
[0176] The present application also provides a storage medium. The storage medium can be a computer-readable storage medium. The storage medium stores a computer program, wherein the computer program is executed by a processor to make the processor execute the sequence recommendation method based on the feature fusion and diffusion model according to Embodiment 1.
[0177] The storage medium can be a U disk, a mobile hard disk, a read-only memory (ROM), a magnetic disk or an optical disk, and various computer-readable storage media that can store program codes.
[0178] It can be understood by those skilled in the art that the units and algorithm steps of the examples described in combination with the embodiments disclosed herein can be realized by electronic hardware, computer software or a combination of both. In order to clearly illustrate the interchangeability of hardware and software, the components and steps of the examples have been described in the above description in general terms. Whether the functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. A person skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.
[0179] In several embodiments provided by the present application, it should be understood that the disclosed apparatus and method can be implemented in other manners. For example, the described apparatus embodiments are merely schematic. For example, the division of the units is merely a logical function division. For example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In this way, the inventive idea can be implemented.
[0180] The steps in the method embodiments of the present application can be adjusted, combined and deleted in sequence according to actual needs. The units in the apparatus embodiments of the present application can be combined, divided and deleted according to actual needs. In addition, each functional unit in each embodiment of the present application can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit.
[0181] The integrated unit, if realized in the form of a software functional unit and sold or used as an independent product, can be stored in a storage medium. Based on such understanding, the technical solutions of the present application essentially or the part that contributes to the prior art, or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, and includes a plurality of instructions for causing a computer device (which can be a personal computer, a terminal, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application.
[0182] Note that the above are merely preferred embodiments of the present application and the technical principles applied. Those skilled in the art will understand that the present application is not limited to the specific embodiments described herein, and those skilled in the art can make various obvious changes, re-adjustments and substitutions without departing from the scope of the present application. Therefore, although the present application has been described in more detail through the above embodiments, the present application is not limited to the above embodiments, and can include more other equivalent embodiments without departing from the concept of the present application, and the scope of the present application is determined by the scope of the appended claims.
Claims
1. A sequence recommendation method based on feature fusion and diffusion model, characterized in that: Including steps: S1. Build a sequence recommendation model based on feature fusion and diffusion model; S2. Using the historical interaction sequences of users in the data set and the corresponding item attribute feature information, the sequence recommendation model based on the feature fusion and diffusion model is trained to obtain a trained sequence recommendation model based on the feature fusion and diffusion model. Step S2 specifically includes the following: Step S21, obtaining the user's historical interaction sequence from the data set; Step S22: Input the historical interaction sequence into the embedding layer to obtain item embedding representation and user embedding representation, and construct a user-item interaction matrix; Step S23: Input the item embedding representation, user embedding representation, and user-item interaction matrix into a graph convolutional network. After message propagation and layer information fusion operations of the graph convolutional network, a user embedding representation at the global interaction level is obtained. Step S24: obtaining corresponding item attribute features from the data set based on the item ID in the historical interaction sequence, encoding each item attribute feature and assigning position information to obtain an attribute feature embedding for each item; Step S25, embedding the attribute features of the project into a self-attention network to obtain a user embedding representation at the attribute feature conversion level; Step S26, inputting the user embedding representation at the global interaction level and the user embedding representation at the attribute feature conversion level into a multi-layer perceptron to obtain a user embedding representation that integrates global interaction and feature conversion; Step S27: randomly sample a time step t, and add the embedding representation of the target item to the randomly obtained Gaussian white noise according to the corresponding ratio at time step t to obtain the embedding representation of the target item with noise; Step S28, inputting the user embedding representation fused with global interaction and feature conversion, the time step embedding, and the target embedding representation with noise into a denoising neural network to obtain a reconstructed user embedding representation; Step S29: calculate the mean square error loss between the reconstructed user embedding representation and the target item embedding representation Update the parameters of the denoising neural network and the embedding representation in the embedding table by gradient descent to reduce the mean square error loss and obtain the final updated reconstructed user embedding representation; S3. Obtain the historical interaction sequence and corresponding item attribute feature information of the user to be recommended, and input the historical interaction sequence and corresponding item attribute feature information of the user to be recommended into the trained sequence recommendation model based on feature fusion and diffusion model to obtain the user embedding representation of the user to be recommended; S4. Calculate the inner product of the user embedding representation of the user to be recommended and the embeddings of all candidate items to obtain corresponding prediction scores, sort the prediction scores to obtain the top-N items with the highest scores, generate a recommended item list, and recommend the recommended item list to the user.
2. The method according to claim 1, characterized in that Step S21, obtaining the user's historical interaction sequence from the data set, specifically including: obtaining the historical interaction sequence of user u∈U Where each x corresponds to a project v, v∈V, and the user set U={u1,u2,...,u M }, item set V = {v1, v2, ..., v N }, M represents the number of users, N represents the number of projects; Step S22 specifically includes: constructing an initial user embedding with an embedding dimension of d based on the user ID and the project ID and project embedding And construct the user-item interaction matrix Y∈R M ×N ,y uv =1 means user u has interacted with item v, y uv =0 means user u has not interacted with item v; In step S23, the graph convolutional network includes a message propagation module and a layer information fusion module, and the formula is as follows: Message propagation module: Layer information fusion module: in, represents the user embedding representation of the k+1th layer, The k+1-layer item embedding representation represented by represents the embedding representation of user u who interacts with item v at the kth layer, N represents the embedding representation of item v that interacts with user u at the kth layer; v , N u They represent the neighbor sets of project v and user u, respectively, obtained from the interaction matrix Y; K represents the number of layers of the graph convolutional network GCN, α k is the learnable weight coefficient; It represents the user embedding representation of all layers fused together, which is the user embedding at the global interaction level.
3. The method according to claim 1, characterized in that Step S24, based on the item ID in the historical interaction sequence, obtain the corresponding item attribute features from the data set, including: each historical interaction sequence X = [x1, x2, .., x |X| ] is converted into a sequence of fixed length L. If the length is greater than L, it is cropped, otherwise padding is performed on the left side of the sequence. Each x in the historical interaction sequence represents a project id, and its corresponding project contains multiple attribute features. The attribute features of the corresponding project are obtained through x, and multiple attribute features are spliced to form the project attribute feature T. In step S24, each item attribute feature is encoded and assigned location information to obtain the attribute feature embedding of each item, which specifically includes: (1) Word embedding encoding, through word embedding table Each word in the item attribute feature is represented by an embedding, where V w is the number of words, d is the dimension of embedding; (2) Word position encoding, giving each word position information, B∈R d ; (3) Item location information: add location information for each item by embedding table C∈R L×d , where L represents the maximum length of the sequence and d represents the dimension of the embedding; (4) A feature is represented as E w =LayerNorm(A w +B w +C w ), the attribute features of each item are embedded as E x =[E w1 , E w2 ,...,E wL ]; among them, A w is the word embedding representation through the word vector table, B w is the word position embedding representation, C w is the item position embedding representation, LayerNorm represents normalization, E w is the final embedding representation of the word; E x Represents the attribute feature embedding representation of item x, E w1 The feature representation of the first word of the sentence consisting of the attributes of item x, E wL Represents the feature representation of the Lth word in the sentence consisting of the attributes of item x, where L is the maximum number of words allowed in the sentence.
4. The method according to claim 1, wherein Step S25, embedding the attribute features of the project into the self-attention network to obtain the user embedding representation at the attribute feature conversion level, specifically including: (1) The attribute features of the project are embedded and transformed through the matrix, Q = EW Q ,K=EW K ,V=EW V , where W Q , W K , W V ∈R d×d is a learnable parameter; (2) Dot product calculation is used to obtain the attention score. The specific calculation method is as follows: Among them, E is the embedding representation of each word, K T represents the transpose of K, softmax represents the softmax activation function, is the scaling factor, d is the embedding dimension of K; (3) Through the feedforward neural network, F=FFN(S)=ReLU(SW (1) + b 1 )W (2) + b 2 ; Among them, ReLU represents the ReLU activation function, W (1) 、W (2) 、b 1 、b 2 is a learnable parameter in the neural network; To learn more complex feature transformations, multiple self-attention operations are stacked, and each self-attention operation is defined as: S (b) =SA(F (b-1) ) F (b) =FFN(S (b) ); Among them, SA() is the self-attention operation function, FFN() is the feedforward neural network, F (b-1) is the output of the b-1 layer feedforward neural network, F (b) is the output of the b-th layer feedforward neural network, S (b) is the output of the self-attention operation of layer b; The output of the self-attention network is an L×d matrix, and the last column of the matrix is taken as the user embedding representation of the attribute feature conversion level learned by the feature sequence 5. The method according to claim 1, wherein Step S26, inputting the user embedding representation at the global interaction level and the user embedding representation at the attribute feature conversion level into a multi-layer perceptron to obtain a user embedding representation that integrates global interaction and feature conversion, specifically includes: The user embedding representation of the global interaction level and the user embedding representation at the attribute feature conversion level Then, the user embedding representation e is obtained by concatenating global interactions and feature transformations through a linear layer. u , as shown below: e u is an embedding of dimension d; MLP() is a multi-layer perceptron.
6. The method according to claim 1, characterized in that Step S27: randomly sample a time step t, and embed the target item into the representation e according to the corresponding ratio through the time step t. y Add the randomly obtained Gaussian white noise to obtain the target item embedding representation with noise, including: Get the embedding representation e corresponding to the target item y y ,make And randomly generate a Gaussian white noise noise, randomly select a time step t, the range of time step t is [1, n], where n is a hyperparameter; use time step t as the index from the time step embedding table to obtain the embedding e corresponding to time step t t ; And the target item embedding representation with noise is obtained by the following formula in α t =1-β t , β t By using the difference table β = [β1, β2, ..., β T ]get; Represents the initial embedding representation, that is, the embedding representation e corresponding to the target item y y .
7. The method according to claim 1, characterized in that Step S28: Input the user embedding representation fused with global interaction and feature conversion, the time step embedding, and the target embedding representation with noise into a denoising neural network to obtain a reconstructed user embedding representation. The specific steps are as follows: The user embedding representation of the fusion of global interaction and feature transformation is e u , time step embedding e t And the target embedding representation with noise After splicing, input into the denoising neural network f θ Get the reconstructed user embedding representation e′ u , the formula is as follows: Among them, || is a concatenation operation, and MLP() is a multi-layer perceptron.
8. The method according to claim 1, characterized in that Step S29: calculate the mean square error loss between the reconstructed user embedding representation and the target item embedding representation Update the parameters of the denoising neural network and the embedding representation in the embedding table by gradient descent to reduce the mean square error loss to obtain the final updated reconstructed user embedding representation, specifically including: u with the embedding representation of the target item e y Calculate the mean square error loss As shown below: By gradient descent, the parameters θ of the denoising neural network are updated so that Reduce; In order to prevent overfitting, L2 regularization loss needs to be added; λ is the weight coefficient used to control the size of L2 regularization loss.
9. The method according to claim 1, characterized in that Step S3, inputting the historical interaction sequence of the user to be recommended and the corresponding item attribute feature information into the trained sequence recommendation model based on feature fusion and diffusion model to obtain the user embedding representation of the user to be recommended, including: Extracting a user embedding representation that integrates global interaction and feature transformation based on the historical interaction sequence of the user to be recommended and the corresponding item attribute feature information; Randomly generate a Gaussian white noise, let Perform n-step denoising operation, take t = [n, n-1, ..., 1], the embedding corresponding to t is e t ; The input of each denoising step is the output of the previous denoising operation, e t and the obtained user embedding representation e that fuses global interaction and feature transformation u , where the input of the first denoising operation is noise, and the process of each denoising operation is as follows: in, α t =1-β t , β t By using the difference table β = [β1, β2, ..., β T ] is obtained; w is used to control the strength of the guidance signal, thereby changing the difference in user embedding after reconstruction, Φ is an empty embedding with dimension d, used to fill the dimension; z is a randomly generated Gaussian white noise; After t times of the above denoising operation, the user embedding representation after t times of denoising operation is obtained Finally, the reconstructed user embedding representation is obtained The reconstructed user embedding representation finally obtained is the user embedding representation of the user to be recommended.
10. A sequence recommendation system based on feature fusion and diffusion model, characterized in that: The sequential recommendation system executes the sequential recommendation method based on the feature fusion and diffusion model according to any one of claims 1 to 9, comprising: a sequential recommendation model construction module, a sequential recommendation model training module, a user embedding representation acquisition module, and an item recommendation module; Sequential recommendation model construction module, which builds a sequential recommendation model based on feature fusion and diffusion model; A sequence recommendation model training module, which trains the sequence recommendation model based on the feature fusion and diffusion model using the historical interaction sequences of users and the corresponding item attribute feature information in the data set, and obtains a trained sequence recommendation model based on the feature fusion and diffusion model; A user embedding representation acquisition module obtains the historical interaction sequence of the user to be recommended and the corresponding item attribute feature information, and inputs the historical interaction sequence of the user to be recommended and the corresponding item attribute feature information into the trained sequence recommendation model based on feature fusion and diffusion model to obtain the user embedding representation of the user to be recommended; The project recommendation module calculates the inner product of the user embedding representation of the user to be recommended and the embeddings of all candidate projects to obtain the corresponding prediction score, sorts the prediction scores, obtains the top-N projects with the highest scores, generates a recommended project list, and recommends the recommended project list to the user.
Citation Information
Patent Citations
Knowledge graph convolutional network-based model hybrid recommendation method
CN112417313A
Self-attention sequence recommendation method, system and equipment fusing time information
CN115249175A