A shopping basket explainable recommendation method and system based on knowledge enhancement

By constructing a shopping basket knowledge graph and reinforcement learning path reasoning, the problem of insufficient interpretability in shopping basket recommendations in the B2B field is solved, high-quality recommendation results are provided, and user trust and recommendation performance are improved.

CN118799038BActive Publication Date: 2024-11-19SOUTH CHINA AGRICULTURAL UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411260400.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-10
Publication Date
2024-11-19
Estimated Expiration
2044-09-10

AI Technical Summary

Technical Problem

Existing shopping basket recommendation systems lack interpretability in the B2B field, and most of the black box models based on deep learning are difficult to provide recommendation results that users trust, especially in the case of data sparseness, which makes it difficult to infer high-quality users. Interaction information with products.

Method used

Using a knowledge graph-based method, a shopping basket knowledge graph is constructed, pre-trained representations are obtained through the TransR model, and a user's shopping basket sequence-level representation is generated by combining LSTM and GAT models. Path reasoning is performed on the knowledge graph through reinforcement learning to generate interpretable Recommended results.

Benefits of technology

It realizes the provision of high-quality interpretable shopping basket recommendations in B2B scenarios, which improves users' understanding and trust in recommendation results, and is suitable for B2B user scenarios with strong repurchase ability and improves recommendation performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118799038B_ABST
    Figure CN118799038B_ABST
Patent Text Reader

Abstract

The present invention relates to a method and system for interpretable recommendation of a shopping basket based on knowledge reinforcement, and belongs to the field of shopping recommendation technology. A temporary representation sequence of a shopping basket is constructed based on a three-step graph in a shopping basket knowledge graph, and a representation at the shopping basket sequence level of a user is generated through LSTM. Based on the goods recently purchased by the user and the number of times, weighted learning is performed to generate a repurchase representation of the user. The learning weights fuse the user's pre-trained representation, the shopping basket sequence-level representation, and the repurchase representation to obtain a user prediction vector. The user prediction vector is used to replace the user's pre-trained representation, and reinforcement learning is used to perform path reasoning on the shopping basket knowledge graph to obtain the recommended goods and explanation path of the shopping basket. User and other entity representations are constructed by knowledge graphs, user shopping basket sequences, and repurchase behavior modeling, and reinforcement learning is used to implement interpretable shopping basket recommendations, thereby improving the recommendation accuracy of e-commerce, improving user experience, and promoting transaction completion.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of shopping recommendation, and in particular to a method and system for explaining shopping basket recommendation based on knowledge enhancement. Background Art

[0002] In the field of e-commerce, recommendation systems have been widely used to help users quickly find products of interest. Especially in B2B scenarios, B2B users usually buy multiple products at a time, and the purchase quantity is large and repetitive. This makes the recommendation system in B2B transactions not just recommend one product, but a group of products. Moreover, the recommendation system not only needs to accurately predict the user's future purchasing needs, but also needs to be able to explain the recommendation results so that the user can understand and trust the recommendation results during the decision-making process, thereby better facilitating transactions. Explainable shopping basket recommendations aim to recommend a group of products that the user may purchase next time based on the shopping basket sequence purchased by the user in the past, and provide recommendation explanations.

[0003] Most of the existing shopping basket recommendations model the relevance of products and mine the user preferences hidden in the shopping basket sequence, trying to use the mined information to infer a set of products that tend to be in the next shopping basket. Existing shopping basket recommendations are mainly based on Markov chains and recurrent neural networks. However, a common problem in recommendation methods is data sparsity. There is little interaction between users and products. It is difficult to infer high-quality representations of shopping baskets and user preferences based solely on interactive information. At present, the research on shopping basket recommendations focuses on improving the accuracy of recommendations and has achieved good recommendation performance. However, most shopping basket recommendations are black box models of deep learning and are not interpretable. The lack of interpretability will cause customers to not understand the recommendation results, affecting the effectiveness of the recommendation. However, there is currently no research on the interpretability of shopping basket recommendations, and the existing shopping basket recommendations are mainly concentrated in the B2C field, and there are few in the B2B field.

[0004] Knowledge graphs have rich information and topological structures in addition to interactive information. We can use the rich information of knowledge graphs to learn high-quality pre-trained representations, and we can also use the topological structure of knowledge graphs to reason and obtain interpretable paths. Therefore, how we can build a shopping basket knowledge graph for B2B e-commerce scenarios, obtain user representations with B2B user characteristics, and achieve interpretable recommendations for shopping baskets is an urgent problem to be solved. Summary of the invention

