Item recommendation method, device, electronic device and storage medium
Through the method of graph representation model based on heterogeneous graph training, the vector representations of the first item and the second item are obtained and combined into user vectors, realizing joint recommendation of the first item and the second item, solving the problem of recommendation in the existing technology Isolate the problem and reduce the user's search time.
Patent Information
- Application Number
- CN202011320699.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-23
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2040-11-23
AI Technical Summary
In the existing technology, the recommendations of the first item and the second item are isolated and cannot meet the user's joint needs for the two, resulting in a long search time for the user.
Through the graph representation model based on heterogeneous graph training, the vector representations of the first item and the second item are obtained and combined into user vectors, which are used to sort the items to be recommended and realize joint recommendation of the first item and the second item.
The user's search time for the first item and the second item is reduced, and the user's joint needs for the two items are met.
Smart Images

Figure CN112541113B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of Internet technology, and in particular, to an item recommendation method, device, electronic device, and storage medium. Background Art
[0002] Currently, the recommendation of the first item and the second item with an associated relationship are two relatively isolated businesses. The recommendation of the first item mainly meets the user's demand for the finished product of the first item, while the recommendation of the second item mainly meets the user's demand for the raw materials of the first item.
[0003] In the prior art, when recommending items to users, only items of the first item category or items of the second item category can be recommended separately, that is, items of the first item category are recommended under the first item item, and items of the second item category are recommended under the second item category. If the user does not find a suitable first item under the first item item, he or she may go to the second item category item to search for items of the second item category, which results in a long search time for the user and fails to meet the user's combined needs for the first item and the second item. Summary of the invention
[0004] The embodiments of the present application provide an item recommendation method, device, electronic device, and storage medium, which can realize the joint recommendation of a first item and a second item, thereby reducing the user's search time.
[0005] In order to solve the above problems, in a first aspect, an embodiment of the present application provides an item recommendation method, comprising:
[0006] Upon receiving a recommendation request from the current user, obtaining the historical behavior data of the current user;
[0007] Determine the vector representation of the first item and the second item in the historical behavior data by using a graph representation model to obtain a historical first item vector and a historical second item vector, wherein the first item and the second item have an association relationship, and the graph representation model is obtained by training based on a heterogeneous graph of the first item and the second item;
[0008] Determining a user vector corresponding to the current user according to the historical first item vector and the historical second item vector;
[0009] sorting the multiple items to be recommended according to the user vector and the item vectors to be recommended corresponding to the multiple items to be recommended to obtain an item recommendation list, wherein the items to be recommended include the first item or the second item, and the item recommendation list includes the item and the second item;
[0010] The item recommendation list is sent to a user terminal of the current user.
[0011] In a second aspect, an embodiment of the present application provides an item recommendation device, comprising:
[0012] A historical data acquisition module is used to acquire the historical behavior data of the current user upon receiving a recommendation request from the current user;
[0013] a vector representation module, used to determine the vector representations of the first item and the second item in the historical behavior data through a graph representation model to obtain a historical first item vector and a historical second item vector, wherein the first item and the second item have an association relationship, and the graph representation model is obtained by training based on a heterogeneous graph of the first item and the second item;
[0014] A user vector determination module, configured to determine a user vector corresponding to the current user according to the historical first item vector and the historical second item vector;
[0015] a recommendation list generating module, configured to sort the multiple items to be recommended according to the user vector and the item vectors to be recommended corresponding to the multiple items to be recommended, to obtain an item recommendation list, wherein the items to be recommended include the first item or the second item, and the item recommendation list includes the item and the second item;
[0016] The recommendation list sending module is used to send the item recommendation list to the user terminal of the current user.
[0017] In a third aspect, an embodiment of the present application further provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the item recommendation method described in the embodiment of the present application when executing the computer program.
[0018] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, performs the steps of the item recommendation method disclosed in the embodiment of the present application.
[0019] The item recommendation method, device, electronic device and storage medium provided in the embodiments of the present application obtain historical behavior data of the current user upon receiving a recommendation request from the current user, determine the vector representation of the first item and the second item in the historical behavior data through a graph representation model, obtain the historical first item vector and the historical second item vector, determine the user vector corresponding to the current user according to the historical first item vector and the historical second item vector, sort the multiple items to be recommended according to the user vector and the item vectors to be recommended corresponding to the multiple items to be recommended, and obtain an item recommendation list. Since the user vector is obtained based on the vectors corresponding to the first item and the second item in the historical behavior data of the current user and includes information of the first item and the second item, the item recommendation list generated based on the user vector and the item vector includes the first item and the second item at the same time, thereby realizing the joint recommendation of the first item and the second item, satisfying the user's joint demand for the first item and the second item, and reducing the user's search and search time for the first item and the second item. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solutions of the embodiments of the present application, 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 application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0021] Figure 1 is a flow chart of an item recommendation method according to Embodiment 1 of the present application;
[0022] Figure 2 is an example diagram of a heterogeneous graph of dishes and ingredients in an embodiment of the present application;
[0023] Figure 3 is a schematic diagram of a training graph representation model in an embodiment of the present application;
[0024] Figure 4 is a schematic diagram of the structure of an item recommendation device according to Embodiment 2 of the present application;
[0025] Figure 5 It is a schematic diagram of the structure of the electronic device of the third embodiment of the present application. DETAILED DESCRIPTION
[0026] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0027] Embodiment 1
[0028] This embodiment provides an item recommendation method, such as Figure 1 As shown, the method includes: step 110 to step 150.
[0029] Step 110, upon receiving a recommendation request from the current user, obtaining historical behavior data of the current user.
[0030] When the current user uses the user terminal to open the first item item or the second item item, or the current user uses the user terminal to search for the first item or the second item, the user terminal receives the recommendation request of the current user and sends the recommendation request to the electronic device that executes the item recommendation method. The electronic device receives the recommendation request of the current user and then obtains the historical behavior data of the current user from the database. The historical behavior data may include the first item and the second item that the current user has clicked or ordered in history. The historical behavior data is preferably historical order data, which is more in line with the current user's interest preference for the first item and the second item. The electronic device may be a server.
[0031] Step 120, determining the vector representation of the first item and the second item in the historical behavior data through a graph representation model to obtain a historical first item vector and a historical second item vector, wherein there is an association relationship between the first item and the second item, and the graph representation model is trained based on a heterogeneous graph of the first item and the second item.
[0032] Among them, the graph representation model is a graph representation model based on deep learning. The heterogeneous graph is a heterogeneous graph about the first item and the second item, and is established based on the association relationship between the first item and the second item. Exemplarily, the first item may be a dish, and the second item may be an ingredient. The heterogeneous graph about the dish and the ingredient is established based on the association relationship between the dish and the ingredient in the recipe data. Exemplarily, the first item may also be a tariff package provided by the operator, and the second item may be each item in the tariff package; the first item may also be a combined item obtained after packaging, and the second item may be each item. For example, the first item may be a skin care product set, and the second item may be each item in the skin care product set.
[0033] Before determining the vector representation of the first item and the second item in the historical behavior data through the graph representation model, the graph representation model has been trained based on the heterogeneous graph of the first item and the second item. At this time, the vector representation of each first item and the second item in the heterogeneous graph can be determined through the trained graph representation model. In order to vectorize the items that the current user is interested in to obtain the user vector, the first item and the second item in the historical behavior data of the current user are firstly vectorized. At this time, the positions of the first item and the second item in the historical behavior data in the heterogeneous graph are determined, and based on the positions of the first item and the second item in the heterogeneous graph, the attribute features of the first item and the second item are respectively input into the graph representation model to obtain their respective vector representations, that is, the vector representation of each first item and the vector representation of each second item in the historical behavior data are obtained, and the vector representation of each first item in the historical behavior data is used as the historical first item vector, and the vector representation of each second item in the historical behavior data is used as the historical second item vector.
[0034] Step 130: Determine a user vector corresponding to the current user according to the historical first item vector and the historical second item vector.
[0035] Each historical first item vector and each historical second item vector are combined as the user vector corresponding to the current user. Since the user vector is obtained by combining each historical first item vector and each historical second item vector, the user vector contains both the information of the first item and the information of the second item.
[0036] In one embodiment of the present application, determining the user vector corresponding to the current user according to the historical first item vector and the historical second item vector includes:
[0037] Using the average vector of the historical first item vector and the historical second item vector as the user vector corresponding to the current user; or
[0038] The sum vector of the historical first item vector and the historical second item vector is used as the user vector corresponding to the current user.
[0039] When determining the user vector corresponding to the current user, the average vector of each historical first item vector and each historical second item vector may be used as the user vector corresponding to the current user, or the sum vector of each historical first item vector and each historical second item vector may be used as the user vector corresponding to the current user. By using the average vector or the sum vector of the historical first item vector and the historical second item vector as the user vector corresponding to the current user, the current user's interest preference for the first item and the second item can be well represented.
[0040] Step 140, sorting the multiple items to be recommended according to the user vector and the item vectors to be recommended corresponding to the multiple items to be recommended to obtain an item recommendation list, wherein the items to be recommended include the first item or the second item, and the item recommendation list includes the item and the second item.
[0041] After recalling multiple items to be recommended according to the user vector based on the recommendation request of the current user, the multiple items to be recommended are respectively vectorized by the graph representation model to obtain a vector of the item to be recommended corresponding to each item to be recommended. The multiple items to be recommended include a first item and a second item, and each item to be recommended is the first item or the second item.
[0042] The user vector and the recommended item vector of one of the multiple recommended items are used as input features of the trained recommendation model to obtain the ranking score of the recommended item. The ranking score of each recommended item is determined in the above manner to obtain the ranking score of each recommended item. Then, each recommended item is sorted in descending order according to the ranking score to obtain an item recommendation list. When determining the ranking score of an item to be recommended by the recommendation model, the input features may also include the historical behavior vector of the current user, which may be obtained based on the item vector corresponding to the historical items (which may be the first item or the second item) that the current user has clicked or ordered in history. When determining the historical behavior vector of the current user, the attention weight of each historical item is determined based on the attention mechanism. According to the attention weight of each historical item, the item vector of each historical item is weighted summed to obtain the historical behavior vector of the current user.
[0043] Step 150: Send the item recommendation list to the user terminal of the current user.
[0044] After the item recommendation list is generated, the item recommendation list is sent to the user terminal of the current user, and the user terminal can display the item recommendation list and scroll to display different items to be recommended based on the operation of the current user.
[0045] When the first item is a dish and the second item is an ingredient, through the technical solution of the present application, when the user is shopping for ingredients, related dishes can be recommended; similarly, when the user is shopping for dishes, ingredients that can be used to prepare the dish can be recommended to him.
[0046] The item recommendation method provided in the embodiment of the present application obtains the historical behavior data of the current user upon receiving a recommendation request from the current user, determines the vector representation of the first item and the second item in the historical behavior data through a graph representation model, obtains the historical first item vector and the historical second item vector, determines the user vector corresponding to the current user according to the historical first item vector and the historical second item vector, sorts the multiple items to be recommended according to the user vector and the item vectors to be recommended corresponding to the multiple items to be recommended, and obtains an item recommendation list. Since the user vector is obtained based on the vectors corresponding to the first item and the second item in the historical behavior data of the current user and includes information of the first item and the second item, the item recommendation list generated based on the user vector and the item vector to be recommended includes the first item and the second item at the same time, thereby realizing the joint recommendation of the first item and the second item, satisfying the user's joint demand for the first item and the second item, and reducing the user's search and search time for the first item and the second item.
[0047] On the basis of the above technical solution, before determining the vector representation of the first item and the second item in the historical behavior data through the graph representation model, it also includes: determining the association relationship between the first item and the second item, and determining the confidence of the association relationship; constructing a heterogeneous graph of the first item and the second item according to the association relationship and the confidence; determining positive sample pairs for training the graph representation model according to the heterogeneous graph, and determining negative sample pairs corresponding to the positive sample pairs; training the graph representation model according to the positive sample pairs and the negative sample pairs corresponding to the positive sample pairs, so that the similarity of the positive sample pairs is greater than the similarity of the negative sample pairs, and obtaining a trained graph representation model.
[0048] A heterogeneous graph refers to a graph with more than one node type or relationship type.
[0049] The relationship between the first item and the second item is mined to obtain the association relationship between the first item and the second item, and the confidence of each second item in the multiple association relationship combinations corresponding to the first item is counted, so as to obtain the confidence of the association relationship between the first item and the second item. After obtaining the association relationship and confidence of the first item and the second item, a heterogeneous graph of the first item and the second item is constructed, and the node types in the heterogeneous graph include first item nodes and second item nodes. After the heterogeneous graph of the first item and the second item is constructed, based on the heterogeneous graph, the first item node and the second item node with a direct relationship are selected from the heterogeneous graph to form a positive sample pair, and negative sampling is performed from the heterogeneous graph to select multiple second item nodes that are far away from the first item node in the positive sample pair, and these second item nodes and the first item node form a negative sample pair, or negative sampling is performed from the heterogeneous graph to select multiple first item nodes that are far away from the second item node in the positive sample pair, and these first item nodes and the second item node form a negative sample pair. In this way, multiple positive sample pairs and negative sample pairs corresponding to the positive sample pairs can be determined. The graph representation model is trained using positive sample pairs and negative sample pairs. The training goal is to make the similarity of the positive sample pairs greater than the similarity of the negative sample pairs. When the difference in similarity between the positive sample pairs and the negative sample pairs converges, the training ends and a trained graph representation model is obtained.
[0050] For example, when the first item is a dish and the second item is an ingredient, the relationship between the dish and the ingredient can be mined based on the recipe data of the recipe website to obtain the association relationship between the dish and the ingredient. The recipe data includes dishes, ingredients and cooking methods. A cooking method is a combination of association relationships corresponding to a dish. A dish can have multiple cooking methods, that is, a dish can correspond to multiple association relationship combinations.
[0051] On the basis of the above technical solution, a heterogeneous graph of the first item and the second item is constructed according to the association relationship and the confidence, including: selecting an association relationship whose confidence is greater than a preset threshold; constructing a first item node and a second item node respectively according to the first item and the second item in the selected association relationship, and using the confidence of the association relationship as an edge between the first item node and the second item node, to obtain a heterogeneous graph of the first item and the second item.
[0052] After obtaining the association relationship and confidence between the first item and the second item, the association relationship with a confidence greater than a preset threshold is selected. In this association relationship, it can be considered that in most practices, the first item in the association relationship will use the second item in the association relationship. After selecting the corresponding relationship with a confidence greater than the preset threshold, a heterogeneous graph of the first item and the second item can be constructed. At this time, the first item node and the second item node are respectively constructed according to the first item and the second item in the association relationship, and the confidence of the association relationship between the first item and the second item is used as the edge between the corresponding first item node and the second item node. The first item and the second item in all selected association relationships are constructed with such a first item node, second item node and the edge between them to obtain a heterogeneous graph of the first item and the second item. By selecting association relationships with a confidence greater than a preset threshold and establishing a heterogeneous graph of the first item and the second item based on these association relationships, it is possible to avoid the association relationships with low confidence in the heterogeneous graph, which increases the difficulty of training the subsequent graph representation model, thereby quickly training the graph representation model.
[0053] Figure 2 is an example diagram of a heterogeneous graph of dishes and ingredients in an embodiment of the present application, such as Figure 2 As shown, the first item is a dish, and the second item is an ingredient. The heterogeneous graph includes two dish nodes and four ingredient nodes. The dish nodes are "scrambled eggs with tomatoes" and "tomato egg drop soup", and the ingredient nodes are "tomato", "egg", "scallion", and "coriander". The confidence between the dish "scrambled eggs with tomatoes" and the ingredient "tomato" is 1.0, the confidence between the dish "scrambled eggs with tomatoes" and the ingredient "egg" is 1.0, the confidence between the dish "scrambled eggs with tomatoes" and the ingredient "scallion" is 0.5, the confidence between the dish "tomato egg soup" and the ingredient "tomato" is 1.0, the confidence between the dish "tomato egg soup" and the ingredient "egg" is 1.0, and the confidence between the dish "tomato egg soup" and the ingredient "coriander" is 0.8.
[0054] On the basis of the above technical solution, the confidence of the association relationship is determined, including: in multiple association relationship combinations corresponding to a first object, respectively counting the Wilson confidence of each second object corresponding to the first object, to obtain the confidence of the association relationship between the first object and each second object, the association relationship combination includes the association relationship between the first object and multiple second objects, and the multiple second objects constitute the first object.
[0055] A first item may correspond to multiple association relationship combinations. The second item corresponding to the first item in each association relationship combination may be different, but the basic second item will be used. For example, in recipe data, a dish may have multiple methods. The ingredients used in different methods may be different, but the basic ingredients will be used. In this case, for a first item, the Wilson confidence of each second item associated with the first item in multiple association relationship combinations is counted to obtain the confidence of the association relationship between the first item and each second item. The calculation formula of Wilson confidence is as follows:
[0056]
[0057] Where S represents the Wilson confidence of a second item in a first item, that is, the confidence of the association between the first item and the second item. It represents the usage ratio of a second item in multiple association relationship combinations of the first item, n represents the number of association relationship combinations of the first item, and z represents the z statistic corresponding to a certain confidence level α, which is a constant and can be obtained by looking up the table. In general, at a confidence level of 95%, the value of the z statistic is 1.96.
[0058] For example, the first item is "scrambled eggs with tomatoes", and the second items involved in one association relationship combination are "tomatoes", "eggs", "onions", "salt" and "sugar", and the second item "onions" may not be used in other association relationship combinations. Therefore, in different association relationship combinations of the first item "scrambled eggs with tomatoes", the confidence of each second item in the first item "scrambled eggs with tomatoes" can be calculated using Wilson confidence, and the confidence of the association relationship between the first item "scrambled eggs with tomatoes" and each second item can be obtained.
[0059] Since there are not too many types of association relationship combinations of a first item, a combination of association relationships of a first item belongs to a small sample. By using Wilson confidence as the confidence of the association relationship between the first item and the second item, the accuracy of small sample calculation can be improved.
[0060] On the basis of the above technical solution, according to the heterogeneous graph, a positive sample pair for training a graph representation model is determined, and a negative sample pair corresponding to the positive sample pair is determined, including: selecting a node from the heterogeneous graph as a starting walking node; performing a random walk in the heterogeneous graph starting from the starting walking node; sampling according to the walking path to obtain a positive sample corresponding to the starting walking node, the starting walking node and the positive sample forming a positive sample pair; according to the node type of the positive sample, global negative sampling is performed in the nodes having the node type in the heterogeneous graph to obtain multiple negative samples, the starting walking node and each negative sample forming a negative sample pair, and the positive sample pair and the negative sample pair are used to train the graph representation model.
[0061] When determining the positive sample pairs and negative sample pairs for training the graph representation model based on the heterogeneous graph of the first item and the second item, a random walk can be performed in the heterogeneous graph, and the starting walk node of the random walk is first determined; then, a random walk is performed in the heterogeneous graph from the starting walk node, and the walk path is sampled to obtain a positive sample corresponding to the starting walk node. The positive sample can be a node directly connected to the starting walk node, and the positive sample and the starting walk node form a positive sample pair; according to the node type of the positive sample, global negative sampling is performed in the nodes with the node type in the heterogeneous graph to obtain multiple negative samples, and a preset number of negative samples can be sampled, and a negative sample and the starting walk node form a negative sample pair. Through multiple random walks, multiple groups of different positive sample pairs and negative sample pairs can be obtained. After obtaining the positive sample pairs and negative sample pairs, the graph representation model can be trained based on the positive sample pairs and negative sample pairs so that the similarity of the positive sample pairs is greater than the similarity of the negative sample pairs. By sampling positive and negative sample pairs through random walks, sufficient training samples can be obtained.
[0062] For example, the random walk path is: "tomato and egg -> tomato -> tomato and egg soup -> egg", and the positive sample pairs obtained by sampling are: "tomato and egg-tomato", "tomato-tomato and egg soup", "tomato and egg soup-egg", and for each positive sample pair, negative sample sampling is performed. In the positive sample pair "tomato and egg-tomato", the positive sample is "tomato" and the negative sample is randomly sampled in all the second item nodes to construct negative sample pairs such as "tomato and egg-potato", "tomato and egg-beef", etc.
[0063] On the basis of the above technical solution, the graph representation model is trained according to the positive sample pairs and the negative sample pairs corresponding to the positive sample pairs, including: inputting the same nodes in the positive sample pairs and the negative sample pairs into the graph representation model to obtain the vector representation of the same nodes; inputting the positive samples in the positive sample pairs and the negative samples in the negative sample pairs into the graph representation model respectively to obtain the positive sample vector representation and the negative sample vector representation; determining the similarity between the vector representation of the same node and the positive sample vector representation as the positive sample pair similarity, and determining the similarity between the vector representation of the same node and the negative sample vector representation as the negative sample pair similarity; adjusting the network parameters of the graph representation model according to the difference between the positive sample pair similarity and the negative sample pair similarity; and cyclically executing the above training operation on the graph representation model until the difference converges.
[0064] Figure 3 is a schematic diagram of a training graph representation model in an embodiment of the present application, such as Figure 3 As shown, after sampling the positive sample pairs and multiple negative sample pairs in the heterogeneous graph, the attribute features of the same node (i.e., the starting walk node of the random walk) in the positive sample pairs and the negative sample pairs are input into the graph representation model initialized with parameters to obtain the vector representation of the same node; the attribute features of the positive sample in the positive sample pair and the multiple negative samples in the multiple negative sample pairs are respectively input into the same graph representation model to obtain the positive sample vector representation and the negative sample vector representation of each negative sample; the training goal of the graph representation model is that the similarity of the positive sample pairs is much greater than the similarity of the negative sample pairs, that is, to maximize the similarity of the positive sample pairs. At this time, the similarity of the vector representation of the same node and the vector representation of the positive sample are calculated respectively, and the pixel point is the similarity of the positive sample pairs. , calculate the similarity between the vector representation of the same node and each negative sample vector representation, and obtain the negative sample pair similarity of multiple negative sample pairs; when there are multiple negative sample pairs, calculate the average of the similarities of multiple negative sample pairs, and calculate the difference between the similarity of the positive sample pair and the average, use the difference as the difference between the similarity of the positive sample pair and the similarity of the negative sample pair, and adjust the network parameters of the graph representation model according to the difference; then sample the positive sample pair and the negative sample pair in the heterogeneous graph, and perform the above training operation on the graph representation model until the difference between the similarity of the positive sample pair and the similarity of the negative sample pair converges, so that the similarity of the positive sample pair is much greater than the similarity of the negative sample pair, and obtain the trained graph representation model. After the graph representation model is trained, it can be used to determine the vector representation of each first item and the second item, and the vector representation of the first item contains the information of the second item, and the vector representation of the second item also contains the information of the first item, thereby laying the foundation for the joint recommendation of the first item and the second item.
[0065] Embodiment 2
[0066] This embodiment provides an item recommendation device, such as Figure 4 As shown, the item recommendation device 400 includes:
[0067] The historical data acquisition module 410 is used to acquire the historical behavior data of the current user upon receiving a recommendation request from the current user;
[0068] A vector representation module 420 is used to determine the vector representation of the first item and the second item in the historical behavior data through a graph representation model to obtain a historical first item vector and a historical second item vector, wherein the first item and the second item have an association relationship, and the graph representation model is obtained by training based on a heterogeneous graph of the first item and the second item;
[0069] A user vector determination module 430, configured to determine a user vector corresponding to the current user according to the historical first item vector and the historical second item vector;
[0070] A recommendation list generating module 440, configured to sort the plurality of items to be recommended according to the user vector and the item vectors to be recommended corresponding to the plurality of items to be recommended, to obtain an item recommendation list, wherein the item to be recommended includes the first item or the second item, and the item recommendation list includes the item and the second item;
[0071] The recommendation list sending module 450 is used to send the item recommendation list to the user terminal of the current user.
[0072] Optionally, the device further comprises:
[0073] An association relationship determination module, used to determine the association relationship between the first item and the second item, and determine the confidence level of the association relationship;
[0074] A heterogeneous graph construction module, used to construct a heterogeneous graph of the first item and the second item according to the association relationship and the confidence level;
[0075] A training sample determination module, used to determine positive sample pairs of a training graph representation model according to the heterogeneous graph, and determine negative sample pairs corresponding to the positive sample pairs;
[0076] The graph representation model training module is used to train the graph representation model according to the positive sample pairs and the negative sample pairs corresponding to the positive sample pairs, so that the similarity of the positive sample pairs is greater than the similarity of the negative sample pairs, thereby obtaining a trained graph representation model.
[0077] Optionally, the heterogeneous graph construction module is specifically used for:
[0078] Selecting the association relationship whose confidence level is greater than a preset threshold;
[0079] According to the first item and the second item in the selected association relationship, a first item node and a second item node are constructed respectively, and the confidence of the association relationship is used as the edge between the first item node and the second item node to obtain a heterogeneous graph of the first item and the second item.
[0080] Optionally, the association relationship determination module includes:
[0081] The association confidence determination unit is used to respectively count the Wilson confidence of each second object associated with a first object in a plurality of association relationship combinations corresponding to the first object, and obtain the confidence of the association relationship between the first object and each second object, wherein the association relationship combination includes the association relationship between the first object and a plurality of second objects, and the plurality of second objects constitute the first object.
[0082] Optionally, the training sample determination module is specifically used to:
[0083] Selecting a node from the heterogeneous graph as a starting node for wandering;
[0084] Performing a random walk in the heterogeneous graph starting from the starting walk node;
[0085] Sampling is performed according to the walking path to obtain a positive sample corresponding to the starting walking node, wherein the starting walking node and the positive sample constitute a positive sample pair;
[0086] According to the node type of the positive sample, global negative sampling is performed in the nodes with the node type in the heterogeneous graph to obtain multiple negative samples, and the starting walking node and each negative sample form a negative sample pair, and the positive sample pair and the negative sample pair are used to train the graph representation model.
[0087] Optionally, the graph representation model training module is specifically used for:
[0088] Inputting the same nodes in the positive sample pair and the negative sample pair into the graph representation model to obtain vector representations of the same nodes;
[0089] Inputting the positive sample in the positive sample pair and the negative sample in the negative sample pair into the graph representation model respectively to obtain a positive sample vector representation and a negative sample vector representation;
[0090] Determine the similarity between the vector representation of the same node and the vector representation of the positive sample as the positive sample pair similarity, and determine the similarity between the vector representation of the same node and the vector representation of the negative sample as the negative sample pair similarity;
[0091] Adjusting the network parameters of the graph representation model according to the difference between the similarity of the positive sample pair and the similarity of the negative sample pair;
[0092] The above training operation of the graph representation model is executed repeatedly until the difference converges.
[0093] Optionally, the user vector determination module is specifically used to:
[0094] Using the average vector of the historical first item vector and the historical second item vector as the user vector corresponding to the current user; or
[0095] The sum vector of the historical first item vector and the historical second item vector is used as the user vector corresponding to the current user.
[0096] Optionally, the first item is a dish, and the second item is an ingredient.
[0097] The item recommendation device provided in the embodiment of the present application is used to implement the various steps of the item recommendation method described in the first embodiment of the present application. The specific implementation methods of each module of the device refer to the corresponding steps and will not be repeated here.
[0098] The item recommendation device provided in the embodiment of the present application obtains the historical behavior data of the current user when receiving the recommendation request of the current user through the historical data acquisition module, the vector representation module determines the vector representation of the first item and the second item in the historical behavior data through the graph representation model, and obtains the historical first item vector and the historical second item vector, the user vector determination module determines the user vector corresponding to the current user according to the historical first item vector and the historical second item vector, and the recommendation list generation module sorts multiple items to be recommended according to the user vector and the item vectors to be recommended corresponding to the multiple items to be recommended to obtain an item recommendation list. Since the user vector is obtained based on the vectors corresponding to the first item and the second item in the historical behavior data of the current user, it also includes information of the first item and the second item. The item recommendation list generated based on the user vector and the item vector to be recommended includes the first item and the second item at the same time, thereby realizing the joint recommendation of the first item and the second item, satisfying the user's joint demand for the first item and the second item, and reducing the user's search and search time for the first item and the second item.
[0099] Embodiment 3
[0100] The present application also provides an electronic device, such as Figure 5As shown, the electronic device 500 may include one or more processors 510 and one or more memories 520 connected to the processor 510. The electronic device 500 may also include an input interface 530 and an output interface 540 for communicating with another device or system. The program code executed by the processor 510 may be stored in the memory 520.
[0101] The processor 510 in the electronic device 500 calls the program code stored in the memory 520 to execute the item recommendation method in the above embodiment.
[0102] The embodiment of the present application also provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the steps of the item recommendation method as described in the first embodiment of the present application are implemented.
[0103] Each embodiment in this specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0104] The above is a detailed introduction to an item recommendation method, device, electronic device and storage medium provided in the embodiments of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, according to the ideas of the present application, there will be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as a limitation on the present application.
[0105] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
Claims
1. An item recommendation method, characterized in that: include: Upon receiving a recommendation request from the current user, obtaining the historical behavior data of the current user; Determine the vector representation of the first item and the second item in the historical behavior data by using a graph representation model to obtain a historical first item vector and a historical second item vector, wherein the first item and the second item have an association relationship, and the graph representation model is obtained by training based on a heterogeneous graph of the first item and the second item; Determining a user vector corresponding to the current user according to the historical first item vector and the historical second item vector; sorting the multiple items to be recommended according to the user vector and the item vectors to be recommended corresponding to the multiple items to be recommended to obtain an item recommendation list, wherein the items to be recommended include the first item or the second item, and the item recommendation list includes the first item and the second item; Sending the item recommendation list to the user terminal of the current user; Before determining the vector representations of the first item and the second item in the historical behavior data by using the graph representation model, the method further includes: Determining an association relationship between a first item and a second item, and determining a confidence level of the association relationship; Constructing a heterogeneous graph of the first item and the second item according to the association relationship and the confidence level; Determine, according to the heterogeneous graph, positive sample pairs for training the graph representation model, and determine negative sample pairs corresponding to the positive sample pairs; According to the positive sample pairs and the negative sample pairs corresponding to the positive sample pairs, the graph representation model is trained so that the similarity of the positive sample pairs is greater than the similarity of the negative sample pairs, thereby obtaining a trained graph representation model; Constructing a heterogeneous graph of the first item and the second item according to the association relationship and the confidence, including: Selecting the association relationship whose confidence level is greater than a preset threshold; According to the first item and the second item in the selected association relationship, a first item node and a second item node are constructed respectively, and the confidence of the association relationship is used as an edge between the first item node and the second item node to obtain a heterogeneous graph of the first item and the second item; Determining a user vector corresponding to the current user according to the historical first item vector and the historical second item vector includes: Using the average vector of the historical first item vector and the historical second item vector as the user vector corresponding to the current user; or The sum vector of the historical first item vector and the historical second item vector is used as the user vector corresponding to the current user.
2. The method according to claim 1, characterized in that The determining of the confidence level of the association relationship comprises: In a plurality of association relationship combinations corresponding to a first object, the Wilson confidence of each second object associated with the first object is counted respectively to obtain the confidence of the association relationship between the first object and each second object, wherein the association relationship combination includes the association relationship between the first object and a plurality of second objects, and the plurality of second objects constitute the first object.
3. The method according to claim 1, characterized in that According to the heterogeneous graph, determining a positive sample pair for training a graph representation model, and determining a negative sample pair corresponding to the positive sample pair, including: Selecting a node from the heterogeneous graph as a starting node for wandering; Performing a random walk in the heterogeneous graph starting from the starting walk node; Sampling is performed according to the walking path to obtain a positive sample corresponding to the starting walking node, wherein the starting walking node and the positive sample constitute a positive sample pair; According to the node type of the positive sample, global negative sampling is performed in the nodes with the node type in the heterogeneous graph to obtain multiple negative samples, and the starting walking node and each negative sample form a negative sample pair, and the positive sample pair and the negative sample pair are used to train the graph representation model.
4. The method according to claim 1, characterized in that: The graph representation model is trained according to the positive sample pairs and the negative sample pairs corresponding to the positive sample pairs, including: Inputting the same nodes in the positive sample pair and the negative sample pair into the graph representation model to obtain vector representations of the same nodes; Inputting the positive sample in the positive sample pair and the negative sample in the negative sample pair into the graph representation model respectively to obtain a positive sample vector representation and a negative sample vector representation; Determine the similarity between the vector representation of the same node and the vector representation of the positive sample as the positive sample pair similarity, and determine the similarity between the vector representation of the same node and the vector representation of the negative sample as the negative sample pair similarity; Adjusting the network parameters of the graph representation model according to the difference between the similarity of the positive sample pair and the similarity of the negative sample pair; The above training operation of the graph representation model is executed repeatedly until the difference converges.
5. The method according to any one of claims 1 to 4, characterized in that: The first item is a dish, and the second item is an ingredient.
6. An item recommendation device, characterized in that: include: A historical data acquisition module is used to acquire the historical behavior data of the current user upon receiving a recommendation request from the current user; a vector representation module, used to determine the vector representations of the first item and the second item in the historical behavior data through a graph representation model to obtain a historical first item vector and a historical second item vector, wherein the first item and the second item have an association relationship, and the graph representation model is obtained by training based on a heterogeneous graph of the first item and the second item; A user vector determination module, configured to determine a user vector corresponding to the current user according to the historical first item vector and the historical second item vector; a recommendation list generating module, configured to sort the multiple items to be recommended according to the user vector and the item vectors to be recommended corresponding to the multiple items to be recommended, to obtain an item recommendation list, wherein the items to be recommended include the first item or the second item, and the item recommendation list includes the item and the second item; A recommendation list sending module, used for sending the item recommendation list to the user terminal of the current user; The device also includes: An association relationship determination module, used to determine the association relationship between the first item and the second item, and determine the confidence level of the association relationship; A heterogeneous graph construction module, used to construct a heterogeneous graph of the first item and the second item according to the association relationship and the confidence level; A training sample determination module, used to determine positive sample pairs of a training graph representation model according to the heterogeneous graph, and determine negative sample pairs corresponding to the positive sample pairs; A graph representation model training module, used to train the graph representation model according to the positive sample pairs and the negative sample pairs corresponding to the positive sample pairs, so that the similarity of the positive sample pairs is greater than the similarity of the negative sample pairs, and obtain a trained graph representation model; The heterogeneous graph construction module is specifically used for: Selecting the association relationship whose confidence level is greater than a preset threshold; According to the first item and the second item in the selected association relationship, a first item node and a second item node are constructed respectively, and the confidence of the association relationship is used as an edge between the first item node and the second item node to obtain a heterogeneous graph of the first item and the second item; The user vector determination module is specifically used for: Using the average vector of the historical first item vector and the historical second item vector as the user vector corresponding to the current user; or The sum vector of the historical first item vector and the historical second item vector is used as the user vector corresponding to the current user.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the item recommendation method according to any one of claims 1 to 5 is implemented.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the item recommendation method described in any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Information generating method and device
CN107944956A
Data mining method and device based on association relation
CN109213801A
