A conversation item recommendation method based on a context-aware graph neural network
By constructing local and cross-session graphs and combining graph convolutional networks and capsule graph neural networks, local and global features in conversational interactions are extracted, which solves the problem of insufficient conversational recommendation performance in anonymous user scenarios and achieves more accurate user preference representation and recommendation effect.
Patent Information
- Application Number
- CN202210803109.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-07
- Publication Date
- 2025-11-04
- Estimated Expiration
- 2042-07-07
AI Technical Summary
Existing conversational recommendation systems struggle to effectively capture users' long-term preferences and global contextual factors in anonymous user scenarios, resulting in limited recommendation performance.
The conversational interaction data of anonymous users is constructed into local graphs and cross-conversation graphs. Graph convolutional networks are used to learn local and global conversational feature vectors, and contextual factor features are extracted through capsule graph neural networks. Attention mechanisms and self-supervised learning are combined to enhance the representation of user preferences.
It improves the performance of the conversation recommendation system by comprehensively capturing user preferences, thereby enhancing the accuracy and effectiveness of recommendations.
Smart Images

Figure CN115292585B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of data mining technology, specifically relating to an item-session recommendation method based on a global context-aware graph neural network in the field of intelligent recommendation. Background Technology
[0002] The rapid development of the internet has brought opportunities to social life and economic development, but it has also led to the problem of information overload. Recommender systems, as an important tool to alleviate information overload, have brought convenience to people's social lives and created significant economic benefits. In recent years, with the diversification of application scenarios and user needs, recommender systems have been widely applied in e-commerce, social media, news information, and many other fields, and have developed rapidly. Recommender systems filter useful information based on users' potential needs, thereby providing more efficient choices. Commonly used recommendation algorithms generally model user preferences based on user item interaction data. However, in some practical application scenarios, due to platform privacy protection policies or users being in a non-logged-in state, it is difficult for the platform to obtain effective user information. The recorded data only contains the current user's item sequence over a period of time, failing to provide clear user profile information for modeling different user preferences. This type of scenario, where recommendations are made based on historical data of anonymous users, is called conversation-based item recommendation. Research on conversation-based recommendation alleviates the data sparsity problem caused by anonymous users, thus improving the performance of recommender systems.
[0003] Conversation-based recommendation systems mine and learn user preferences from conversations formed by anonymous users' interaction records on the platform. Each conversation contains multiple "user-item" interactions that occur within a continuous period of time. Early conversation-based recommendation methods used traditional data mining or machine learning techniques to capture item dependencies embedded in conversation data, such as conversation recommendations based on frequent patterns and association rules, which recommend items by mining association rules or user behavior patterns reflected in conversation data. [Reference 1] The conversation recommendation model based on Markov Chain (MC) models the temporal information in the current conversation, assuming that the next item is only related to the previous item, and therefore cannot capture long-term inter-item dependencies. FPMC [Reference 2] uses personalized transition matrices based on MC to capture temporal information and model users' long-term preferences, and alleviates the problem of data sparsity and reduces the number of parameters through matrix factorization (MF). Deep learning research has further improved the performance of conversation recommendations. Recurrent Neural Networks (RNNs) are widely used in the field of conversation recommendation because they are suitable for processing sequential data. GRU4Rec [Reference 3] provides more accurate recommendations by modeling session data using a gated recurrent unit (GRU) based on RNNs. NARM [Reference 4] uses RNNs to model user interaction sequences to capture the user's main intent and integrates the intent using an attention mechanism to improve recommendation performance. STAMP [Reference 5] replaces the RNN encoder with an attention mechanism and adds a self-attention layer to capture more accurate session representations (i.e., user preference representations). CSRM [Reference 6] assumes that the neighbors' sessions contain rich collaborative information, thus capturing a more comprehensive user preference representation and improving recommendation performance. However, due to their strict reliance on the inherent temporal dependencies between items, most of these methods cannot effectively obtain accurate user preference representations.
[0004] Methods based on Graph Neural Networks (GNNs) typically construct user-item interactions as bipartite graphs, leveraging multi-hop information propagation on the graph structure to learn richer preference features. Despite the often lack of explicit user information, most existing session recommendation research also utilizes GNNs to model more complex item transition relationships. SRGNN [Reference 7] constructs each session as a directed graph and uses gated graph neural networks (GGNNs) to learn item transition relationships within each session, thereby capturing user preferences. Based on this idea, GC-SAN [Reference 8] further utilizes multi-layer self-attention to learn users' long-term interests, and then combines short-term and long-term interests through a gating mechanism to obtain user interests. FGNN [Reference 9] also proposes a weighted graph attention layer that integrates multi-head attention mechanisms, based on a directed weighted graph constructed from each session, for learning item representations. However, most of these methods only focus on the current session, ignoring potential collaborative information from other historical sessions, thus resulting in limited performance. GCE-GNN [Reference 10] utilizes the current session and other sessions from both local and global perspectives to learn more complete user preferences. Currently, most GNN-based methods are based on simple graph structures, but simple graphs are insufficient to model the more complex transition relationships in real-world scenarios. Therefore, the emergence of hypergraphs provides an effective method for modeling higher-order complex relationships between items and sessions. HyperRec [Reference 11] utilizes hypergraphs to model short-term user preferences and achieves good performance. LHCN [Reference 12] further proposes converting the hypergraph into a linear graph and obtaining better session representations through Graph Convolutional Networks (GCNs). Based on these models, DHCN [Reference 13] and COTREC [Reference 14] further model session representations from different perspectives based on two transformed hypergraphs and enhance the learned session representations through self-supervised learning (SSL), improving session recommendation performance. These hypergraph-based models generally outperform previous simple graph-based methods; however, they focus more on user preferences that integrate global information and neglect the personalized user preferences reflected in the current session. Furthermore, most of these methods do not take into account the global contextual factors implicit in all session data, such as current popularity trends and seasonal factors, and therefore cannot capture more comprehensive user preferences.
[0005] [Reference 1] Wang S, Cao L, Wang Y, et al. A survey on session-based recommender systems[J]. ACM Computing Surveys(CSUR), 2021, 54(7): 1-38.
[0006] [Reference 2] Rendle S, Freudenthaler C, Schmidt-Thieme L. Factorizing personalized markov chains for next-basket recommendation[C] / / Proceedings of the 19th international conference on World wide web. 2010: 811-820.
[0007] [Reference 3] Hidasi B, Karatzoglou A, Baltrunas L, et al. Session-based recommendations with recurrent neural networks[J]. arXiv preprint arXiv:1511.06939, 2015.
[0008] [Reference 4] Li J, Ren P, Chen Z, et al. Neural attentive session-based recommendation[C] / / Proceedings of the 2017 ACM on Conference on Information and Knowledge Management. 2017: 1419-1428.
[0009] [Reference 5] Liu Q, Zeng Y, Mokhosi R, et al. STAMP: short-term attention / memory priority model for session-based recommendation[C] / / Proceedings of the 24th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining. 2018: 1831-1839.
[0010] [Reference 6] Wang M, Ren P, Mei L, et al. A collaborative session-based recommendation approach with parallel memory modules[C] / / Proceedings of the 42nd international ACM SIGIR conference on research and development in information retrieval. 2019: 345-354.
[0011] [Reference 7] Wu S, Tang Y, Zhu Y, et al. Session-based recommendation with graph neural networks[C] / / Proceedings of the AAAI conference on artificial intelligence. 2019, 33(01): 346-353.
[0012] [Reference 8] Xu C, Zhao P, Liu Y, et al. Graph Contextualized Self-Attention Network for Session-based Recommendation[C] / / IJCAI. 2019, 19: 3940-3946.
[0013] [Reference 9] Qiu R, Li J, Huang Z, et al. Rethinking the item order in session-based recommendation with graph neural networks[C] / / Proceedings of the 28th ACM international conference on information and knowledge management. 2019: 579-588.
[0014] [Reference 10] Wang Z, Wei W, Cong G, et al. Global context enhanced graph neural networks for session-based recommendation[C] / / Proceedings of the 43rd International ACM SIGIR Conference on Research and Development in Information Retrieval. 2020:169-178.
[0015] [Reference 11] Wang J, Ding K, Hong L, et al. Next-item recommendation with sequential hypergraphs[C] / / Proceedings of the 43rd international ACM SIGIR conference on research and development in information retrieval. 2020:1101-1110.
[0016] [Reference 12] Bandyopadhyay S, Das K, Murty M N. Line Hypergraph Convolution Network: Applying Graph Convolution for Hypergraphs[J]. arXiv preprint arXiv:2002.03392, 2020.
[0017] [Reference 13] Xia X, Yin H, Yu J, et al. Self-supervised hypergraph convolutional networks for session-based recommendation[C] / / Proceedings of the AAAI Conference on Artificial Intelligence. 2021, 35(5):4503-4511.
[0018] [Document 14]Xia Summary of the Invention
[0019] The technical problem this invention aims to solve is to address the shortcomings and deficiencies of existing technologies by providing a conversational item recommendation method based on a context-aware graph neural network. The key aspect is constructing local and cross-conversation graphs from the conversational interaction data of anonymous users. Graph convolutional networks are used to learn local and cross-conversational conversational feature vectors from these two perspectives respectively. Self-supervised learning is then used to enhance these two aspects of the conversational feature vectors, which are then fused to generate a representation of user preferences. Simultaneously, a capsule graph neural network is used to extract feature vectors of contextual factors influencing user preferences from the cross-conversational graph. These feature vectors are then fused with the user preference feature vector through an attention mechanism to obtain the final user preference feature vector, thereby improving the performance of the recommendation system.
[0020] The present invention discloses a conversation item recommendation method based on a context-aware graph neural network, characterized by modeling user preferences from the perspectives of the interaction between the current local part of the conversation and the overall historical conversation, while also considering the influence of contextual factors, and includes the following steps:
[0021] Step 1: Filter the user-project session interaction data and preprocess the filtered session data;
[0022] Step 2: Map the project ID to the project feature vector matrix, construct a local session graph for each session data, and use a graph convolutional neural network to learn the user's local preference feature vector from the session graph;
[0023] Step 3: Transform all local graphs into a cross-session interaction graph, and use a graph convolutional network to learn the user's global preference feature vector from the cross-session graph;
[0024] Step 4: Using a capsule graph neural network, extract feature vectors from several aspects of the cross-session interaction graph as global context factors for the current session, and use an attention mechanism to fuse user preference feature vectors.
[0025] Step 5: Construct an auxiliary self-supervised learning task, fuse project feature vectors through a fusion layer, and then integrate them to obtain the final conversation representation as a comprehensive user preference feature vector;
[0026] Step 6: Calculate the interaction probability using the user preference representation and the initial feature vector of the item obtained by the above fusion. Train and optimize the model jointly using the cross-entropy loss function and the self-supervised loss function to predict the next item of the current session interaction.
[0027] As a further optimization of the conversational item recommendation method based on context-aware graph neural networks of the present invention, the detailed steps of step 1 are as follows:
[0028] For anonymous user session data, sessions with a sequence length of 1 are filtered out, and items with a frequency of less than 5 are removed. Then, a data augmentation operation is performed to divide each filtered session into multiple labeled subsequences.
[0029] As a further optimization of the conversational item recommendation method based on context-aware graph neural networks of the present invention, the detailed steps of step 2 are as follows:
[0030] Step 2.1: For each session s = [v s,1 ,v s,2 ,...,v s,t Construct a directed graph G s =(V s E s ), where V s It is a set of nodes and node v s,i ∈V s E represents the items that have been interacted with in the current session. s It is the edge set of the graph and e s,i =(v s,i ,v s,i+1 )∈E s This indicates that the node v in the graph is a slave node. s,i to node v s,i+1 A directed edge describing a user's interaction with item v in session s. s,i After the interaction, the project v was then interacted with. s,i+1 .
[0031] Step 2.2: For the local session graph, first set each item v i Based on its unique ID mapping, it is represented by a d-dimensional representation vector. Thus, the eigenvectors of all items together form the eigenvector matrix of the project. As the initial input to the convolutional network, M is the total number of items.
[0032] Next, a graph convolutional network is used to learn the representation of each item in the corresponding session from each local graph. The specific process can be represented as follows:
[0033] X (l+1) =D l -1 A l X (l)
[0034] Where X (l) A represents the feature vector matrix of the item in the l-th convolutional layer (initially l is 0). l =A l +I l Let A represent the adjacency matrix of the corresponding graph. l With the correlation matrix I l The sum of, and D l -1 =∑ j A ij A represents l The inverse of the degree matrix. Meanwhile, for simplicity and efficiency, the convolution process omits the nonlinear activation function and convolution parameter matrix commonly used in graph convolution. By stacking L1 layers of convolutional networks, L1+1 item representation matrices [X] output from different layers can be obtained. (0) ,X (1) ,...,X (L1) The final project representation matrix is obtained by taking the average value:
[0035]
[0036] Considering that the different positions of items in a session can affect the representation of user preferences, for each session s = [v s,1 ,v s,2 ,...,v s,z First, put the last item v s,z The representation of x s,z Considering this as a representation of the user's current preferences, we then introduce a reversed position vector P = [p1, p2, ..., p...]. z To characterize the importance of projects in different locations, and to represent x for each project. s,i Add its corresponding reversed position feature vector
[0037]
[0038] in b1 is the weight matrix, and b1 is the offset vector.
[0039] Next, the mean of the feature vectors of all items in the current session is calculated to obtain a general representation of the session. The formula is as follows, where len refers to the length of the current session:
[0040]
[0041] Then, an attention mechanism is used to compute the attention of each item's representation relative to the general representation of the session:
[0042]
[0043] in W3, All of these are learnable weight parameters, b2 is the offset, and σ() represents the Sigmoid() activation function.
[0044] Next, the representations of each item are summed according to their attention weights to obtain the user's local preference representation in the current session.
[0045]
[0046] As a further optimization of the conversational item recommendation method based on context-aware graph neural networks of the present invention, the detailed steps of step 3 are as follows:
[0047] Step 3.1: Based on all sessions, abstract each session as a whole into a node, thereby constructing a global cross-session graph G. c =(V c E c ), where node s a ∈V c This corresponds to a single original session sequence, and the undirected edge e i =(s a ,s b )∈E c Indicates session s a With s b There are shared interactive items between the two sessions, and the weight of the corresponding edge is determined by the intersection and union of the items between the two sessions, i.e., e(s). a ,s b )=|N a ∩N b | / |N a ∪N b |, where N a N b Each represents a session s a s b The set of items in |N a | is the computation set N a Size.
[0048] Step 3.2: Based on the above cross-session graph, first, for each session node s...i The initial representation vector for each session node is obtained by taking the mean of the initial representations of all items. This allows us to obtain the initial node representation matrix of the cross-session graph. Where S is the number of session nodes, i.e., the number of sessions. The process of learning session representation vectors for cross-session interactions using graph convolutional networks can be described as follows:
[0049] Y (l+1) =D c -1 A c Y (l)
[0050] Where Y (l) A represents the representation matrix of the session in the l-th convolutional layer (initially l is 0). c The adjacency matrix A of the cross-session graph c With the correlation matrix I c The sum of, and D c -1 A represents c The inverse of the degree matrix. By stacking L2 layers of convolutional networks, L2+1 session representation matrices output from different layers can be obtained. Final cross-session session representation matrix The result is obtained through mean pooling:
[0051]
[0052] L2, like L1, is a hyperparameter, and its specific value can only be determined through actual needs and experiments; it is generally taken as 3.
[0053] As a further optimization of the conversational item recommendation method based on context-aware graph neural networks of the present invention, the detailed steps of step 4 are as follows:
[0054] Step 4.1: Based on the cross-session graph constructed above, a capsule graph neural network is further used to extract the latent feature vector of the entire graph, serving as a contextual factor influencing user preferences and assisting in constructing a more complete user preference feature vector. The initial node feature vector for the cross-session is set to...
[0055] Step 4.2: First, use multi-channel graph convolution operations to learn the conversation node representation matrices at different levels. For example, the conversation node representation matrix of the j-th channel at the (l+1)-th layer is obtained through the following convolution process:
[0056]
[0057] in It is the convolution kernel weight matrix, d cIt's the dimension of the capsule.
[0058] By iteratively using L c Multichannel graph convolution of layers yields basic capsules. Where N is the number of nodes, L c K is the number of convolutional layers, and K is the number of channels.
[0059] Next, graph capsules are generated using attention and dynamic routing mechanisms. Where M c This represents the number of capsules in the image. The specific generation process is as follows: First, the basic capsules are uniformly scaled to obtain scaled basic capsules. To mitigate the computational impact of the different scales of the basic capsules, the basic capsules are then transformed into graph capsules using the squash() function.
[0060]
[0061] For each capsule Its input s i By using all the prediction vectors u i|j According to its corresponding coupling coefficient c ji The weighted sum is obtained, and each prediction vector u is... i|j It is composed of the above-mentioned basic capsule p j With weight matrix W ji Multiplying them together, the specific process is as follows:
[0062] s i =∑ j c ji u i|j ,u i|j =W ji p j
[0063] Where the coupling coefficient c ji This indicates the basic capsule p j With the image capsule g i The corresponding weights, and each basic vector p j The sum of the coupling coefficients between all the graph capsules is 1, which can be expressed as:
[0064]
[0065] And b ji The initial value represents capsule p. j Related to capsule g i The logarithmic prior probability is updated as follows:
[0066]
[0067] Based on the graph capsules generated above, the dynamic routing mechanism described above is used again to obtain multiple higher-level context capsules. Each context capsule is a feature vector, representing a fine-grained global feature of a certain aspect of the cross-session graph. Thus, step 4 yields the global context representation matrix. This represents the k distinct contextual factors reflected in the overall cross-session graph, which can influence user preferences to some extent.
[0068] As a further optimization of the conversational item recommendation method based on context-aware graph neural networks of the present invention, the detailed steps of step 5 are as follows:
[0069] Step 5.1: The above steps yielded a representation of the user's local preferences in the current session. Global preference representation in cross-session interactions and global contextual factor representation h c First, we aggregate local and partial user preference representations, as described in the following process:
[0070]
[0071] Considering that user preferences are also influenced by global context factors, an attention mechanism is used to calculate the user preference representation h. s h represented by contextual factors c The attention of each user is weighted and summed to obtain a comprehensive user preference representation H. s The process is described as follows:
[0072] H s =h s +atten(h s ,h c (W) V h c )
[0073]
[0074] Among them W Q W K , These are the attention parameter weights.
[0075] Step 5.2: Treat the user's local preference representation in the current session and the global preference representation in cross-session interactions as two different perspectives of user preference representation, and enhance the expression of user preferences by constructing a self-supervised task. The loss function of the self-supervised task is as follows:
[0076]
[0077] Where hi Indicates session s i Representation in the local user preference representation matrix Indicates session s i The representations in the global user preference representation matrix, together with the two, constitute a positive sample pair. Indicates session s j The representation in the global user preference representation matrix, and h i Forming negative sample pairs, f sim () represents the similarity function between vectors.
[0078] As a further optimization of the global context-aware session item recommendation method of the present invention, the detailed steps of step 6 are as follows:
[0079] In the prediction layer, based on the final user preference expression H obtained above... s Predicting user and each candidate item v i Interaction probability y i By calculating H s With Project v i eigenvector x s,i The vector inner product, calculated using the Softmax() function, is expressed as follows:
[0080] y i =Softmax((H s ) T x s,i )
[0081] To optimize the model, a multi-task learning framework is constructed, with recommendation as the primary task and self-supervised learning as the auxiliary task. The loss function for the recommendation task is cross-entropy loss, as shown below:
[0082]
[0083] Where y i If the actual value is the corresponding value, then the total loss function of this invention can be expressed as follows:
[0084] L = L rec (y)+λL ssl
[0085] Where λ is a parameter that controls the weights of the self-supervised loss.
[0086] Compared with the prior art, the present invention, employing the above technical solution, has the following technical effects:
[0087] 1. The session data is converted into a graph structure. The ability of graph convolutional neural networks to model structured data is used to learn the local transition relationships of the project from the complex interaction relationships of the project. At the same time, the session is abstracted into nodes to construct a cross-session graph. The interaction relationship between sessions is modeled by graph convolutional networks. While modeling the user's local personalized preferences, global collaborative preference information is also taken into account, so that the user preference representation is more comprehensive.
[0088] 2. Construct a self-supervised learning task so that the expressions of local personalized preferences and global collaborative preferences are mutually enhanced through a contrastive learning loss function, and fuse these two feature vectors to capture a more accurate representation of user preferences.
[0089] 3. Conversational item recommendations are often limited by the lack of access to user information; relying solely on conversation data from anonymous users makes it difficult to achieve excellent recommendation performance. This invention utilizes capsule graph neural networks to learn features implicit in different aspects across the conversation graph, serving as contextual factors influencing user preferences. Through feature fusion, it helps generate a more comprehensive expression of user preferences.
[0090] Combining the above three points, the conversational item recommendation method based on context-aware graph neural networks adopted in this invention can more accurately learn user preference representations, thereby improving the performance of the recommendation system. Attached Figure Description
[0091] Figure 1 This is a flowchart illustrating a conversational item recommendation method based on a context-aware graph neural network according to the present invention. Detailed Implementation
[0092] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are for illustrative purposes only and are not intended to limit the invention.
[0093] This paper presents a conversational item recommendation method based on context-aware graph neural networks. A graph convolutional neural network is used to learn the representation of each item in the current conversation graph, and an attention mechanism is employed to capture local preference representations within the current conversation. A graph neural network is then used to learn the representations of each conversation across the conversation graph, capturing the global preference representations of users across conversational interactions. A more accurate user preference representation is learned through an auxiliary self-supervised task and then fused together. Finally, a capsule graph neural network is used to learn fine-grained features reflected in the overall cross-conversation graph, serving as global contextual factors influencing user preferences. These features are then combined with the user preference representations through an attention mechanism to obtain a comprehensive user preference representation, thereby improving conversational recommendation performance.
[0094] like Figure 1As shown, this invention discloses a conversational item recommendation method based on a context-aware graph neural network, the specific implementation of which includes the following steps:
[0095] Step 1: Filter the user-project session interaction data and preprocess the filtered session data;
[0096] Step 2: Map the project ID to the project feature vector matrix, construct a local session graph for each session data, and use a graph convolutional neural network to learn the user's local preference feature vector from the local session graph;
[0097] Step 3: Transform all local graphs into a cross-session interaction graph, and use a graph convolutional network to learn the user's global preference feature vector from the cross-session graph;
[0098] Step 4: Using a capsule graph neural network, extract feature vectors from several aspects of the cross-session interaction graph as global context factors for the current session, and use an attention mechanism to fuse user preference representations.
[0099] Step 5: Construct an auxiliary self-supervised learning task, fuse project feature vectors through a fusion layer, and then integrate them to obtain the final conversation representation as a comprehensive user preference feature vector;
[0100] Step 6: Calculate the interaction probability using the user preference representation and the initial feature vector of the item obtained by the above fusion. Train and optimize the model jointly using the cross-entropy loss function and the self-supervised loss function to predict the next item of the current session interaction.
[0101] The detailed steps of step 1 are as follows:
[0102] For anonymous user session data, sessions with a sequence length of 1 are filtered out, and items with a frequency of less than 5 are removed. Then, a data augmentation operation is performed to divide each filtered session into multiple labeled subsequences.
[0103] The detailed steps of step 2 are as follows:
[0104] Step 2.1: For each session s = [v s,1 ,v s,2 ,...,v s,t Construct a directed graph G s =(V s E s ), where V s It is a set of nodes and node v s,i ∈V s E represents the items that have been interacted with in the current session. s It is the edge set of the graph and e s,i =(v s,i,v s,i+1 )∈E s This indicates that the node v in the graph is a slave node. s,i to node v s,i+1 A directed edge describing a user's interaction with item v in session s. s,i After the interaction, the project v was then interacted with. s,i+1 .
[0105] For a partial session graph, first, each item v i Based on its unique ID mapping, it is represented by a d-dimensional vector. Thus, the eigenvectors of all items together form the eigenvector matrix of the project. As the initial input to the convolutional network, M is the total number of items.
[0106] The process of learning representations of each item in a session from each local graph using a graph convolutional network can be represented as follows:
[0107] X (l+1) =D l -1 A l X (l)
[0108] Where X (l) A represents the feature vector matrix of the item in the l-th convolutional layer (initially l is 0). l =A l +I l Let A represent the adjacency matrix of the corresponding graph. l With the correlation matrix I l The sum of, and D l -1 =∑ j A ij A represents l The inverse of the degree matrix. Meanwhile, for simplicity and efficiency, the convolution process omits the nonlinear activation function and convolution parameter matrix commonly used in graph convolution. By stacking L1 layers of convolutional networks, L1+1 item representation matrices [X] output from different layers can be obtained. (0) ,X (1) ,...,X (L1) The final project representation matrix is obtained by taking the average value:
[0109]
[0110] Considering that the different positions of items in a session can affect the representation of user preferences, for each session s = [v s,1 ,v s,2 ,...,v s,z First, put the last item v s,zThe representation of x s,z Considering this as a representation of the user's current preferences, we then introduce a reversed position vector P = [p1, p2, ..., p...]. z To characterize the importance of projects in different locations, and to represent x for each project. s,i Add its corresponding reversed position feature vector
[0111]
[0112] in b1 is the weight matrix, and b1 is the offset vector.
[0113] Next, the mean of the feature vectors of all items in the current session is calculated to obtain a general representation of the session. The formula is as follows, where len refers to the length of the current session:
[0114]
[0115] Then, an attention mechanism is used to compute the attention of each item's representation relative to the general representation of the session:
[0116]
[0117] in W3, All of these are learnable weight parameters, b2 is the offset, and σ() represents the Sigmoid() activation function.
[0118] Next, the representations of each item are summed according to their attention weights to obtain the user's local preference representation in the current session.
[0119]
[0120] The detailed steps of step 3 are as follows:
[0121] Based on all sessions, each session is abstracted as a node, thereby constructing a global cross-session graph G. c =(V c E c ), where node s a ∈V c This corresponds to a single original session sequence, and the undirected edge e i =(s a ,s b )∈E represents session s a With s b There are shared interactive items between the two sessions, and the weight of the corresponding edge is determined by the intersection and union of the items between the two sessions, i.e., e(s). a ,s b)=|N a ∩N b | / |N a ∪N b |, where N a N b Each represents a session s a s b The set of items in |N a | is the computation set N a Size.
[0122] Based on the cross-session graph described above, firstly, for each session node s... i The initial representation vector for each session node is obtained by taking the mean of the initial representations of all items. This allows us to obtain the initial node representation matrix of the cross-session graph. Where S is the number of session nodes (i.e., the number of sessions). The process of learning session representation vectors for cross-session interactions using a graph convolutional network can be described as follows:
[0123] Y (l+1) =D c -1 A c Y (l)
[0124] Where Y (l) A represents the representation matrix of the session in the l-th convolutional layer (initially l is 0). c The adjacency matrix A of the cross-session graph c With the correlation matrix I c The sum of, and D c -1 A represents c The inverse of the degree matrix. By stacking L2 layers of convolutional networks, L2 session representation matrices output by different layers can be obtained. Final cross-session session representation matrix The result is obtained through mean pooling:
[0125]
[0126] L2, like L1, is a hyperparameter, and its specific value can only be determined through actual needs and experiments; it is generally taken as 3.
[0127] The detailed steps of step 4 are as follows:
[0128] Based on the cross-session graph constructed above, a capsule graph neural network is further used to extract the latent feature vector of the entire graph, serving as a contextual factor influencing user preferences and assisting in the construction of a more complete user preference feature vector. The initial node feature vector for the cross-session is set as follows:
[0129] First, multi-channel graph convolution operations are used to learn the session node representation matrices at different levels. For example, the session node representation matrix of the j-th channel at the (l+1)-th layer is obtained through the following convolution process:
[0130]
[0131] in It is the convolution kernel weight matrix, d c It's the dimension of the capsule.
[0132] By iteratively using L c Multichannel graph convolution of layers yields basic capsules. Where N is the number of nodes, L c K is the number of convolutional layers, and K is the number of channels.
[0133] Next, graph capsules are generated using attention and dynamic routing mechanisms. Where M c This represents the number of capsules in the image. The specific generation process is as follows: First, the basic capsules are uniformly scaled to obtain scaled basic capsules. To mitigate the computational impact of the different scales of the basic capsules, the basic capsules are then transformed into graph capsules using the squash() function.
[0134]
[0135] For each capsule Its input s i By using all the prediction vectors u i|j According to its corresponding coupling coefficient c ji The weighted sum is obtained, and each prediction vector u is... i|j It is composed of the above-mentioned basic capsule p j With weight matrix W ji Multiplying them together, the specific process is as follows:
[0136] s i =∑ j c ji u i|j ,u i|j =W ji p j
[0137] Where the coupling coefficient c ji This indicates the basic capsule p j With the image capsule g i The corresponding weights, and each basic vector p j The sum of the coupling coefficients between all the graph capsules is 1, which can be expressed as:
[0138]
[0139] And b ji The initial value represents capsule p. j Related to capsule g i The logarithmic prior probability is updated as follows:
[0140]
[0141] Based on the graph capsules generated above, multiple higher-level context capsules are obtained again using the dynamic routing described above. Each context capsule is a feature vector, representing a fine-grained feature of a certain aspect of the cross-session graph. Thus, the global context representation matrix can be obtained through step 4. This represents the k distinct contextual factors reflected in the overall cross-session graph, which can influence user preferences to some extent.
[0142] The detailed steps of step 5 are as follows:
[0143] The above steps yielded a representation of the user's local preferences in the current session. Global preference representation in cross-session interactions and global contextual factor representation h c First, we aggregate local and partial user preference representations, as described in the following process:
[0144]
[0145] Considering that user preferences are also influenced by global context factors, an attention mechanism is used to calculate the user preference representation h. s h represented by contextual factors c The attention of each user is weighted and summed to obtain a comprehensive user preference representation H. s The process is described as follows:
[0146] H s =h s +atten(h s ,h c (W) V h c )
[0147]
[0148] Among them W Q W K , These are the attention parameter weights.
[0149] This approach treats the local preference representation exhibited by a user in the current session and the global preference representation exhibited in cross-session interactions as two different perspectives on user preference representation. A self-supervised task is constructed to enhance the expression of user preferences. The loss function of the self-supervised task is as follows:
[0150]
[0151] Where h i Indicates session s i Representation in the local user preference representation matrix Indicates session s i The representations in the global user preference representation matrix, together with the two, constitute a positive sample pair. Indicates session s j The representation in the global user preference representation matrix, and h i Forming negative sample pairs, f sim () represents the similarity function between vectors.
[0152] The detailed steps of step 6 are as follows:
[0153] In the prediction layer, based on the final user preference expression H obtained above... s Predicting user and each candidate item v i Interaction probability y i By calculating H s With Project v i eigenvector x s,i The vector inner product, calculated using the Softmax() function, is expressed as follows:
[0154] y i =Softmax((H s ) T x s,i )
[0155] To optimize the model, a multi-task learning framework is constructed, with recommendation as the primary task and self-supervised learning as the auxiliary task. The loss function for the recommendation task is cross-entropy loss, as shown below:
[0156]
[0157] Where y i If the actual value is the corresponding value, then the total loss function of this invention can be expressed as follows:
[0158] L = L rec (y)+λL ssl
[0159] Where λ is a parameter that controls the weights of the self-supervised loss.
[0160] It should be understood that the above embodiments are for illustrative purposes only and are not intended to limit the scope of the invention. Furthermore, it should be understood that after reading the teachings of this invention, those skilled in the art can make various modifications or alterations to the invention without departing from the spirit and scope of the invention. All such modifications or alterations should be covered by the claims of this invention.
Claims
1. A conversational item recommendation method based on a context-aware graph neural network, characterized in that... Modeling user preferences from the perspectives of interaction between the current session and the overall historical sessions, while also considering the influence of contextual factors, includes the following steps: Step 1: Filter the user-project session interaction data and preprocess the filtered session data; Step 2: Map the project ID to the project feature vector matrix, construct a local session graph for each session data, and use a graph convolutional neural network to learn the user's local preference feature vector from the session graph; Step 3: Transform all local graphs into a cross-session interaction graph, and use a graph convolutional network to learn the user's global preference feature vector from the cross-session graph; Step 4: Using a capsule graph neural network, extract feature vectors from several aspects of the cross-session interaction graph as global contextual factors for the current session, specifically: Based on the constructed cross-session graph, a capsule graph neural network is used to extract several latent feature vectors of the whole as contextual factors influencing user preferences, which are used to help construct a more complete user preference feature vector. First, multi-channel graph convolution operations are used to learn the feature vector matrices of session nodes at different levels, thus obtaining the basic capsules. ,in It is the number of nodes. It is the number of convolutional layers. It is the number of channels; then, attention mechanisms and dynamic routing mechanisms are used to generate... indivual Vidicapsule , It is the dimension of the capsule; then dynamic routing is applied to obtain... indivual Higher-level context capsules, each a feature vector representing a fine-grained global feature across the session graph, thus yielding a global contextual factor representation. ; Step 5: Construct an auxiliary self-supervised learning task, which fuses item feature vectors through a fusion layer, and then integrates them to obtain the final conversation representation as a comprehensive user preference feature vector. Specifically: Based on the user's local preference representation in the current session Global preference representation in cross-session interactions and global contextual factor representation First, the local and global user preference representations are aggregated to obtain the user preference representation. ; Considering that user preferences can be influenced by global context factors, an attention mechanism is used to compute user preference representations. Relative to contextual factors The attention of each user is calculated and summed according to their attention weights to obtain a comprehensive representation of user preferences. ; Step 6: Calculate the interaction probability using the user preference representation and the initial feature vector of the item obtained by the above fusion. Train and optimize the model jointly using the cross-entropy loss function and the self-supervised loss function to predict the next item of the current session interaction.
2. The conversational item recommendation method based on a context-aware graph neural network according to claim 1, characterized in that, Step 1 specifically involves: For anonymous user session data, sessions with a sequence length of 1 are filtered out, and items with a frequency of less than 5 are removed. Then, data augmentation is performed to divide each filtered session into multiple labeled subsequences.
3. The conversational item recommendation method based on a context-aware graph neural network according to claim 1, characterized in that, Step 2 specifically involves: For each session, first construct it as a directed graph as a local session graph; then map each project's unique ID to a... The feature vector is a matrix representing all items. For each session graph, the feature vector matrix of each item is updated through graph convolution and pooling operations. Then, based on the item's position in the session, the feature vector of the session is aggregated through an attention mechanism to obtain the session's feature vector, which is the representation of the user's local preferences. .
4. The conversational item recommendation method based on a context-aware graph neural network according to claim 1, characterized in that, Step 3 specifically involves: Based on all sessions, each session is first abstracted as a node, thus constructing a global cross-session graph. Each edge represents a common interactive item between sessions. The initial feature vector of each session node is obtained by taking the mean of the initial feature vectors of all items within it, thus yielding the initial node feature vector matrix of the cross-session graph. Then, a graph convolutional network and mean pooling are used to learn the session feature vectors of cross-session interactions, i.e., the global preference representation of the user. .
5. The conversational item recommendation method based on a context-aware graph neural network according to claim 1, characterized in that: In step 5, the user's local preference representation and global preference representation are regarded as two different perspectives of user preference expression. A self-supervised task is constructed to enhance the expression of user preferences. The loss function of the self-supervised task is as follows: in Representing a session Representation in the local user preference representation matrix Representing a session The representations in the global user preference representation matrix, together with the two, constitute a positive sample pair. Representing a session The representation in the global user preference representation matrix, and To form negative sample pairs, This represents a function for calculating the similarity between vectors. express Activation function.
6. The conversational item recommendation method based on a context-aware graph neural network according to claim 1, characterized in that, Step 6 specifically involves: A multi-task learning framework is constructed, with recommendation as the primary task and self-supervised learning as the auxiliary task. The loss function for the recommendation task adopts cross-entropy loss, as follows: in It is its corresponding true value. Indicates users and candidate items The interaction probability is calculated by determining the final user preference representation. With the project eigenvectors inner product and through The result is obtained from the function calculation and is expressed as follows: The overall loss function can be expressed as follows: in It is a parameter that controls the weights of the self-supervised loss.
Citation Information
Patent Citations
Graph neural network recommendation method based on multi-aspect enhancement
CN113378047A
Session recommendation method based on graph neural network
CN113946675A