[0005] The present invention overcomes the deficiencies of the prior art and provides a method and system for interpretable shopping basket recommendation based on knowledge enhancement.

[0006] To achieve the above object, the technical solution adopted by the present invention is:

[0007] The first aspect of the present invention provides a method for explaining shopping basket recommendation based on knowledge enhancement, comprising:

[0008] Obtain the user's interaction information and product information in the relevant historical time period of the shopping system, extract each attribute entity and the relationship between attribute entities based on the interaction information and product information, and construct a shopping basket knowledge graph;

[0009] Constructing a TransR model, inputting the shopping basket knowledge graph into the TransR model to obtain a pre-trained representation; the attribute entity includes a user, a product, a shopping basket, and a product attribute;

[0010] A user-specific three-step graph is constructed based on the most recently purchased goods, shopping basket, and goods attributes in the shopping knowledge graph, a shopping basket representation sequence is constructed according to the user-specific three-step graph, and a user's shopping basket sequence-level representation is generated through LSTM;

[0011] Filtering the user's interaction data within a preset time from the interaction data including the shopping basket to obtain the user's most recent shopping basket sequence, and performing weighted learning based on the user's most recent shopping basket sequence to generate the user's repurchase representation;

[0012] The learning weights fuse the pre-trained representation, the shopping basket sequence level representation, and the repeat purchase representation to obtain a user prediction vector;

[0013] The user prediction vector replaces the user pre-trained representation, and path reasoning is performed on the shopping basket knowledge graph through reinforcement learning to obtain the recommended products and explanation paths of the shopping basket.

[0014] Furthermore, in this method, the interaction information and product information of the user in the relevant historical time period of the shopping system are obtained, and the attribute entities and the relationship between the attribute entities are extracted based on the interaction information and product information, and a shopping basket knowledge graph is constructed, specifically:

[0015] Obtain the user's interaction information and product information in the relevant historical time period of the shopping system;

[0016] The interactive information of the user's shopping system is divided by time to obtain data including the shopping basket;

[0017] Extract attribute entities and extract relationship between attribute entities from the interactive information and product information of the user shopping system;

[0018] A shopping basket knowledge graph is constructed based on the extracted attribute entities and the relationships between them.

[0019] Furthermore, in this method, a TransR model is constructed, and the shopping basket knowledge graph is input into the TransR model to obtain a pre-trained representation, specifically:

[0020] Construct a TransR model, input the shopping basket knowledge graph into the, and obtain a pre-trained representation of the entity, wherein the pre-trained representation satisfies the following relationship:

[0021] ;

[0022] represents the shopping basket knowledge graph, where Represents a collection of entities, Represents a set of relationships between entities, a triple Indicates that a head entity is observed With tail entity There is a relationship between .

[0023] Furthermore, in this method, a user-specific three-step graph is constructed based on the most recently purchased goods, shopping cart, and goods attributes in the shopping knowledge graph, a shopping cart representation sequence is constructed according to the user-specific three-step graph, and a user's shopping cart sequence-level representation is generated through LSTM, specifically including:

[0024] For each user, obtain the most recently purchased goods, shopping cart, and goods attribute data in the shopping knowledge graph, and construct a user-specific three-step graph based on the most recently purchased goods, shopping cart, and goods attributes in the shopping knowledge graph;

[0025] The GAT model is used to aggregate the representations of different entities in the user-specific three-step graph to obtain a temporary representation of each user's shopping basket;

[0026] The temporary shopping basket representation of the user’s recent shopping basket sequence is modeled through LSTM to obtain the user’s shopping basket sequence-level representation.

[0027] Furthermore, in this method, the interaction data of the user within a preset time is screened out from the interaction data including the shopping basket to obtain the shopping basket sequence of the user's most recent purchases, and weighted learning is performed based on the shopping basket sequence of the user's most recent purchases to generate the user's repurchase representation, specifically:

[0028] Filter the user's interaction data within a preset time from the interaction data containing the shopping cart to obtain the user's most recently purchased shopping cart sequence;

[0029] Counting the number of purchases of each item in the user's most recent shopping basket based on the user's most recent shopping basket sequence;

[0030] Filter out the most recently purchased products, and perform weighted learning on the most recently purchased products and the purchase frequency to obtain the user's repurchase representation.

[0031] Furthermore, in this method, the learning weights fuse the pre-trained representation, the shopping basket sequence level representation and the repeat purchase representation to obtain a user prediction vector, specifically:

