An Interest-Aware Dual-Channel Graph Contrastive Learning Session Recommendation Method
By constructing interest-project interaction hypergraph and global interest-project transformation diagram, combining comparative learning and location time information, the problems of high-order relationship modeling and data sparsity in the conversation recommendation system are solved, and the accuracy and effectiveness of the recommendation system are improved.
Patent Information
- Application Number
- CN202310674698.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-08
- Publication Date
- 2025-08-01
- Estimated Expiration
- 2043-06-08
AI Technical Summary
The existing session recommendation system fails to fully model the high-order relationships between session projects, fails to fully discover user intentions, and fails to effectively solve the problems of data sparseness and noise interference, resulting in low performance of the recommendation system.
Build interest-project interaction hypergraph and global interest-project conversion diagram, and enhance interest embedding consistency through dual-channel graph comparison learning method, combine position and time information, design the attention layer of position and time perception, and optimize recommendation accuracy.
It improves the accuracy of session recommendations, significantly improves recommendation efficiency, and solves the problems of long-distance information transmission and data sparseness.
Smart Images

Figure CN117194765B_ABST
Abstract
Description
Technical Field
[0001] The present invention provides an interest-aware dual-channel graph contrast learning session recommendation method, belonging to the technical field of session recommendation. Background Art
[0002] With the rapid development of information technology, the amount of information that users receive every day has increased sharply. However, a vast amount of information is inevitably accompanied by a large amount of useless redundant information. Therefore, it is necessary to obtain useful information while filtering out useless redundant information. The recommendation system can screen out information that matches the user's interests and make targeted recommendations, so the recommendation system has broad application prospects.
[0003] Traditional recommendation systems mainly make recommendations based on known user information. However, due to reasons such as privacy protection, user information is unknown in many real-world scenarios. Therefore, session-based recommendation systems have gradually emerged. This system uses the behavior sequence of anonymous users to predict the next item and learns the user's preferences based on the items interacted by the user in the session to provide accurate personalized recommendations for the user.
[0004] In early work, the methods of session recommendation systems were proposed based on the idea of machine learning. The early methods mainly utilized the ideas of Markov chains and matrix factorization, but they could only capture first-order dependencies and were unable to capture long-term high-order dependencies. With the popularity of recurrent neural network methods, the method of modeling session data as an ordered sequence using recurrent neural networks and modeling the order of items in the session has achieved good results. However, the transformation of session data is not a strictly time-series transformation, and recurrent neural networks cannot model more complex associations between items. Graph neural networks can model session data as graph data, so graph neural networks are widely used in session recommendation systems. However, in real-world scenarios, the occurrence of an item is often the result of the joint action of a series of previous items, and the relationship between items is not a simple binary relationship but a more complex many-to-many relationship. How to more accurately model the complex high-order relationships between items has been a challenge in the field of session recommendation systems.
[0005] Another challenge faced by session recommendation systems is the sparsity of data. In the application scenarios of session recommendation, user information is often anonymous, which requires the session recommendation system to predict the user's next behavior based on a small amount of existing data. In addition, in the session sequence, there are cases where users click by mistake, and some items are added to the session due to user operation errors, which is not the original intention of the user. Contrast learning uses auxiliary tasks for multi-faceted learning, which can partially solve the problems of data sparsity and noise interference. However, how to select more appropriate positive and negative samples and contrast methods in session recommendation systems still needs to be studied. Summary of the Invention
[0006] The object of the present invention is to address the technical problems that the prior art fails to fully model the high-order relationships between session items, fails to fully explore the user's intentions, and fails to well solve the problems of data sparsity and noise interference in session recommendation systems, resulting in low efficiency of session recommendation systems. The present invention creatively proposes an Interest-aware Dual-channel Graph Contrastive learning for session-based recommendation (IDGC) method.
[0007] The present invention constructs two different graph structures to collect information on different aspects between items with emphasis. The two different graph structures are: an interest-item interaction hypergraph, which uses a hypergraph structure to mine more complex interaction relationships between items, effectively reducing the loss of original information caused by the forced conversion of multi-way relationships between items into binary relationships; and a global interest-item transition graph, which combines global sessions to model the transition relationships of items in adjacent sessions. Different from other existing methods, in the construction process of the two views, the present invention adds an interest node to each session and connects the interest node to each item node in the corresponding session, enabling better information dissemination between non-adjacent items.
[0008] At the same time, the present invention uses contrastive learning to enhance the consistency of interest embeddings in the two views, enabling the information in the two views to complement each other. After fusing the item embeddings of the two views, the present invention designs a position-time aware attention layer to obtain session embeddings by fusing position information and time information and assigning weights to different items, thereby improving the accuracy of recommendations.
[0009] To facilitate the elaboration of the detailed content of the present invention, relevant concepts involved in the present invention are first defined and explained.
[0010] Item set, session set and session: Define V as the set of all items, i.e., the item set, V = {v1, v2, v3,..., v |V|}, where |V| is the number of items; define S as the set of all sessions, i.e., the session set, S = {s1, s2, s3,..., s |S|}, where |S| is the number of items; each session is represented as a set s, s = [v1, v2, v3,..., v n , and n is the length of the session.
[0011] The present invention is implemented by the following technical solutions.
[0012] An interest-aware dual-channel graph contrastive learning session recommendation method, comprising the following steps:
[0013] Step 1: Construct an interest-item interaction hypergraph and a global interest-item transformation graph based on session data.
[0014] Specifically, Step 1 includes the following steps:
[0015] Step 1.1: Construct an interest-item interaction hypergraph, define G h =(V h ,U h ,E h ,W h ), where represents all items in the item set V, represents the interest nodes added for each session, represents the set of edges, where represents the set of hyperedges, and the i-th hyperedge connects all items in the i-th session, represents the set of undirected edges connecting the interest nodes and the items in the session corresponding to the interest nodes, and W h represents the weight matrix of the hyperedges, where represents the weight of the hyperedge . In addition, the hypergraph can be represented as an incidence matrix C h ∈R |V|×|S| , where represents that the hyperedge contains the vertex v∈V h , otherwise it is 0.
[0016] Step 1.2: Construct a global interest-item transformation graph, define G g =(V g ,U g ,E g ), where represents all items in the item set V, represents the interest nodes corresponding to each session, and E g represents the set of edges, which is divided into two types. One is the directed edge formed according to the interaction order between item nodes, and the other is the undirected edge connecting the interest nodes and the item nodes. If in the entire session set, the user clicks on v i-1 and then clicks on v i , then e i =(v i-1 →v i )∈E g . In addition, for each session, the interest node corresponding to the session is connected to all item nodes in the session by undirected edges.
[0017] Step 2: Input the constructed interest-item interaction hypergraph and the global interest-item transformation graph into the dual-channel interest-item embedding learning module, design two channels to process the two graph structures respectively, and obtain the interest embedding and item embedding under the two graph structures.
[0018] Specifically, Step 2 includes the following steps:
[0019] Step 2.1: Design a hypergraph item embedding learning module, use the hypergraph convolutional network to perform embedding learning on the item nodes in the hypergraph, and the specific calculation formula is as follows:
[0020]
[0021] Among them, represents the item embedding in the l-th layer of the hypergraph convolutional network, the range of l is from 0 to L, L is a set hyperparameter, C is the incidence matrix of the interest-item interaction hypergraph G h , and respectively represent the degree matrix of the hyperedges in h and the degree matrix of all vertices in V
[0022] Stack multiple hypergraph convolutional networks to obtain high-order information, and output the embedding representation of each item in the last layer, and finally obtain the item embedding H under the interest-item interaction hypergraph h .
[0023] Step 2.2: Design a global graph item embedding learning module, input the constructed global interest-item transformation graph into the gated graph neural network, specifically as follows:
[0024]
[0025] Among them, represents the i-th item embedding in the l-th layer of the network, the range of l is from 0 to L, L is a set hyperparameter, is the update gate in the gated graph neural network, r i l is the reset gate in the gated graph neural network; A s is the adjacency matrix, U1, U2, U3, U4 and W1, W2, W3 control the weights, b1 is a trainable parameter, is an intermediate quantity in the calculation process, ⊙ represents the element-wise product, tanh represents the hyperbolic tangent function, σ represents the sigmod function, and T represents the transpose operation. <(
[0026] Through the global graph item embedding learning module, finally obtain the item embedding H under the global interest-item transformation graph g .
[0027] Step 2.3: Initialize the interest nodes. Since the interest nodes represent the interest preferences shown by a session, a method similar to session aggregation is used to initialize the interest nodes. Taking the interest-item interaction hypergraph as an example, for each session s = [v1, v2, v3,..., v n , let the interest node corresponding to s in the interest-item interaction hypergraph be u h , which is specifically as follows:
[0028]
[0029]
[0030] where represents the item embedding of the i-th item under the interest-item interaction hypergraph, α i represents the attention score, u h′ and u h′ are intermediate quantities in the calculation process, n represents the length of the session, W4, W5 ∈ R d×d and q1, b2 ∈ R d are all learnable parameters, and T represents the transpose operation.
[0031] Similarly, the initial embedding u g of the interest node corresponding to each session in the global interest-item conversion graph is obtained.
[0032] Step 2.4: After initializing the interest nodes, update the interest embedding according to the obtained item embeddings. Specifically, taking the interest-item interaction hypergraph as an example, calculate the similarity score γ i between each item in the session and the interest node corresponding to the current session, and aggregate the item embeddings according to the similarity score to obtain the interest embedding u h corresponding to the session.
[0033] Specifically, it is as follows:
[0034] γ i = softmax(LeakyReLU(W6h i h + W7u h )) (12)
[0035]
[0036] where W6, W7 ∈ R 1×d are learnable parameters, represents the item embedding of the i-th item under the interest-item interaction hypergraph, and n represents the length of the session.
[0037] Similarly, the updated embedding u of the interest node in the global interest-item transformation graph is obtained. g 。
[0038] Step 2.5: After updating the interest embedding, use the updated interest nodes to update the item nodes. Similar to the interest embedding update, if an item node is connected to k interest nodes, calculate the similarity score γ between the item embedding and all the connected interest embeddings j , and aggregate all the interest embeddings to obtain the final item embedding h h , as follows:
[0039]
[0040] where [[ID=1,7]] represents the embedding of the j-th interest node connected to the item node, and W8, W9 ∈ R 1×d are learnable parameters.
[0041] Similarly, the updated embedding h of the item node in the global interest-item transformation graph is obtained. g 。Add the item embeddings h h and h g obtained from the two views to get the final item embedding H = {h1, h2, h3,..., h |V|}.
[0042] Step 3: Aggregate the obtained item embeddings into a session representation embedding, and enhance the session representation using position information and time information.
[0043] Specifically, Step 3 includes the following steps:
[0044] Step 3.1: Obtain the position information embedding. In session-based recommendation, the same item appearing at different positions in a session contains different information. Therefore, in each session, use a learnable position matrix P = [p1, p2, p3,..., p n to record the position information of the items in each session.
[0045] Step 3.2: Obtain the time information embedding. Without changing the interaction order between items, two sessions with different time intervals represent completely different user intents. By calculating the difference in timestamps between adjacent items, obtain the time matrix T = [t1, t2, t3,..., t n that records the time information of different items. After obtaining the position embedding P and the time embedding T, for each session s, add P and T to the item embedding H to get the final item embedding X = [x1, x2, x3,..., x n .
[0046] Step 3.3: Obtain the session embedding. Generally, it can be considered that the items closer to the end of the browsing position can better represent the user's current interest preference. Therefore, use the embedding x of the last item in session s n as the local-level session embedding, and then use the soft attention mechanism to calculate the weights to obtain the global-level session embedding. Combine the global-level embedding and the local-level embedding of the session to get the session embedding s f , specifically as follows:
[0047]
[0048] s l = x n (19)
[0049] s f = s l + s g (20)
[0050] where x i represents the item embedding of the i-th item in the session, n represents the length of the session, s * is an intermediate quantity in the calculation process, θ i represents the attention score of item i for the entire session, s g represents the global-level session embedding, s l represents the local-level session embedding, W 10 , W 11 and q2, b3 are learnable parameters.
[0051] Step 4: Use contrastive learning to enhance the interest embeddings obtained from the two graphs.
[0052] The interest preferences of the same session in two different views should be as similar as possible. Since the total number of sessions defined in session set S is |S|, the total number of all interest nodes in the two views is 2|S|. Define two interest embeddings representing the interest biases of the j-th session in the two views as a pair of positive samples, and the remaining 2|S| - 1 pairs as negative samples. Use the InfoNCE loss as the contrastive loss, aiming to optimize the model to make the encodings of the interest nodes of the same session in the two views as similar as possible. The specific calculation formula is as follows:
[0053]
[0054] where, L s represents the contrastive learning loss function, l j represents the loss corresponding to the j-th session, represents the positive sample pair, (u p , u qIt represents all sample pairs, sim() represents the cosine similarity, and τ is a hyperparameter.
[0055] Step 5: Calculate the recommendation probability of candidate items and give the loss function, which is specifically as follows:
[0056]
[0057] L = L c + λL s (25)
[0058] Among them, s f is the session embedding representation; z i represents the true value label of the i-th candidate item, represents the predicted probability of the i-th candidate item; L c represents the cross-entropy loss function, L s represents the contrastive learning loss function, L represents the final loss function, and λ is a learnable parameter.
[0059] From Step 1 to Step 5, the recommendation probability of candidate items for the session sequence is obtained; based on the recommendation probability, interest-aware dual-channel graph contrastive learning session recommendation is realized.
[0060] Beneficial effects
[0061] Compared with the prior art, the method of the present invention has the following advantages:
[0062] The method of the present invention pays attention to the item relationships in different aspects by constructing an interest-item interaction hypergraph and a global interest-item transformation graph. By setting interest nodes to represent user interest preferences, the problem of long-distance information transmission between non-adjacent items is solved, and contrastive learning is used to expand the information of the two graphs, and position information and time interval information are used to enhance the session embedding representation, thus improving the recommendation efficiency and having a significant improvement compared with the prior art. Description of the drawings
[0063] Figure 1 is the flowchart of the method of the present invention. Detailed implementation manners
[0064] In order to make the purpose and advantages of the present invention clearer, the present invention will be further described below in conjunction with the implementation manners. It should be noted that the specific implementation manners described here are only used to explain the present invention and do not limit the present invention.
[0065] Refer to the attached Figure 1 , an interest-aware dual-channel graph contrastive learning session recommendation method, includes the following steps:
[0066] Define V as the set of all items, i.e., the item set, V = {v1, v2, v3,..., v |V|}, where |V| is the number of items. Define S as the set of all sessions, i.e., the session set, S = {s1, s2, s3,..., s |S|}, where |S| is the number of sessions. Each session is represented as a set s, s = [v1, v2, v3,..., v n , and n is the length of the session.
[0067] Step A: According to the session data, construct an interest-item interaction hypergraph, and define G h = (V h , U h , E h , W h ), where represents all items in the item set V, represents the interest nodes added for each session, represents the set of edges, where represents the set of hyperedges. The i-th hyperedge connects all items in the i-th session, represents the set of undirected edges connecting the interest nodes and the items in the session corresponding to the interest nodes. W h represents the weight matrix of the hyperedges, where represents the weight of the hyperedge ; construct a global interest-item transformation graph, and define G g = (V g , U g , E g ), where represents all items in the item set V, represents the interest nodes corresponding to each session, and E g represents the set of edges, which is divided into two types. One is the directed edge formed according to the interaction order between the item nodes, and the other is the undirected edge connecting the interest nodes and the item nodes. If in the entire session set, the user clicks on v i-1 and then clicks on v i , then e i = (v i-1 → v i ) ∈ E g . In addition, for each session, the interest node corresponding to the session is connected to all item nodes in the session by undirected edges.
[0068] Step B: Input the constructed interest-item interaction hypergraph and the global interest-item transformation graph into the dual-channel interest-item embedding learning module, and design two channels to process the two graph structures respectively to obtain the interest embeddings and item embeddings under the two graph structures. The specific process is as follows:
[0069] Design a hypergraph project embedding learning module, and use the hypergraph convolutional network to perform embedding learning on the project nodes in the hypergraph, which is calculated according to the following formula:
[0070]
[0071] Where represents the project embedding in the l-th layer of the hypergraph convolutional network. The range of l is from 0 to L, where L is a set hyperparameter. C is the incidence matrix of the interest-project interaction hypergraph G h ; and respectively represent the degree matrix of the hyperedges in h and the degree matrix of all vertices in V h ; H
[0072] Design a global graph project embedding learning module, and input the constructed global interest-project conversion graph into the gated graph neural network, as shown in the following formula:
[0073]
[0074] Where represents the i-th project embedding in the l-th layer of the network. The range of l is from 0 to L, where L is a set hyperparameter, is the update gate in the gated graph neural network, and r i l is the reset gate in the gated graph neural network; A s is the adjacency matrix, U1, U2, U3, U4, and W1, W2, W3 are control weights, and b1 is a trainable parameter, is an intermediate quantity in the calculation process. ⊙ represents the element-wise product, tanh represents the hyperbolic tangent function, σ represents the sigmoid function, and T represents the transpose operation. Through the global graph project embedding learning module, the project embedding H g under the global interest-project conversion graph is finally obtained.
[0075] Initialize the interest nodes. First, operate on the interest-project interaction hypergraph. For each session s = [v1, v2, v3,..., v n , assume that the interest node corresponding to s in the interest-project interaction hypergraph is u h , and the specific calculation is as follows:
[0076]
[0077] Where represents the project embedding of the i-th project under the interest-project interaction hypergraph, and α idenotes the attention score, u h′ and u h′ are intermediate quantities in the calculation process, n represents the length of the session, W4, W5 ∈ R d×d and q1, b2 ∈ R d are all learnable parameters, and T represents the transpose operation. Then, through a similar calculation, the initial embedding u of the interest node corresponding to each session in the global interest-item conversion graph is obtained g .
[0078] After initializing the interest nodes, the interest embeddings are updated according to the obtained item embeddings. First, operate on the interest-item interaction hypergraph to calculate the similarity score γ between each item in the session and the interest node corresponding to the current session i , and aggregate the item embeddings according to the similarity score to obtain the interest embedding u h corresponding to the session. The specific calculation is as follows:
[0079] γ i = softmax(LeakyReLU(W6h i h + W7u h ))
[0080]
[0081] where W6, W7 ∈ R 1×d are learnable parameters, represents the item embedding of the i-th item under the interest-item interaction hypergraph, n represents the length of the session, and then through a similar calculation, the updated embedding u of the interest node in the global interest-item conversion graph is obtained g .
[0082] After updating the interest embeddings, the updated interest nodes are used to update the item nodes. Calculate the similarity score γ between the item embedding and all the connected interest embeddings j , and aggregate all the interest embeddings to obtain the final item embedding h h . The specific calculation formula is as follows:
[0083]
[0084] where represents the embedding of the j-th interest node connected to the item node, W8, W9 ∈ R 1×d are learnable parameters. Through a similar calculation method, the updated embedding h of the item node in the global interest-item conversion graph is obtained g , and the item embeddings h h and h gAdd them up to get the final item embedding \(H = \{h_1, h_2, h_3, \ldots, h\}\). |V|}
[0085] Step C: Aggregate the obtained item embeddings into a session representation embedding, and enhance the session representation using position information and time information. The specific method is as follows:
[0086] Obtain the position information embedding. In session-based recommendation, use a learnable position matrix \(P = [p_1, p_2, p_3, \ldots, p]\) to record the position information of items in each session. n
[0087] Obtain the time information embedding. By calculating the difference in timestamps between adjacent items, obtain a time matrix \(T = [t_1, t_2, t_3, \ldots, t]\) that records the time information of different items. After obtaining the position embedding \(P\) and time embedding \(T\), for each session \(s\), add \(P\) and \(T\) to the item embedding \(H\) to get the final item embedding \(X = [x_1, x_2, x_3, \ldots, x]\). n n
[0088] Obtain the session embedding. Use the last item embedding \(x\) in session \(s\) as the local-level session embedding, and then use the soft attention mechanism to calculate the weights to obtain the global-level session embedding. Combine the global-level embedding and local-level embedding of the session to get the session embedding \(s\). n The specific calculation is as follows: f
[0089]
[0090] s l = x n
[0091] s f = s l + s g
[0092] where \(x\) i represents the item embedding of the \(i\)-th item in the session, \(n\) represents the length of the session, \(s\) * is an intermediate quantity in the calculation process, \(\theta\) i represents the attention score of item \(i\) for the entire session, \(s\) g represents the global-level session embedding, \(s\) l represents the local-level session embedding, \(W\) 10 , \(W\) 11 and \(q_2, b_3\) are learnable parameters.
[0093] Step D: Use contrastive learning to enhance the interest embeddings obtained from the two graphs. Define two interest embeddings representing the interest bias of the j-th session in the two views as a pair of positive samples, and the remaining 2|S|-1 pairs as negative samples. Use the InfoNCE loss as the contrastive loss, and the specific calculation is as follows:
[0094]
[0095] where L s represents the contrastive learning loss function, l j represents the loss corresponding to the j-th session, represents the positive sample pair, (u p , u q ) represents all sample pairs, sim() represents the cosine similarity, and τ is a hyperparameter.
[0096] Step E: Calculate the candidate item recommendation probability, and the specific method is as follows:
[0097]
[0098] L = L c + λL s
[0099] where s f is the session embedding representation, z i represents the true label of the i-th candidate item, represents the predicted probability of the i-th candidate item, L c represents the cross-entropy loss function, L s represents the contrastive learning loss function, L represents the final loss function, and λ is a learnable parameter.
[0100] Embodiment
[0101] Taking the session sequence "Session 1: [Item 1, Item 3, Item 2, Item 5, Item 7]; Session 2: [Item 2, Item 6, Item 8, Item 10]; and Session 3: [Item 4, Item 7, Item 9, Item 11]" as an embodiment, the specific operation steps of an interest-aware dual-channel graph contrastive learning session recommendation method of the present invention are described in detail.
[0102] As shown in the attached Figure 1 to the specification, an interest-aware dual-channel graph contrastive learning session recommendation method includes the following steps:
[0103] Step A: According to the session data, construct an interest-item interaction hypergraph and a global interest-item transformation graph.
[0104] Specifically in this embodiment, an interest-item interaction hypergraph and a global interest-item transformation graph are constructed according to the order of items in the session. The construction method of the interest-item interaction hypergraph is to construct each session into a hyperedge and add an interest node to each hyperedge. Therefore, the constructed global hypergraph has 3 hyperedges, and each hyperedge is connected to all items in sessions 1, 2, and 3 and the corresponding interest nodes interest 1, 2, and 3; the global interest-item transformation graph constructs a transformation graph according to the interactions of all items in sessions 1, 2, and 3, and connects the interest nodes to each item in the session. Taking session 1 as an example, interest node 1 is connected to items 1, 3, 2, 5, and 7 respectively.
[0105] Step B: Input the constructed interest-item interaction hypergraph and the global interest-item transformation graph into the dual-channel interest-item embedding learning module, design two channels to process the two graph structures respectively, and obtain the interest embeddings and item embeddings under the two graph structures.
[0106] In this embodiment, first input the constructed interest-item interaction hypergraph into the hypergraph item embedding learning module to learn the representations of all items in sessions 1, 2, and 3 in the interest-item interaction hypergraph; then input the constructed global interest-item transformation graph into the global graph item embedding learning module to obtain the representations of all items in sessions 1, 2, and 3 in the global interest-item transformation graph; under the interest-item interaction hypergraph, obtain the embeddings of interest nodes 1, 2, and 3 and all item embeddings in sessions 1, 2, and 3 through the interest node initialization module, the interest embedding update module, and the item embedding update module; under the global interest-item transformation graph, obtain the embeddings of interest nodes 1, 2, and 3 and all item embeddings in sessions 1, 2, and 3 through the interest node initialization module, the interest embedding update module, and the item embedding update module.
[0107] Step C: Aggregate the obtained item embeddings into session representation embeddings, and enhance the session representations using position information and time information.
[0108] In this embodiment, add the item embeddings under the interest-item interaction hypergraph obtained in step B and the item embeddings under the global interest-item transformation graph to obtain item embeddings, fuse the position information embedding and the time information embedding in the item embeddings as new item embeddings, and calculate the embedding representation of each session. Taking session 1 as an example, take the last item in the session, that is, item 7, as the local-level session embedding, use the attention mechanism to obtain the global-level embedding of the session, and combine the global-level embedding and the local embedding of the session to obtain the session embedding.
[0109] Step D: Use contrastive learning to enhance the interest embeddings obtained from the two graphs.
[0110] Specifically in this embodiment, the interest embeddings under the interest-item interaction hypergraph and the interest embeddings under the global interest-item transformation graph are obtained from step B. If the interest embeddings under the interest-item interaction hypergraph and the interest embeddings under the global interest-item transformation graph correspond to the same session, then this pair of interest embeddings is recorded as a positive sample. That is, the embedding of interest 1 under the interest-item interaction hypergraph and the embedding of interest 1 under the global interest-item transformation graph are a pair of positive samples, the embedding of interest 2 under the interest-item interaction hypergraph and the embedding of interest 2 under the global interest-item transformation graph are a pair of positive samples, the embedding of interest 3 under the interest-item interaction hypergraph and the embedding of interest 3 under the global interest-item transformation graph are a pair of positive samples, and the rest are negative samples; the two types of interest embeddings are subjected to contrastive learning to obtain a loss function under contrastive learning, and it is added to the final loss function for training.
[0111] Step E: Calculate the candidate item recommendation probability.
[0112] Specifically in this embodiment, the recommendation probability is calculated by taking the inner product of the feature representations of session 1, session 2, and session 3 and the candidate items, and the item most likely to be recommended for each session is obtained.
[0113] To evaluate the IDGC method proposed in this patent, two common datasets are used to compare the IDGC method with representative methods in other session recommendation fields. The two common datasets are Diginetica and Yoochoose 1 / 64 respectively. The source of Diginetica is CIKM Cup 2016 (http: / / cikm2016.cs.iupui.edu / cikm-cup), and the source of the Yoochoose1 / 64 dataset is RecSys Challenge 2015 (http: / / 2015.recsyschallenge.com / challenge.html). The dataset Diginetica includes 719,470 training sessions, 60,858 test sessions, and the total number of items is 43,097; the dataset Yoochoose 1 / 64 includes 369,859 training sessions, 55,898 test sessions, and the total number of items is 17,745. During the training process, the dimension of the representation vector of the item is set to 100, the Adam optimizer is used, the initial learning rate is 0.001, and it decays by 0.1 every three epochs. The training results are shown in the following table.
[0114]
[0115]
[0116] Table 1 Comparison of the experimental results of the IDGC method of the present invention with the experimental results of other traditional methods
[0117] As can be seen from the above table, the IDGC method of the present invention has improved in both the hit rate and the mean reciprocal rank. Among them, the hit rate refers to the frequency of the recommended item sequence containing the correctly recommended item. The higher this index, the better the recommendation effect; the mean reciprocal rank refers to the sum of the reciprocals of the positions of the correct items in the recommendation list. The higher this index, the better the recommendation effect.
[0118] So far, the technical solution of the present invention has been described in detail in conjunction with the preferred embodiments shown in the accompanying drawings of the specification. However, those skilled in the art can easily understand that the protection scope of the present invention is obviously not limited to this specific embodiment. Without departing from the principle of the present invention, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will fall within the protection scope of the present invention.
Claims
1. An interest-aware dual-channel graph contrastive learning session recommendation method, characterized in that: The method includes step S0 of constructing an item set, a session set and sessions, defining V as the set of all items, i.e., the item set, V = {v1, v2, v3,..., v |V|}, where |V| is the number of items, defining S as the set of all sessions, i.e., the session set, S = {s1, s2, s3,..., s |S|}, where |S| is the number of items, each session is represented as a set s, s = [v1, v2, v3,..., v n , n is the length of the session; step S1 of constructing an interest-item interaction hypergraph and a global interest-item transformation graph according to session data; step S2 of inputting the constructed interest-item interaction hypergraph and global interest-item transformation graph into a dual-channel interest-item embedding learning module, designing two channels to process the two graph structures respectively, and obtaining interest embeddings and item embeddings under the two graph structures, including designing a hypergraph item embedding learning module, and using a hypergraph convolutional network to perform embedding learning on the item nodes in the hypergraph. The specific method is as follows: Among them, represents the item embedding in the l-th layer of the hypergraph convolutional network, where l ranges from 0 to L, and L is a set hyperparameter. C is the incidence matrix of the interest-item interaction hypergraph G h of and respectively represent the degree matrix of the hyperedges in h and the degree matrix of all vertices in V. T represents the transpose operation. Design a global graph item embedding learning module and input the constructed global interest-item conversion graph into the gated graph neural network as follows: Among them, represents the i-th item embedding in the l-th layer of the network, where l ranges from 0 to L, and L is a set hyperparameter, is the update gate in the gated graph neural network, is the reset gate in the gated graph neural network; A s is the adjacency matrix, U1, U2, U3, U4 and W1, W2, W3 control the weights, and b1 is a trainable parameter, is an intermediate quantity in the calculation process, ⊙ represents the element-wise product, tanh represents the hyperbolic tangent function, σ represents the sigmoid function, and T represents the transpose operation; the interest nodes are initialized as follows: Among them, represents the item embedding of the i-th item under the interest-item interaction hypergraph, and α i represents the attention score, u h’ and u h’ are intermediate quantities in the calculation process, n represents the length of the session, W4, W5 ∈ R d×d and q1, b2 ∈ R d are all learnable parameters, and T represents the transpose operation; the interest embedding is updated according to the obtained item embedding, and the specific method is as follows: where W6, W7 ∈ R 1×d are learnable parameters, represents the item embedding of the i-th item under the interest-item interaction hypergraph, n represents the length of the session; and update the item nodes using the updated interest nodes, the specific method is as follows: Among them, represents the embedding of the j-th interest node connected to the item node, where W8, W9 ∈ R 1×d are learnable parameters. In a similar way, the updated embedding h g of the item node in the global interest-item conversion graph is obtained. Add the item embeddings h h and h g obtained from the two views to get the final item embedding H = {h1, h2, h3,..., h |V|}; Step S3, aggregate the obtained item embeddings into a session representation embedding, and enhance the session representation using position information and time information; Step S4, use contrastive learning to enhance the interest embeddings obtained from the two graphs; and Step S5, calculate the recommendation probability of candidate items and give a loss function.
2. The interest-aware dual-channel graph contrastive learning conversation recommendation method according to claim 1, wherein: In step S1, the method for constructing the interest-item interaction hypergraph is as follows: Define G h =(V h , U h , E h , W h ), where represents all items in the item set V, represents the interest nodes added for each session, represents the set of edges, where represents the set of hyperedges. The i-th hyperedge connects all items in the i-th session, represents the set of undirected edges connecting the interest nodes and the items in the session corresponding to the interest nodes. W h represents the weight matrix of the hyperedges, where represents the weight of the hyperedge ; The method for constructing the global interest-item transformation graph is as follows: Define G g =(V g , U g , E g ), where represents all items in the item set V, represents the interest nodes corresponding to each session, and E g represents the set of edges, which is divided into two types. One is the directed edges formed according to the interaction order between the item nodes, and the other is the undirected edges connecting the interest nodes and the item nodes.
3. The interest-aware dual-channel graph contrastive learning conversation recommendation method according to claim 1, characterized in that: Step S3 includes obtaining position information embedding: using a learnable position matrix P = [p1, p2, p3,..., p n to record the position information of items in each session; obtaining time information embedding: by calculating the difference in timestamps between adjacent items, obtaining a time matrix T = [t1, t2, t3,..., t n that records the time information of different items. For each session s, adding P and T to the item embedding H to obtain the final item embedding X = [x1, x2, x3,..., x n ; and obtaining session embedding: using the last item embedding x n in session s as the session embedding at the local level, then using a soft attention mechanism to calculate weights to obtain the session embedding at the global level, and combining the global-level embedding and the local-level embedding of the session to obtain the session embedding s f , the specific method is as follows: s l = x n s f = s l + s g where x i represents the item embedding of the i-th item in the session, n represents the length of the session, s * is an intermediate quantity in the calculation process, θ i represents the attention score of item i for the entire session, s g represents the session embedding at the global level, s l represents the session embedding at the local level, W 10 , W 11 and q2, b3 are learnable parameters.
4. The interest-aware dual-channel graph contrastive learning conversation recommendation method according to claim 1, wherein: The content of step S4 includes: according to the total number of sessions defined in session set S as |S|, the total number of all interest nodes in the two calculated views is 2|S|, and two interest embeddings defining the interest bias representing the j-th session in the two views are a pair of positive samples, and the remaining 2|S| - 1 pairs are negative samples. The InfoNCE loss is used as the contrastive loss, and the specific method is as follows: Among them, L s represents the contrastive learning loss function, and l j represents the loss corresponding to the j-th session. represents the positive sample pair, (u p , u q ) represents all sample pairs, sim() represents the cosine similarity, and τ is a hyperparameter.
5. The method for interest-aware dual-channel graph contrastive learning session recommendation according to claim 4, wherein: The specific calculation formula for the step S5 is as follows: L = L c + λL s where s f is the session embedding representation; z i represents the true label of the i-th candidate item, represents the predicted probability of the i-th candidate item, L c represents the cross-entropy loss function, L s represents the contrastive learning loss function, L represents the final loss function, and λ is a learnable parameter.
Citation Information
Patent Citations
Graph neural network session recommendation method based on time enhancement
CN114186139A
Contrast learning session recommendation method fusing hypergraph
CN116186390A