Recommendation method based on neighborhood interest perception and attention mechanism

By introducing methods based on neighborhood interest perception and attention mechanisms into the recommendation system, and using graph neural networks and attention modules, we solve the problem of difficulty predicting changes in users' interests in the future, achieve more accurate and diverse recommendation results, and improve the overall effectiveness of the system.

CN118568337APending Publication Date: 2024-08-30HANGZHOU DIANZI UNIV
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410520456.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-04-28
Publication Date
2024-08-30

AI Technical Summary

Technical Problem

It is difficult for existing recommendation systems to accurately predict future changes in users' interests, resulting in single recommendation results and a lack of novel items, which affects the effectiveness of the system.

Method used

Adopting a recommendation method based on neighborhood interest awareness and attention mechanism, extracting user interest features through a graph neural network integrating attention mechanism, combining the neighborhood interest awareness module and attention module to mine the interest trends of similar users and dynamically adjust user interests Weight to improve recommendation diversity and accuracy.

Benefits of technology

It improves the accuracy and diversity of recommendation results, enhances the modeling ability of user interests, and improves the robustness of the recommendation model and the prediction ability of new interests.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118568337A
    Figure CN118568337A
Patent Text Reader

Abstract

The invention discloses a recommendation method based on neighborhood interest perception and an attention mechanism. The method comprises the following steps: firstly, carrying out user interaction sequence directed graph representation; obtaining user interest features through a graph neural network fused with an attention mechanism; acquiring a neighborhood interest trend through a neighborhood interest perception module; fusing the plurality of interest trends through a neighborhood attention module to obtain a neighborhood interest feature vector; adaptively fusing the user interest features and the neighborhood interest features to obtain a final interest feature vector of the user; probability scores are calculated according to the final interest feature vectors of the users, then descending sorting is carried out according to the interaction probability scores, and articles corresponding to the first N probability scores are recommended. According to the method, interest features of neighbor users are extracted through the neighborhood interest perception module, the interest features serve as new interest trends possibly generated by the users in the future, the neighborhood interest perception module excavates interest preferences of similar users, the diversity of recommendation results is improved, and multi-interest recommendation is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of recommendation systems, and in particular relates to a recommendation method based on neighborhood interest perception and attention mechanism. Background Art

[0002] With the vigorous development of Internet technology, recommendation systems have been widely used in some social media software and have achieved good results. Recommendation systems mainly analyze and calculate users' historical behaviors to capture users' interest preferences and predict the items that users may be interested in next. Therefore, how to model users' historical behaviors is crucial to the recommendation results of the system. However, users' interests are not static, but change dynamically over time, and new interests and preferences may emerge in the process. Therefore, modeling based solely on the user's own historical behavior may not accurately predict the user's new interests in the future, resulting in the recommendation system generating a too single type of product sequence, losing the ability to introduce or supplement novel items to the recommendation system, and ultimately affecting the overall effectiveness of the recommendation system.

[0003] To address the above problems, the present invention proposes a recommendation method based on neighborhood interest perception and attention mechanism to predict users' potential future interests and improve the diversity of recommendation results. Summary of the invention

[0004] In view of the problems existing in existing recommendation algorithms, this paper proposes a recommendation method based on neighborhood interest perception and attention mechanism. This method first extracts the user's interest preferences through a graph neural network integrated with an attention mechanism, then searches for other users with similar behaviors to the user through a neighborhood interest perception module, and extracts neighborhood interest features as new interests that the user may have in the future. Then, the neighborhood interests are integrated through the neighborhood attention module and finally recommended through the rating prediction module.

[0005] In order to solve the problems of the prior art, the technical solution of the present invention is as follows:

[0006] In a first aspect, the present invention provides a recommendation method based on neighborhood interest perception and attention mechanism, which specifically comprises the following steps:

[0007] Step (1): Directed graph representation of user interaction sequence;

[0008] Step (2): obtaining user interest features through a graph neural network that integrates an attention mechanism, wherein the graph neural network that integrates an attention mechanism includes an embedding layer, an interest extraction layer, and an interest aggregation layer, wherein the embedding layer obtains an embedded representation of an item through a graph neural network, the interest extraction layer obtains the user's multi-dimensional interest features through a multi-head attention mechanism, and the interest aggregation layer obtains the user's interest features by integrating multiple interest features;