[0032] Among them, by calculating the user pre-training representation , User shopping basket sequence level representation and user repurchase characteristics The weighted sum of User prediction vector Different user representations may have different contributions to the user prediction vector in the recommendation. We assign a weight to each user representation, which satisfies the following relationship:

[0033] ;

[0034] in, and Corresponding to user pre-training representations , User shopping basket sequence level representation and user repurchase characteristics The weight of .

[0035] Furthermore, in this method, the user prediction vector is used to replace the user pre-trained representation, and path reasoning is performed on the shopping basket knowledge graph through reinforcement learning to obtain the recommended products and explanation paths of the shopping basket, specifically:

[0036] The user prediction vector replaces the user pre-trained representation in the entity and relationship representation obtained by pre-training the shopping basket knowledge graph;

[0037] Construct an MDP environment for reinforcement learning, train the policy network through the MDP environment to maximize the cumulative reward, and obtain the reasoning path by using action probability to guide beam search for path reasoning;

[0038] The user's rating of the product is obtained by calculating the user prediction vector and the pre-trained product embedding through MLP, and the products with the highest ratings are selected from the products at the end of the path as the shopping basket recommendation results.

[0039] Furthermore, in this method, the user's rating of the product is obtained by calculating the user prediction vector and the product pre-training embedding through MLP, which specifically includes:

[0040] The user's rating of the product is obtained by calculating the user prediction vector and the product pre-trained embedding through an MLP. The calculation formula is:

[0041] ;

[0042] in, For rating, Predict vector for user, It is a commodity Pre-trained representations.

[0043] A second aspect of the present invention provides an explainable shopping basket recommendation system based on knowledge enhancement, comprising:

[0044] Data preprocessing module: responsible for obtaining the user's interaction information and product information in the relevant historical time period of the shopping system, and preprocessing the obtained information;

[0045] Shopping basket knowledge graph construction and pre-trained representation module: extracting attribute entities and the relationship between attribute entities based on the interaction information and product information, constructing a shopping basket knowledge graph, and constructing a TransR model, and inputting the shopping basket knowledge graph into the TransR model to obtain a pre-trained representation;

[0046] User prediction vector module: responsible for constructing a user-specific three-step graph based on the most recently purchased goods, shopping basket, and product attributes in the shopping knowledge graph, constructing a shopping basket representation sequence based on the user-specific three-step graph, and generating a user's shopping basket sequence-level representation through LSTM, filtering out the user's interaction data within a preset time from the interaction data containing the shopping basket, obtaining the user's most recently purchased shopping basket sequence, and performing weighted learning based on the user's most recently purchased shopping basket sequence to generate the user's repurchase representation, and learning weights to fuse the pre-trained representation, shopping basket sequence-level representation, and repurchase representation to obtain a user prediction vector;

[0047] Path reasoning and explainable recommendation module: responsible for replacing the user pre-trained representation with the user prediction vector, performing path reasoning on the shopping basket knowledge graph through reinforcement learning, and obtaining the recommended products and explanation paths of the shopping basket;

[0048] User transaction module: responsible for displaying recommendations and explaining results, providing online transaction services for users and suppliers, and collecting and storing interaction data.

[0049] A third aspect of the present invention provides a computer-readable storage medium, which includes an interpretable shopping basket recommendation method program based on knowledge enhancement. When the interpretable shopping basket recommendation method program based on knowledge enhancement is executed by a processor, it implements any step of the interpretable shopping basket recommendation method based on knowledge enhancement.

[0050] The present invention solves the defects existing in the background technology and has the following beneficial effects:

[0051] The present invention introduces explainable recommendations for shopping basket scenarios. Traditional shopping basket recommendations only focus on improving the accuracy of recommendation performance. Such methods may cause users to not understand the recommendation results, and thus not use the recommendation results, affecting the customer experience and the practicality of the recommendation system. However, the explainable shopping basket recommendation proposed in the present invention provides recommendation explanations while improving the accuracy of recommendation performance, so that users can better understand the recommendation results, trust the recommendation system more, and complete transactions more easily. The present invention introduces a shopping basket knowledge graph. Traditional shopping basket recommendations are mostly based on sequence pattern modeling or are enhanced by constructing a simple three-step graph, ignoring the role of rich information and topological structure of the knowledge graph. The method proposed in the present invention introduces shopping basket entities, uses the rich information of the knowledge graph to obtain the representation of each entity, and also uses the topological structure of the knowledge graph to perform path reasoning of reinforcement learning to obtain recommendations and explanations. The present invention introduces feature modeling for users in B2B scenarios. Traditional shopping basket recommendations are mostly used in B2C scenarios and may not be suitable for customers in B2B scenarios. The method proposed in the present invention models the characteristics of B2B users, especially repurchase, and the obtained user prediction vector includes rich information of the knowledge graph, user shopping basket sequence information and user repurchase behavior information, which can greatly improve the recommendation performance. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, drawings of other embodiments can be obtained based on these drawings without paying creative work.

