Shopping basket recommendation method and system based on graph contrast learning and personalized graph prompt
By introducing singular value decomposition and weighted graph prompt mechanisms in graph comparison learning, combined with graph convolution network and gated recursive unit, the generality and robustness of the recommendation system based on graph comparison learning is solved, and the performance improvement of the shopping basket recommendation task is achieved.
Patent Information
- Application Number
- CN202510216553.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-26
- Publication Date
- 2025-06-13
- Estimated Expiration
- 2045-02-26
AI Technical Summary
The recommendation system based on graph comparison learning has shortcomings in terms of universality and robustness, resulting in limited generalization ability and recommendation performance of the model.
A shopping basket recommendation method based on graph comparison learning and personalized graph prompts is proposed. Pre-trained through LightGCL, and a weighted graph prompt mechanism is used to combine singular value decomposition and graph convolution network to enhance the shopping basket-product embedding characterization, and information fusion is carried out through gated recursive units and multi-layer perceptrons to infer the probability of product appearance in the next shopping basket.
It significantly improves the performance of the shopping basket recommendation task, enhances the generalization ability and robustness of the model, and improves the reliability and personalization of the recommendation results.
Smart Images

Figure CN120146951A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of personalized recommendation, and more specifically, to a shopping basket recommendation method and system based on graph contrastive learning and personalized graph prompts. Background Art
[0002] In the field of recommendation systems, Graph Contrastive Learning (GCL) has been widely used to capture complex user-item relationships and significantly improve recommendation performance. Traditional GCL methods rely on random augmentations (such as node or edge perturbations) or heuristic augmentations (such as user clustering) to generate different contrast views.
[0003] However, these methods often destroy the semantic structure of the graph during the contrast process, leading to the model being vulnerable to noise, which limits the robustness and generalization ability of the model. In addition, GNN-based contrastive recommendation methods are often limited by the over-smoothing problem, making the learned representations less distinguishable. Therefore, how to solve the generality and robustness problems of recommendation systems based on graph contrastive learning and improve the performance of the shopping basket recommendation task is an urgent problem to be solved. Summary of the Invention
[0004] To solve the above technical problems, the present invention proposes a shopping basket recommendation method and system based on graph contrastive learning and personalized graph prompts. It is pre-trained through LightGCL and uses a weighted graph prompt mechanism to directly improve the downstream recommendation effect, effectively solving the generality and robustness problems of recommendation systems based on graph contrastive learning and bringing a significant performance improvement to the shopping basket recommendation task.
[0005] The first aspect of the present invention provides a shopping basket recommendation method based on graph contrastive learning and personalized graph prompts, including:
[0006] Obtain enterprise transaction data. After data preprocessing, initialize the embedding representations of shopping baskets and commodities, and construct a shopping basket-commodity frequency interaction graph;
[0007] Use a graph convolutional network to generate main-view shopping basket-commodity embedding representations, and combine singular value decomposition to extract global collaborative relationships to generate globally enhanced global-view shopping basket-commodity embedding representations;
[0008] Construct a graph contrastive learning pre-training framework to enhance the main-view shopping basket-commodity embedding representations and global-view shopping basket-commodity embedding representations through the graph contrastive learning pre-training framework;
[0009] Use a graph prompt mechanism to encode user historical interaction data into shopping basket-level and commodity-level prompt embeddings, and use a multi-layer perceptron to fuse and construct a graph prompt vector;
[0010] Obtain the enhanced embeddings of the items and shopping basket sequences for the fusion graph hint vectors, hierarchically obtain the representations of the user's dynamic interests at the item and shopping basket levels through a gated recurrent unit, infer the appearance probability of an item in the next shopping basket, and obtain the recommended items in the next shopping basket.
[0011] In this solution, enterprise transaction data is obtained. After data preprocessing, the embedding representations of shopping baskets and items are initialized, and a shopping basket-item frequency interaction graph is constructed, specifically as follows:
[0012] Obtain enterprise transaction data for data cleaning, format conversion, and standardization operations. After the data preprocessing is completed, define the item set as I = {i 1 , i 2 , …, i |J|}, |J| represents the total number of items, define the user set as U = {u 1 , u 2 , …, u |U|}, |U| represents the total number of users, and define the shopping basket set |K| represents the total number of shopping baskets;
[0013] Initialize all shopping basket embedding representations E (b) and item embedding representations E (i) , collect the user's historical interaction data, including the shopping basket set and the item set I, and count the occurrence times of the items and shopping baskets included in each shopping basket;
[0014] According to the historical interaction data, construct a shopping basket-item frequency interaction graph, use the shopping basket set and the item set I as two parts of the nodes, set the edge structure according to the association between the shopping basket and the item, and use the occurrence times of the shopping basket in the historical interaction data to set the weight of the edge structure;
[0015] Based on the constructed shopping basket-item frequency interaction graph, construct a frequency adjacency matrix of shopping basket-items, and perform normalization processing on the frequency adjacency matrix A to obtain the normalized adjacency matrix R K×J represents the real number space of K×J, where K represents the shopping basket and J represents the item.
[0016] In this solution, use a graph convolutional network to generate the main view shopping basket-item embedding representations, specifically as follows:
[0017] Use a graph convolutional network to learn the shopping basket-item frequency interaction graph to obtain the initial shopping basket embedding representations E (b) and item embedding representations E (i), in the graph convolutional network, aggregate the neighbor information of each shopping basket k or item j through matrix multiplication, and output the main view embedding representation of the shopping basket at the l-th layer through the activation function and the main view embedding representation of the item
[0018] Generate the final embedding vector of the shopping basket according to the sum of the embedding vectors of all layers in the graph convolutional network and the final embedding vector of item j According to the final embedding vector of the shopping basket and the final embedding vector of item j Calculate the embedding inner product of the shopping basket and the item to obtain the predicted correlation between the shopping basket and the item
[0019] In this solution, combine singular value decomposition to extract the global collaboration relationship, and generate a globally enhanced global view shopping basket-item embedding representation, specifically:
[0020] Use singular value decomposition to decompose the normalized adjacency matrix to obtain the singular value list of the adjacency matrix Preset a quantity threshold q, use the quantity threshold q to truncate the singular value list, retain the first q singular values in the singular value list, and reconstruct the normalized adjacency matrix using the retained singular values Obtain the reconstructed adjacency matrix
[0021] According to the reconstructed adjacency matrix Execute message propagation to obtain the global view embedding representation of the shopping basket after singular value decomposition global enhancement in the l-th layer of the graph convolutional network and the global view embedding representation of the item
[0022] In this solution, enhance the main view shopping basket-item embedding representation and the global view shopping basket-item embedding representation through the graph contrast learning pre-training framework, specifically:
[0023] Construct a contrast loss by comparing the similarity between the main view shopping basket-item embedding representation and the global view shopping basket-item embedding representation, and at the same time combine the contrast loss and the regularization term to construct a graph contrast learning pre-training framework for the recommendation task. The corresponding loss function L is expressed as:
[0024]
[0025] where L con represents the contrast loss, represents the contrast loss of the shopping basket node, represents the contrast loss of the item node Denote the regular term, λ 1 , λ 2 denote learnable parameters;
[0026] The contrast loss calculates the predicted scores of items in the shopping basket based on the predicted relevance between the shopping basket and the items, encouraging the model to give high predicted scores to positive items and low predicted scores to negative items;
[0027] The contrast loss of the shopping basket node and the contrast loss of the item node measure the similarity between the main view shopping basket-item embedding representation and the global view shopping basket-item embedding representation based on the InfoNCE loss function, and compare the similarity with the global view embedding representations of other shopping basket nodes or item nodes.
[0028] In this solution, a graph prompt module is constructed through the shopping basket-item frequency interaction graph, encoding the user's historical interaction data into shopping basket-level and item-level prompt embeddings, and using a multi-layer perceptron to fuse and construct a graph prompt vector, specifically:
[0029] The normalized adjacency matrix of the shopping basket-item frequency interaction graph is mapped to the embedding spaces of the shopping basket and the item through an MLP to construct a shopping basket-level prompt vector P B and an item-level prompt vector P I , expressed as:
[0030]
[0031]
[0032] where P I ∈R J×d denotes the prompt vector mapped to the item level, J represents the number of all items, P B ∈R K×d denotes the prompt vector mapped to the shopping basket level, K represents the number of all shopping baskets; denotes the normalized adjacency matrix of the shopping basket-item interaction frequency, and and denote the weight matrices of two-layer linear transformation, d h is the hidden embedding dimension, d represents the target prompt embedding dimension, and and denote the bias terms, σ represents the non-linear activation function ReLU;
[0033] Define the historical interaction shopping basket sequence of each user u |S uDenote the length of the historical interaction shopping basket sequence of user u, and define the commodity extended sequence For the commodity extended sequence S of the user (u,I) , its embedding representation is:
[0034]
[0035] where E (u,I) represents the set of commodity sequence embedding representations that the user has interacted with historically, represents the commodity embedding representation of the user in the commodity-level interaction sequence at time t, |S (u,I) | represents the number of commodities that the user has interacted with;
[0036] Encode the embedding representation E of the commodity extended sequence S (u,I) through a gated recurrent unit to generate the dynamic interest hidden state of the user: (u,I) H
[0037] H (u,I) = GRU(E (u,I) )
[0038] represents the dynamic interest hidden state of the user extracted through the gated recurrent unit. The hidden state H of the user's historical commodity interaction (u,I) is respectively inner product-operated with two different-level graph information hint vectors P I and P B to generate the commodity-level hint embedding S I and the shopping basket-level hint embedding S B ;
[0039] Perform non-linear transformation and compression on the commodity-level hint embedding S I and the shopping basket-level hint embedding S B through a multi-layer perceptron, and finally generate the graph hint vector of the user through addition fusion
[0040] In this solution, obtain the enhanced embeddings of the commodity and shopping basket sequences that fuse graph hint information, specifically:
[0041] Define the commodity-level interaction sequence embedding E of the user (u,I) and the shopping basket-level interaction sequence embedding E (u,B) . Respectively add the commodity embedding in the commodity-level interaction sequence and the shopping basket embedding in the shopping basket-level interaction sequence to the graph hint vector to obtain the enhanced commodity embedding and the shopping basket embedding Integrate to generate the enhanced embeddings of the commodity and shopping basket sequences that fuse the graph hint vector and and
[0042] In this solution, the gated recurrent unit is used to hierarchically obtain the representations of the user's dynamic interests at the commodity and shopping basket levels, infer the appearance probability of a commodity in the next shopping basket, and obtain the recommended commodities in the next shopping basket. Specifically:
[0043] The gated recurrent unit is used to gradually encode the user's shopping basket sequence For each time step t, the encoding updates of the gated recurrent unit at the shopping basket sequence level and the user sequence level are expressed as:
[0044]
[0045]
[0046] where represents the enhanced embedding representation of the t-th shopping basket and the t-th commodity, represents the encoding of the historical interaction information of the t-th shopping basket and the t-th commodity, represents the encoding of the historical interaction information of the (t + 1)-th shopping basket and the (t + 1)-th commodity;
[0047] The final representation s at the shopping basket level is obtained through the recursive encoding of the gated recurrent unit (u,B) and the final representation s at the commodity level (u,I) ;
[0048] The embedding representation e of commodity i is obtained through the graph contrast learning pre-training framework i , and using the final representation s at the shopping basket level (u,B) and the embedding representation e of commodity i i , the correlation score of commodity i at the shopping basket level is calculated
[0049] Using the final representation s at the commodity level (u,I) and the embedding representation e of commodity i i , the correlation score of commodity i at the commodity level is calculated
[0050] The correlation scores at the shopping basket level and the commodity level are added together, and the sigmoid function is used to map them to the probability range of [0, 1] to obtain the probability that commodity i appears in the next shopping basket
[0051] The second part of the present invention proposes a shopping basket recommendation system based on graph contrast learning and personalized graph prompts. The system includes: an enterprise transaction data collection module, a shopping basket-item frequency interaction graph construction module, a singular value decomposition-pre-trained contrast enhanced representation module, a graph prompt construction module, a shopping basket-item embedding representation fusion module, a next shopping basket prediction module, and a prediction result output module;
[0052] The enterprise transaction data collection module: collects and preprocesses user transaction data;
[0053] The shopping basket-item frequency interaction graph construction module: reads the interaction frequencies between shopping baskets and items according to the user's historical interaction data to construct a shopping basket-item frequency interaction graph;
[0054] The singular value decomposition-pre-trained contrast enhanced representation module: generates a main view shopping basket-item embedding representation through a graph convolutional network, and then uses singular value decomposition to further enhance and generate a global view shopping basket-item embedding representation; performs contrast learning on the two different perspective embedding representations to enhance the main view shopping basket-item embedding representation and the global view shopping basket-item embedding representation;
[0055] The graph prompt construction module: uses graph prompts to encode the user's historical interaction data into shopping basket-level and item-level prompt embeddings, and uses a multi-layer perceptron to fuse and construct a graph prompt vector;
[0056] The shopping basket-item embedding representation fusion module: fuses the graph prompt vector with the pre-trained shopping basket-item embedding representation, performs a linear transformation through trainable weights and biases, and applies an activation function for non-linear processing. The fused representation is further compressed and optimized through a multi-layer perceptron to obtain the shopping basket and item representation embeddings that fuse the graph prompt vector;
[0057] The next shopping basket prediction module: calculates the relevance scores of item i at the shopping basket level and the item level according to the shopping basket and item representation embeddings that fuse the graph prompt vector, and fuses the probabilities at the two levels to obtain the final probability of item i appearing in the next shopping basket;
[0058] The prediction result output module: obtains the recommended items in the next shopping basket according to the final probability of the item appearing in the next shopping basket.
[0059] Compared with the prior art, the beneficial effects of the present invention are:
[0060] (1) By introducing the Singular Value Decomposition (SVD) technique into the pre-training stage of graph contrastive learning, the present invention significantly enhances the generalization ability and robustness of the model. The SVD technique can effectively capture the global structural relationships of the graph. Compared with traditional random perturbation methods, the present invention performs refined processing on the graph structure during the contrastive learning process, avoiding the loss of useful information. This refined processing enables the model to more flexibly adapt and maintain good performance when facing different datasets or user behavior patterns, effectively reducing the risk of overfitting. Therefore, the pre-training of graph contrastive learning based on SVD not only improves the learning efficiency of the model but also significantly enhances the stability and reliability of the model in practical applications.
[0061] (2) The present invention innovatively adopts a graph hint mechanism. By constructing a weighted graph to dynamically adjust the relationships between nodes, the ability of the model to capture user behavior and resist noise data is enhanced. This mechanism not only improves the reliability and accuracy of the recommendation results but also significantly enhances the personalized recommendation ability of the model. Through the shopping basket-item weighted graph, the model can more meticulously capture the preference relationships of users during the purchase process, providing more accurate and personalized recommendation services for users. At the same time, the graph hint mechanism also improves the interpretability of the model. By visualizing the weighted graph, researchers and application developers can more clearly understand the basis for the model's recommendations, enhancing users' trust and satisfaction with the recommendation results. This advantage makes the present invention have higher transparency and credibility in practical applications, contributing to improving the user experience and conversion rate. BRIEF DESCRIPTION OF THE DRAWINGS
[0062] To more clearly illustrate the technical solutions in the embodiments or exemplifications of the present invention, the following will briefly introduce the drawings required for use in the description of the embodiments or exemplifications. Obviously, the following drawings are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained according to the drawings shown.
[0063] Figure 1 Shows the flowchart of the shopping basket recommendation method based on graph contrastive learning and personalized graph hints;
[0064] Figure 2 Shows the framework flowchart of the shopping basket recommendation method;
[0065] Figure 3 Shows the block diagram of the shopping basket recommendation system based on graph contrastive learning and personalized graph hints. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0066] To better understand the above objects, features, and advantages of the present invention, the present invention will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be noted that, without conflict, the embodiments of the present application and the features in the embodiments can be combined with each other.
[0067] In the following description, many specific details are set forth to facilitate a thorough understanding of the present invention. However, the present invention may be implemented in other ways different from those described herein. Therefore, the scope of protection of the present invention is not limited by the specific embodiments disclosed below.
[0068] Figure 1 、 2 The flowchart and process framework diagram of a shopping basket recommendation method based on graph contrast learning and personalized graph prompts are shown.
[0069] As Figure 1 shown, this embodiment provides a shopping basket recommendation method based on graph contrast learning and personalized graph prompts, including:
[0070] S102, obtaining enterprise transaction data, initializing the embedding representations of shopping baskets and commodities after data preprocessing, and constructing a shopping basket-commodity frequency interaction graph;
[0071] S104, using a graph convolutional network to generate main-view shopping basket-commodity embedding representations, and combining singular value decomposition to extract global collaborative relationships to generate globally enhanced global-view shopping basket-commodity embedding representations;
[0072] S106, constructing a graph contrast learning pre-training framework to enhance the main-view shopping basket-commodity embedding representations and global-view shopping basket-commodity embedding representations through the graph contrast learning pre-training framework;
[0073] S108, using a graph prompt mechanism to encode user historical interaction data into shopping basket-level and commodity-level prompt embeddings, and using a multi-layer perceptron to fuse and construct a graph prompt vector;
[0074] S110, obtaining enhanced embeddings of commodities and shopping basket sequences that fuse graph prompt vectors, hierarchically obtaining representations of the user's dynamic interests at the commodity and shopping basket levels through a gated recurrent unit, inferring the probability of a commodity appearing in the next shopping basket, and obtaining recommended commodities in the next shopping basket.
[0075] Note that enterprise transaction data is obtained for data cleaning, format conversion, and standardization operations to ensure the integrity and consistency of shopping basket and item information. The data cleaning process filters out missing values, illegal data, and duplicate transaction records. Meanwhile, we convert all timestamps and text information into a unified format to lay the foundation for subsequent analysis. After data preprocessing is completed, we initialize the embedding representations of shopping baskets and items to prepare for model training. After data preprocessing is completed, the item set is defined as I = {i 1 , i 2 , …, i |J|}, |J| represents the total number of items, the user set is defined as U = {u 1 , u 2 , …, u |U|}, |U| represents the total number of users, and the shopping basket set |K| represents the total number of shopping baskets.
[0076] Each shopping basket is composed of items interacted by a user within a specific time period, where |b| represents the number of items in the shopping basket, and this number can vary for different shopping baskets. The items are all from the item set I = {i 1 , i 2 , …, i |J|}. The shopping basket set is defined as where |K| represents the total number of shopping baskets. For each user u ∈ U, their historical interactions can be represented as a shopping basket sequence where |S u | represents the length of the shopping basket sequence of user u.
[0077] In the task of the recommendation system, for each user the goal is to infer which items will be included in their next shopping basket based on their shopping basket sequence , where the size (i.e., the number of items included) is unknown but can be estimated based on historical data or specific rules. Initialize all shopping basket embedding representations E (b) ∈ R K×d and item embedding representations E (i) ∈ R J×d , where K represents the number of all shopping baskets, J represents the number of all items, and d represents the dimension of the embedding representation.
[0078] Collect the historical interaction data of users, including the shopping basket set and the item set I, and count the items included in each shopping basket and the occurrence times of the shopping baskets; define the node set where the shopping basket set The shopping basket set and the product set I are used as two parts of nodes respectively; define the edge set to represent the association relationship between the shopping basket and the product. For each shopping basket traverse all the products i∈I it contains, and add an edge (b, i) from the shopping basket node b to the product node i. Construct a shopping basket-product frequency interaction graph according to the historical interaction data, and use the shopping basket set and the product set I as two parts of nodes. Set the edge structure according to the association between the shopping basket and the product, and use the number of occurrences of the shopping basket in the historical interaction data to set the weight of the edge structure, which reflects the strength of the relationship between the shopping basket and the product. Based on the constructed shopping basket-product frequency interaction graph, construct a frequency adjacency matrix of the shopping basket-product. The rows of the matrix represent the shopping basket nodes, and the columns represent the product nodes. Normalize the frequency adjacency matrix A to obtain the normalized adjacency matrix R K×J represents the real number space of K×J, where K represents the shopping basket and J represents the product. The purpose of normalization is to eliminate the difference in the frequency dimension between different shopping baskets or products, making the elements in the matrix more comparable.
[0079] It should be noted that use the graph convolutional network to learn the shopping basket-product frequency interaction graph to obtain the initial shopping basket embedding representation E (b) and the product embedding representation E (i) , and aggregate the neighbor information of each shopping basket k or product j through matrix multiplication in the graph convolutional network, and output the main view embedding representation of the shopping basket at the l-th layer through the activation function (identity function) and the main view embedding representation of the product which is expressed as:
[0080]
[0081]
[0082] Among them, represents the k-th row of the normalized adjacency matrix, that is, the association weight between the shopping basket k and all products, represents the embedding matrix of all products at the l-1 layer through matrix multiplication, and p(·) represents the function of edge dropout in the adjacency matrix; represents the j-th column of the normalized adjacency matrix, that is, the association weight between the product j and all shopping baskets. represents the embedding matrix of all shopping baskets at the l-1 layer.
[0083] Generate the final embedding vector of the shopping basket k according to the sum of the embedding vectors of all layers in the graph convolutional network and the final embedding vector of the product j which is expressed as:
[0084]
[0085] Among them, represents the main view embedding representation of shopping basket k, represents the main view embedding representation of item j, d represents the embedding representation dimension, and l = 0 represents the original embedding vector (i.e., E (b) and E (i) ).
[0086] According to the final embedding vector of the shopping basket and the final embedding vector of item j calculate the embedding inner product of the shopping basket and the item to obtain the predicted relevance between the shopping basket and the item The predicted relevance reflects the matching degree between the item and the shopping basket in the embedding space.
[0087] It should be noted that singular value decomposition is a matrix decomposition method that decomposes a matrix into the product of three matrices: an orthogonal matrix, a diagonal matrix (containing singular values), and the transpose of another orthogonal matrix. Using singular value decomposition on the normalized adjacency matrix is decomposed and expressed as:
[0088]
[0089] where U ∈ R K×K and V ∈ R J×J represent orthogonal matrices, S ∈ R K×J represents a diagonal matrix containing singular values.
[0090] To reduce the computational complexity and storage requirements, obtain the list of singular values of the adjacency matrix , preset a quantity threshold q, truncate the list of singular values using the quantity threshold q, retain the first q singular values in the list of singular values, and reconstruct the normalized adjacency matrix using the retained singular values Obtain the reconstructed adjacency matrix which is expressed as:
[0091]
[0092]
[0093] where respectively contain the first q columns of U and V, is a diagonal matrix containing the first q largest singular values.
[0094] The normalized adjacency matrix is processed using SVD to extract important cooperation relationships in the interaction between shopping baskets and goods, and an SVD-enhanced view is constructed based on this. According to the reconstructed adjacency matrix Message propagation is performed to obtain the global view embedding representation of the shopping basket after global enhancement by singular value decomposition in the l-th layer graph convolutional network and the global view embedding representation of the goods which is expressed as:
[0095]
[0096]
[0097] where represents the updated SVD-enhanced view embedding representation of the shopping basket node k in the l-th layer graph convolutional network; σ represents an activation function represents the reconstructed shopping basket-goods relationship matrix the k-th row of. This matrix is obtained through singular value decomposition (SVD) and is used to represent the connection strength between the shopping basket node and the goods node represents the set of embedding representations of all goods nodes in the (l - 1)-th layer graph neural network represents the updated SVD-enhanced view embedding representation of the goods node j in the l-th layer graph neural network, which is the j-th column of the reconstructed shopping basket-goods relationship matrix ; represents the set of embedding representations of all shopping basket nodes in the (l - 1)-th layer graph neural network
[0098] It should be noted that a contrast loss is constructed by comparing the similarity between the main view shopping basket-goods embedding representation and the global view shopping basket-goods embedding representation. The similarity between the main view shopping basket-goods embedding representation and the global view shopping basket-goods embedding representation is measured based on the InfoNCE loss function, and the similarity is compared with the global view embedding representations of other shopping basket nodes or goods nodes. The contrast loss of the shopping basket node is expressed as:
[0099]
[0100] where s(·) and τ represent the cosine similarity and temperature parameter respectively represents the main view embedding representation of the shopping basket node k in the l-th layer graph convolutional network represents the global view embedding of the shopping basket node k in the l-th layer graph convolutional network, K represents the total number of shopping basket nodes, and L represents the total number of layers of the graph convolutional network. Similarly, the contrast loss of the goods node is constructed
[0101] Define the contrastive loss L con , which encourages the model to give high prediction scores to positive items (items in the shopping basket) and low prediction scores to negative items (items not in the shopping basket), expressed as:
[0102]
[0103] where represents the prediction relevance score of the positive items (items in the shopping basket) of shopping basket k, represents the prediction relevance score of the negative items (items not in the shopping basket) of shopping basket k, K represents the number of all shopping baskets, and S represents the number of positive-negative pairs in each shopping basket.
[0104] At the same time, combine the contrastive loss and the regularization term to construct a graph contrastive learning pre-training framework for the recommendation task, and the corresponding loss function L is expressed as:
[0105]
[0106] where L con represents the contrastive loss, represents the contrastive loss of shopping basket nodes, represents the contrastive loss of item nodes, represents the regularization term, λ 1 、λ 2 represent learnable parameters.
[0107] The main view embedding captures the user's historical shopping basket-item interaction information, while the SVD-based global view embedding integrates the global structural features of the data. By constructing a contrastive learning objective between the two views, the model's joint understanding of local and global information is strengthened. The regularization term in the framework further helps control the model complexity, prevent overfitting, and improve the generalization ability of the embedding representation. Overall, this pre-training framework not only improves the matching accuracy between the shopping basket and the item, but also enhances the robustness and interpretability of the model in the recommendation task.
[0108] It should be noted that the adjacency matrix after normalizing the shopping basket-item frequency interaction graph is mapped to the embedding spaces of the shopping basket and the item through MLP to construct the shopping basket-level prompt vector P B and the item-level prompt vector P I , expressed as:
[0109]
[0110]
[0111] where, P I ∈R J×ddenotes the hint vector mapped to the item level, J denotes the number of all items, P B ∈R K×d denotes the hint vector mapped to the shopping basket level, K denotes the number of all shopping baskets; denotes the normalized adjacency matrix of the interaction frequency between shopping baskets and items, and and denote the weight matrices of two-layer linear transformation, d h is the hidden embedding dimension, d denotes the target hint embedding dimension, and and denote the bias terms, σ denotes the non-linear activation function ReLU;
[0112] Define the historical interaction shopping basket sequence of each user u |S u | represents the length of the historical interaction shopping basket sequence of user u, and at the same time define the item expansion sequence The items in each shopping basket have no strict time order, which is different from the sequence in item-level recommendation. For the convenience of description, set the length of a shopping basket sequence interacted by a user to be |S u |, and the length of the item sequence interacted by the user is |S (u,I) |.
[0113] For the item expansion sequence S (u,I) of the user, its embedding representation is:
[0114]
[0115] where E (u,I) represents the set of embedded representations of the item sequences that the user has interacted with historically, represents the item embedded representation of the user in the item-level interaction sequence at time t, |S (u,I) | represents the number of items that the user has interacted with; Embed the representation E (u,I) of the item expansion sequence S (u,I) through the encoding of the gated recurrent unit to generate the dynamic interest hidden state of the user:
[0116] H (u,I) =GRU(E (u,I) )
[0117] represents the dynamic interest hidden state of the user extracted by the gated recurrent unit.
[0118] To fuse the information of the interaction frequency between shopping baskets and items and enhance the graph semantic expression ability of the hint embedding, we design a hint generation process based on the inner product, and use the hidden state H of the user's historical item interaction(u,I) Perform inner product operations with two different levels of graph information hint vectors P I and P B respectively to generate item-level hint embeddings S I and basket-level hint embeddings S B , and the hint embeddings at the two levels not only integrate the user's interaction history but also contain more semantic information related to the graph structure, expressed as:
[0119]
[0120]
[0121] where represents the item-level hint embedding, represents the basket-level embedding, K represents the number of all baskets, J represents the number of all items, and |S (u,I) | represents the length of the user's historical interaction item sequence.
[0122] In the process of constructing the graph hint vector, dimensionality reduction processing needs to be performed on the hint embeddings at the two levels (item-level hint and basket-level hint). Through a multi-layer perceptron, the item-level hint embedding S I and the basket-level hint embedding S B are subjected to non-linear transformation and compression, expressed as:
[0123]
[0124]
[0125] where represents the item-level hint embedding after dimensionality reduction, |S (u,I) | represents the number of items in the user's historical interaction item sequence, and represent the two-layer weight matrices for compressing the item hint embedding, where d h represents the hidden layer embedding, d represents the target hint compression embedding, σ(·) represents the ReLU activation function, and represent the bias terms of the item hint embedding, represents the basket-level hint embedding after dimensionality reduction, and represent the two-layer weight matrices for compressing the basket hint embedding, and represent the bias terms of the basket hint embedding.
[0126] The dimension-reduced product-level and shopping basket-level hint embeddings are fused additively to obtain a new fused hint embedding, denoted as:
[0127]
[0128] Among them, represents the final hint embedding that fuses product-level and shopping basket-level hint information. This embedding vector contains both the user's interaction information at the product level and the frequency information at the shopping basket level;
[0129] The row vectors of all hint embeddings are summed to obtain the user's graph hint vector Denoted as:
[0130]
[0131] Among them, represents the t-th row vector in the hint embedding P u . Finally, represents the constructed user's graph hint vector, which is used to capture the user's dynamic interaction features and semantic information.
[0132] It should be noted that by adding the graph hint vector to the user's product and shopping basket sequence embedding representations, an enhanced embedding is constructed. This process aims to capture the user's behavior patterns and further improve the understanding of the user's interests. The embedding of each product interacted by the user is added to the graph hint information to obtain a new product embedding representation.
[0133] Define the user's product-level interaction sequence embedding E (u,I) and shopping basket-level interaction sequence embedding E (u,B) , denoted as:
[0134]
[0135]
[0136] Among them, represents the embedding vector of the t-th product in the product sequence of user u, represents the embedding vector of the t-th shopping basket in the shopping basket sequence of the user, and d represents the dimension;
[0137] The product embeddings in the product-level interaction sequence and the shopping basket embeddings in the shopping basket-level interaction sequence are respectively added to the graph hint vector to obtain the enhanced product embedding and shopping basket embedding Denoted as:
[0138]
[0139]
[0140] Generate the fused graph prompt vector after integration Enhanced embeddings of the item and shopping basket sequences and Capture the overall user behavior pattern, and enhance the model's understanding of user interests by adding the embeddings of items and shopping baskets.
[0141] It should be noted that a hierarchical prediction scheme is introduced to model the user's historical interaction behavior for efficient personalized recommendation. This scheme can not only capture the shopping basket-level interactions of users at different time periods, but also deeply mine the item-level information inside the shopping basket, so as to comprehensively describe the dynamic interest evolution process of users. The core of the adopted model is the gated recurrent unit (GRU), which encodes information at the shopping basket level and the item level respectively, improving the modeling ability for complex behavior sequences.
[0142] Use the gated recurrent unit to gradually encode the user's shopping basket sequence For each time step t, the encoding updates of the gated recurrent unit at the shopping basket sequence level and the user sequence level are expressed as:
[0143]
[0144]
[0145] where represents the enhanced embedding representation of the t-th shopping basket and the t-th item, represents the historical interaction information encoding of the t-th shopping basket and the t-th item, represents the historical interaction information encoding of the (t + 1)-th shopping basket and the (t + 1)-th item, and d represents the dimension of the hidden state of the GRU.
[0146] Obtain the final representation s at the shopping basket level through the recursive encoding of the gated recurrent unit (u,B) and the final representation s at the item level (u,I) , s (u,B) encodes the user's dynamic interests at the shopping basket level, such as seasonal preferences or shopping habits during specific time periods, and s (u,I) encodes the user's fine-grained interests at the item level, such as the user's detailed preferences for specific items.
[0147] Obtain the embedding representation e of item i through the graph contrastive learning pre-training framework i , and use the final representation s at the shopping basket level (u,B) and the embedding representation e of item i i to calculate the correlation score of item i at the shopping basket level This score represents the similarity between item i and the user's historical preferences at the shopping basket level, reflecting the user's preference for this item based on the dynamic interest of the overall shopping basket;
[0148] Using the final representation s at the item level (u,I) and the embedded representation e of item i i , calculate the relevance score of item i at the item level This score reflects the user's preference at the item level and is calculated by capturing the user's fine-grained interest in specific items;
[0149] Add the relevance scores at the shopping basket level and the item level, and use the sigmoid function to map them to the probability range of [0,1] to obtain the probability that item i appears in the next shopping basket
[0150] To train the model, define a loss function L for the recommendation task rec , aiming to optimize the prediction effect of the model. The loss function combines the log-likelihood losses of positive and negative samples, and the definition of the objective function:
[0151]
[0152] where, represents the set of items in the next shopping basket after S u , and represents the set of items not in the next shopping basket, that is, used as negative samples. To avoid the problem of data imbalance, the loss function normalizes the positive and negative samples respectively, is the number of positive samples, is the number of negative samples. The definition of the label is: for item i in the next shopping basket , its label For item i not in the next shopping basket, its label
[0153] The loss function is a binary cross-entropy loss, and the weighted average is performed on the positive and negative samples respectively:
[0154] Positive sample part: For each item i in , calculate its predicted probability and the error with the true label
[0155] Negative sample part: For each item i not in , calculate its predicted probability and the true label error
[0156] Through the above hierarchical prediction scheme, the shopping basket-level interests and item-level interests of users are fully utilized to predict the behavior of users in the next shopping basket. The final loss function L rec optimizes the accuracy of positive and negative samples to ensure that the model can effectively recommend items in various scenarios. This scheme not only captures the dynamic interests of users but also improves the performance of the recommendation system through reasonable optimization strategies.
[0157] Figure 3 shows the flowchart of a shopping basket recommendation system based on graph contrast learning and personalized graph prompts.
[0158] The second embodiment of the present invention also provides a shopping basket recommendation system based on graph contrast learning and personalized graph prompts. The system includes: an enterprise transaction data collection module, a shopping basket-item frequency interaction graph construction module, a singular value decomposition-pre-training contrast enhancement representation module, a graph prompt construction module, a shopping basket-item embedding representation fusion module, a next shopping basket prediction module, and a prediction result output module.
[0159] The enterprise transaction data collection module: collects and preprocesses user transaction data. By sorting out enterprise transaction data, preprocesses shopping basket and item information through steps such as cleaning, transformation, and formatting, and initializes the embedding representations of shopping baskets and items, laying a foundation for subsequent recommendation tasks.
[0160] The shopping basket-item frequency interaction graph construction module: constructs a shopping basket-item frequency interaction graph according to the historical interaction data of users to read the interaction frequencies between shopping baskets and items;
[0161] The singular value decomposition-pre-training contrast enhancement representation module: generates a main view shopping basket-item embedding representation through a graph convolutional network, and then uses singular value decomposition to further enhance and generate a global view shopping basket-item embedding representation; performs contrast learning on the two different perspective embedding representations to enhance the main view shopping basket-item embedding representation and the global view shopping basket-item embedding representation.
[0162] Under the framework of the Graph Convolutional Network (GCN), a two-layer GCN structure is utilized to generate the embedding representations of shopping baskets and items. The GCN gradually updates the embedding vectors of shopping baskets and items by aggregating the neighbor information of each shopping basket or item, enabling the embedding representations of shopping baskets and items to not only contain their own information but also incorporate the information of other related shopping baskets and items, thereby generating a more comprehensive and informative main view embedding representation. Finally, we use the inner product of these embedding representations to predict the relevance between shopping baskets and items, providing strong support for subsequent shopping basket recommendation tasks;
[0163] By introducing SVD (Singular Value Decomposition) to effectively extract important cooperation signals in the interaction between shopping baskets and items from a global perspective. By performing SVD on the normalized adjacency matrix, the main components of the graph are identified and emphasized while preserving the global collaboration signals. Efficient message propagation is performed on the reconstructed shopping basket-item relationship graph at each layer to generate shopping basket-item embedding representations based on the global view, which not only improves the model efficiency but also enhances the accuracy and robustness of the recommendation system.
[0164] The graph prompt construction module: uses graph prompts to encode user historical interaction data into shopping basket-level and item-level prompt embeddings and uses a multi-layer perceptron to fuse and construct graph prompt vectors; enhances the embedding representations of shopping baskets and items through a pre-trained contrastive learning framework optimized based on SVD (Singular Value Decomposition). By introducing an SVD-enhanced view established based on the global collaborative relationship, the representation of the main view is strengthened. The SVD-enhanced view not only retains the global collaboration signals but also effectively reduces the rank of the matrix by truncating the singular value list and reconstructing the normalized adjacency matrix, thereby improving the computational efficiency. Based on the LightGCL framework, directly contrast the SVD-enhanced view embeddings with the main view embeddings in the InfoNCE loss. By calculating the cosine similarity and applying a temperature parameter, define the InfoNCE loss for shopping baskets and items, and define the InfoNCE loss for items in the same way. To further improve the generalization ability of the model, add a random node dropout strategy in each batch to exclude some nodes from participating in the contrastive learning, thereby preventing overfitting.
[0165] The shopping basket - item embedding representation fusion module: Fuses the graph prompt vector with the pre - trained shopping basket - item embedding representation, performs a linear transformation through trainable weights and biases, and applies an activation function for non - linear processing. The fused representation is further compressed and optimized through a multi - layer perceptron to obtain the shopping basket and item representation embedding fused with the graph prompt vector. Defines the user's shopping basket sequence and item expansion sequence, and encodes each user's historical interaction using the pre - trained embedding representation. Then, extracts the user's dynamic historical interest representation through a gated recurrent unit (GRU) and performs an inner - product operation with the pre - compressed graph structure information to generate two - level prompt embeddings, representing semantic information at the item level and shopping basket level respectively. Subsequently, uses a multi - layer perceptron (MLP) to reduce the dimension of these two - level prompt embeddings, and finally generates a comprehensive graph prompt vector through additive fusion. This graph prompt vector can not only capture the user's overall behavior pattern but also enhance the understanding of the user's interest, thereby improving the accuracy and effectiveness of downstream recommendation tasks.
[0166] After obtaining the personalized prompt, it is fused with the pre - trained shopping basket - item embedding representation. Inject the key information in the personalized prompt into the pre - trained embedding representation to enhance the expressive power of the representation. Finally, to reduce the dimension of the representation and extract key information, a multi - layer perceptron (MLP) layer is used to compress the shopping basket representation embedding and item representation embedding fused with the prompt. The compressed representation not only has a lower dimension but also can retain key information, facilitating the use in subsequent downstream shopping basket recommendation tasks.
[0167] The next shopping basket prediction module: According to the shopping basket and item representation embedding fused with the graph prompt vector, calculates the relevance scores of item i at the shopping basket level and item level, and fuses the probabilities at the two levels to obtain the final probability of item i appearing in the next shopping basket.
[0168] The shopping basket sequence is processed hierarchically, including two levels: the basket level and the item level. Each shopping basket in the shopping basket sequence contains a series of items, but these items do not have a strict time order. To capture the dynamic interests of users, a gated recurrent unit (GRU) is used to encode historical interactions. At the basket level, the module embeds each shopping basket in the shopping basket sequence as a vector and uses GRU to encode the shopping basket sequence to obtain the representation of the user's dynamic interests at the basket level. Similarly, at the item level, the module embeds the items in each shopping basket and uses GRU to encode the item sequence to obtain the representation of the user's dynamic interests at the item level. Using the representations at these two levels, the module can infer the probability of the items that may be included in the next shopping basket. To comprehensively consider the probabilities at the two levels, the module adopts a specific calculation method to combine the probabilities at the basket level and the item level to obtain the final prediction result. Finally, the module is optimized using the defined loss function Lrec, which calculates the loss based on the difference between the items actually included in the next shopping basket and the predicted items. By minimizing this loss function, the module can continuously optimize its prediction ability and improve the accuracy of recommendations.
[0169] The prediction result output module: obtains the recommended items in the next shopping basket according to the final probability of the items appearing in the next shopping basket.
[0170] In several embodiments provided by the present application, it should be understood that the disclosed method can be implemented in other ways. The above-described embodiments are merely illustrative. For example, the division of the units is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units or components can be combined, or can be integrated into another system, or some features can be ignored, or not executed. In addition, the coupling, direct coupling, or communication connection between the various components shown or discussed with each other can be through some interfaces. The indirect coupling or communication connection of the units can be electrical or in other forms.
[0171] In addition, each functional unit in the embodiments of the present invention can be all integrated in a processing unit, or each unit can be separately used as a unit, or two or more units can be integrated in a unit; the above integrated unit can be implemented in the form of hardware, or in the form of a hardware plus a software functional unit.
[0172] Those of ordinary skill in the art can understand that all or part of the steps to implement the above method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps including those of the above method embodiments. The aforementioned storage medium includes various media that can store program codes, such as removable storage devices, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical discs.
[0173] Alternatively, if the above integrated unit is implemented in the form of a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the embodiments of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media that can store program codes, such as removable storage devices, ROM, RAM, magnetic disks, or optical discs.
[0174] As described above, the above are only the specific implementation manners of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present invention can easily think of changes or substitutions, which should all be covered by the protection scope of the present invention. Therefore, the protection scope of the present invention should be subject to the protection scope of the claims.
Claims
1. A shopping basket recommendation method based on graph contrast learning and personalized graph prompts, characterized in that: The following steps are involved: Obtain enterprise transaction data, initialize the embedded representation of shopping baskets and products after data preprocessing, and construct a shopping basket-product frequency interaction graph; The graph convolutional network is used to generate the main view shopping basket-product embedding representation, and the global collaborative relationship is extracted by combining the singular value decomposition to generate the globally enhanced global view shopping basket-product embedding representation; Constructing a graph contrast learning pre-training framework, and enhancing the main view shopping basket-product embedding representation and the global view shopping basket-product embedding representation through the graph contrast learning pre-training framework; The user's historical interaction data is encoded into shopping basket-level and product-level prompt embeddings using the graph prompt mechanism, and the graph prompt vector is constructed using multi-layer perceptron fusion; Obtain enhanced embedding of product and shopping basket sequences of fused graph prompt vectors, obtain hierarchical representation of user dynamic interests at the product and shopping basket levels through gated recurrent units, infer the probability of a product appearing in the next shopping basket, and obtain recommended products in the next shopping basket.
2. A shopping basket recommendation method based on graph comparison learning and personalized graph prompts according to claim 1, characterized in that: Obtain enterprise transaction data, initialize the embedded representation of shopping baskets and products after data preprocessing, and construct a shopping basket-product frequency interaction graph, specifically: Obtain enterprise transaction data for data cleaning, format conversion and standardization. After data preprocessing is completed, define the product set as I = {i1, i2, ..., i |J| }, |J| represents the total number of commodities, and the user set is defined as U = {u1,u2,…,u |U| }, |U| represents the total number of users, and defines the shopping basket set |K| represents the total number of shopping baskets; Initialize all shopping basket embedding representations E (b) and product embedding representation E (i) , collect historical user interaction data, including shopping cart collection and product set I, counting the number of products contained in each shopping basket and the number of occurrences of the shopping basket; Build a shopping basket-product frequency interaction graph based on historical interaction data and combine the shopping basket and the product set I as two parts of nodes, set the edge structure according to the association between the shopping basket and the products, and set the weight of the edge structure according to the number of appearances of the shopping basket in the historical interaction data; Based on the constructed shopping basket-product frequency interaction graph, a shopping basket-product frequency adjacency matrix is constructed, and the frequency adjacency matrix A is normalized to obtain a normalized adjacency matrix R K×J Represents the real number space of K×J, K represents the shopping basket, and J represents the product.
3. A shopping basket recommendation method based on graph contrast learning and personalized graph prompts according to claim 1, characterized in that: The graph convolutional network is used to generate the main view shopping basket-product embedding representation, specifically: The graph convolutional network is used to learn the shopping basket-product frequency interaction graph to obtain the initial shopping basket embedding representation E (b) and product embedding representation E (i) In the graph convolutional network, the neighbor information of each shopping basket k or product j is aggregated through matrix multiplication, and the main view embedding representation of the l-th layer shopping basket is output through the activation function and the main view embedding representation of the product The final embedding vector of the shopping basket is generated by summing the embedding vectors of all layers in the graph convolutional network. and the final embedding vector of product j The final embedding vector of the shopping basket and the final embedding vector of product j Calculate the embedded inner product of the shopping basket and the product to obtain the predicted correlation between the shopping basket and the product 4. A shopping basket recommendation method based on graph comparison learning and personalized graph prompts according to claim 1, characterized in that: Combined with singular value decomposition to extract global collaboration relationships, a globally enhanced global view shopping basket-product embedding representation is generated, specifically: Use singular value decomposition to normalize the adjacency matrix Decompose and obtain the adjacency matrix A singular value list of , a preset quantity threshold q, using the quantity threshold q to truncate the singular value list, retaining the first q singular values in the singular value list, and reconstructing the normalized adjacency matrix using the retained singular values Get the reconstructed adjacency matrix According to the reconstructed adjacency matrix Perform message propagation to obtain the global view embedding representation of the shopping basket after global enhancement of the singular value decomposition in the l-th layer graph convolutional network And the global view embedding representation of the product 5. A shopping basket recommendation method based on graph contrast learning and personalized graph prompts according to claim 1, characterized in that: The main view shopping basket-product embedding representation and the global view shopping basket-product embedding representation are enhanced by using a graph contrast learning pre-training framework, specifically: By comparing the similarity between the main view shopping basket-product embedding representation and the global view shopping basket-product embedding representation, we construct a contrast loss. At the same time, we combine the contrast loss and the regularization term to construct a graph contrast learning pre-training framework for recommendation tasks. The corresponding loss function L is expressed as: Where L con represents the contrast loss, represents the contrast loss of the shopping basket node, represents the contrast loss of the commodity node, represents the regular term, λ1 and λ2 represent learnable parameters; The contrast loss calculates the predicted scores of the items in the shopping basket based on the predicted correlation between the shopping basket and the items, encouraging the model to give high prediction scores for positive items and low prediction scores for negative items; The comparison loss of the shopping basket node and the comparison loss of the product node measure the similarity between the main view shopping basket-product embedding representation and the global view shopping basket-product embedding representation based on the InfoNCE loss function, and compare the similarity with the global view embedding representation of other shopping basket nodes or product nodes.
6. A shopping basket recommendation method based on graph comparison learning and personalized graph prompts according to claim 1, characterized in that: The graph prompt module is constructed by constructing the shopping basket-product frequency interaction graph, encoding the user's historical interaction data into shopping basket-level and product-level prompt embeddings, and constructing the graph prompt vector using multi-layer perceptron fusion, specifically: The adjacency matrix after normalizing the shopping basket-product frequency interaction graph Mapped to the embedding space of shopping basket and products through MLP, construct the shopping basket level prompt vector P B and the product-level prompt vector P I , expressed as: Among them, P I ∈R J×d represents the hint vector mapped to the product level, J represents the number of all products, and P B ∈R K×d represents the prompt vector mapped to the shopping basket level, and K represents the number of all shopping baskets; The normalized adjacency matrix representing the frequency of interaction between the shopping basket and the products, and and Represents the weight matrix of the two-layer linear transformation, d h is the hidden embedding dimension, d represents the target cue embedding dimension, and and represents the bias term, σ represents the nonlinear activation function ReLU; Define the historical interaction shopping basket sequence of each user u |S u | represents the length of the historical interactive shopping basket sequence of user u, each shopping basket Define a product expansion sequence for a shopping behavior For the user's product expansion sequence S (u,I) , whose embedding is expressed as: Where E (u,I) The product sequence embedding representation set represented by the user’s historical interaction, represents the item embedding representation of the user's interaction sequence at the item level at time t, |S (u,I) | represents the number of products that the user has interacted with; Expand the product sequence S (u,I) The embedding representation E (u,I) After encoding by the gated recurrent unit, the user’s dynamic interest hidden state is generated: H (u,I) =GRU(E (u,I) ) H (u,I) ∈R |S(u,I)|×d It represents the hidden state of the user's dynamic interest extracted by the gated recursive unit, and the hidden state H of the user's historical product interaction (u,I) With two different levels of graph information hint vector P I and P B Perform inner product operations respectively to generate product-level hint embedding S I and shopping basket level prompts embedded in S B ; Embed S into product-level prompts through multi-layer perceptron I and shopping basket level prompts embedded in S B Perform nonlinear transformation and compression, and finally generate the user's graph prompt vector through additive fusion 7. A shopping basket recommendation method based on graph comparison learning and personalized graph prompts according to claim 6, characterized in that: Get the enhanced embedding of the product and shopping basket sequence of the fusion graph prompt information, specifically: Define the user's item-level interaction sequence embedding E (u,I) and shopping basket level interaction sequence embedding E (u,B) , respectively add the product embedding in the product-level interaction sequence and the shopping basket embedding in the shopping basket-level interaction sequence to the graph prompt vector to obtain the enhanced product embedding and shopping cart embed After integration, the fusion map prompt vector is generated Enhanced embedding of product and shopping basket sequences and 8. A shopping basket recommendation method based on graph comparison learning and personalized graph prompts according to claim 7, characterized in that: Through the gated recursive unit, the user's dynamic interests are hierarchically obtained at the product and shopping basket levels, the probability of the product appearing in the next shopping basket is inferred, and the recommended products in the next shopping basket are obtained. Specifically: Using gated recurrent units to train users’ shopping cart sequences Step-by-step encoding is performed. For each time step t, the encoding update of the gated recurrent unit at the shopping basket sequence level and the user sequence level is expressed as: in represents the enhanced embedding representation of the t-th shopping basket and the t-th product, Represents the historical interactive information encoding of the t-th shopping basket and the t-th product, Represents the historical interactive information encoding of the t+1th shopping basket and the t+1th product; The final representation s at the shopping basket level is obtained through the recursive encoding of the gated recurrent unit (u,B) and the final representation of product level (u,I) ; Obtain the embedding representation e of product i through the graph contrast learning pre-training framework i , using the final representation s at the shopping basket level (u ,B) and the embedding representation e of product i i , calculate the relevance score of product i at the shopping basket level Using the final representation of the product level (u,I) and the embedding representation e of product i i , calculate the relevance score of product i at the product level Add the shopping basket-level and product-level relevance scores and use the sigmoid function to map them to the probability range of [0,1] to obtain the probability of product i appearing in the next shopping basket.
9. A shopping basket recommendation system based on graph contrast learning and personalized graph prompts, characterized in that: Implementing the shopping basket recommendation method based on graph contrast learning and personalized graph prompts as described in any one of claims 1 to 8, the system comprises: an enterprise transaction data collection module, a shopping basket-commodity frequency interaction graph construction module, a singular value decomposition-pre-trained contrast enhancement representation module, a graph prompt construction module, a shopping basket-commodity embedding representation fusion module, a next shopping basket prediction module and a prediction result output module; The enterprise transaction data collection module is used to collect and pre-process user transaction data; The shopping basket-product frequency interaction graph construction module: reads the interaction frequency between the shopping basket and the item according to the user's historical interaction data to construct a shopping basket-product frequency interaction graph; The singular value decomposition-pretrained contrast enhancement representation module: generates a main view shopping basket-product embedding representation through a graph convolutional network, and then further enhances and generates a global view shopping basket-item embedding representation using singular value decomposition; compares and learns the embedding representations of two different perspectives to enhance the main view shopping basket-product embedding representation and the global view shopping basket-product embedding representation; The graph prompt construction module: uses graph prompt generation to encode user historical interaction data into shopping basket-level and product-level prompt embeddings, and uses multi-layer perceptron fusion to construct graph prompt vectors; The shopping basket-product embedding representation fusion module: fuses the graph prompt vector with the pre-trained shopping basket-item embedding representation, performs linear transformation through trainable weights and biases, and applies activation functions for nonlinear processing. The fused representation is further compressed and optimized through a multi-layer perceptron to obtain the shopping basket and item representation embedding of the fused graph prompt vector; The next shopping basket prediction module: calculates the relevance score of product i at the shopping basket level and the product level according to the shopping basket and item representation embedding of the fusion graph prompt vector, and fuses the probabilities of the two levels to obtain the final probability of product i appearing in the next shopping basket; The prediction result output module is used to obtain the recommended products in the next shopping basket according to the final probability of the products appearing in the next shopping basket.
Citation Information
Patent Citations
Sequence recommendation method and device based on hypergraph neural network
CN115082147A
Cross-hierarchy graph contrast learning bundled commodity recommendation method
CN116611894A
Graph contrast learning recommendation method, system and device based on global collaboration and medium
CN117350803A
Commodity recommendation method for removing noise interaction signal of social platform
CN117670464A
Multi-behavior perception graph comparison recommendation method
CN117909577A