[0009] Step (3): Obtaining neighborhood interest trends through a neighborhood interest perception module; specifically including the following steps:

[0010] Step (3.1): Implicit neighbor search;

[0011] By calculating the similarity between users, sorting them in descending order according to the similarity, and taking the first Z users to form the implicit neighbor set of the target user;

[0012] Step (3.2): Construct a new future sequence;

[0013] Sort the interactive items of implicit neighbors in the order of interaction time, construct a new sequence for the future, and represent the future new sequence with a directed graph of user interaction sequence;

[0014] Step (3.3): Obtain the embedding representation of items in future new sequences through graph neural networks;

[0015] Step (3.4): The interest perception layer mines multiple neighborhood interest trends of implicit neighbors through capsule networks;

[0016] Step (4): fuse multiple neighborhood interest trends through the neighborhood attention module to obtain neighborhood interest features;

[0017] Step (5): Adaptively fuse the user interest features and neighborhood interest features through a gating mechanism to obtain the user's final interest feature vector;

[0018] Step (6): Calculate the probability score based on the user's final interest feature vector, then sort in descending order according to the interaction probability score, and take the items corresponding to the top N probability scores for recommendation.

[0019] In a second aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to execute the method described.

[0020] In a third aspect, the present invention provides a computing device, comprising a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the described method is implemented.

[0021] Compared with the prior art, the present invention has the following advantages:

[0022] (1) High accuracy. The graph neural network integrated with the attention mechanism mines the user's interest characteristics from multiple dimensions and deeply explores the dynamic changes of interests during user interaction, thereby enhancing the modeling ability of user interests and improving the accuracy of recommendation results.

[0023] (2) Improve the diversity of recommendation results. The present invention extracts the interest characteristics of neighbor users through the neighborhood interest perception module, which is used as the new interest trend that the user may have in the future. The neighborhood interest perception module improves the diversity of recommendation results by mining the interest preferences of similar users and realizes multi-interest recommendations.

[0024] (3) High robustness. The present invention calculates the user's attention weights for each interest trend through the neighborhood attention module, thereby enhancing the modeling capability of neighborhood interests. Secondly, through the gating mechanism, the user's interest features and neighborhood interest features are adaptively integrated, so that the model can dynamically adjust the user's interest weights in the formal environment, effectively improving the robustness of the recommendation model. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] Figure 1 A flow chart is provided for the recommendation method based on neighborhood interest perception and attention mechanism in the present invention.

[0026] Figure 2 A schematic representation of a user sequence diagram.

[0027] Figure 3 This is a framework diagram of a graph neural network that integrates an attention mechanism.

[0028] Figure 4 This is the overall flow chart of the neighborhood interest perception module.

[0029] Figure 5 This is a comparison chart of Diversity@50 in different data sets of the present invention.

[0030] Figure 6 It is a heat map of the coupling coefficient between each interest trend and item. DETAILED DESCRIPTION

[0031] The following will further introduce a recommendation method based on neighborhood interest perception and attention mechanism provided by the present invention in conjunction with the accompanying drawings.

[0032] See also Figure 1 The flowchart of the recommendation method based on neighborhood interest perception and attention mechanism in the present invention is organized. Specifically, it includes the following steps:

[0033] Step (1): User sequence diagram representation, see Figure 2 , specifically including the following steps:

[0034] Step (1.1): Obtain user interaction sequence data. The user interaction sequence specifically includes user ID, item ID, item type, item rating, and user interaction timestamp.

[0035] Step (1.2): Construct a user sequence directed graph.

[0036] The user sequence directed graph includes the item directed graph G(v,ε).

[0037] The item directed graph G(v,ε) is constructed by the time sequence of items interacted by users, where v represents the set of item nodes in the user sequence, and ε represents the item node-item node edge. That is, if item v in the sequence k-1 ,v k are in adjacent positions, then there exists an edge (v k-1 ,v k )∈ε.