[0053] Figure 1 A flowchart of an explainable shopping basket recommendation method based on knowledge enhancement of the present invention is shown;

[0054] Figure 2 A flow chart showing generation of a user prediction vector according to the present invention is shown;

[0055] Figure 3 A flow chart showing the path reasoning and explainable recommendation of the present invention is shown;

[0056] Figure 4 A block diagram of an explainable shopping basket recommendation system based on knowledge enhancement of the present invention is shown. DETAILED DESCRIPTION

[0057] In order to more clearly understand the above-mentioned purpose, features and advantages of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be noted that the embodiments of the present application and the features in the embodiments can be combined with each other without conflict.

[0058] In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention may also be implemented in other ways different from those described herein. Therefore, the protection scope of the present invention is not limited to the specific embodiments disclosed below.

[0059] Figure 1 A flow chart of an explainable shopping basket recommendation method based on knowledge enhancement of the present invention is shown.

[0060] like Figure 1 As shown, the first aspect of the present invention provides an explainable shopping basket recommendation method based on knowledge enhancement, comprising:

[0061] Extract shopping baskets and other entities and relationships based on the interaction information and product information of the user shopping system, and build a shopping basket knowledge graph;

[0062] The shopping basket knowledge graph is input into the TransR model to obtain pre-trained representations of various entities such as users, products, shopping baskets, etc.

[0063] For each shopping basket of each user, a shopping basket representation sequence is constructed based on the three-step graph of the most recently purchased shopping basket, products, and product attributes (such as price, weight, etc.) in the shopping basket knowledge graph, and the user's shopping basket sequence-level representation is generated through LSTM.

[0064] Based on the items that the user has recently purchased and their frequency, weighted learning is performed to generate the user's repurchase representation.

[0065] The learning weights fuse the user’s pre-trained representation, shopping basket sequence-level representation, and repeat purchase representation to obtain a user prediction vector.

[0066] The user prediction vector replaces the user pre-trained representation, and path reasoning is performed on the shopping basket knowledge graph through reinforcement learning to obtain the recommended products and explanation paths of the shopping basket.

[0067] It should be noted that the user's interaction information and product information in the relevant historical time period of the shopping system are obtained to generate a user interaction data set. The products purchased by each user every day are regarded as a shopping basket. The user, product, shopping basket, product attribute entities (such as price entity, weight entity, etc.) and the relationship between entities are extracted from the interaction data and product information containing the shopping basket, such as the purchase relationship between user and product, user and shopping basket, the belonging relationship between product and shopping basket, and the equipment relationship between product attributes and products. Since the price of the product fluctuates every day, we use the price after the weighted average of sales volume as the price of the product, and divide the prices of all products into intervals to obtain the price entity. Other similar floating attributes can be added to the knowledge graph in the same way, and user attributes can also be added to the shopping basket knowledge graph. Formally, the extracted entities and relationships are fused to construct the shopping basket knowledge graph, which is expressed as:

[0068] ,in, Represents a collection of entities, Represents a set of relationships between entities, a triple Indicates that a head entity is observed With tail entity There is a relationship between .

[0069] Build a TransR-based model, input the shopping basket knowledge graph, and obtain pre-trained representations of various entities such as users, shopping baskets, products, product attributes (such as price, weight, etc.), as well as pre-trained representations of various relationships such as purchase, belong, equipment, etc.

[0070] ;

[0071] Figure 2 A flow chart of generating a user prediction vector according to the present invention is shown.

[0072] According to an embodiment of the present invention, for each user, a user-specific three-step graph is constructed based on the most recently purchased shopping basket, goods, and goods attributes (such as price, weight, etc.) in the shopping basket knowledge graph, and a temporary shopping basket representation is obtained through the GAT model. The temporary shopping basket representation of the user's shopping basket sequence is modeled through LSTM to obtain the user's shopping basket sequence-level representation; the number of purchases of each item in the user's most recently purchased shopping basket is counted, and the pre-trained representation of the most recently purchased items is weighted by the number of purchases to obtain the user's repurchase representation; the user's pre-trained representation, shopping basket sequence-level representation, and repurchase representation are fused through learning weights to obtain a user prediction vector. Specifically:

