A sequence recommendation method, device, and medium
By constructing a Top-k global item map and a combination graph convolution network and a convolutional neural network, we can capture the long-term and short-term interest information between users and items, and solve the shortcomings in accuracy and real-time of the existing sequence recommendation system, and achieve more efficient personalized recommendations.
Patent Information
- Application Number
- CN202510533837.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-27
- Publication Date
- 2025-07-22
- Estimated Expiration
- 2045-04-27
AI Technical Summary
The existing sequence recommendation system fails to fully tap the potential of graph neural networks in processing user behavior sequences and extracting sequences, resulting in insufficient recommendation accuracy and real-timeness.
By constructing a Top-k global item map, combining graph convolution networks and convolutional neural networks, long-term and short-term interest information between users and items is captured, and the shortest path algorithm is used to quantify the global correlation between items, generate dynamic maps and extract item characteristics, and personalized recommendations.
It improves the accuracy and real-timeness of sequence recommendations, enhances the expressiveness of user characteristics, improves the ability to capture long-term and short-term interests, and improves the accuracy and personalized service capabilities of recommendations.
Smart Images

Figure CN120070872B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of electronic digital data processing, and particularly to a sequence recommendation method, device and medium. Background Art
[0002] With the rapid development of Internet, Internet of Things and mobile information technologies, the progress of information technology and Internet has not only accelerated information dissemination, but also brought about information explosion, entering an era of information overload. Although the massive amount of information provides users with more choices, it also makes it extremely difficult for users to quickly find the content they need among numerous information. In this context, recommendation systems have emerged as an important tool to solve the problem of information overload. By combining the personal characteristics of users (such as geographical location, gender, age, etc.), the characteristic information of items (such as category, time, origin, etc.) and historical interaction data (such as clicks, favorites, etc.), recommendation systems accurately model user preferences to achieve personalized recommendations. By filtering out irrelevant information, recommendation systems can improve user satisfaction and platform retention rate, help information seekers quickly find the content they need, and achieve a win-win situation for information providers and users.
[0003] A sequence recommendation system is a recommendation technology that predicts the next interest of users based on their historical interaction behaviors (such as browsing, clicking, favoriting, purchasing, etc.), and is particularly suitable for scenarios such as e-commerce, video platforms and online education. Different from traditional recommendation methods, sequence recommendation systems can not only mine users' long-term preferences, but also capture the dynamic changes of short-term interests. For example, on an e-commerce platform, if a user frequently browses items of a certain category in a short period of time, the sequence recommendation system can identify and timely recommend items of that category.
[0004] Different from traditional static recommendation systems, sequential recommendation systems learn dynamic feature embeddings by leveraging users' interaction sequences to achieve more accurate predictions. Initially, sequential recommendation identified changes in users' interests by capturing patterns in the user behavior sequences. With the advancement of deep learning, methods based on recurrent neural networks (RNNs) became popular, effectively capturing users' dynamic interests by modeling the temporal dependencies in the sequences. With the introduction of self-attention mechanisms and Transformer models, sequential recommendation systems began to better capture the complex dependencies between items in the sequence, further improving the accuracy of recommendations. In recent years, graph neural networks (GNNs) have been introduced into sequential recommendation tasks, allowing models to more effectively utilize the complex relationships and higher-order connectivity between users and items. The historical interaction behaviors of users can be constructed as a user-item bipartite graph. GNNs have significant advantages in capturing relationships between nodes and representing graph data. By introducing GNNs, the higher-order connectivity in the user-item bipartite graph can be better utilized to generate more accurate user and item embedding representations. Sequential recommendation systems based on graph neural networks can improve the accuracy and quality of recommendations by learning about items, users, and the relationships between them, thus providing more personalized recommendations for users.
[0005] In recent years, significant progress has been made in sequential recommendation techniques based on graph neural networks. However, overall, the research on integrating graph neural networks with sequential recommendation tasks is still in the exploratory stage, and the potential of graph neural networks in processing user behavior sequences and extracting collaborative information between sequences has not been fully exploited. Summary of the Invention
[0006] The objective of this application is to provide a sequential recommendation method, device, and medium that can improve the accuracy and real-time performance of sequential recommendations.
[0007] To achieve the above objective, this application provides the following solutions:
[0008] In a first aspect, this application provides a sequential recommendation method, including:
[0009] Constructing a Top-k global item graph based on the relevance between items in the user interaction sequence; the user interaction sequence is a sequence formed by the interaction information between users and items;
[0010] Generating a dynamic graph based on the user interaction sequence;
[0011] Using a graph convolutional network and a convolutional neural network, based on the dynamic graph, long-term interest information and short-term interest information are obtained; the long-term interest information refers to the stable and continuous interests or preferences of the user within a first set time, as well as the effective characteristics of the item itself; the short-term interest information is the real-time impact on the characteristics of the user and the item caused by the current environment, situation or behavior within a second set time; the first set time is greater than the second set time;
[0012] Based on the Top-k global item graph, item features related to the items currently of interest to the user are extracted;
[0013] Based on the item features related to the items currently of interest to the user, the long-term interest information and the short-term interest information, item sequence recommendation information is obtained.
[0014] Optionally, constructing a Top-k global item graph based on the correlation between items in the user interaction sequence includes:
[0015] Constructing an initial global item graph based on the user interaction sequence, and constructing a global item graph based on the initial global item graph using the shortest path algorithm;
[0016] In the global item graph, retain the first edges with the largest correlation for each item to obtain the Top-k global item graph.
[0017] Optionally, in the process of constructing an initial global item graph based on the user interaction sequence and constructing a global item graph based on the initial global item graph using the shortest path algorithm, the number of times the end node of each directed edge is clicked after the start node is used as the weight of the directed edge;
[0018] Introduce a filtering mechanism to filter out the directed edges with weights lower than the set threshold parameter to obtain the directed weighted graph.
[0019] Optionally, constructing an initial global item graph based on the user interaction sequence and constructing a global item graph based on the initial global item graph using the shortest path algorithm includes:
[0020] In the user interaction sequence, the number of times an item is clicked after another item is used as the weight of the edge between this item and the other item;
[0021] When an item is adjacent to another item in the user interaction sequence, the weight of the edge between this item and the other item is increased by 1 to generate the initial global item graph;
[0022] Based on the weight of the edge between an item and another item in the initial global item graph, determine the cost value of the edge;
[0023] Using the shortest path algorithm, based on the cost value, determine the minimum cost from each item to other items, and generate a shortest path graph;
[0024] In the shortest path graph, based on the minimum cost from one item to another item, determine the weight of the edge between this item and the other item, and based on the weight of the edge between this item and the other item, combine with the maximum weight of the edges in the shortest path graph to obtain the correlation between this item and the other item, until the correlations between all items and other items in the shortest path graph are obtained, so as to generate the global item graph.
[0025] Optionally, generate a dynamic graph based on the user interaction sequence, including:
[0026] Regarding the click relationship between the user and the item in the user interaction sequence as the edge between the user and the item, and obtain the time point when the user clicks the item;
[0027] Regarding the time point as the attribute interaction timestamp of the edge between the user and the item, and generate a user-item bipartite graph;
[0028] Dynamically sample from the user-item bipartite graph to establish a user dynamic subgraph and a dynamic item subgraph centered on the user and the item;
[0029] Generate the dynamic graph based on the user dynamic subgraph and the dynamic item subgraph.
[0030] Optionally, using a graph convolutional network and a convolutional neural network, based on the dynamic graph, obtain long-term interest information and short-term interest information, including:
[0031] Using the graph convolutional network, obtain user long-term interest information based on the user dynamic subgraph;
[0032] Using the graph convolutional network, obtain item long-term interest information based on the dynamic item subgraph;
[0033] Obtain the long-term interest information based on the user long-term interest information and the item long-term interest information;
[0034] The interaction information between the user and the item within a set time with the current time as the end time point, and input the user dynamic subgraph corresponding to this interaction information into the convolutional neural network to obtain the short-term interest information.
[0035] Optionally, extract item features related to the item currently interested by the user based on the Top-k global item graph, including:
[0036] Apply graph convolutional network operations to extract the relevant features of the nodes connected to an item in the Top-k global item graph;
[0037] Obtain item features related to the item currently of interest to the user based on the relevant features.
[0038] Optionally, obtain item sequence recommendation information based on the item features related to the item currently of interest to the user, the long-term interest information, and the short-term interest information, including:
[0039] Generate an embedding of the user at the current time and an embedding of the item at the current time based on the item features related to the item currently of interest to the user, the long-term interest information, and the short-term interest information;
[0040] Determine the user preference score of the candidate item for the next time based on the embedding of the user at the current time and the embedding of the item at the current time;
[0041] Retain the candidate item information with the user preference score exceeding the set score threshold, and generate the item sequence recommendation information.
[0042] In a second aspect, the present application provides a computer device, including: a memory, a processor, and a computer program stored on the memory and executable on the processor, where the processor executes the computer program to implement the steps of the sequence recommendation method provided above.
[0043] In a third aspect, the present application provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the sequence recommendation method provided above are implemented.
[0044] According to the specific embodiments provided by the present application, the present application has the following technical effects:
[0045] The present application provides a sequence recommendation method, device, and medium. By constructing a Top-k global item graph based on the correlation between items in the user interaction sequence, personalized recommendations can be provided, improving the accuracy and real-time performance of sequence recommendations. Moreover, by using a graph convolutional network and a convolutional neural network to obtain long-term interest information and short-term interest information, the timeliness and relevance of user interests can be enhanced, thereby enhancing the expressiveness of user features and improving the recommendation accuracy. At the same time, by combining the advantages of the graph convolutional network and the convolutional neural network, the complex relationship between users and items can be better modeled, which can not only improve the ability to capture long-term and short-term interests, but also enhance the response speed of sequence recommendations in rapidly changing user interaction behaviors, thereby enhancing the personalized service ability and timeliness of sequence recommendations. Description of the Drawings
[0046] To more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the accompanying drawings required for use in the embodiments. Obviously, the accompanying drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other accompanying drawings can also be obtained based on these drawings.
[0047] Figure 1 Flow chart of a sequence recommendation method provided by an embodiment of the present application;
[0048] Figure 2 Initial global item graph provided by an embodiment of the present application;
[0049] Figure 3 Global item graph provided by an embodiment of the present application;
[0050] Figure 4 Flow chart of converting a user interaction sequence into a user-item bipartite graph provided by an embodiment of the present application;
[0051] Figure 5 Schematic diagram of dynamic subgraph sampling provided by an embodiment of the present application;
[0052] Figure 6 User-item bipartite graph provided by another embodiment of the present application;
[0053] Figure 7 Flow chart of dynamic graph convolution provided by another embodiment of the present application;
[0054] Figure 8 Flow chart of extracting user short-term interests provided by an embodiment of the present application;
[0055] Figure 9 Schematic diagram of item feature extraction provided by an embodiment of the present application;
[0056] Figure 10 Overall model implementation flow chart provided by an embodiment of the present application. Detailed implementation manners
[0057] The following will clearly and completely describe the technical solutions in the embodiments of the present application in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only some embodiments of the present application, rather than all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the scope of protection of the present application.
[0058] To make the above objects, features, and advantages of the present application more obvious and understandable, the present application will be further described in detail below in conjunction with the accompanying drawings and specific implementation manners.
[0059] In an exemplary embodiment, the present application provides a sequence recommendation method, which is executed by a computer device. Specifically, it can be executed independently by a computer device such as a terminal or a server, or jointly executed by a terminal and a server. In the embodiments of the present application, this method is described by taking the case where it is applied to a server as an example. As Figure 1 shown, the method includes:
[0060] Step 100: Construct a Top-k global item graph based on the relevance between items in the user interaction sequence. The user interaction sequence is a sequence formed by the interaction information between the user and the items.
[0061] Step 101: Generate a dynamic graph based on the user interaction sequence. Among them, the dynamic graph is derived from the user interaction sequence, with the current user and items as the central nodes, capturing the interaction patterns of the time series.
[0062] Step 102: Adopt a graph convolutional network and a convolutional neural network to obtain long-term interest information and short-term interest information based on the dynamic graph. The long-term interest information refers to the stable and continuous interests or preferences of the user within a first set time (i.e., a relatively long time), as well as the characteristics of the items that are effective for a long time. The short-term interest information is the real-time impact on the characteristics of the user and the items caused by the current environment, situation, or behavior within a second set time (i.e., recent behavior).
[0063] Step 103: Extract item features related to the item currently of interest to the user based on the Top-k global item graph. Among them, extract the item features most relevant to the current item to enrich the item representation and obtain context information from the relevant items.
[0064] Step 104: Obtain item sequence recommendation information based on the item features related to the item currently of interest to the user, the long-term interest information, and the short-term interest information. Among them, the long-term and short-term interest information can be integrated into a unified preference profile to predict the next item that the user is most likely to interact with.
[0065] In another exemplary embodiment of the present application, in traditional sequence recommendation methods, the relationship between items often depends only on the user's interaction history, and an item graph is constructed by establishing connection edges between adjacent items. However, this method may ignore the situation where some strongly related items are not directly connected, thus affecting the comprehensiveness of item correlation modeling. To solve this problem, the present application quantifies the global correlation between items by introducing the shortest path algorithm to construct a Top-k global item graph. Specifically, using the shortest path algorithm, the shortest distance between items can be calculated, and then those item pairs that are indirectly related but may affect user preferences can be identified. To enhance the accuracy of recommendation, the embedding representation of users and items can be further optimized by introducing the top-k most relevant items, thereby effectively supplementing the missing relationships in the item graph, fully mining the collaborative information between sequences, and effectively alleviating the data sparsity problem. At the same time, by adopting the Top-k global item graph, a graph representation learning method based on global item perception, the potential relationships between items can be captured more comprehensively, and the accuracy and robustness of sequence recommendation can be improved.
[0066] In this embodiment, the implementation process of step 100 given above in the present application can be to construct a Top-k global item graph based on the user interaction sequence to capture the relationship between items. Calculate the correlation value between items through the shortest path algorithm, and retain the top-k most relevant items for each node. Based on this, the implementation process of step 100 includes:
[0067] Step 1001: Construct an initial global item graph based on the user interaction sequence, and construct a global item graph based on the initial global item graph using the shortest path algorithm. Among them:
[0068] (1) In the user interaction sequence, the number of times an item is clicked by the user after another item is used as the weight of the edge between this item and the other item.
[0069] (2) When an item is adjacent to another item in the user interaction sequence, the weight of the edge between this item and the other item is increased by 1 to generate an initial global item graph.
[0070] (3) In the initial global item graph, introduce a filtering mechanism to filter out the edges with weights lower than the set threshold, and then determine the cost value of the edge based on the weight of the edge between an item and another item in the directed weighted graph obtained after filtering.
[0071] (4) Adopt the shortest path algorithm, based on the cost value, determine the minimum cost from each item to other items, and generate a shortest path graph.
[0072] (5) In the shortest path graph, determine the weight of the edge between an item and another item based on the minimum cost from one item to the other item. Combine the weight of the edge between this item and the other item with the maximum weight of the edges in the shortest path graph to obtain the relevance between this item and the other item, until the relevance between all items and other items in the shortest path graph is obtained, so as to generate a global item graph.
[0073] Step 1002. Retain the first edges with the highest relevance for each item in the global item graph to obtain the Top-k global item graph.
[0074] In the actual application process, for example, in the sequence recommendation task, let and represent the sets of all users and items respectively. For each user , their interaction sequence with items is represented as =( , , ,…, ), where . The corresponding interaction timestamp sequence is represented as . Let represent the set of interaction sequences of all users. The goal of sequence recommendation is to predict the next item that the user is most likely to interact with based on the user's interaction history up to time . Each user and item is represented by a low-dimensional embedding vector , where is the dimension of the embedding space, , . The user embedding matrix is represented as , and the item embedding matrix is represented as .
[0075] The global item graph is denoted as , and it is represented as a directed weighted graph. In the global item graph , the shortest path algorithm is used to determine the relevance between each item and other items. For each item , based on these calculation results, identify the top items that are most relevant to it, and retain the edges with these items, thereby constructing the Top-k global item graph. The embedding vectors of the top most relevant items can provide rich context information to help item learn its features more effectively.
[0076] As Figure 2 shows, given a user interaction sequence =( , , ,…, ), if the item immediately follows the item in the sequence (i.e., the user clicks immediately after clicking ), then a significant correlation is assumed to exist between them. Therefore, the weight of the edge from item to item is increased by 1. More generally, the weight of each edge in the global item graph represents the number of times item is clicked after item in all user sequences in the dataset. A higher edge weight indicates a stronger correlation between item and item .
[0077] To mitigate the impact of noise caused by accidental user clicks and avoid irrelevant edges affecting the prediction accuracy, this application introduces a filtering mechanism. This mechanism uses a threshold parameter to remove low-weight edges that may represent accidental clicks rather than meaningful interactions. Edges with weights below the threshold are filtered out from the global item graph , thereby enhancing the reliability of the constructed graph. Among them, the weight is defined as:
[0078] .
[0079] In the global item graph , edges only connect adjacent items in the user sequence, which poses a significant limitation. For example, although there may be a correlation between item and item in the user sequence, this relationship is not explicitly represented in . Instead, the correlation between item and item can only be inferred indirectly through the existence of intermediate edges and . To overcome this constraint, a shortest path algorithm is introduced, which evaluates the correlation between two nodes without a direct edge by considering the cumulative edge weights on the indirect path. For example, the algorithm can determine the correlation between item and item by evaluating the path formed by edges and The correlation between. The following also explains how to calculate the correlation between two non - adjacent items using the shortest - path algorithm.
[0080] First, assign a cost value to each edge in the global item graph based on its weight to facilitate the calculation of the global shortest - path graph. The cost value of an edge is defined as :
[0081] .
[0082] Among them, represents the maximum edge weight in the global item graph . A higher edge weight indicates a stronger correlation between item and item , resulting in a lower cost value, which reflects this correlation. Using these cost values, the shortest - path algorithm is applied to calculate the minimum cost required for each item to reach all other items, obtaining the shortest - path graph . In the shortest - path graph , a lower path cost from item to item indicates a stronger inferred correlation between items. To simplify subsequent calculations, the weights of the edges in the shortest - path graph are processed as follows:
[0083] .
[0084] .
[0085] Among them, represents the maximum edge weight in the shortest - path graph . represents, in the shortest - path graph, the weight of the edge between item and item . represents the correlation between item and item .
[0086] By performing logarithmic transformation and inversion calculation on the edge weights, the correlation between two items can be effectively captured. Then, each item can focus on a limited number of highly correlated items. Items with a smaller value are considered weakly correlated. Therefore, edge pruning is performed on the shortest - path graph , retaining only the top The top-k global item graph is finally constructed through this process by selecting the k edges with the strongest relevance. Among them, corresponding to the initial global item graph shown in Figure 2 as shown, the global item graph shown in Figure 3 can be obtained.
[0087] In another exemplary embodiment of the present application, to improve the accuracy and real-time performance of sequential recommendations, the dynamic graph in step 101 can be obtained by constructing a dynamic subgraph based on a user-item bipartite graph to capture the dynamic changes in the user behavior sequence. Based on this, in this embodiment, the implementation process of step 101 includes:
[0088] Step 1011: Use the click relationship between the user and the item in the user interaction sequence as the edge between the user and the item, and obtain the time point when the user clicks on the item.
[0089] Step 1012: Use the time point as the attribute interaction timestamp of the edge between the user and the item to generate a user-item bipartite graph.
[0090] Step 1013: Dynamically sample from the user-item bipartite graph to establish a user dynamic subgraph and a dynamic item subgraph centered on the user and the item.
[0091] Step 1014: Generate a dynamic graph based on the user dynamic subgraph and the dynamic item subgraph.
[0092] Through the above process, all user interaction sequences can be converted into a user-item bipartite graph , and a user dynamic subgraph and a dynamic item subgraph centered on the user and the item are sampled around any given user-item interaction. Among them, the user dynamic subgraph sampled with the user as the core node at time is denoted as , and the dynamic item subgraph is denoted as .
[0093] When the user clicks on the item at time , an edge will be established between the item and the user , thereby forming a user-item bipartite graph as shown in Figure 4 . Among them, the time is used as the attribute interaction timestamp of the edge .
[0094] The user-item bipartite graph effectively integrates the interaction sequences of different users. To better capture the temporal evolution of user and item embeddings, reduce computational overhead, and mitigate noise from other user sequences, we dynamically sample from the user-item bipartite graph to build dynamic subgraphs centered around users and items. Suppose we want to predict the clicks of user at time . Then, we construct a user dynamic subgraph with user as the root node. The most recently visited items of the user are regarded as first-order neighbors, where is a hyperparameter that determines the number of neighbor nodes in the current layer. Next, we use these items as root nodes to conduct a new round of sampling. Each item on the edge has a timestamp . We add the users who visited item earliest before the timestamp as second-order neighbors to the user dynamic subgraph.
[0095] For example, suppose user visited items ( , , , , ) at timestamps ( , , , , ). If we want to predict the items that the user will visit at , we need to construct the user dynamic subgraph and set and . First, we consider user as the root node and determine the items ([[]] , , , , , ) that were most recently visited at time . Since , , , are regarded as first-order neighbors and added to the dynamic subgraph. Next, we use these items , , , ) Conduct a new round of sampling with it as the root node. For example, consider the item , the user who recently accessed it is , and the timestamps are ([[]] , , , , ). Determine the users who accessed the item before the timestamp . These users exactly match . Therefore, add these four users as second-order neighbors to the user dynamic subgraph . This method ensures capturing the features of the node at the moment because the features evolve over time. Set the hyperparameter to control the number of layers of the dynamic subgraph. If third-layer nodes are needed, use the nodes in the second layer as new root nodes for sampling and continue with deep-level sampling. Usually, the default setting is .
[0096] Further, to improve the learning of item features and enhance the prediction accuracy, a dynamic item subgraph is also constructed for the items of interest to the user . The process of constructing the dynamic item subgraph is similar to that of constructing the user dynamic subgraph . Starting from the item , when it is accessed at time , determine its first-order neighbors, and then use these neighbors as new root nodes for further sampling. For the dynamic item subgraph , the settings of the hyperparameters and are kept consistent with those of the user dynamic subgraph . Among them, the process of dynamic subgraph sampling is as shown in Figure 5 . Figure 5 is based on the user-item bipartite graph shown in Figure 4 and is sampled with the user and the item as the central nodes at the moment . Figure 5 The light blue area in is the item dynamic subgraph , and the light orange area is the user dynamic subgraph
[0097] With the progress of graph neural network technology, more and more sequential recommendation models adopt graph convolution to model the complex relationships between users and items. However, the stacking of multiple graph convolution layers often leads to over-smoothing of information, weakening the distinguishability between node features and limiting the ability to capture long-distance semantic relationships. Therefore, most existing methods limit graph convolution to two layers, which restricts the scale of the dynamic graph and hinders the ability to capture long-distance semantic relationships between distant related items. In addition, there are no direct connections between many semantically related items in the user-item bipartite graph directly used by these models, and there is a limit on the number of graph convolution layers in the sequential recommendation algorithm based on graph neural networks, making it unable to effectively capture long-distance semantic relationships, so information cannot be transmitted between many long-distance related items.
[0098] Figure 6 shows the two-hop neighborhood dynamic graph around the item , which only represents a small part of the user-item interaction network. Figure 6 The node of type i in (i.e., ) represents the item node item, and different numbered nodes of type i represent different items. Similarly, the node of type u (i.e., ) represents the user node user. The on the edge represents time. For example, the edge between has the attribute of , representing that user accessed item at time. Different represent different timestamps. Figure 6 The area marked by the light green box in represents the dynamic item subgraph centered on item . Although the maximum shortest path length (or diameter) of the dynamic graph is limited to four, the datasets in practical applications usually have a diameter far exceeding this value, possibly covering dozens or even hundreds of nodes. This limited range means that node information from outside the local graph is often ignored, which may have a negative impact on the accuracy of node embeddings. Taking the user node located outside the dynamic graph as an example, whose purchase history is mainly composed of luxury goods. The embedding of user node may significantly affect the representations of item , item , thus affecting user node and item node Recommendations. These limitations highlight the need for a dynamic graph that makes more full use of cross-sequence collaboration information to capture more comprehensive information on user interaction sequences (sequences formed by the interaction behavior between users and items). To address these issues, this application proposes a Top-k global item graph. Through the shortest path algorithm, an edge can be established between long-distance related items, enabling more full utilization of cross-sequence collaboration information.
[0099] With the diversification of user behavior and the dynamic changes in interests, the user interests extracted from considering the complete interaction sequence often cannot fully reflect the user's short-term interests. In contrast, considering the items recently purchased by the user can provide more information about the user's current preferences, which can better capture the user's interest fluctuations and purchase trends. For example, on an e-commerce platform, if a user frequently purchases items of a certain category in a short period, it may indicate that the user's interest in that category of items is increasing. However, simply referring to the item purchased most recently when analyzing the user's short-term interests often cannot accurately reflect the user's immediate interests. By analyzing the items purchased multiple times, these short-term interests can be captured more precisely, thus providing more personalized and timely recommendations. This method has been proven to be superior to recommendation systems that only rely on single purchase records and can effectively improve the recommendation accuracy and user experience.
[0100] To address the above problems, in this embodiment, step 102 can use a graph convolutional network to extract long-term interests from the dynamic subgraph centered on users and items, providing insights into the user's long-term preferences and item associations. Using a convolutional neural network, capture the short-term user interests from the most recent m interactions, supplement the long-term preferences, and provide immediate behavior clues. Based on this, the implementation process of step 102 can include:
[0101] Step 1021: Use a graph convolutional network to obtain user long-term interest information based on the user dynamic subgraph.
[0102] Step 1022: Use a graph convolutional network to obtain item long-term interest information based on the dynamic item subgraph.
[0103] Step 1023: Obtain long-term interest information based on the user long-term interest information and the item long-term interest information.
[0104] Step 1024: The interaction information between the user and the item within the set time with the current time as the end time point, and input the user dynamic subgraph corresponding to this interaction information into the convolutional neural network to obtain short-term user short-term interest information.
[0105] In the actual application process, combined with the description of the previous embodiment, it can be obtained from the user dynamic subgraph and the dynamic item subgraph Extract the long-term features of users and items. Based on this, the implementation process of step 102 above includes:
[0106] Step 1021: Use a graph convolutional network to obtain user long-term interest information based on the user dynamic subgraph.
[0107] Step 1022: Use a graph convolutional network to obtain item long-term interest information based on the dynamic item subgraph.
[0108] Step 1023: Obtain long-term interest information based on the user long-term interest information and the item long-term interest information.
[0109] Step 1024: The interaction information between the user and the item within the set time with the current time as the termination time point, and input the user dynamic subgraph corresponding to this interaction information into the convolutional neural network to obtain short-term interest information.
[0110] In the actual application process, the extraction process of the above long-term and short-term interest information can be described as:
[0111] In the process of encoding user and item features to extract valuable information, each user and item is represented by a dimensional feature vector, the user embedding matrix is denoted as , and the item embedding matrix is denoted as .
[0112] To integrate and update node features in these subgraphs, a graph convolutional network is used. Conceptually, both dynamic subgraphs can be regarded as a tree with layers, where the root node or is located in the layer, and the layer consists of hop neighbors obtained through the th subsampling process. To achieve complete information transmission, each user dynamic subgraph and the dynamic item subgraph have to perform graph convolution operations, and the number of layers of the graph convolutional network . Among them, the dynamic graph convolution is as shown in Figure 7 .
[0113] Furthermore, to better capture the sequential relationship in the user interaction sequence and the impact of the interaction time on the long-term preference features of users and items, time and position embeddings are introduced in this embodiment. The time embedding reflects the time difference between a node and its neighbor nodes, indicating when the user interacts with a specific item, or when the item is accessed by the user. To effectively represent time features, the formula Discretize the time value. This logarithmic transformation scales the time value starting from . The embedding matrix of the time scale is denoted as , and the default setting is time scales.
[0114] In the actual application process, a GCN aggregator based on the self-attention mechanism can be used as the graph convolutional network to more effectively capture the sequential and temporal influences of neighbor nodes. This aggregator contains two multi-head self-attention layers followed by a feed-forward layer. Below, taking the user node as an example, the implementation process of extracting long-term interest information is outlined by aggregating the long-term preferences of users from the user dynamic subgraph . Among them:
[0115] (1) The first self-attention layer calculates the weighted sum of the item embedding, time embedding, and position embedding, which is expressed as:
[0116] .
[0117] .
[0118] Among them, , . represents the embedding matrix of the neighbor nodes of user , represents the neighborhood of user in the user dynamic subgraph . represents the item embedding, which is the embedding of item after the th layer of graph convolution. represents the feature embedding, represents the shape of the vector matrix, represents the time embedding of the neighbor nodes, represents the position information embedding of the neighbor nodes. The multi-head attention mechanism used in this embodiment is a method provided by the pytorch framework, is the parameter matrix to be passed in.
[0119] (2) The second self-attention layer is used to model the interest preferences of users based on the neighbor nodes of the users, and there is:
[0120] .
[0121] .
[0122] Among them, represents the user embedding, which is the embedding of user after the Embedding. Represents the user interest preference calculated by the second - layer self - attention mechanism, Represents the multi - head self - attention mechanism method, Represents the attention score matrix calculated by the first - layer self - attention mechanism.
[0123] Next, the concept of a residual network is introduced to integrate the long - term interest of users, thus avoiding common problems in deep neural networks such as overfitting and gradient vanishing.
[0124] .
[0125] Among them, , , and respectively represent different fully - connected layer matrices, Represents the long - term preference of the user, Represents the activation function.
[0126] By the same steps of aggregating the long - term preference of the user from the user dynamic sub - graph , the long - term preference of items can be aggregated from the dynamic item sub - graph .
[0127] In this embodiment, the GCN aggregator based on the self - attention mechanism is used to obtain the long - term preference of the user and the long - term preference of items .
[0128] Furthermore, although many existing studies only focus on the most recent interaction to determine short - term interest, this method may not comprehensively capture the immediate preference of users. In contrast, this application uses the user's most recent number of interactions ) to better represent short - term interest (i.e., short - term interest information). Among them, the user short - term interest extraction process is as Figure 8 shown, and this process can be expressed as:
[0129] .
[0130] .
[0131] .
[0132] Among them, represents the matrix composed of the embeddings of the items in the most recent number of interactions, represents the items that the user has clicked most recently. Indicates matrix concatenation operation, such as the concat operation in PyTorch. The result and the result are obtained through convolutional operations with a stride of 1, using and as horizontal and vertical convolutional kernels respectively. Each group of convolutional kernels includes 8 horizontal convolutional kernels and 4 vertical convolutional kernels of the same shape in a group. After the outputs obtained through these convolutional operations are pooled and concatenated, the results and the result are obtained, and there are:
[0133] .
[0134] .
[0135] Finally, the result and the result are fused to generate the user's short-term interest vector, denoted as:
[0136] .
[0137] In the formula, represents the user's short-term interest vector, and MLP represents the fusion operation using a multi-layer perceptron.
[0138] In another exemplary embodiment of the present application, the feature vectors of relevant items should have a certain similarity to generate item embeddings that can support effective modeling. Based on this, the implementation process of step 103 in the present application can be described as:
[0139] Step 1031: Apply graph convolutional network operations to extract the relevant features of nodes connected to an item in the Top-k global item graph.
[0140] Step 1032: Obtain item features related to the item currently of interest to the user based on the relevant features. Among them, the extraction process of the relevant item features is as Figure 9 shown.
[0141] Based on the description in the above embodiment, the present application uses the shortest path algorithm to identify the top relevant items for each item and construct the Top-k global item graph . In the Top-k global item graph , for the nodes connected to the node , apply GCN operations to extract relevant features. These extracted features are calculated according to the following formula:
[0142] 。
[0143] 。
[0144] Among them, represents the neighborhood of the item of user interest , represents the finally obtained relevant item feature vector, represents the attention score obtained by regularization calculation, represents the regularization calculation function, represents in the item correlation graph based on the shortest path the neighborhood of the item , represents the embedding vector of item j.
[0145] In another exemplary embodiment of the present application, the implementation process of step 104 may include:
[0146] Step 1041, generate the embedding of the user at the current time and the embedding of the item at the current time based on the item features, long-term interest information, and short-term interest information related to the item currently of interest to the user.
[0147] Step 1042, determine the user preference score of the candidate item for the next time based on the embedding of the user at the current time and the embedding of the item at the current time.
[0148] Step 1043, retain the candidate item information with the user preference score exceeding the set score threshold, and generate item sequence recommendation information.
[0149] In the actual application process, combine the user's long-term preference , the item's long-term preference , the user's short-term interest vector and the relevant item feature vector to form the embedding of the user at time , and the embedding of the corresponding item at time , expressed as:
[0150] 。
[0151] 。
[0152] In the formula, , , and all represent different fully connected layer matrices.
[0153] To predict the user At the next time step aims to illustrate which items may be interacted with at the next time step, including:
[0154] For each candidate item , the user's preference score in is calculated as follows:
[0155] . In the formula, represents the preference score, represents the vector transpose.
[0156] Furthermore, in the actual application process, the entire implementation process of the above steps 100 - 104 can be regarded as a model. The overall implementation process of this model is as shown in Figure 10 . To further improve the accuracy of sequence recommendation, the cross-entropy loss function can be used to train the model parameters. The cross-entropy loss function is expressed as:
[0157] .
[0158] Among them, represents the loss function value, represents the true label of the candidate item, is the user's preference score vector for all candidate items, represents the cross-entropy loss function.
[0159] In another exemplary embodiment of the present application, in order to evaluate the effectiveness of the method provided by the present application, in this embodiment, three datasets from the real world are tested. These datasets are publicly available on the Internet and are widely used to evaluate sequence recommendation methods. The Amazon dataset is a large-scale dataset widely used in sequence recommendation research. It contains interaction information such as user purchases, browsing, ratings, and reviews from the Amazon e-commerce platform. Three data subsets, namely Amazon-CDs, Amazon-Games, and Amazon-Beauty, are cited from it. The Amazon dataset is known for its high sparsity and variability.
[0160] All these datasets contain user-item interactions. Each dataset records the user ID, item ID, and the timestamp corresponding to the interaction. For all datasets, all interactions are sorted in ascending order of the timestamp, and users and items (as items) with fewer than five interactions are discarded. For all datasets, the leave-one-out sampling method is used to divide the training set and the test set. For the interaction sequence of each user, the last interaction is used for testing, and the remaining data is used as the training data.
[0161] In addition, a sequence segmentation method is adopted to enhance the data. Each sequence is segmented to generate multiple subsequences , where the last item of each sequence is the corresponding label.
[0162] To prove the effectiveness of the method model provided in this application, the following models will be used as comparative methods for effectiveness comparison:
[0163] 1. The recurrent neural network based on Top-k gain for session recommendation (GRU4Rec+). This is a model based on the gated recurrent unit (GRU) and is an improved version of the session-based recurrent neural network recommendation (GRU4Rec). Compared with GRU4Rec, it adopts a new loss function and sampling strategy.
[0164] 2. Personalized Top-N sequence recommendation based on convolutional sequence embedding (Caser), which is a model that combines convolutional neural networks and embedding methods to capture information from user interaction sequences.
[0165] 3. Self-attention sequence recommendation (SASRec), which is a model based on the self-attention mechanism and can capture semantic information from the user's interaction sequence for predicting the next item.
[0166] 4. Session recommendation based on graph neural network (SR-GNN), which is a GNN-based recommendation model that combines an attention network to obtain accurate item embeddings.
[0167] 5. Sequence recommendation based on hierarchical gated network (HGN), which is a model that integrates Bayesian personalized ranking (BPR) with a hierarchical gated structure and can be used for sequence recommendation tasks.
[0168] 6. Self-attention sequence recommendation considering time intervals (TiSASRec), which is a method improved from the self-attention-based sequence recommendation model (SASRec). It models the absolute position of items and the time intervals between items in the sequence to optimize the model.
[0169] 7. Session recommendation based on graph neural network with global context enhancement (GCE-GNN), which is a GNN-based recommendation model that aggregates the item representations learned from the session graph and the global graph through a soft attention mechanism to help the model make predictions.
[0170] 8. An efficient and effective social recommendation session recommendation framework (SERec), which is a GNN-based model that uses a heterogeneous graph neural network to learn user and item representations through knowledge from the social network.
[0171] 9. Next Item Recommendation based on Sequential Hypergraph (HyperRec), which is a hypergraph - structured model that uses hypergraphs to capture the high - order connectivity between users and items to handle recommendation problems.
[0172] 10. Sequential Recommendation based on Dynamic Graph Neural Network (DGSR), which is a GNN - based model that creates a dynamic graph connecting different user sequences to capture the dynamic collaborative signals between different user sequences for prediction.
[0173] 11. Position - Enhanced and Time - Aware Graph Convolutional Network for Sequential Recommendation (PTGCN), which is a GNN - based model that performs graph convolution on the high - order connectivity graph of users and items, and helps to learn the dynamic representations of users and items through position enhancement and time awareness.
[0174] To evaluate the performance of the above models, two widely used metrics, Hit@K and NDCG@K, are adopted to quantify the recommendation performance. The Hit@K metric measures whether the top K recommended items contain the items that the user is truly interested in. For each user, if the top K recommended items contain the items that the user is interested in, it is recorded as a hit. Hit@K calculates the average hit rate of all users. NDCG@K is a metric that comprehensively considers the hit rate and position of the recommendation results. A higher Normalized Discounted Cumulative Gain (NDCG) value represents that the items the user is interested in are in more forward positions among the top K recommended items. For each set of test samples, 100 negative samples are randomly selected, and these negative samples and 1 true item are ranked. The metrics Hit@K and NDCG@K are evaluated based on these 101 items. By default, K = 10 is set.
[0175] Table 1 Evaluation Results of Each Model
[0176]
[0177] Based on the evaluation results shown in Table 1, the model proposed in this application achieves the best results in two evaluation metrics in two of the three datasets compared with the above - mentioned 11 comparison models.
[0178] In summary, this application captures the dynamic changes in the user behavior sequence by constructing a dynamic sub - graph based on the user - item bipartite graph, calculates the correlation between global items based on the global item graph and introduces the shortest - path algorithm to help extract the collaborative information between sequences for feature learning, thereby improving the accuracy and real - time performance of sequential recommendation. Through the advantages of graph neural networks, it better models the complex relationships between users and items, further improving the accuracy of sequential recommendation and the personalized service ability.
[0179] In an exemplary embodiment, a computer device is provided. The computer device may be a server or a terminal. The computer device includes a processor, a memory, an input / output interface (I / O), and a communication interface. Among them, the processor, the memory, and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store sequence recommendation data. The input / output interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to communicate with external terminals through a network connection. When the computer program is executed by the processor, it implements a sequence recommendation method.
[0180] In an exemplary embodiment, a computer device is provided, including a memory and a processor. A computer program is stored in the memory. When the processor executes the computer program, the steps in the above method embodiments are implemented.
[0181] In an exemplary embodiment, a computer-readable storage medium is provided, storing a computer program. When the computer program is executed by the processor, the steps in the above method embodiments are implemented.
[0182] In an exemplary embodiment, a computer program product is provided, including a computer program. When the computer program is executed by the processor, the steps in the above method embodiments are implemented.
[0183] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. And the collection, use, and processing of relevant data need to comply with relevant regulations.
[0184] Those of ordinary skill in the art can understand that all or part of the processes of implementing the methods in the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, database, or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memories. Non-volatile memories can include read-only memory (ROM), magnetic tapes, floppy disks, flash memories, optical memories, high-density embedded non-volatile memories, resistive random-access memories (ReRAM), magnetoresistive random-access memories (MRAM), ferroelectric random-access memories (FRAM), phase change memories (PCM), graphene memories, etc. Volatile memories can include random access memory (RAM) or external cache memories, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc.
[0185] The databases involved in the embodiments provided in the present application can include at least one of relational databases and non-relational databases. Non-relational databases can include distributed databases based on blockchain, etc., without limitation. The processors involved in the embodiments provided in the present application can be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logics, data processing logics based on quantum computing, etc., without limitation.
[0186] The technical features of the above embodiments can be combined arbitrarily. For the sake of concise description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope described in this specification.
[0187] Specific examples are used in this article to elaborate on the principles and implementation manners of the present application. The description of the above embodiments is only used to help understand the method and its core idea of the present application; at the same time, for those of ordinary skill in the art, according to the idea of the present application, there will be changes in the specific implementation manners and application scopes. In summary, the content of this specification should not be construed as a limitation to the present application.
Claims
1. A sequence recommendation method, characterized in that, Including: Construct an initial global item graph based on the user interaction sequence, and use the shortest path algorithm to construct a global item graph based on the initial global item graph; the user interaction sequence is a sequence formed by the interaction information between the user and the items; Assign a cost value to each edge in the global item graph, which is calculated based on its weight to facilitate the calculation of the global shortest path graph; the cost value of the edge is defined as : ; Among them, represents the maximum edge weight in the global item graph, represents the edge weight; Using the cost value, the shortest path algorithm is applied to calculate the minimum cost required for each item to reach all other items, obtaining a shortest path graph; Perform the following processing on the weights of the edges in the shortest path graph: ; ; Among them, represents the maximum edge weight in the shortest path graph; represents, in the shortest path graph, the weight of the edge between item and item represents the correlation between item and item represents the path cost from item to item ; By performing logarithmic transformation and inversion calculation on the edge weights, capture the correlation between two items; Each item can focus on a limited number of highly relevant items; items with a smaller value are considered weakly relevant; thus, edge pruning is performed on the shortest path graph, and only the top strongest relevant edges of each item are retained, and finally the Top-k global item graph is constructed; Generate a dynamic graph based on the user interaction sequence; the dynamic graph includes a user dynamic sub-graph and a dynamic item sub-graph; Using a graph convolutional network and a convolutional neural network, based on the dynamic graph, long-term interest information and short-term interest information are obtained, including: using the graph convolutional network, based on the user dynamic subgraph, user long-term interest information is obtained; using the graph convolutional network, based on the dynamic item subgraph, item long-term interest information is obtained; wherein, a GCN aggregator based on the self-attention mechanism is used as the graph convolutional network; both the user dynamic subgraph and the dynamic item subgraph are regarded as a tree with layers, the root node is located at the th layer, and the th layer consists of hop neighbors obtained through the th subsampling process; in order to achieve complete information transmission, each user dynamic subgraph and dynamic item subgraph are both subjected to graph convolutional operations; based on the user long-term interest information and the item long-term interest information, the long-term interest information is obtained; wherein, the first self-attention layer calculates the weighted sum of the item embedding, time embedding, and position embedding; the second self-attention layer is used to model the user's interest preference based on the user's neighbor nodes; the concept of a residual network is introduced to integrate the user's long-term interest; the interaction information between the user and the item within a set time with the current time as the end time point, and the user dynamic subgraph corresponding to this interaction information is input into the convolutional neural network to obtain the short-term interest information; the long-term interest information refers to the stable and continuous interests or preferences of the user within the first set time, as well as the effective characteristics of the item itself; the short-term interest information is the real-time impact on the user's and item's own characteristics caused by the current environment, situation, or behavior within the second set time; the first set time is greater than the second set time; Extract item features related to the item currently of interest to the user based on the Top-k global item graph; Obtain item sequence recommendation information based on item features related to the item that the user is currently interested in, the long-term interest information, and the short-term interest information, including: generating an embedding of the user at the current time and an embedding of the item at the current time based on the item features related to the item that the user is currently interested in, the long-term interest information, and the short-term interest information; determining the user preference score of the candidate item for the next time based on the embedding of the user at the current time and the embedding of the item at the current time; retaining the candidate item information with the user preference score exceeding the set score threshold to generate the item sequence recommendation information; wherein, the time embedding reflects the time difference between a node and its neighbor nodes, indicating when the user interacts with a specific item, or when the item is accessed by the user; in order to effectively represent the time feature, use the formula to discretize the time value; this logarithmic transformation scales the time value starting from and represents the time value.
2. The sequence recommendation method according to claim 1, wherein In the process of constructing an initial global item graph based on the user interaction sequence and using the shortest path algorithm to construct a global item graph based on the initial global item graph, use the number of times the end node of each directed edge is clicked after the start node as the weight of the directed edge; Introduce a filtering mechanism to filter out the directed edges with weights lower than the set threshold parameter, obtaining the global item graph.
3. The sequence recommendation method according to claim 1, wherein Construct an initial global item graph based on the user interaction sequence and use the shortest path algorithm to construct a global item graph based on the initial global item graph, including: In the user interaction sequence, use the number of times an item is clicked by the user after another item as the weight of the edge between this item and the other item; When an item and another item are adjacent in the user interaction sequence, increase the weight of the edge between this item and the other item by 1 to generate the initial global item graph; Determine the cost value of the edge based on the weight of the edge between an item and another item in the initial global item graph; Use the shortest path algorithm to determine the minimum cost from each item to other items based on the cost value, generating a shortest path graph; In the shortest path graph, determine the weight of the edge between an item and another item based on the minimum cost from an item to the other item, and combine the weight of the edge between this item and the other item with the maximum weight of the edges in the shortest path graph to obtain the correlation between this item and the other item, until the correlations between all items and other items in the shortest path graph are obtained, to generate the global item graph.
4. The sequence recommendation method according to claim 1, wherein Generate a dynamic graph based on the user interaction sequence, including: Take the click relationship between the user and the items in the user interaction sequence as the edge between the user and the items, and obtain the time point when the user clicks the item; Take the time point as the attribute interaction timestamp of the edge between the user and the item, generating a user-item bipartite graph; Dynamically sample from the user-item bipartite graph to establish a user dynamic sub-graph and a dynamic item sub-graph centered on the user and the items; Generate the dynamic graph based on the user dynamic sub-graph and the dynamic item sub-graph.
5. The sequence recommendation method according to claim 1, wherein Extract item features related to the item currently of interest to the user based on the Top-k global item graph, including: Apply graph convolutional network operations to extract the relevant features of nodes connected to an item in the Top-k global item graph; nodes; Obtain item features related to the item currently of interest to the user based on the relevant features.
6. A computer device, comprising: A memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor executes the computer program to implement the sequence recommendation method according to any one of claims 1-5.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the sequence recommendation method according to any one of claims 1-5.
Citation Information
Patent Citations
Self-supervised sequence recommendation method based on long-term and short-term interests of user
CN114528490A
Recommendation method based on dynamic difference graph
CN115878884A