[0038] Step (1.3): Construct the adjacency matrix.

[0039] The adjacency matrix M of the item directed graph is composed of its out-degree matrix and the in-degree matrix Composition, where M out , M in Each element in is normalized separately, and the specific formula of the adjacency matrix is ​​as follows:

[0040] M=[M out ,M in ] (1)

[0041] Step (2): Obtain user interest features through a graph neural network with an attention mechanism, see Figure 3 The graph neural network integrating the attention mechanism includes an embedding layer, an interest extraction layer, and an interest aggregation layer. The specific steps are as follows:

[0042] Step (2.1): The embedding layer obtains the embedded representation p of the item through the graph neural network k , the calculation formula of the graph neural network is as follows:

[0043]

[0044]

[0045]

[0046]

[0047]

[0048] Formula (2) defines the process of node information propagation in the network, where represents the context information captured by node k from other nodes in the tth iteration. M represents the adjacency matrix, which is used to define the degree of connection between nodes. represents the kth row of the in-degree matrix, represents the kth row of the degree matrix, represents the embedding vector of node n generated in the t-1th iteration, H in ,H out The parameter matrices of the in-degree matrix and out-degree matrix, b in ,b out They represent the bias values ​​of the in-degree matrix and out-degree matrix respectively, and Concat() represents the concatenation operation. Formulas (3) and (4) define an update gate respectively. and a reset gate Where W z ,G z ,W l ,G l They represent the learnable parameter matrices in the iterative process. Formula (5) outputs the previous round of calculation of the node Current status information and the output of the reset gate Candidate states for node k Calculate, W e ,G e represents the parameter matrix. Formula (6) is based on the update gate The node's previous round of calculation output and candidate status The node information is calculated again, and finally the latest embedding vector of node k is obtained

[0049] Step (2.2): The interest extraction layer obtains the user's multi-dimensional interest features through a multi-head attention mechanism.

[0050] Specifically, for each node in the user sequence, the embedding representation P = [p1, p2, ..., p n ], the preference matrix calculated by the multi-head attention mechanism The calculation formula is as follows:

[0051]

[0052] in represents the parameter matrix for linear transformation, h represents the number of attention heads, d represents the embedding dimension, each attention head i Represents a potential interest feature of the user, and its calculation formula is as follows:

[0053]

[0054] Where W i Q , W i K , W i V represents the parameter matrix; Q, K, V represent the query matrix, key matrix and value matrix respectively;

[0055] Step (2.3): Multiple interest features are integrated through the interest aggregation layer to obtain user interest features. The specific calculation formula is as follows:

[0056]

[0057] Among them I u represents the user's fused interest features, express The corresponding parameter matrix, δ u represents the bias value, ReLU represents the activation function, and n represents the number of user interests.

[0058] Step (3): Obtain neighborhood interest trends through the neighborhood interest perception module, see Figure 4 , specifically including the following steps:

[0059] Step (3.1): Implicit neighbor search.

[0060] By calculating the similarity between users, the top Z users in similarity ranking are selected to form the implicit neighbor set of the target user.

[0061] The similarity is expressed by item_similarity(u i ,u k ), score similarity score_similarity(u i ,u k ) and category similarity category_similarity(u i ,u k ) is calculated, and the calculation formula is as follows:

[0062]

[0063] where u i ,u k They represent the i-th user and the k-th user respectively, and α, β, and γ represent the weight parameters of item similarity, rating similarity, and type similarity respectively.

[0064] The formula for calculating item similarity is as follows:

[0065]

[0066] in Represents user u i and user u k An interactive collection of items.

[0067] The score similarity calculation formula is as follows:

[0068]

[0069] in Represents user u i For items v j The rating value of Represents user u i The average rating of all interactive items. Represents user u k For items v j Rating value, Represents user u k The average score of all interactive items. Since the calculation result of formula (12) score_similarity(u i ,u k )∈[-1,1], this paper uses a mapping function f(x)=(1+x) / 2 to convert score_similarity(u i ,u k ) is mapped to the interval [0,1].

[0070] The type similarity calculation formula is as follows:

[0071]

[0072] in Represents user u i and user u k A collection of item types to interact with.