[0073] For each user, a user-specific three-step graph is constructed based on the recently purchased shopping basket, products, and product attributes (such as price, weight, etc.) in the shopping basket knowledge graph;

[0074] By aggregating the representations of different entities in the user-specific three-step graph, a temporary representation of each user’s shopping basket is obtained;

[0075] The temporary shopping basket representation of the user's recent shopping basket sequence is modeled by LSTM to obtain the user's shopping basket sequence level representation;

[0076] Count the number of times the user recently purchased each item in the shopping cart;

[0077] Filter out the products with the highest number of purchases among the most recent purchases;

[0078] For the products with the highest number of purchases, use the pre-trained representation of the products weighted by the number of purchases to obtain the user's repurchase representation;

[0079] The learning weights fuse the user’s pre-trained representation, shopping basket sequence-level representation, and repeat purchase representation to obtain a user prediction vector.

[0080] What needs to be explained is that the user's recent interaction data is filtered out from the interaction data containing the shopping basket to obtain the user's most recently purchased shopping basket sequence. For each user's most recently purchased shopping basket sequence, a user-specific three-step graph is constructed based on the shopping basket, goods, and product attributes (such as price, weight, etc.) in the shopping basket knowledge graph. The GAT model can better capture the relationship and feature information between nodes by introducing an attention mechanism between nodes, and obtain an entity representation that aggregates other node information. The formula is:

[0081] ;

[0082] in It is a set of pre-trained representations corresponding to the entities of the three-step graph. It is a collection of entity representations that aggregates information from other nodes. The shopping basket temporary embedding containing information about products and product attributes (such as price, weight, etc.) is taken from the obtained representation collection. The user's dynamic interest is captured from the user's recently purchased shopping basket sequence and the corresponding shopping basket temporary representation through the LSTM model to obtain the user's shopping basket sequence level representation , the formula is:

[0083] ;

[0084] in is the length of the most recently purchased shopping basket sequence, A temporary representation of the shopping basket corresponding to the most recently purchased shopping basket sequence;

[0085] It should be noted that the interaction data of the user in the recent period is filtered out from the interaction data including the shopping cart. Considering that the repurchase rate of the products with few purchases is low, the number of recent purchases of each product in the shopping cart recently purchased by the user is calculated to filter out the products with the most recent purchases. Use the most recently purchased quantity as the weight to calculate The weighted average of the pre-trained embeddings of the products is the user repurchase representation :

[0086] ;

[0087] in The most recently purchased item in the user's shopping cart A collection of products, yes The total number of purchases of all items in is the pre-trained representation of the product, It is a commodity Number of purchases.

[0088] It should be noted that by calculating the user pre-training representation , User shopping basket sequence level representation and user repurchase characteristics The weighted sum of the user prediction vector is obtained by fusion Different user representations may have different contributions to the user prediction vector in the recommendation. We assign a weight to each user representation, and the model learns it as the most appropriate weight.

[0089] ;

[0090] in, and Corresponding to user pre-training representations , User shopping basket sequence level representation and user repurchase characteristics The weight of .

[0091] Figure 3 A flowchart of path reasoning and explainable recommendation of the present invention is shown.

[0092] According to an embodiment of the present invention, the MDP environment of reinforcement learning is constructed for the interpretable shopping basket recommendation task, and reinforcement learning is used to perform path reasoning in the shopping basket knowledge graph to obtain the path reasoning result, and the scores of the user and the goods at the end of the reasoned path are calculated to obtain the shopping basket recommendation result and the recommendation explanation, specifically:

[0093] The user prediction vector replaces the user pre-trained representation in the entity and relationship representation obtained by pre-training the shopping basket knowledge graph;

[0094] Constructing an MDP environment for reinforcement learning for interpretable shopping basket recommendation tasks in B2B scenarios;

[0095] Use the policy network trained with historical user interaction data to perform path reasoning on the shopping basket knowledge graph;

[0096] Calculate the ratings of the user and the products at the end of the inferred path, and select the products with higher ratings as the shopping basket recommendation results;

[0097] For each item in the shopping basket, select the path with the highest total generation probability as the explanation.

