Commodity recommendation method and device for e-commerce platform, and readable storage medium
By constructing a time-aware knowledge graph and decomposing it according to time periods, analyzing multiple interactive relationships between users, stores and products, the problem of inaccurate recommendations caused by ignoring time factors in the existing technology is solved, and more accurate product recommendations are achieved.
Patent Information
- Application Number
- CN202510406282.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-01
- Publication Date
- 2025-07-11
AI Technical Summary
Existing e-commerce platform product recommendation methods usually build a knowledge graph based on the binary relationship between users and products, or between users and stores, ignoring time factors, resulting in the inability to accurately predict users' shopping preferences.
Build a time-aware knowledge graph, and use the interaction relationship between users, stores, and products and the time stamps during interaction, and decompose them into multiple periodic graphs according to the preset time period, and analyze user preferences based on multiple periodic graphs to generate product recommendation results in the current time period.
It realizes the accurate prediction of users' shopping preferences based on the interaction between users and stores and products in multiple time periods, and improves the accuracy of product recommendations.
Smart Images

Figure CN120298077A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of product recommendation, and in particular to a product recommendation method, device and readable storage medium for an e-commerce platform. Background Art
[0002] Currently, most e-commerce platforms construct the recommendation algorithms of the platforms based on knowledge graphs. Among them, the knowledge graph represents entities (such as users and products) and the relationships between entities (such as interaction behaviors such as purchase, click, and collection) through nodes and edges in the graph structure. For example, based on the interaction behaviors of a certain user with products, a knowledge graph corresponding to the user can be constructed, and the association patterns and rules between the user and the products can be captured through the knowledge graph, and the preferences of the user can be inferred, so as to provide personalized product recommendations based on the preferences of the user.
[0003] However, the existing recommendation methods usually construct knowledge graphs based on the binary relationships between users and products, or users and stores, and ignore the influence of time factors. Therefore, there is a problem that the shopping preferences of users cannot be accurately predicted. Summary of the Invention
[0004] The technical problem to be solved by the present invention is to provide a product recommendation method, device and readable storage medium for an e-commerce platform in view of the above deficiencies of the prior art, so as to solve the problem that the existing recommendation methods usually construct knowledge graphs based on the binary relationships between users and products, or users and stores, and ignore the influence of time factors, resulting in the inability to accurately predict the shopping preferences of users.
[0005] In a first aspect, the present invention provides a product recommendation method for an e-commerce platform, including:
[0006] Constructing a time-aware knowledge graph according to the interaction relationships among users, stores, and products and the timestamps at the time of interaction;
[0007] Decomposing the time-aware knowledge graph according to a preset time period to obtain a plurality of periodic graphs;
[0008] Analyzing user preferences according to the plurality of periodic graphs, and generating a product recommendation result corresponding to the user in the current time period.
[0009] Further, the constructing a time-aware knowledge graph according to the interaction relationships among users, stores, and products and the timestamps at the time of interaction specifically includes:
[0010] Taking users, stores, and products as entities, taking the interaction behaviors among users, stores, and products on the e-commerce platform as relationships, and taking the time when the interaction behaviors occur as timestamps, to construct a time-aware knowledge graph including entities, relationships, and timestamps.
[0011] Furthermore, the multiple periodic graphs include multiple product-level periodic graphs and multiple store-level periodic graphs. Decomposing the time-aware knowledge graph according to a preset time period to obtain multiple periodic graphs specifically includes:
[0012] Taking products and stores as central nodes respectively, dividing the time-aware knowledge graph into a product-level time-aware knowledge graph and a store-level time-aware knowledge graph;
[0013] Determining the time period where each timestamp is located in the product-level time-aware knowledge graph and the store-level time-aware knowledge graph;
[0014] Decomposing the product-level time-aware knowledge graph and the store-level time-aware knowledge graph into multiple product-level periodic graphs and multiple store-level periodic graphs according to the time period where each timestamp is located.
[0015] Furthermore, the product-level time-aware knowledge graph includes the relationships between users and products, products and stores, and the timestamps during interactions. The store-level time-aware knowledge graph includes the relationships between users and stores, stores and products, and the timestamps during interactions.
[0016] Furthermore, analyzing the user preferences based on the multiple periodic graphs to generate the product recommendation results corresponding to the user in the current time period specifically includes:
[0017] Extracting the cross-period shared features of the user based on the multiple product-level periodic graphs and multiple store-level periodic graphs, where the cross-period shared features are products or stores that the user repeatedly prefers in multiple time periods;
[0018] Obtaining the product recommendation results corresponding to the user in the current time period from the candidate product set that the user has interacted with according to the cross-period shared features of the user.
[0019] Furthermore, extracting the cross-period shared features of the user based on the multiple product-level periodic graphs and multiple store-level periodic graphs specifically includes:
[0020] Searching for the products or stores with the highest frequency of occurrence among the stores and products related to the user in multiple time periods in the multiple product-level periodic graphs and multiple store-level periodic graphs;
[0021] Taking the product or store as the cross-period shared feature of the user.
[0022] Furthermore, obtaining the product recommendation results corresponding to the user in the current time period from the candidate product set that the user has interacted with according to the cross-period shared features of the user specifically includes:
[0023] Taking the cross - cycle sharing feature of the user as the central node, combine the cross - cycle sharing feature of the user with each candidate product in the candidate product set to construct a plurality of quadruples including entities, relationships, and timestamps;
[0024] Input the plurality of quadruples into a pre - trained time - aware relational graph attention model, and output the feature vector of the central node through the time - aware relational graph attention model, where the trained time - aware relational graph attention model is trained based on a plurality of historical quadruples;
[0025] According to the feature vector of the central node, predict the click - through rate of all candidate products in the candidate product set, and use the top K candidate products with the click - through rate as the product recommendation result corresponding to the user in the current time period, where K is greater than or equal to 1.
[0026] In a second aspect, the present invention provides a product recommendation device for an e - commerce platform, including:
[0027] A construction module, configured to construct a time - aware knowledge graph according to the interaction relationship among users, stores, and products and the timestamp at the time of interaction;
[0028] A decomposition module, connected to the construction module, configured to decompose the time - aware knowledge graph according to a preset time period to obtain a plurality of periodic graphs;
[0029] A recommendation module, connected to the decomposition module, configured to analyze user preferences according to the plurality of periodic graphs and generate a product recommendation result corresponding to the user in the current time period.
[0030] In a third aspect, the present invention provides a product recommendation device for an e - commerce platform, including a memory and a processor. A computer program is stored in the memory, and the processor is configured to run the computer program to implement the product recommendation method for the e - commerce platform described in the first aspect above.
[0031] In a fourth aspect, the present invention provides a computer - readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it implements the product recommendation method for the e - commerce platform described in the first aspect above.
[0032] The commodity recommendation method, device and readable storage medium of the e-commerce platform provided by the present invention first construct a time-aware knowledge graph according to the interaction relationship among users, stores and commodities and the time stamp at the time of interaction; then decompose the time-aware knowledge graph according to a preset time period to obtain a plurality of periodic graphs; finally, analyze user preferences according to the plurality of periodic graphs to generate a commodity recommendation result corresponding to the user within the current time period. By decomposing the time-aware knowledge graph constructed according to the interaction relationship among users, stores and commodities and the time stamp at the time of interaction into a plurality of periodic graphs according to a preset time period, and performing user preference analysis based on the plurality of periodic graphs to obtain a user commodity recommendation result, the present invention realizes accurate prediction of the shopping preferences of users based on the interaction between users and stores and commodities in a plurality of time periods, thereby improving the accuracy of commodity recommendation, and solving the problem that the existing recommendation methods usually construct knowledge graphs based on the binary relationship between users and commodities or between users and stores, and ignore the influence of time factors, resulting in the inability to accurately predict the shopping preferences of users. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 It is a flowchart of a commodity recommendation method for an e-commerce platform according to Embodiment 1 of the present invention;
[0034] Figure 2 It is a structural schematic diagram of a time-aware relational graph attention model according to an embodiment of the present invention;
[0035] Figure 3 It is a structural schematic diagram of a commodity recommendation device for an e-commerce platform according to Embodiment 2 of the present invention;
[0036] Figure 4 It is a structural schematic diagram of a commodity recommendation device for an e-commerce platform according to Embodiment 3 of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0037] To enable those skilled in the art to better understand the technical solutions of the present invention, the embodiments of the present invention will be further described in detail below in conjunction with the accompanying drawings.
[0038] It can be understood that the specific embodiments and drawings described herein are only for explaining the present invention, rather than limiting the present invention.
[0039] It can be understood that, without conflict, the various embodiments in the present invention and the various features in the embodiments can be combined with each other.
[0040] It can be understood that for the convenience of description, only the parts related to the present invention are shown in the drawings of the present invention, and the parts unrelated to the present invention are not shown in the drawings.
[0041] It is understandable that each unit and module involved in the embodiments of the present invention may correspond to only one entity structure, or may be composed of multiple entity structures. Alternatively, multiple units and modules may also be integrated into one entity structure.
[0042] It is understandable that, without conflict, the functions and steps marked in the flowcharts and block diagrams of the present invention may occur in an order different from that marked in the accompanying drawings.
[0043] It is understandable that in the flowcharts and block diagrams of the present invention, the possible architectures, functions, and operations of the systems, devices, equipment, and methods according to the embodiments of the present invention are shown. Among them, each block in the flowchart or block diagram may represent a unit, module, program segment, or code, which contains executable instructions for implementing the specified function. Moreover, each block or combination of blocks in the block diagram and flowchart may be implemented by a hardware-based system for implementing the specified function, or may be implemented by a combination of hardware and computer instructions.
[0044] It is understandable that the units and modules involved in the embodiments of the present invention may be implemented in software or in hardware. For example, the units and modules may be located in the processor.
[0045] Application Overview
[0046] The existing product recommendation methods of e-commerce platforms mainly identify users' preferences by analyzing the historical interactions between users and products, or between users and stores, and then make recommendations. The main disadvantages are as follows:
[0047] The existing product recommendation methods of e-commerce platforms often rely on the direct interaction between users and products, or users and stores in the current time period to infer user preferences, which is usually simplified to a binary relationship between users-products or users-stores. However, the interaction in the real world is much more complicated, involving multiple relationships between users, stores and products. For example, a user first clicks and enters a store he trusts, and then browses and buys the products he needs from the store. At this time, the actual interaction process includes the interaction between the user and the store and the interaction between the user and the product. In addition, the product recommendation methods of existing e-commerce platforms ignore the time factor and only consider the interaction behavior in the current time period, which is also susceptible to seasonal changes. For example, a user has always liked to buy historical novels online, but in the current time period, the user bought a lot of ice cream and cold drinks online due to the influence of summer, and it happened that the user did not buy historical novels in the current time period. At this time, only considering the interaction behavior in the current time period will ignore the user's interaction behavior with historical novels. Therefore, if the product recommendation methods of existing e-commerce platforms only rely on the interaction between users and products, or users and stores in the current time period when inferring user preferences, it will be impossible to accurately infer user preferences, resulting in inaccurate and inpersonalized recommendations.
[0048] In response to the above technical problems, the present application provides a product recommendation method, device and readable storage medium for an e-commerce platform, which decomposes the time-aware knowledge graph constructed by the interactive relationship between users, stores and products and the timestamps of the interactions into multiple period graphs according to a preset time period, and performs user preference analysis based on the multiple period graphs to obtain user product recommendation results, thereby accurately predicting the user's shopping preferences based on the interactions between users, stores and products in multiple time periods, thereby improving the accuracy of product recommendations, and at least solving the problem that existing recommendation methods usually construct knowledge graphs based on the binary relationship between users and products, or users and stores, and ignore the influence of time factors, and are unable to accurately predict users' shopping preferences.
[0049] After introducing the basic principles of the present application, various non-limiting embodiments of the present application will be described in detail with reference to the accompanying drawings.
[0050] Embodiment 1:
[0051] This embodiment provides a product recommendation method for an e-commerce platform. Figure 1 As shown, the method includes:
[0052] Step S101: Construct a time-aware knowledge graph based on the interaction relationship between users, stores, and products and the timestamps of the interactions.
[0053] It should be noted that the interaction relationships between users and stores include: search, click, enter, browse, follow, evaluate, collect, etc. The interaction relationships between users and products include: search, click, browse, evaluate, collect, add to shopping cart, purchase, etc. The interaction relationships between stores and products include: display, hide, put on the shelf, take off the shelf, etc.
[0054] In an alternative embodiment, constructing the temporal awareness knowledge graph according to the interaction relationships and timestamps during the interaction among users, stores, and products specifically includes:
[0055] Taking users, stores, and products as entities, taking the interaction behaviors among users, stores, and products on the e-commerce platform as relationships, and taking the time when the interaction behaviors occur as timestamps, to construct a temporal awareness knowledge graph including entities, relationships, and timestamps.
[0056] Specifically, taking users, stores, and products as entities, taking the interaction behaviors among users, stores, and products on the e-commerce platform as relationships, taking the time when the interaction behaviors among users, stores, and products on the e-commerce platform occur as timestamps, and adding attributes to each entity. For example, the attributes added to users can be age, gender, etc., the attributes added to products can be category, origin, price, etc., and the attributes added to stores can be location, sales category, grade, etc. Using a knowledge graph construction tool to construct the relationships and timestamps among users, stores, and products into a graph structure. Each two-way interactive edge of the graph structure can be regarded as a set of quadruples in the form of (subject, relationship, object, timestamp), forming a TKG (Temporal Knowledge Graph, temporal awareness knowledge graph).
[0057] Step S102: Decompose the temporal awareness knowledge graph according to a preset time period to obtain multiple periodic graphs.
[0058] In this embodiment, the multiple periodic graphs can include multiple product-level periodic graphs and multiple store-level periodic graphs. Each periodic graph in the multiple periodic graphs represents the temporal awareness knowledge graph within its corresponding time period. The preset time period can be any time period, such as one day, one week, one month, one season, one year, etc.
[0059] In an alternative embodiment, the multiple periodic graphs include multiple product-level periodic graphs and multiple store-level periodic graphs. The decomposing the temporal awareness knowledge graph according to a preset time period to obtain multiple periodic graphs specifically includes:
[0060] Respectively taking products and stores as central nodes, and dividing the temporal awareness knowledge graph into a product-level temporal awareness knowledge graph and a store-level temporal awareness knowledge graph;
[0061] Determine the time period in which each of the timestamps in the product-level time-aware knowledge graph and the store-level time-aware knowledge graph is located;
[0062] Decompose the product-level time-aware knowledge graph and the store-level time-aware knowledge graph into multiple product-level periodic graphs and multiple store-level periodic graphs according to the time period in which each timestamp is located.
[0063] Specifically, in order to achieve more detailed subsequent preference analysis and recommendation, the time-aware knowledge graph is further divided into two levels of knowledge graphs: specifically, the time-aware knowledge graph is divided with products and stores as the central nodes respectively to obtain the product-level time-aware knowledge graph and the store-level time-aware knowledge graph. Among them, the product-level time-aware knowledge graph includes the relationships between users and products, and between products and stores, as well as the timestamps during interactions, and the store-level time-aware knowledge graph includes the relationships between users and stores, and between stores and products, as well as the timestamps during interactions.
[0064] Specifically, determine the interaction behavior time period in which the timestamp corresponding to the relationship between each user, store, and product in the product-level time-aware knowledge graph and the store-level time-aware knowledge graph is located. For example, the timestamp corresponding to the relationship between a certain user and a product is 08:00:00 on March 27, 2025. Assuming it is within the range of the third interaction behavior time period, then determine that the interaction behavior time period in which this timestamp is located is the third interaction behavior time period. Based on the interaction behavior time period in which each timestamp is located, decompose the product-level time-aware knowledge graph and the store-level time-aware knowledge graph into multiple product-level periodic graphs and multiple store-level periodic graphs.
[0065] Step S103: Analyze user preferences based on the multiple periodic graphs to generate product recommendation results corresponding to the user in the current time period.
[0066] In this embodiment, aiming at the problem in the prior art that only the interactions between users and products, or between users and stores in the current time period are considered to infer user preferences, resulting in inaccurate recommendations, by analyzing user preferences based on multiple periodic graphs and generating product recommendation results corresponding to the user in the current time period, it is realized to comprehensively analyze user preferences based on the interactions between users and stores and products in multiple time periods to accurately recommend products.
[0067] In an alternative embodiment, the step of analyzing user preferences based on the multiple periodic graphs to generate product recommendation results corresponding to the user in the current time period specifically includes:
[0068] Extract the cross-cycle shared features of the user based on the multiple product-level cycle graphs and multiple store-level cycle graphs, where the cross-cycle shared features are the products or stores that the user repeatedly prefers within multiple time cycles;
[0069] According to the cross-cycle shared features of the user, obtain the product recommendation results corresponding to the user in the current time cycle from the candidate product set that the user has interacted with.
[0070] It should be noted that the candidate product set that the user has interacted with is several interesting products extracted from the user's historical interaction behaviors on the e-commerce platform. The interesting products can be products that the user stays on the product list page for more than a preset time but the user does not perform other interactions. Preferably, the preset time is 30 seconds.
[0071] In an optional embodiment, the extracting the cross-cycle shared features of the user based on the multiple product-level cycle graphs and multiple store-level cycle graphs specifically includes:
[0072] Search for the product or store with the highest frequency of occurrence among the stores and products related to the user within multiple time cycles in the multiple product-level cycle graphs and multiple store-level cycle graphs;
[0073] Take the product or store as the cross-cycle shared feature of the user.
[0074] Specifically, obtain the product or store with the highest frequency of occurrence among the stores and products that have an interaction relationship with the user and the timestamps during the interaction within multiple time cycles from the multiple product-level cycle graphs and multiple store-level cycle graphs, and take the product or store with the highest frequency of occurrence as the cross-cycle shared feature of the user.
[0075] In an optional embodiment, the obtaining the product recommendation results corresponding to the user in the current time cycle from the candidate product set that the user has interacted with according to the cross-cycle shared features of the user specifically includes:
[0076] Take the cross-cycle shared feature of the user as the central node, combine the cross-cycle shared feature of the user with each candidate product in the candidate product set, and construct multiple quadruples including entities, relationships, and timestamps;
[0077] Input the multiple quadruples into a pre-trained time-aware relational graph attention model, and output the feature vector of the central node through the time-aware relational graph attention model, where the trained time-aware relational graph attention model is trained based on multiple historical quadruples;
[0078] Predict the click-through rates of all candidate products in the candidate product set according to the feature vector of the central node, and use the top K candidate products with the click-through rates as the product recommendation results corresponding to the user in the current time period, where K is greater than or equal to 1.
[0079] Specifically, use the cross-period shared features of the user as the central node, and combine the cross-period shared features of the user with each candidate product in the candidate product set to obtain multiple quadruples including entities, relationships, and timestamps. Specifically, use the user as a bridge, define the relationship between the cross-period shared features of the user and the candidate products (such as "associated through the user"), and use the cross-period shared features of the user as the central node. Based on the relationship between the cross-period shared features of the user and the candidate products, combine the cross-period shared features with the candidate products to construct indirectly associated quadruples. The specific quadruple example is as follows: (the cross-period shared features of the user, associated through the user, candidate product, the timestamp when the user interacts with the candidate product), where the cross-period shared features of the user are the head entity, associated through the user is the relationship, indicating the indirect association resulting from the user's interaction behavior based on both, the candidate product is the tail entity, and the timestamp when the user interacts with the candidate product is the time. Further combine multiple quadruples into a subgraph centered on the cross-period shared features of the user, and input this subgraph into a pre-trained time-aware relational graph attention model. Through the time-aware relational graph attention model, based on all candidate products, the cross-period shared features of the user, and the relationships and times between all candidate products and the cross-period shared features of the user respectively, generate the weights corresponding to all candidate products, and based on the weights corresponding to all candidate products, weight the embedding features of each candidate product, and then aggregate the cross-period shared features of the user and the weighted embedding features of each candidate product to output the feature vector of the central node processed by the graph attention mechanism. This feature vector is the result of fusing the self-information of the cross-period shared features of the user and the information of all candidate products, and is used for subsequent further downstream tasks.
[0080] It should be noted that the trained time-aware relational graph attention model is trained based on multiple historical quadruples, and its training process is a known prior art, and the present invention does not make any regulations.
[0081] Specifically, based on the feature vector of the central node, predict the click-through rates of all candidate products in the candidate product set through a pre-trained click-through rate prediction model, and sort the candidate products according to the click-through rates, and take the top K candidate products as the product recommendation results corresponding to the user in the current time period. Among them, the pre-trained click-through rate prediction model can be a deep learning model, a GBDT (Gradient Boosting Decision Tree) model, etc., and its training process is a known prior art, and the present invention does not make any regulations.
[0082] It should be noted that the present invention can also generate a candidate store set based on a number of interested stores, and based on the user's cross-cycle sharing features and the candidate store set, generate the store recommendation result corresponding to the user in the current time cycle through the above method.
[0083] In a specific embodiment, as Figure 2 shown, the time-aware relational graph attention model provided by the present invention includes: a time-aware relational weight generator (Time-aware relational weight generator), an embedding vector (Embedding), a graph attention mechanism (Graph Attention), and an output (output), which is used to input the sub-graph of entity e0 (A sub-graph for entity) into the time-aware relational graph attention model, and output the processed result through the time-aware relational graph attention model, and this result will be used for further downstream tasks. Among them, the sub-graph of entity e0 includes a central node e0 and neighbor nodes (Neighbors) e1, e2, and e3. Specifically, the specific steps of the product recommendation method of this e-commerce platform are as follows:
[0084] Step S1: After preprocessing the data in the dataset, obtain the interaction relationships and corresponding timestamps among users, stores, and products.
[0085] Specifically, this step S1 specifically includes the following steps:
[0086] The first step, data cleaning: conduct a preliminary review of the original dataset, identify and process missing values, outliers, and duplicate data. Ensure that all necessary data fields exist and the data formats are consistent.
[0087] The second step, standardize the timestamps to ensure that all timestamps follow the same format (ISO 8601 format).
[0088] The third step, convert the user ID, store ID, and product ID into unified integer indexes.
[0089] Step S2: Construct a global full-cycle time-aware knowledge graph. Among them, the global full-cycle time-aware knowledge graph can be expressed as: G = {U ∪ S ∪ O, ξ US ∪ ξ UO ∪ ξ SO}, where U, S, and O respectively represent the sets of users, stores, and products, and ξ US , ξ UO and ξ SO respectively represent the relationship sets between users and stores, users and products, and stores and products.
[0090] Specifically, step S2 specifically includes the following steps:
[0091] First, determine the entities (users, stores, products) and relationships (purchase, browsing, etc.) in the knowledge graph.
[0092] Second, add attributes to each entity, such as the age, gender, etc. of the user; the category, origin, price, etc. of the product; the location, sales category, level, etc. of the store.
[0093] Third, use the knowledge graph construction tool to construct the interaction relationships between users, stores, and products into a graph structure. Each bidirectional interaction edge in the knowledge graph can be regarded as a quadruple in the form of (subject, relationship, object, timestamp), forming a time-aware knowledge graph TKG. Formally, a TKG can be expressed as: G = {(e s ,r,e o ,m)|s,o∈ξ,r∈R,m∈M}, where s and o represent the entity sets of the subject and object respectively. In ξ US , s and o are the user set and the store set respectively. In ξ UO , s and o are the user set and the product set respectively. In ξ SO , s and o are the store set and the product set respectively. R represents the set of possible relationships, and m∈M indicates that each quadruple is valid in a specific time period.
[0094] Step S3, further divide the full-cycle knowledge graph into two levels of knowledge graphs: product-level G [o] ={U∪S∪O,ξ uo ∪ξ so} and store-level G [s] ={U∪S∪O,ξ us ∪ξ so} to achieve more detailed preference analysis and recommendation.
[0095] Among them, the product-level knowledge graph takes the product as the central node and contains the interaction edges between users and products and the interaction edges between products and stores. The store-level knowledge graph takes the store as the central node and contains the interaction edges between users and stores and the interaction edges between stores and products.
[0096] Step S4, the time decomposition module processes the dual-perception knowledge graph to learn the periodic changes of user preferences.
[0097] Specifically, in this step S4, the edge set in each dual-perception knowledge graph is uniformly represented as ξ i , and the time period of each interaction edge c i is represented as In the time-based decomposition module, for each edge c i in the time period Assigning a hard weight can be expressed as:
[0098]
[0099] where I(·) is the indicator function. When the time period i in which the edge c is located i matches the preset interaction behavior time period m, the hard weight of the edge c i is assigned as 1 to retain the edge c i ; otherwise, by assigning the hard weight of the edge c i as 0, the edge c om is removed. This means that only when the interaction time of the edge matches the currently considered time period, the weight of the edge (relationship) will be taken into account;
[0100] Therefore, given the time period m of each interaction data, for the dual perception knowledge graph can be decomposed into M periodic graphs:
[0101]
[0102] where, when i = o, ξ om is the commodity-level periodic graph corresponding to the m-th interaction behavior time period, and when i = s, ξ sm is the store-level periodic graph corresponding to the m-th interaction behavior time period.
[0103] Step S5: Use the cross-period shared features (a certain type of commodity or a certain store that the user always prefers) as the initial embedding vector group.
[0104] Step S6: Generate time-aware relationship weights.
[0105] Specifically, the specific steps of this step S6 are as follows:
[0106] Given an entity e i and its adjacent entity set j where each adjacent entity e j is represented as a vector e d ∈R ij each relationship r ij is represented as a vector r d ∈R ij ij ∈R d. Use an MLP (Multilayer Perceptron) to learn the conversion weights between different timestamps, and dynamically generate a conversion matrix for each edge in the graph, which is expressed as:
[0107] W ij = Reshape(U(W[r ij ||t ij +b))
[0108] where W ∈ R d×d , and b ∈ R 1 are both trainable parameters. "Reshape" is responsible for converting the input vector into a matrix form suitable for calculation, and W ij ∈ R d×d is the conversion matrix.
[0109] Step S7, apply a graph attention mechanism to capture the interaction features from the quadruple, and its calculation method is as follows:
[0110]
[0111] where σ is the activation function, W0 is the trainable parameter, and α ij is the attention weight for each neighbor, which is obtained by using a bilinear function and then performing softmax normalization:
[0112]
[0113] Step S8, adopt the "Talking-heads" attention mechanism, and use the linear combination of different attention heads to generate the final node embedding representation. It is defined as follows:
[0114]
[0115] where M is the number of attention heads, ω m is the weight of the m-th attention head. The learned embedding representation is given a learnable scaling factor, and these scaling factors are normalized through a softmax layer to ensure that the weighted sum of all heads is 1, that is is the attention weight of the m-th attention head for the neighbor j of node i. is the weight matrix corresponding to the m-th attention head. is the trainable parameter of the m-th attention head.
[0116] Step S9. By stacking multiple multi-head attention mechanisms, the encoder can capture multi-hop structural information on the graph. The output entity embedding of the encoder is denoted as E.
[0117] Step S10. Combine the element embedding, position embedding, and time embedding to construct the final input of the time transformer.
[0118] Specifically, in Step S10, for a quadruple q = (e s , r, e o , t), the calculation method of the input embedding is as follows:
[0119]
[0120] e 0 = r + e pos1 + t
[0121]
[0122] where e pos0 , e pos1 and e pos2 are position embeddings, e s , r, e o are element embeddings, and t is the time embedding. For the query quadruple, e o is a masked vector. For the quadruple with a time interval (e.g., t = [t start , t end ), a linear transformation is used to combine the start time and the end time:
[0123] t = W t [t start || t end
[0124] where W t is a training parameter, t start and t end are the time embeddings of the start time and the end time in the time interval. Then, these input embeddings are fed into the time transformer stacked with K Transformer blocks, denoted as:
[0125]
[0126] where k represents the k-th Transformer layer. Each Transformer layer uses the multi-head self-attention mechanism to learn the interaction features between each element in the quadruple.
[0127] Finally, a vector representation of the input query quadruple is obtained through a max pooling layer, and its calculation method is as follows:
[0128]
[0129] Step S11: Given a query quadruple \(q=(e s , r,?, t)\), the question mark "?" represents the missing entity to be predicted. Use a scoring function \(f(\cdot)\) to measure the matching score between the query quadruple \(q\) and each candidate entity \(e c \) in the time period \(t\). The scoring function is defined as follows:
[0130] f t (e s , r, e c ) = -||e s + r - e c ||
[0131] Step S12: Using the scores of each candidate entity, we can use an optimization algorithm to train the model in mini-batch mode. For each quadruple (head entity, relation, tail entity, time), we adopt the 1vsAll negative sampling method, which calculates the cross-entropy loss of all entities in the entity set \(E\):
[0132]
[0133] where \(e a \) is the correct answer entity of the query \(q\).
[0134] Step S13: After the model is trained, for user \(u\), by predicting the click-through rate of the candidate products in the candidate product set that the user has interacted with, and sorting the candidate products according to the click-through rate, take the top \(K\) candidate products as the recommendation results.
[0135] It is worth mentioning that the present invention has the following advantages: 1. Multi-dimensional interaction analysis: The present invention not only analyzes the interaction between the user and the product, but also deeply analyzes the interaction between the user and the store, providing more comprehensive user preferences. 2. Dynamic weight allocation: The time-aware relational graph attention model of the present invention can dynamically adjust the importance of different interaction data according to the time context.
[0136] It should be noted that the application of this model is not limited to traditional e-commerce platforms, but can also be extended to other fields that require personalized recommendations, such as travel recommendations, content recommendations, etc., to provide users with a richer and more satisfactory recommendation experience.
[0137] The commodity recommendation method of the e-commerce platform provided by the embodiment of the present invention first constructs a time-aware knowledge graph according to the interaction relationship among users, stores, and commodities and the time stamp at the time of interaction; then decomposes the time-aware knowledge graph according to a preset time period to obtain a plurality of periodic graphs; finally, analyzes user preferences according to the plurality of periodic graphs to generate a commodity recommendation result corresponding to the user within the current time period. By decomposing the time-aware knowledge graph constructed based on the interaction relationship among users, stores, and commodities and the time stamp at the time of interaction into a plurality of periodic graphs according to a preset time period, and performing user preference analysis based on the plurality of periodic graphs to obtain the user commodity recommendation result, the present invention realizes accurate prediction of the shopping preferences of users based on the interaction between users and stores and commodities in multiple time periods, thereby improving the accuracy of commodity recommendation, and solving the problem that the existing recommendation methods usually construct knowledge graphs based on the binary relationship between users and commodities or between users and stores, and ignore the influence of time factors, resulting in the inability to accurately predict the shopping preferences of users.
[0138] Embodiment 2:
[0139] As Figure 3 shown, the present embodiment provides a commodity recommendation device for an e-commerce platform, which is used to execute the commodity recommendation method of the above-mentioned e-commerce platform, and includes:
[0140] A construction module 11, configured to construct a time-aware knowledge graph according to the interaction relationship among users, stores, and commodities and the time stamp at the time of interaction;
[0141] A decomposition module 12, connected to the construction module 11, and configured to decompose the time-aware knowledge graph according to a preset time period to obtain a plurality of periodic graphs;
[0142] A recommendation module 13, connected to the decomposition module 12, and configured to analyze user preferences according to the plurality of periodic graphs to generate a commodity recommendation result corresponding to the user within the current time period.
[0143] Further, the construction module 11 specifically includes:
[0144] A construction unit, configured to use users, stores, and commodities as entities, use the interaction behaviors among users, stores, and commodities on the e-commerce platform as relationships, and use the time when the interaction behaviors occur as time stamps to construct a time-aware knowledge graph including entities, relationships, and time stamps.
[0145] Further, the plurality of periodic graphs include a plurality of commodity-level periodic graphs and a plurality of store-level periodic graphs, and the decomposition module 12 specifically includes:
[0146] A partitioning unit, which is used to divide the time-aware knowledge graph into a commodity-level time-aware knowledge graph and a store-level time-aware knowledge graph by taking commodities and stores as central nodes respectively;
[0147] A determining unit, which is used to determine the time period where each of the timestamps in the commodity-level time-aware knowledge graph and the store-level time-aware knowledge graph is located;
[0148] A decomposing unit, which is used to decompose the commodity-level time-aware knowledge graph and the store-level time-aware knowledge graph into a plurality of commodity-level periodic graphs and a plurality of store-level periodic graphs according to the time period where each of the timestamps is located.
[0149] Further, the commodity-level time-aware knowledge graph includes the relationships between users and commodities and between commodities and stores, as well as the timestamps during interactions, and the store-level time-aware knowledge graph includes the relationships between users and stores and between stores and commodities, as well as the timestamps during interactions.
[0150] Further, the recommendation module 13 specifically includes:
[0151] An extraction unit, which is used to extract the cross-period shared features of the user based on the plurality of commodity-level periodic graphs and the plurality of store-level periodic graphs, where the cross-period shared features are the commodities or stores that the user repeatedly prefers in multiple time periods;
[0152] A obtaining unit, which is used to obtain the commodity recommendation result corresponding to the user in the current time period from the candidate commodity set with which the user has interacted according to the cross-period shared features of the user.
[0153] Further, the extraction unit specifically includes:
[0154] A searching unit, which is used to search for the commodity or store with the highest occurrence frequency among the stores and commodities related to the user in multiple time periods in the plurality of commodity-level periodic graphs and the plurality of store-level periodic graphs;
[0155] An acting unit, which is used to use the commodity or store as the cross-period shared feature of the user.
[0156] Further, the obtaining unit specifically includes:
[0157] A combination construction unit, which is used to take the cross-period shared features of the user as the central node, combine the cross-period shared features of the user with each candidate commodity in the candidate commodity set, and construct a plurality of quadruples including entities, relationships, and timestamps;
[0158] An output unit for inputting the multiple quadruples into a pre-trained time-aware relational graph attention model, and outputting a feature vector of the central node through the time-aware relational graph attention model, wherein the trained time-aware relational graph attention model is obtained by training based on multiple historical quadruples;
[0159] A prediction unit for predicting the click-through rates of all candidate products in the candidate product set according to the feature vector of the central node, and taking the top K candidate products with click-through rates as the product recommendation results corresponding to the user in the current time period, where K is greater than or equal to 1.
[0160] Embodiment 3:
[0161] Reference Figure 4 In this embodiment, a product recommendation device for an e-commerce platform is provided, including a memory 21 and a processor 22. A computer program is stored in the memory 21, and the processor 22 is configured to run the computer program to execute the product recommendation method for the e-commerce platform in Embodiment 1.
[0162] Wherein, the memory 21 is connected to the processor 22. The memory 21 can adopt flash memory or read-only memory or other memories, and the processor 22 can adopt a central processing unit or a single-chip microcomputer.
[0163] Embodiment 4:
[0164] This embodiment provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the product recommendation method for the e-commerce platform in Embodiment 1 above is implemented.
[0165] The computer-readable storage medium includes volatile or non-volatile, removable or non-removable media implemented in any method or technology for storing information such as computer-readable instructions, data structures, computer program modules, or other data. The computer-readable storage medium includes, but is not limited to, RAM (Random Access Memory), ROM (Read-Only Memory), EEPROM (Electrically Erasable Programmable Read Only Memory), flash memory or other memory technologies, CD-ROM (Compact Disc Read-Only Memory), digital versatile disc (DVD) or other optical disc storage, magnetic cassette, tape, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer.
[0166] In summary, for the product recommendation method, device, and readable storage medium of the e-commerce platform provided by the embodiments of the present invention, a time-aware knowledge graph is first constructed based on the interaction relationships among users, stores, and products and the timestamps at the time of interaction; then the time-aware knowledge graph is decomposed according to a preset time period to obtain multiple periodic graphs; finally, user preferences are analyzed based on the multiple periodic graphs to generate product recommendation results corresponding to users within the current time period. By decomposing the time-aware knowledge graph constructed based on the interaction relationships among users, stores, and products and the timestamps at the time of interaction into multiple periodic graphs according to a preset time period, and performing user preference analysis based on the multiple periodic graphs to obtain user product recommendation results, the present invention realizes accurate prediction of users' shopping preferences based on the interactions between users and stores and products in multiple time periods, thereby improving the accuracy of product recommendation, and solving the problem that existing recommendation methods usually construct knowledge graphs based on the binary relationships between users and products or between users and stores, and ignore the influence of time factors, resulting in the inability to accurately predict users' shopping preferences.
[0167] It can be understood that the above embodiments are merely exemplary embodiments adopted to illustrate the principle of the present invention, and the present invention is not limited thereto. For those of ordinary skill in the art, various modifications and improvements can be made without departing from the spirit and essence of the present invention, and these modifications and improvements are also considered within the protection scope of the present invention.
Claims
1. A method for recommending products on an e-commerce platform, characterized in that, The method includes: Constructing a time-aware knowledge graph based on the interaction relationships among users, stores, and products and the timestamps at the time of interaction; Decomposing the time-aware knowledge graph according to a preset time period to obtain multiple periodic graphs; Analyzing user preferences based on the multiple periodic graphs to generate product recommendation results corresponding to the user in the current time period.
2. The method according to claim 1, wherein The constructing of the time-aware knowledge graph based on the interaction relationships among users, stores, and products and the timestamps at the time of interaction specifically includes: Taking users, stores, and products as entities, taking the interaction behaviors among users, stores, and products on the e-commerce platform as relationships, and taking the time when the interaction behaviors occur as timestamps to construct a time-aware knowledge graph including entities, relationships, and timestamps.
3. The method according to claim 1, characterized in that, The multiple periodic graphs include multiple product-level periodic graphs and multiple store-level periodic graphs. The decomposing of the time-aware knowledge graph according to a preset time period to obtain multiple periodic graphs specifically includes: Taking products and stores as central nodes respectively to divide the time-aware knowledge graph into a product-level time-aware knowledge graph and a store-level time-aware knowledge graph; Determining the time period where each timestamp in the product-level time-aware knowledge graph and the store-level time-aware knowledge graph is located; Decomposing the product-level time-aware knowledge graph and the store-level time-aware knowledge graph into multiple product-level periodic graphs and multiple store-level periodic graphs according to the time period where each timestamp is located.
4. The method according to claim 3, characterized in that The product-level time-aware knowledge graph includes the relationships between users and products and between products and stores and the timestamps at the time of interaction. The store-level time-aware knowledge graph includes the relationships between users and stores and between stores and products and the timestamps at the time of interaction.
5. The method according to claim 3, characterized in that, The analyzing of user preferences based on the multiple periodic graphs to generate product recommendation results corresponding to the user in the current time period specifically includes: Extracting cross-period shared features of the user based on the multiple product-level periodic graphs and multiple store-level periodic graphs, where the cross-period shared features are products or stores that the user repeatedly prefers in multiple time periods; Obtaining the product recommendation results corresponding to the user in the current time period from the candidate product set that the user has interacted with according to the cross-period shared features of the user.
6. The method according to claim 5, characterized in that, The extracting of the cross-period shared features of the user based on the multiple product-level periodic graphs and multiple store-level periodic graphs specifically includes: Searching in the multiple product-level periodic graphs and multiple store-level periodic graphs for the products or stores with the highest frequency of occurrence among the stores and products related to the user in multiple time periods; Taking the product or store as the cross-period shared feature of the user.
7. The method according to claim 5, wherein The obtaining of the product recommendation results corresponding to the user in the current time period from the candidate product set that the user has interacted with according to the cross-period shared features of the user specifically includes: Taking the cross-period shared features of the user as the central node and combining the cross-period shared features of the user with each candidate product in the candidate product set to construct multiple quadruples including entities, relationships, and timestamps. Input multiple of the above quadruples into a pre-trained time-aware relational graph attention model, and output the feature vector of the central node through the time-aware relational graph attention model, where the trained time-aware relational graph attention model is obtained based on multiple historical quadruples; Predict the click-through rates of all candidate products in the candidate product set according to the feature vector of the central node, and use the top K candidate products with click-through rates as the product recommendation results corresponding to the user in the current time period, where K is greater than or equal to 1.
8. A product recommendation device for an e-commerce platform, characterized in that, It includes: A construction module, configured to construct a time-aware knowledge graph according to the interaction relationship among users, stores, and products and the time stamps at the time of interaction; A decomposition module, connected to the construction module, configured to decompose the time-aware knowledge graph according to a preset time period to obtain multiple periodic graphs; A recommendation module, connected to the decomposition module, configured to analyze user preferences according to the multiple periodic graphs and generate product recommendation results corresponding to the user in the current time period.
9. A product recommendation device for an e-commerce platform, characterized in that, It includes a memory and a processor, where a computer program is stored in the memory, and the processor is configured to run the computer program to implement the product recommendation method of the e-commerce platform according to any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, and when the computer program is executed by the processor, it implements the product recommendation method of the e-commerce platform according to any one of claims 1-7.