[0073] Step (3.2): Construct a new future sequence.

[0074] Sort the interactive items of implicit neighbors in the order of interaction time to construct a new future sequence. And perform a graph representation of the new future sequence according to steps 1.2 to 1.3;

[0075] Step (3.3): Obtain the embedding representation of the items in the future new sequence according to step 2.1.

[0076] Step (3.4): The interest perception layer mines multiple interest trends of implicit neighbors through capsule networks. First, embed r i As the first layer of capsules, and calculate ri Corresponding to trend j The prediction vector

[0077]

[0078] Formula (14) represents the i Perform a spatial transformation, which is to transform r i The space is mapped to The space where W ij Represents the parameter matrix. The final interest trend calculation process is as follows:

[0079]

[0080] Among them, trend j That is, the interest trend corresponding to the jth capsule, e j Represents the total input of the jth capsule, which is obtained by It is expressed as weighted sum, and the calculation formula is as follows

[0081]

[0082] where α ij represents the coupling coefficient, which is calculated by using the Softmax function, α ij The calculation process is as follows:

[0083]

[0084] where b ij represents the logarithmic prior probability of the i-th capsule being coupled to the j-th capsule, b ij The update process of is shown in formula (18):

[0085]

[0086] Step (4): Use the neighborhood attention module to fuse multiple interest trends and obtain neighborhood interest features. The specific formula is as follows:

[0087] θ i =ReLU(W tθ trend i +W eθ E u +b θ ) (19)

[0088] Among them, E u Represents the embedding vector of the original user u, which is used as the query vector to calculate each interest trend trend i The hidden representation θ i , Wtθ , W eθ They represent the parameter matrix, b θ Indicates the offset value.

[0089] Then, the Softmax function is used to calculate the trend of each interest. i The attention weight The specific calculation formula is as follows:

[0090]

[0091] Where m represents the number of interest trends, and the final neighborhood interest feature vector I n The calculation formula is as follows:

[0092]

[0093] Step (5): Adaptively fuse user interest features and neighborhood interest features through a gating mechanism. The specific calculation formula is as follows:

[0094] λ u =σ(W uλ I u +W nλ I n +b λ ) (twenty two)

[0095] where λ u represents the weight vector, W uλ , W nλ represents the parameter matrix, b λ represents the bias value, σ represents the Sigmoid activation function. Finally, I u , I n Adding different weights, the calculation formula of the user's final interest feature vector is shown in formula (4.23):

[0096]

[0097] Step (6): Rating prediction

[0098] For a given training sample set V, the system predicts the probability of the user interacting with the target item using the following formula:

[0099]

[0100] among them They represent the embedding representations of items i and j respectively; P(i|V) represents the recommendation probability of item i; V represents the item set.

[0101] Finally, all items are ranked in descending order according to the probability scores, and the items corresponding to the top N scores are used for recommendation.

[0102] Step (7): Model training.

[0103] In the model training process, a loss function is set to measure the difference between the model prediction value and the true value, and the loss function is continuously optimized to gradually adjust the model parameters to improve its fit to the training data. The loss function used in the present invention is as follows:

[0104] Loss=∑ i∈V -logP(i|V)+λ w ||W|| (25)

[0105] Where i∈V represents the samples in the training set. W represents all the parameters to be trained, λ w Represents the regularization parameter, which is used to prevent overfitting of the model.

[0106] The experiment uses the Pytorch framework to implement the method of the present invention. For the neural network model, the Dropout mechanism is used to randomly inactivate certain neurons to prevent the model from over-relying on specific neurons and improve the generalization ability of the model. The Dropout discard rate is set to 0.5, and the batch size is set to 128. The Adam optimizer is used to optimize the training, and the learning rate is set to 0.001. This embodiment conducts experiments on the Beauty, ML-1m, and Book data sets, and comprehensively compares the evaluation indicators such as HR@N and NDCG@N with the Youtube, MIND, ComiRec, and TimiRec algorithm models. The HR@N and NDCG@N comparison results of the models on each data set are shown in Tables 1 to 3. It can be seen from the experimental results that the present invention performs better than the other benchmark models on the three data sets. On the ML-1m data set, the hit rate HR@20 of the model reaches 0.5802, which is 3.15% higher than the suboptimal model, and the NDCG@20 reaches 0.2928, which is about 2.52% higher than the suboptimal model. At the same time, the model also performs well in the self-made dataset Book, with HR@20 improving by 3.71% and NDCG@20 improving by 2.48% compared to the second-best model. Figure 5 The Diversity@50 comparison results of each model in the three data sets are shown. The diversity comparison experiment further illustrates the effectiveness of the present invention in enriching the types of recommendation results.