[0098] It should be noted that the user prediction vector is used to replace the user pre-trained representation obtained by pre-training the shopping basket knowledge graph, and is used together with other entity and relationship representations in the shopping basket knowledge graph for path reasoning. To ensure the convenience of path reasoning, we added reverse edges to the shopping basket knowledge graph, that is, if ,but .

[0099] The MDP environment in reinforcement learning is defined as a tuple Definition, where represents the state space, represents the action space, is the state transition function, is the reward function.

[0100] (1) State. Time step The state of the agent at Defined as a tuple ,in is the originating user entity, is the agent at time step The entity that arrives, is the time step Previous history. User The initial state is . Set the maximum step size to , the terminal state is represented by .

[0101] (2) Action. In time step The complete candidate action set At is the entity All possible outgoing edges of . Unlike the traditional complete action space that excludes all historical entities and relations, we consider repurchase factors by allowing the addition of historically visited commodity entities and relations. The complete action space is defined as:

[0102] ;

[0103] 3) State transition function. Given a state and the next action , the next state can be determined The transfer function is defined as:

[0104] ;

[0105] (4) Rewards. Rewards are given by The entity that reaches the final state after the step is determined. If the entity is the initial user If the product is purchased, a positive reward of 1 is given, otherwise no reward is given. The reward function is defined as follows:

[0106] ;

[0107] It should be noted that, based on the MDP environment, reinforcement learning is used to train the policy network to maximize the cumulative reward. The reasoning path is obtained by using action probability to guide beam search for path reasoning, and the diversity of the path is ensured by setting the maximum number of steps and the sample size of each step. The candidate recommended product set is obtained by screening out entities whose end points are product types in the reasoning path. The user's rating of the product is obtained by calculating the user prediction vector and the product pre-trained embedding through an MLP. The calculation formula is:

[0108] ;

[0109] By selecting the highest-scoring items from the items at the end of the path as the shopping basket recommendation results, the path with the highest total generation probability is selected for each item in the shopping basket as an explanation. The total generation probability of each path is the product of the action probabilities of each step on the path.

[0110] In summary, the present invention introduces explainable recommendations for shopping basket scenarios. Traditional shopping basket recommendations only focus on improving the accuracy of recommendation performance. Such methods may cause users to not understand the recommendation results, and thus not use the recommendation results, affecting the customer experience and the practicality of the recommendation system. However, the explainable shopping basket recommendation proposed in the present invention provides recommendation explanations while improving the accuracy of recommendation performance, so that users can better understand the recommendation results, trust the recommendation system more, and complete transactions more easily. The present invention introduces a shopping basket knowledge graph. Traditional shopping basket recommendations are mostly based on sequence pattern modeling or are enhanced by constructing a simple three-step graph, ignoring the role of rich information and topological structure of the knowledge graph. The method proposed in the present invention introduces shopping basket entities, uses the rich information of the knowledge graph to obtain the representation of each entity, and also uses the topological structure of the knowledge graph to perform path reasoning of reinforcement learning to obtain recommendations and explanations. The present invention introduces feature modeling for users in B2B scenarios. Traditional shopping basket recommendations are mostly used in B2C scenarios and may not be suitable for customers in B2B scenarios. The method proposed in the present invention models the characteristics of B2B users, especially repurchase, and the obtained user prediction vector includes rich information of the knowledge graph, user shopping basket sequence information and user repurchase behavior information, which can greatly improve the recommendation performance.

[0111] In addition, the method may further comprise the following steps:

[0112] A particle swarm algorithm and a Jaccard metric algorithm are introduced, and the Jaccard similarity coefficient between the attribute entities in the pre-trained representation is calculated by the Jaccard metric algorithm;

[0113] Determine whether there is data in the pre-trained representation whose Jaccard coefficient is greater than a preset Jaccard coefficient threshold,

[0114] When there is data whose Jaccard coefficient is greater than the preset Jaccard coefficient threshold, the number of iterations is set based on the particle swarm algorithm, and iteration is performed based on the number of iterations to merge the data whose Jaccard similarity coefficient is greater than the Jaccard similarity coefficient threshold into one attribute entity until there is no data whose Jaccard coefficient is greater than the preset Jaccard coefficient threshold;

[0115] When there is no data whose Jaccard coefficient is greater than the preset Jaccard coefficient threshold, the pre-trained representation is used as the final pre-trained representation.

