Prediction method based on time-aware hypergraph convolution
By introducing a time-aware hypergraph convolution method in the recommendation system, the time-aware hypergraph and local graph are constructed, which solves the problem of failing to make full use of timestamp data in the prior art and achieves more accurate item recommendations.
Patent Information
- Application Number
- CN202210611429.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-31
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2042-05-31
AI Technical Summary
When applying graph neural networks, existing session-based recommendation systems fail to fully utilize the time stamp data of items and cannot effectively capture complex high-order dependencies between items.
A time-aware hypergraph convolution session recommendation method is proposed. By constructing time-aware hypergraphs and local graphs, graph convolutions and graph attention networks are used to capture high-order dependencies between items and make prediction recommendations.
This method can more effectively characterize the relationship between items, improve the accuracy of recommendations and the average reciprocal ranking, not only considering the number of occurrences of items, but also the time interval between items.
Smart Images

Figure CN114880576B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a technology in the field of neural network applications, specifically a prediction and recommendation method based on time-aware hypergraph convolutional sessions. Background Art
[0002] Existing session-based recommendation systems, when applying graph neural networks, often only assign weights to each edge based on the number of times an item appears, without considering that the weights of items at different time intervals should be different. In those models that consider item timestamps, timestamps are often added to the recurrent neural network as additional information to capture continuous item dependencies, but cannot capture complex high-order item conversion relationships.
[0003] After searching the prior art, it was found that Chinese patent document No. CN113672811A was published on 20211119, disclosing a hypergraph convolution collaborative filtering recommendation method, system and computer-readable storage medium based on topological information embedding, the method comprising: obtaining user and project interaction data, and constructing a user-project interaction bipartite graph; constructing an initial embedding lookup table of users and projects, and using a clustering algorithm to perform subgraph division; encoding the clustered subgraph to obtain a positional topological code; defining an association rule table, using the association rule table to obtain user and project hyperedge groups respectively, integrating the hyperedge groups to generate a hypergraph, and obtaining a hypergraph association matrix; learning the high-order neighborhood complex correlations between users and projects respectively through hypergraph convolution operations, combining the output of the hypergraph convolution with the positional topological code, and obtaining an embedding vector through information fusion; performing inner product processing on the embedded vector to obtain the association score between the user and the project, and recommending projects that may be of interest to the user based on the association score. However, the existing technology is mainly aimed at ordinary user-item recommendation scenarios. User information needs to be used in the model, and ordinary hypergraph convolution is used. Ordinary hypergraph convolution has been widely used since it was proposed in 2003. It only models a global hypergraph to consider the global item dependency. Summary of the invention
[0004] The present invention aims to solve the problem that the prior art does not fully utilize the timestamp data of interactive items, that is, in the composition, the weight of each edge in the graph is only assigned according to the number of times the item appears, and the time information is not used. A time-aware hypergraph graph convolution session recommendation method is proposed. In the composition, the time interval information of the items should be fully mined and applied to the graph convolution. The known session sequence is constructed into a hypergraph and a local graph. The weight of each edge in the graph is jointly determined by the number of times the item appears and the time interval. The next item to be clicked is predicted through the recommendation system model. In the industry, in many cases, there are cold start problems when the user is not logged in and for new users. In these two cases, the user's personal information and historical click sequence are unknown. The present invention can effectively complete the recommendation based on the high-order dependency relationship between items based on anonymous session modeling, which has practical value in the industry.
[0005] The present invention is achieved through the following technical solutions:
[0006] The present invention relates to a time-aware hypergraph graph convolution conversation recommendation method, which converts an item click sequence into a time-aware hypergraph and a local graph, and captures high-order item conversion relationships in the hypergraph according to the time-aware hypergraph graph convolution, and mines the dependency relationship between items in conversation sequence data according to the graph attention network. After training and achieving simultaneous convergence, the next item to be clicked is predicted.
[0007] The time-aware hypergraph G T =(V,E), counts the number of occurrences and time intervals of items in all sessions, and is used to calculate the dependencies between all items globally, where: V and E are the set of item nodes and the set of hyperedges, respectively.
[0008] The local graph records the relationship between adjacent items in a session. The nodes in the local graph represent each item. When item i appears after item j, a directed edge is connected between i and j. The weight of the edge is determined by the number of times the two items appear together in the session and the time interval.
[0009] After the graph is constructed, two different representations are obtained for each item by performing graph convolution in a time-aware hypergraph and a local graph. In general, in the global graph, the present invention constructs a time-aware hypergraph and performs graph convolution on the time-aware hypergraph, capturing high-order dependencies between items by continuously multiplying the weighted Laplacian matrix. In the local graph, the present invention uses a graph attention network to calculate the similarity of adjacent nodes and aggregate neighbor information to obtain item dependencies within the session.
[0010] The recommended method specifically includes:
[0011] Step 1) Data preprocessing: Clean all session sequences, remove noise data and items that appear too few times, and retain the timestamps of all items in the session. Then perform data enhancement, treat subsequences of different lengths starting from the beginning of each session as a new session, and the subsequent items as target items to form a new training sample.
[0012] Step 2) Constructing hypergraph and local graph: First, count the number of occurrences of all items in all sessions and the corresponding timestamps. Based on this information, use the principle of hypergraph to construct a time-aware hypergraph as a hypergraph through special matrix operations. Then, for each session, construct a local graph, with an edge between adjacent item nodes. The weight of the edge is determined by the number of co-occurrences of the items and the time interval.
[0013] Step 3) Training the recommendation model: Based on the constructed local graph and hypergraph, the present invention designs corresponding graph convolution operations. In the hypergraph, the hypergraph graph convolution operation is applied to aggregate the information of high-order neighbors, and in the local graph, the graph attention network is applied to aggregate the information of similar items in a session. After the model training is completed, the model generates a low-dimensional vector expression for each item for the final recommendation result generation.
[0014] Step 4) Recommendation results: After obtaining the global representation and local representation of the item by graph convolution respectively, the two different representations are first fused to obtain the expression of each item. Since there are multiple items in a session, the present invention then uses the attention mechanism to take the average of all item expressions as the query, calculates the similarity score between each item in the session and the query, and then weights and aggregates the expressions of all items in a session according to the scores to obtain the expression of the session. Finally, the expression of the session is used to calculate the preference for all items through dot product operation. According to the calculated preference scores, the items are sorted from high to low, and the highest k items are selected for recommendation to obtain the final recommendation results.
[0015] The present invention relates to a hypergraph convolution conversation recommendation system for implementing the above method, comprising: a global graph item representation learning unit, a local graph item representation learning unit, a session representation generation unit and a recommendation unit, wherein: the global graph item representation learning unit constructs a time-aware hypergraph based on all global conversation information, and then uses the global representation of the graph-convolved items; the local graph item representation learning unit constructs a local graph based on the items in the conversation, and then learns the local representation of the items through a graph attention network; the session representation generation unit aggregates the item representations in the conversation to obtain the conversation representation based on the global representation and local representation of the items using an attention mechanism; the recommendation unit performs dot product calculation scores on the conversation representation and the initialization of the conversation representation and the items, and recommends the k items with the highest scores.
[0016] Technical Effects
[0017] Compared with the existing hypergraph convolution, when composing a graph, weights are only assigned according to the number of times an item appears. The present invention is based on time-aware hypergraph convolution. After learning the item representation, it can better characterize the relationship between items. When making the final prediction, it can effectively improve the prediction accuracy and average reciprocal ranking. It not only considers the number of occurrences but also the time interval between items, making the calculation of weights more meaningful. The shorter the adjacent time, the higher the weight. Then, the global graph representation of each item can be obtained through convolution operation. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 It is a flow chart of the present invention;
[0019] Figure 2 It is a schematic diagram of the structure of a time-aware hypergraph convolutional recommendation model of an embodiment;
[0020] Figure 3 Schematic diagram of the time-aware hypergraph convolution proposed in the present invention. DETAILED DESCRIPTION
[0021] like Figure 1 As shown, the hypergraph convolution session recommendation method based on time perception in this embodiment includes:
[0022] Step 1) Data preprocessing: The identification of each item and the timestamp of the interaction are retained in the session, that is, [<item1,time1> ,<item2,time2> …], where item2 represents an item in the session, time2 represents the timestamp of the corresponding item, and all items in the session are arranged in chronological order. First, the session data needs to be cleaned to remove possible noise, such as items that appear too few times and sessions that only contain one item. Then, for each session, the items are sorted according to their interaction time, with the items that interacted first being ranked first. At the same time, the data is enhanced, and for each session of length n, n-1 subsequences are generated, and the item after the subsequence is used as the target item of the subsequence.
[0023] Step 2) First, a time-aware hypergraph and local graph are constructed using the time-aware hypergraph convolution technology. The specific steps include:
[0024] 2.1) A hyperedge in a hypergraph may contain more than two nodes. A session usually contains multiple items and corresponding timestamps. In this embodiment, each item is modeled as a node, each session is modeled as a hyperedge, and the items in the session are sorted in chronological order. In a hypergraph, as long as two nodes appear together in a hyperedge, an edge is connected between each two nodes. The weight of the edge is determined by the number of times the two items appear together and the time interval between them in different sessions. In this embodiment, the number of all sessions and all items is set to M and N respectively, that is, |E|=M and |V|=N.
[0025] 2.2) In a local graph consisting of a single session, some items may appear multiple times and thus have multiple successor nodes. The indexes of all successor nodes of an item v in the session are counted and recorded as the successor node index set D s (v) = {j+1|v j =v,v j+1 ≠v,v j ∈s,v j+1 ∈s}, where: v j Represents the jth item in the session. The elements in this set are the set of subscripts of all subsequent items of item v.
[0026] 2.3) The successor node index set is used to calculate the weight of each edge and perform normalization in the time-aware local graph.
[0027] Step 3) Build and train Figure 2 The time-aware hypergraph recommendation model shown in the figure includes: an input layer, a global representation learning layer, a local representation learning layer, a session representation generation layer and a recommendation result generation layer, wherein: the input layer takes all nodes in the hypergraph and the local graph as input, randomly generates a vector x for each node as the initialization representation of the node, and initializes a vector c for different time intervals as the representation of the interval; the global representation learning layer obtains the global representation of the item through multiple layers of convolution; the local representation learning layer uses the graph attention network to dynamically capture the correlation between different items in a session, and obtains the local representation of the item by aggregating the representation of the neighbors around a point; the session representation generation layer fuses the global representation and the local representation to generate an embedded expression representing the session; the recommendation layer calculates the similarity between the representation of the session and the initialization representation of each item, scores each candidate item and recommends the item with the highest score.
[0028] The global representation of the item is: the item representation calculated by the time-aware hypergraph convolution, which is represented as When calculating the weight, the number of occurrences and time intervals of the items are taken into account. The weight distribution from point to session and from session to point are represented by two matrix dimensions, namely: in represents the timestamp of the i-th item in session ∈, t ∈ Indicates the timestamp when the last item click occurred in the session.
[0029] In order to ensure that the time perception weight of any two items in different sessions is a number less than 1, a function φ(·) is designed. When x<1, φ(x)=x, and when x>1, The weight between every two items is obtained through matrix operation, specifically: Among them: f is a newly defined function, i, j represent the subscripts of the matrix, and each item is determined by the time interval between two items in the session in which they co-appear. Using the designed matrix mentioned above and the defined matrix operation, we can get the relationship matrix of the items. The elements of this matrix can represent the weight between any two items. This weight not only considers the number of times the items co-appear, but also the time price of the items in any session. In this way, when performing graph convolution, the weight between items with more co-appearances and shorter time intervals will be greater. Therefore, compared with the existing hypergraph convolution, the time-aware hypergraph convolution can better examine the dependency between items and learn better item representations.
[0030] Through multi-layer convolution, we can get the global object representation of each layer. Where: τ represents the activation function, RN(·) represents the row normalization function, P (l) is a trainable parameter, l represents the number of layers, and finally the results of each layer are added together to obtain the final global object representation.
[0031] The local representation of the object is obtained specifically by the following method:
[0032] i) Calculate the time-aware weight for each edge: in: represents the timestamp of the i-th item in session s, 1 represents an indicative function, which returns 1 when the condition is true, otherwise it returns 0, D(v i ) represents the aforementioned successor node index set. The weight is obtained by weighting the time interval weight of the item according to the number of occurrences of the item.
[0033] ii) Use the graph attention network to dynamically calculate the similarity between every two points in the graph in: Indicates different types of edges. In this embodiment, there are four types of edges: one-way, self-loop, and bidirectional. Attention scores are calculated for different types of edges. is the representation of the item, w ij The vector representing the edge. ij is the calculated similarity score, e ij It is for α ij The value obtained after softmax normalization.
[0034] iii) The final local representation of a point is obtained by aggregating the representations of its neighbors
[0035] The embedding expression is to generate the final item representation based on the global and local representations of the items generated above, and then generate the final session embedding expression based on the representation of each item in the session. Specifically, the local and global representations of the items are fused: in: and They represent the local representation and global representation of the item respectively, and after fusion, the final embedding representation of the item is obtained
[0036] In a session, different items have different influences on the items to be predicted. Generally speaking, the closer the item is to the recommendation time, the greater its influence on the target item (the item at the next moment). In order to better measure the influence of items at different time intervals on the target item, this embodiment designs a time interval embedding c and fuses the time interval embedding with the item representation through an MLP network. in: and is the corresponding final representation of the item and the time interval representation, W1 and b1 are trainable parameters. First, calculate the average value s of each item representation ave , and then obtain the final representation of the session through the attention mechanism: Among them: W2, W3, b2 and is a trainable parameter, β i is the calculated attention score, and s is the representation finally generated for each session.
[0037] The item with the highest score is: after calculating the similarity score between the session representation and the item representation, specifically: calculating in: represents the initialization vector of the item, is the calculated score of the final candidate items. The top k items are selected for recommendation.
[0038] The training described above uses cross entropy as the loss function: Where: y i Indicates the true score of the item, that is, the score for positive samples is 1 and the score for negative samples is 0.
[0039] In the time-aware hypergraph, due to too many parameters, the convergence speed is very slow in reverse derivation, while in the local graph, since only the item information in one session is aggregated, the convergence speed is very fast. Therefore, when training these two graphs at the same time, the effect cannot be optimal. When the hypergraph converges, the local graph may be overfitted. In this embodiment, the hypergraph (the time-aware hypergraph) is trained first, that is, only the local graph is used. Complete the recommendation prediction, and when the network converges to a certain degree, add the representation of local graph items Put two Figure 1 This allows the two parts to converge simultaneously to achieve the optimal result.
[0040] Through specific practical implementation examples, the present invention is compared with existing methods under two data sets Diginetica and Yoochoose collected from real life. The data set Diginetica has 7194700 sessions for training and 60858 sessions for testing, involving a total of 43097 items. The data set Yoochoose has 369859 sessions for training and 55898 sessions for testing, involving a total of 17745 items. In this method, the number of network layers in the global item representation learning unit is set to 3, and the number of network layers in the local item representation learning unit is set to 1. The representation vector dimension of all items is set to 100. The comparison is made on the two indicators of hit rate and average reciprocal ranking on the top 20 items with the highest scores, and the embodiment data that can be obtained are shown in the following table:
[0041]
[0042] Compared with the prior art, the present invention has achieved significant improvements in two indicators, hit rate and average reciprocal ranking, on two data sets. Hit rate refers to the frequency of correct items in the recommended items. The higher this indicator is, the better the recommendation effect is. Average reciprocal ranking refers to the sum of the reciprocals of the positions of correct items in the recommendation list. The higher this indicator is, the better the recommendation effect is.
[0043] The above-mentioned specific implementation can be partially adjusted in different ways by those skilled in the art without departing from the principle and purpose of the present invention. The protection scope of the present invention shall be based on the claims and shall not be limited by the above-mentioned specific implementation. Each implementation scheme within its scope shall be subject to the constraints of the present invention.
Claims
1. A time-aware hypergraph convolutional session recommendation method, characterized in that: The item click sequence is converted into a time-aware hypergraph and local graph, and the high-order item conversion relationship in the hypergraph is captured based on the time-aware hypergraph graph convolution. The dependency relationship between items in the session sequence data is mined based on the graph attention network. After training and achieving simultaneous convergence, the next item to be clicked is predicted. The time-aware hypergraph G T =(V,E), counts the number of occurrences and time intervals of items in all sessions, and is used to calculate the dependencies between all items in the global scope, where: V and E are the set of item nodes and the set of hyperedges respectively; The local graph records the relationship between adjacent items in a session. The nodes in the local graph represent each item. When item i appears after item j, a directed edge is connected between i and j. The weight of the edge is determined by the number of times the two items appear together in the session and the time interval. The recommended method specifically includes: Step 1) Data preprocessing: Clean all session sequences, remove noise data and items that appear too few times, and retain the timestamps of all items in the session; then perform data augmentation, treat subsequences of different lengths starting from the beginning of each session as a new session, and the subsequent items as target items to form a new training sample; Step 2) Constructing a hypergraph and a local graph: First, count the number of occurrences of all items in all sessions and the corresponding timestamps. Based on this information, apply the principle of hypergraphs and construct a time-aware hypergraph as a hypergraph through special matrix operations. Then, for each session, construct a local graph, with an edge between adjacent item nodes. The weight of the edge is determined by the number of co-occurrences of the items and the time interval. Step 3) Construct and train a time-aware hypergraph recommendation model, which includes: an input layer, a global representation learning layer, a local representation learning layer, a session representation generation layer, and a recommendation result generation layer, wherein: the input layer takes all nodes in the hypergraph and the local graph as input, randomly generates a vector x for each node as the initialization representation of the node, and initializes a vector c for different time intervals as the representation of the interval; the global representation learning layer obtains the global representation of the item through multiple layers of convolution; the local representation learning layer uses the graph attention network to dynamically capture the correlation of different items in a session, and obtains the local representation of the item by aggregating the representation of the neighbors around a point; the session representation generation layer fuses the global representation and the local representation to generate an embedded expression representing the session; the recommendation layer calculates the similarity between the representation of the session and the initialization representation of each item, scores each candidate item, and recommends the item with the highest score; Step 4) Recommendation results: After obtaining the global and local representations of the items through graph convolution, the two different representations are first fused to obtain the expression of each item; since there are multiple items in a session, the attention mechanism is used to take the average of all item expressions as the query, and the similarity score between each item in the session and the query is calculated. Then, the expressions of all items in a session are weighted and aggregated according to the scores to obtain the expression of the session; finally, the expression of the session is used to calculate the preference for all items through dot product operation; according to the calculated preference scores, the items are sorted from high to low, and the top k items are selected for recommendation to obtain the final recommendation result; The training described above uses cross entropy as the loss function: Where: y i Indicates the true score of the item, that is, the score for the positive sample is 1 and the score for the negative sample is 0; First, we train the time-aware hypergraph, using only Complete the recommendation prediction and add the representation of local graph items when the network converges Train the two images together.
2. The time-aware hypergraph convolutional session recommendation method according to claim 1 is characterized in that: The step 2 specifically includes: 2.1) In a hyperedge of a hypergraph, there may be more than two nodes. A session usually contains multiple items and corresponding timestamps. Each item is modeled as a node and each session is modeled as a hyperedge. The items in the session are sorted in chronological order. In the hypergraph, as long as two nodes appear in a hyperedge together, an edge is connected between each two nodes. The weight of the edge is determined by the number of times the two items appear together and the time interval between them in different sessions. The number of all sessions and all items is set to M and N respectively, that is, |E| = M and |V| = N. 2.2) In a local graph consisting of a single session, some items may appear multiple times and thus have multiple successor nodes; the indexes of all successor nodes of an item v in the session are counted and recorded as the successor node index set D s (v) = {j+1|v j =v,v j+1 ≠v,v j ∈s,v j+1 ∈s}, where: s is the item representation calculated based on the time-aware hypergraph convolution, v j represents the jth item in the session. The elements in this set are the set of subscripts of all subsequent items of item v; 2.3) The successor node index set is used to calculate the weight of each edge and perform normalization in the time-aware local graph.
3. The time-aware hypergraph convolutional session recommendation method according to claim 1, characterized in that: The global representation of the item is: the item representation calculated by the time-aware hypergraph convolution, which is represented as When calculating the weight, in order to take into account the number of occurrences and time intervals of the items, two matrix dimensions are used to represent the weight distribution from point to session and from session to point, respectively. Specifically: in represents the timestamp of the i-th item in the session ∈, and t∈ represents the timestamp of the last item click in the session; Global item representation per layer Where: τ represents the activation function, RN(·) represents the row normalization function, P (l) is a trainable parameter, l represents the number of layers, and finally the results of each layer are added together to obtain the final global object representation.
4. The time-aware hypergraph convolutional session recommendation method according to claim 3 is characterized in that: Further design the function φ(·), when x<1, φ(x)=x, when x>1, The weight between every two items is obtained through matrix operation, specifically: Where: f is a newly defined function, i and j represent the subscripts of the matrix, and each item is determined by the time interval between two items in the session in which they co-appear. Using the designed matrix mentioned above and the defined matrix operation, we get the item relationship matrix. The elements of this matrix represent the weight between any two items, which not only considers the number of times the items co-appear but also the time price of the items in any session.
5. The time-aware hypergraph convolutional session recommendation method according to claim 1, characterized in that: The local representation of the object is obtained specifically by the following method: i) Calculate the time-aware weight for each edge: in: represents the timestamp of the ith item in session s, 1 represents an indicative function, which returns 1 if the condition is true, otherwise it returns 0, D(v i ) represents the aforementioned successor node index set; the weight is obtained by weighting the time interval weight of the item according to the number of occurrences of the item; ii) Use the graph attention network to dynamically calculate the similarity between every two points in the graph in: Indicates different types of edges, which are divided into four categories: one-way, self-loop, and bidirectional. Attention scores are calculated for different types of edges. is the representation of the item, w ij The vector representing the edge; α ij is the calculated similarity score, e ij It is for α ij The value obtained after softmax normalization; iii) The final local representation of a point is obtained by aggregating the representations of its neighbors 6. The time-aware hypergraph convolutional session recommendation method according to claim 1, characterized in that: The embedding expression refers to: generating a final item representation based on the global representation and local representation of the item generated above, and then generating a final session embedding expression based on the representation of each item in the session, specifically: fusing the local representation and global representation of the item: in: and They represent the local representation and global representation of the item respectively, and after fusion, the final embedding representation of the item is obtained 7. A hypergraph graph convolution conversation recommendation system that implements the time-aware hypergraph graph convolution conversation recommendation method according to any one of claims 1 to 6, characterized in that: include: The global graph item representation learning unit, the local graph item representation learning unit, the generated session representation unit and the recommendation unit, wherein: the global graph item representation learning unit constructs a time-aware hypergraph based on all global session information, and then uses the global representation of the items through graph convolution; the local graph item representation learning unit constructs a local graph based on the items in the session, and then learns the local representation of the items through the graph attention network; the generated session representation unit aggregates the item representations in the session to obtain the session representation based on the global and local representations of the items using the attention mechanism; The recommendation unit calculates the dot product of the session representation and the initialization of the session representation and the item, and sorts the scores, and recommends the k items with the highest scores.
Citation Information
Patent Citations
Hypergraph convolution collaborative filtering recommendation method and system based on topological information embedding, and computer readable storage medium
CN113672811A
Recommendation system based on graph convolution technology
CN109299373A
Session recommendation method based on space-time sequence diagram convolutional network
CN112035746A