[0107] Table 1 Comparison results of HR@N and NDCG@N of various models on the Beauty dataset

[0108]

[0109] Table 2 Comparison results of HR@N and NDCG@N of various models on the ML-1m dataset

[0110]

[0111] Table 3 Comparison results of HR@N and NDCG@N of various models on Book dataset

[0112]

[0113] See also Figure 6 This is a heat map of the coupling coefficients between various interest trends and items. Each row in the figure represents an interest trend, and each column represents items that the user continues to interact with after the target item. Each item has a coupling coefficient corresponding to the interest trend. The darker the color in the figure, the larger the coupling coefficient value. As can be seen from the figure, after interacting with the target item, the user interacted with four types of books: history, biography, science fiction, and science. These interactive items have relatively large coupling coefficients in the corresponding interest trends, which further illustrates that it is effective to obtain interest trends through the neighborhood interest perception module for recommendation. The neighborhood interest perception module can predict new interests that users may not have to a certain extent.

[0114] The above embodiments are only used to help understand the method and core idea of ​​the present invention. It should be noted that, for those skilled in the art, several improvements and modifications can be made to the present invention without departing from the principles of the present invention, and these improvements and modifications also fall within the scope of protection of the claims of the present invention.

[0115] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A recommendation method based on neighborhood interest perception and attention mechanism, characterized in that The following steps are involved: Step (1): Directed graph representation of user interaction sequence; Step (2): obtaining user interest features through a graph neural network that integrates an attention mechanism, wherein the graph neural network that integrates an attention mechanism includes an embedding layer, an interest extraction layer, and an interest aggregation layer, wherein the embedding layer obtains an embedded representation of an item through a graph neural network, the interest extraction layer obtains the user's multi-dimensional interest features through a multi-head attention mechanism, and the interest aggregation layer obtains the user's interest features by integrating multiple interest features; Step (3): Obtaining neighborhood interest trends through a neighborhood interest perception module; specifically including the following steps: Step (3.1): Implicit neighbor search; By calculating the similarity between users, sorting them in descending order according to the similarity, and taking the first Z users to form the implicit neighbor set of the target user; Step (3.2): Construct a new future sequence; Sort the interactive items of implicit neighbors in the order of interaction time, construct a new sequence for the future, and represent the future new sequence with a directed graph of user interaction sequence; Step (3.3): Obtain the embedding representation of items in future new sequences through graph neural networks; Step (3.4): The interest perception layer mines multiple neighborhood interest trends of implicit neighbors through capsule networks; Step (4): fuse multiple neighborhood interest trends through the neighborhood attention module to obtain neighborhood interest features; Step (5): Adaptively fuse the user interest features and neighborhood interest features through a gating mechanism to obtain the user's final interest feature vector; Step (6): Calculate the probability score based on the user's final interest feature vector, then sort in descending order according to the interaction probability score, and take the items corresponding to the top N probability scores for recommendation.

2. The method according to claim 1, characterized in that Step (1) specifically includes the following steps: Step (1.1): Obtain user interaction sequence data; The user interaction sequence specifically includes user ID, item ID, item type, item rating, and user interaction timestamp; Step (1.2): Construct a directed graph of user interaction sequences; The user interaction sequence directed graph includes an item directed graph G(v,ε); the item directed graph G(v,ε) is constructed by the time sequence of items interacted by the user, wherein v represents the item node set in the user interaction sequence, and ε represents the item node-item node edge; Step (1.3): Construct the adjacency matrix; The adjacency matrix M of the item directed graph is composed of the out-degree matrix M out and the in-degree matrix M in composition.