[0116] It should be noted that since there may be multiple descriptions of the name and attributes of a product, such as the descriptions of short-sleeved shirts and t-shirts, the pre-trained representation can be optimized by integrating the particle swarm algorithm and the Jaccard metric algorithm. When there is data whose Jaccard coefficient is greater than the preset Jaccard coefficient threshold, there are similar attribute representations of the same product. At this time, it is equivalent to the existence of redundant representation data. This method can optimize the pre-trained representation and remove redundant data, making data processing more efficient and reducing the complexity of calculation.

[0117] like Figure 4 As shown, the second aspect of the present invention provides an explainable shopping basket recommendation system based on knowledge enhancement, which includes: a data preprocessing module, a shopping basket knowledge graph construction and pre-training representation module, a user prediction vector module, a path reasoning and explainable recommendation module user transaction module. Specifically, it includes:

[0118] Data preprocessing module: responsible for obtaining the interaction information between users and products and product information, and preprocessing the obtained information;

[0119] Shopping basket knowledge graph construction and pre-trained representation module: Extract various entities and relationships based on historical user interaction data and product data, build a shopping basket knowledge graph, and obtain pre-trained representations of entities and relationships in the shopping basket knowledge graph;

[0120] User prediction vector module: responsible for obtaining multiple types of user representations and fusing them to obtain user prediction vectors. For the user's shopping basket sequence, GAT and LSTM are used to obtain the user's shopping basket sequence level representation; the user's repurchase behavior is modeled to obtain the user repurchase representation; finally, the user pre-trained representation, shopping basket sequence level representation, and user repurchase representation are fused to obtain the user prediction vector;

[0121] Path reasoning and explainable recommendation module: responsible for training the policy network through training data, and then using the trained policy network to perform path exploration on the shopping basket knowledge graph using reinforcement learning to find the recommended products in the shopping basket and their recommendation explanations;

[0122] User transaction module: responsible for displaying recommendations and explaining results, providing online transaction services for users and suppliers, and collecting and storing interaction data.

[0123] It should be noted that the method steps in the explainable shopping basket recommendation method based on knowledge enhancement are implemented through the data preprocessing module, shopping basket knowledge graph construction and pre-training representation module, user prediction vector module, path reasoning and explainable recommendation module user transaction module.

[0124] A third aspect of the present invention provides a computer-readable storage medium, which includes a knowledge-enhanced explainable shopping basket recommendation method program. When the knowledge-enhanced explainable shopping basket recommendation method program is executed by a processor, it implements any step of the knowledge-enhanced explainable shopping basket recommendation method.

[0125] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as: 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 components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.

[0126] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units; they may be located in one place or distributed on multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0127] In addition, all functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may be separately used as a unit, or two or more units may be integrated into one unit; the above-mentioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.

[0128] A person of ordinary skill in the art can understand that: all or part of the steps of implementing the above method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above method embodiment; and the aforementioned storage medium includes: a mobile storage device, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.

[0129] Alternatively, if the above-mentioned integrated unit of the present invention is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present invention can be essentially or partly reflected in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the methods of each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROM, RAM, magnetic disks or optical disks.

[0130] The above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art who is familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

Claims

1. A shopping basket explainable recommendation method based on knowledge enhancement, characterized in that: include: Obtain the user's interaction information and product information in the relevant historical time period of the shopping system, extract each attribute entity and the relationship between attribute entities based on the interaction information and product information, and construct a shopping basket knowledge graph; Constructing a TransR model, inputting the shopping basket knowledge graph into the TransR model to obtain a pre-trained representation; the attribute entity includes a user, a product, a shopping basket, and a product attribute; A user-specific three-step graph is constructed based on the most recently purchased goods, shopping basket, and goods attributes in the shopping basket knowledge graph, a shopping basket representation sequence is constructed according to the user-specific three-step graph, and a user's shopping basket sequence-level representation is generated through LSTM; Filtering the user's interaction data within a preset time from the interaction data including the shopping basket to obtain the user's most recent shopping basket sequence, and performing weighted learning based on the user's most recent shopping basket sequence to generate the user's repurchase representation; The learning weights fuse the pre-trained representation, the shopping basket sequence level representation, and the repeat purchase representation to obtain a user prediction vector; The user prediction vector is used to replace the user pre-trained representation, and path reasoning is performed on the shopping basket knowledge graph through reinforcement learning to obtain the recommended products and explanation paths of the shopping basket; Obtain the user's interaction information and product information in the relevant historical time period of the shopping system, extract the attribute entities and the relationship between the attribute entities based on the interaction information and product information, and build a shopping basket knowledge graph, specifically: Obtain the user's interaction information and product information in the relevant historical time period of the shopping system; The interactive information of the user's shopping system is divided by time to obtain data including the shopping basket; Extract attribute entities and extract relationship between attribute entities from the interactive information and product information of the user shopping system; Construct a shopping basket knowledge graph based on the extracted attribute entities and the relationships between them; The user prediction vector is used to replace the user pre-trained representation, and the path reasoning is performed on the shopping basket knowledge graph through reinforcement learning to obtain the recommended products and explanation path of the shopping basket. Specifically: The user prediction vector replaces the user pre-trained representation in the entity and relationship representation obtained by pre-training the shopping basket knowledge graph; Construct an MDP environment for reinforcement learning, train the policy network through the MDP environment to maximize the cumulative reward, and obtain the reasoning path by using action probability to guide beam search for path reasoning; The user's rating of the product is obtained by calculating the user prediction vector and the pre-trained product embedding through MLP, and the products with the highest ratings are selected from the products at the end of the path as the shopping basket recommendation results.

2. According to claim 1, a method for explaining shopping basket recommendation based on knowledge enhancement is characterized in that: Construct a TransR model, and input the shopping basket knowledge graph into the TransR model to obtain a pre-trained representation, specifically: Construct a TransR model, input the shopping basket knowledge graph into the, and obtain a pre-trained representation of the entity, wherein the pre-trained representation satisfies the following relationship: , , represents the shopping basket knowledge graph, where Represents a collection of entities, Represents a set of relationships between entities, a triple Indicates that a head entity is observed With tail entity There is a relationship between .

3. The method for explaining shopping basket recommendation based on knowledge enhancement according to claim 1, characterized in that: A user-specific three-step graph is constructed based on the most recently purchased goods, shopping basket, and goods attributes in the shopping basket knowledge graph, a shopping basket representation sequence is constructed according to the user-specific three-step graph, and a user's shopping basket sequence-level representation is generated through LSTM, specifically including: For each user, obtain the most recently purchased goods, shopping basket, and product attribute data in the shopping basket knowledge graph, and construct a user-specific three-step graph based on the most recently purchased goods, shopping basket, and product attributes in the shopping basket knowledge graph; The GAT model is used to aggregate the representations of different entities in the user-specific three-step graph to obtain a temporary representation of each user's shopping basket; The temporary shopping basket representation of the user’s recent shopping basket sequence is modeled through LSTM to obtain the user’s shopping basket sequence-level representation.

4. The method for explaining shopping basket recommendation based on knowledge enhancement according to claim 1, characterized in that: The user's interaction data within a preset time period is filtered out from the interaction data including the shopping basket to obtain the user's most recently purchased shopping basket sequence, and the user's repurchase representation is generated by weighted learning based on the user's most recently purchased shopping basket sequence, specifically: Filter the user's interaction data within a preset time from the interaction data containing the shopping cart to obtain the user's most recently purchased shopping cart sequence; Counting the number of purchases of each item in the user's most recent shopping basket based on the user's most recent shopping basket sequence; Filter out the most recently purchased products, and perform weighted learning on the most recently purchased products and the purchase frequency to obtain the user's repurchase representation.

5. The method for explaining shopping basket recommendation based on knowledge enhancement according to claim 1, characterized in that: The learning weights fuse the pre-trained representation, the shopping basket sequence level representation, and the repeat purchase representation to obtain a user prediction vector, specifically: Among them, by calculating the user pre-training representation , User shopping basket sequence level representation and user repurchase characteristics The weighted sum of the user prediction vector is obtained by fusion , different user representations may have different contributions to the user prediction vector in the recommendation. We assign a weight to each user representation, which satisfies the following relationship: , in, , and Corresponding to user pre-training representations , User shopping basket sequence level representation and user repurchase characteristics The weight of .

6. The method for explaining shopping basket recommendation based on knowledge enhancement according to claim 1, characterized in that: The user's rating of the product is obtained by calculating the user prediction vector and the product pre-training embedding through MLP, including: The user's rating of the product is obtained by calculating the user prediction vector and the product pre-trained embedding through an MLP. The calculation formula is: , in, For rating, Predict vector for user, It is a pre-trained representation of a product.

7. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a knowledge-enhanced explainable shopping basket recommendation method program. When the knowledge-enhanced explainable shopping basket recommendation method program is executed by a processor, the steps of the knowledge-enhanced explainable shopping basket recommendation method according to any one of claims 1 to 6 are implemented.