3. The method according to claim 2, characterized in that In step (2), the embedding layer obtains the embedding representation p of the object through the graph neural network k , the calculation formula of the graph neural network is as follows: in represents the context information captured by node k from other nodes in the tth iteration, represents the kth row of the in-degree matrix, represents the kth row of the degree matrix, represents the embedding vector of node n generated in the t-1th iteration, H in ,H out The parameter matrices of the in-degree matrix and out-degree matrix, b in ,b out They represent the bias values ​​of the in-degree matrix and out-degree matrix respectively, and Concat() represents the concatenation operation; represents the update gate, Represents the reset gate, W z ,G z ,W l ,G l They represent the parameter matrices that can be learned during the iteration process; Indicates the current status information, W e ,G e represents the parameter matrix.

4. The method according to claim 3, characterized in that In step (2), the interest extraction layer obtains the multi-dimensional interest features of the user through a multi-head attention mechanism, specifically: For each node in the user interaction sequence, the embedding representation P = [p1, p2, ..., p n ], the preference matrix calculated by the multi-head attention mechanism The calculation formula is as follows: in represents the parameter matrix for linear transformation, h represents the number of attention heads, and each attention head i Represents a potential interest feature of the user, and its calculation formula is as follows: in represents the parameter matrix; Q, K, and V represent the query matrix, key matrix, and value matrix, respectively.

5. The method according to claim 4, characterized in that In step (2), the interest aggregation layer fuses multiple interest features to obtain user interest features, which are specifically calculated as follows: Among them I u represents the user's fused interest features, express The corresponding parameter matrix, δ u represents the bias value, ReLU represents the activation function, and n represents the number of user interests.

6. The method according to claim 5, characterized in that The similarity described in step (3.1) is calculated by item similarity item_similarity(u i ,u k ), score similarity score_similarity(u i ,u k ) and category similarity category_similarity(u i ,u k ) is calculated, and the calculation formula is as follows: where u i ,u k denote the i-th user and the k-th user respectively, α, β, and γ denote the weight parameters of item similarity, rating similarity, and type similarity respectively; The formula for calculating item similarity is as follows: in Represents user u i and user u k Item interaction collection; The score similarity calculation formula is as follows: in Represents user u i For items v j The rating value of Represents user u i The average rating of all interactive items; similarly, Represents user u k For items v j Rating value, Represents user u k The average rating of all interactive items; The type similarity calculation formula is as follows: in Represents user u i and user u k A collection of item types to interact with.

7. The method according to claim 6, characterized in that Step (3.4) is specifically: Embed r with the i-th item in the future new sequence i As the first layer of capsules, and calculate r i Corresponding to the interest trend corresponding to the jth capsule j The prediction vector Where W ij represents the parameter matrix; The final interest trend calculation process is as follows: where e j Represents each prediction vector The weighted sum is calculated as follows where α ij represents the coupling coefficient, which is calculated by using the Softmax function, α ij The calculation process is as follows: where b ij represents the logarithmic prior probability of the i-th capsule being coupled to the j-th capsule, b ij The updating process of is shown in formula (17):

8. The method according to claim 7, characterized in that Step (4) is specifically: Embed the user into vector E u As query vector to calculate each interest trend i The hidden representation θ i : Where W tθ , W eθ They represent the parameter matrix, b θ Indicates the bias value; Then, the Softmax function is used to calculate the trend of each interest. i The attention weight Finally, the neighborhood interest feature vector I n The calculation formula is as follows:

9. The method according to claim 8, characterized in that Step (5) is specifically: l u =σ(W uλ I u +W nλ I n +b λ (21) where λ u represents the weight vector, W uλ , W nλ represents the parameter matrix, b λ represents the bias value, and σ represents the Sigmoid activation function.

10. The method according to claim 9, characterized in that The calculation of the interaction probability score in step (6) is specifically: in Represent the embedding representation of items i and j respectively; P(i|V) represents the recommendation probability of item i; V represents the set of items.

Citation Information

Cited By

  • Anti-noise recommendation method and recommendation system based on social graph learning

    CN121788208A