A method and device for processing a request

By constructing a multi-group collection and training a neural network to obtain vectors of users and items, the problem of low hit rate of item recommendation in the prior art is solved, and more efficient user demand matching is achieved.

CN113393281BActive Publication Date: 2025-02-25BEIJING WODONG TIANJUN INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202010167073.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-03-11
Publication Date
2025-02-25
Estimated Expiration
2040-03-11

AI Technical Summary

Technical Problem

When using global information, the existing item recommendation system is not likely to hit the user's needs, especially when the number of items is huge.

Method used

By constructing a collection of multiple groups, including behavioral data of users and items, the neural network is trained to obtain vectors of users and items, and the items to be recommended are filtered based on these vectors.

Benefits of technology

It improves the hit rate and performance of the recommendation system, can more accurately take into account user behavior preferences and item similarity, and significantly improves the recommendation effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113393281B_ABST
    Figure CN113393281B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and device for processing requests, and relates to the field of computer technology. A specific implementation of the method includes: constructing a multi-tuple set based on the behavior data of each user on each item; wherein the multi-tuple set includes multiple multi-tuples, each multi-tuple includes a user and at least one item; training a neural network based on the multi-tuple set to obtain vectors of each user and vectors of each item; receiving and parsing a recommendation request to obtain a target user and a target item set; based on the vector of the target user and the vector of each target item in the target item set, screening out at least one item to be recommended from each item, and returning the at least one item to be recommended. This implementation can solve the technical problem that the possibility of hitting user needs is not high.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method and device for processing a request. Background Art

[0002] Personalized item recommendation systems have become a necessity for today's e-commerce platforms, and many methods have emerged that have been or are currently popular.

[0003] In the process of implementing the present invention, the inventors found that there are at least the following problems in the prior art:

[0004] Traditional item recommendation systems try to make the most of global information, such as user attributes, user behavior, etc. Although this approach is more common, the number of items is generally tens of millions, and the possibility of directly hitting the items that users need is not high. Summary of the invention

[0005] In view of this, an embodiment of the present invention provides a method and apparatus for processing a request to solve the technical problem that the possibility of meeting user needs is low.

[0006] To achieve the above object, according to one aspect of an embodiment of the present invention, a method for processing a request is provided, comprising:

[0007] Constructing a tuple set according to the behavior data of each user on each item; wherein the tuple set includes a plurality of tuples, each of which includes a user and at least one item;

[0008] Training a neural network according to the multi-tuple set, thereby obtaining a vector of each of the users and a vector of each of the items;

[0009] Receive and parse recommendation requests to obtain target users and target item sets;

[0010] At least one to-be-recommended item is screened out from each of the items according to the vector of the target user and the vectors of each target item in the target item set, and the at least one to-be-recommended item is returned.

[0011] Optionally, training a neural network according to the multi-tuple set to obtain a vector of each of the users and a vector of each of the items includes:

[0012] Constructing a log-likelihood function of the multi-tuple set according to the multi-tuple set;

[0013] Training a neural network using each of the multi-tuples as a sample set and optimizing the parameters of the hidden layer with the goal of maximizing the log-likelihood function;

[0014] The optimized hidden layer parameters are used as vectors of each of the users and vectors of each of the items.

[0015] Optionally, training a neural network using each of the multi-tuples as a sample set and optimizing the parameters of the hidden layer with the goal of maximizing the log-likelihood function includes:

[0016] For each tuple, train the first neural network with one of the items as output and the user and the remaining items as input. At the same time, train the second neural network with the user as output and the items as input for each tuple.

[0017] The hidden layer parameters of the first neural network and the hidden layer parameters of the second neural network are optimized with the goal of maximizing the log-likelihood function.

[0018] Optionally, using the optimized hidden layer parameters as the vectors of each of the users and the vectors of each of the items includes:

[0019] Using the optimized hidden layer parameters of the first neural network as vectors of each of the items, wherein a row of parameters in the hidden layer parameters represents a vector of an item;

[0020] The optimized hidden layer parameters of the second neural network are used as vectors of each of the users, wherein a row of parameters in the hidden layer parameters represents a vector of one user.

[0021] Optionally, constructing a log-likelihood function of the multi-tuple set according to the multi-tuple set includes:

[0022] Calculate the co-occurrence probability of each multi-group respectively, so as to obtain the softmax function of each element in the multi-group;

[0023] Convert the softmax function of each element in the multi-tuple into a sigmoid function;

[0024] The logarithm of the sigmoid function of each element in the multi-tuple is taken, and the logarithmic results are summed to obtain the log-likelihood function of the multi-tuple set.

[0025] Optionally, selecting at least one item to be recommended from each of the items according to the vector of the target user and the vector of each target item in the target item set includes:

[0026] Sum and average the vectors of each target item in the target item set to obtain the vector of the target item set;

[0027] At least one item to be recommended is screened out from each of the items according to the vector of the target user and the vector of the target item set.

[0028] Optionally, selecting at least one item to be recommended from each of the items according to the vector of the target user and the vector of the target item set includes:

[0029] Taking the target user, the target item set and the item to be recommended as a target triplet, and constructing a co-occurrence probability of the target triplet according to the vector of the target user, the vector of the target item set and the vector of the item to be recommended;

[0030] With the goal of maximizing the co-occurrence probability of the target triplet, at least one item to be recommended is screened out from each of the items.

[0031] In addition, according to another aspect of an embodiment of the present invention, there is provided an apparatus for processing a request, comprising:

[0032] A construction module, used to construct a tuple set according to the behavior data of each user on each item; wherein the tuple set includes a plurality of tuples, each of which includes a user and at least one item;

[0033] A training module, used for training a neural network according to the multi-tuple set, so as to obtain a vector of each of the users and a vector of each of the items;

[0034] The receiving module is used to receive and parse the recommendation request to obtain the target user and target item set;

[0035] The returning module is used to select at least one item to be recommended from each of the items according to the vector of the target user and the vector of each target item in the target item set, and return the at least one item to be recommended.

[0036] Optionally, the training module is further used to:

[0037] Constructing a log-likelihood function of the multi-tuple set according to the multi-tuple set;

[0038] Training a neural network using each of the multi-tuples as a sample set and optimizing the parameters of the hidden layer with the goal of maximizing the log-likelihood function;

[0039] The optimized hidden layer parameters are used as vectors of each of the users and vectors of each of the items.

[0040] Optionally, the training module is further used to:

[0041] For each tuple, train the first neural network with one of the items as output and the user and the remaining items as input. At the same time, train the second neural network with the user as output and the items as input for each tuple.

[0042] The hidden layer parameters of the first neural network and the hidden layer parameters of the second neural network are optimized with the goal of maximizing the log-likelihood function.

[0043] Optionally, the training module is further used to:

[0044] Using the optimized hidden layer parameters of the first neural network as vectors of each of the items, wherein a row of parameters in the hidden layer parameters represents a vector of an item;

[0045] The optimized hidden layer parameters of the second neural network are used as vectors of each of the users, wherein a row of parameters in the hidden layer parameters represents a vector of one user.

[0046] Optionally, the training module is further used to:

[0047] Calculate the co-occurrence probability of each multi-group respectively, so as to obtain the softmax function of each element in the multi-group;

[0048] Convert the softmax function of each element in the multi-tuple into a sigmoid function;

[0049] The logarithm of the sigmoid function of each element in the multi-tuple is taken, and the logarithmic results are summed to obtain the log-likelihood function of the multi-tuple set.

[0050] Optionally, the return module is further used for:

[0051] Sum and average the vectors of each target item in the target item set to obtain the vector of the target item set;

[0052] At least one item to be recommended is screened out from each of the items according to the vector of the target user and the vector of the target item set.

[0053] Optionally, the return module is further used for:

[0054] Taking the target user, the target item set and the item to be recommended as a target triplet, and constructing a co-occurrence probability of the target triplet according to the vector of the target user, the vector of the target item set and the vector of the item to be recommended;

[0055] With the goal of maximizing the co-occurrence probability of the target triplet, at least one item to be recommended is screened out from each of the items.

[0056] According to another aspect of an embodiment of the present invention, there is further provided an electronic device, including:

[0057] one or more processors;

[0058] a storage device for storing one or more programs,

[0059] When the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any of the above embodiments.

[0060] According to another aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored. When the program is executed by a processor, the method described in any one of the above embodiments is implemented.

[0061] One embodiment of the above invention has the following advantages or beneficial effects: because a multi-tuple set is constructed based on the behavioral data of each user on each item, a neural network is trained based on the multi-tuple set, and a vector of each user and a vector of each item are obtained, thereby filtering out the items to be recommended based on the target user and the target item set. Therefore, the technical problem of the low possibility of hitting user needs in the prior art is overcome. The embodiment of the present invention establishes a contextual connection by constructing a multi-tuple set, and obtains the vectors of each user and each item by training a neural network. Therefore, it is possible to take into account both user behavior preferences and item similarities, accurately hit user needs, and significantly improve the recommendation effect and performance. In addition, the present invention converts the item recommendation modeling into a vector-based nearest neighbor search problem, which can not only optimize the performance of the recommendation system, but also facilitate performance enhancement through hardware horizontal expansion.

[0062] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS

[0063] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.

[0064] Figure 1 is a schematic diagram of the main flow of a method for processing a request according to an embodiment of the present invention;

[0065] Figure 2 is a schematic diagram of a random sample according to an embodiment of the present invention;

[0066] Figure 3 is a schematic diagram of the main flow of a method for processing a request according to a reference embodiment of the present invention;

[0067] Figure 4 is an implementation architecture diagram according to an embodiment of the present invention;

[0068] Figure 5 is a schematic diagram of main modules of an apparatus for processing requests according to an embodiment of the present invention;

[0069] Figure 6 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;

[0070] Figure 7 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION

[0071] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0072] Personalized item recommendation systems are already a must for today’s e-commerce platforms. There are many methods that have been or are currently popular, including:

[0073] 1) Content-based recommendation: Recommendations are made based on the content information of items, without requiring users to evaluate the items;

[0074] 2) Recommendation based on collaborative filtering: The recommendation system predicts the target user's preference for a specific product based on the preferences of several similar users of the nearest neighbors, and makes recommendations based on this preference;

[0075] 3) Recommendation based on association rules: Based on association rules, the purchased items are used as the rule head and the rule body is the recommendation object. Its intuitive meaning is how much the user tends to buy other items when buying certain items;

[0076] 4) Search-based recommendations: including click-through rate estimation, conversion rate estimation, etc.

[0077] 5) Combination recommendation: All the above recommendation methods have their own advantages and disadvantages. Combination recommendation attempts to combine two or more recommendation methods to retain the best and eliminate the worst. Common combination methods include weighted, hybrid, feature combination, cascading, etc.

[0078] In recent years, recommendations based on user shopping behavior have emerged. The basis of this recommendation method is that user purchasing behavior is often not isolated. For example, users often buy the same brand of milk or red wine, and users often buy milk at the same time as cereal. This reflects a potential and special motivation of the user: he may be preparing breakfast for the next week, or preparing to entertain guests for dinner. Therefore, the recommendation system must consider both the user's special preference for items and the association between shopping cart items.

[0079] On the one hand, the recommendations in the user's shopping cart are often items that the user urgently needs, which have higher click-through rates and purchase rates. On the other hand, since the user's shopping cart operations may be quite frequent, for example, all red wines may be deleted within a minute, and a large number of books may be added. In scenarios where the data scale of users and items is very large, the current recommendation methods (such as collaborative filtering, click-through rate estimation, etc.) require a lot of training time and cannot respond in time.

[0080] In order to solve the technical problems existing in the prior art, an embodiment of the present invention provides a method for processing requests, which infers the user's direct shopping needs and preferences based on the user's shopping cart, and can provide high-concurrency and high-availability services on a scale of hundreds of millions of users and items.

[0081] Figure 1 Schematic diagram of the main process of the method for processing a request according to an embodiment of the present invention. As an embodiment of the present invention, Figure 1 As shown, the method for processing a request may include:

[0082] Step 101, construct a multi-tuple set based on the behavior data of each user on each item.

[0083] In the embodiment of the present invention, the user's behavior on the item can be the user's behavior of following, adding to purchase, commenting, forwarding, and downloading the item. The item can be a physical item or a virtual item, which is not limited in the embodiment of the present invention.

[0084] Before building a multi-tuple set, you need to collect the behavior data of each user on each item. Optionally, the front-end sends the user's behavior data on the item to the Kafka message queue, and Spark Streaming pulls messages from Kafka in real time, processes the behavior data in batches (mainly user ID, item ID), and then writes the user ID and its corresponding item ID to a distributed file system (such as HDFS) for storage.

[0085] Therefore, the behavior data of each user on each item can be obtained from the distributed file system, and a tuple set can be constructed by enumeration. The tuple set includes multiple tuples, each of which includes a user and at least one item. Taking the construction of a two-tuple set as an example, the two-tuple set includes multiple two-tuples, each of which includes a user identifier and an item identifier. Taking the construction of a three-tuple set as an example, the three-tuple set includes multiple three-tuples, each of which includes a user identifier and two item identifiers.

[0086] Take the purchase behavior (the behavior of adding items to the shopping cart by users at the website front desk) as an example. When a user adds an item to the shopping cart, the front desk sends the user's purchase behavior data to the Kafka message queue. At the same time, Spark Streaming pulls messages from Kafka in real time, processes the purchase behavior data in batches (mainly user ID and item ID in the shopping cart), and then writes the user ID and its corresponding item ID into HDFS for storage. Before step 101, the user purchase behavior data in HDFS needs to be processed. The processing methods mainly include: if the items have been purchased more than 60 days ago, this part of the data is not counted in the purchase behavior data; for users with very few purchase behaviors, some items in recent orders or items that users frequently browse / collect can be added; and those items that are not suitable for recommendation, such as items involving privacy and items that are not suitable for display, are cleaned. Finally, a multi-tuple set is constructed based on the processed behavior data of each user. For example, extracting any two items (i, j) from the shopping cart of user u will obtain a triple (u, i, j).

[0087] Step 102: training a neural network according to the multi-tuple set, thereby obtaining a vector of each of the users and a vector of each of the items.

[0088] In this step, a neural network is trained according to the multi-tuple set constructed in step 101, and the optimal hidden layer parameters are obtained by optimizing the neural network, thereby obtaining the vectors of each user and each item in the multi-tuple set.

[0089] Optionally, step 102 may include: constructing a log-likelihood function of the set of tuples based on the set of tuples; training a neural network using each of the tuples as a sample set, and optimizing the parameters of the hidden layer with the goal of maximizing the log-likelihood function; and using the optimized hidden layer parameters as the vector of each of the users and the vector of each of the items.

[0090] Taking triples as an example, suppose all triples (u, i, j) constitute the triple set T, then the total log-likelihood function of the (u, i, j) triple is:

[0091]

[0092] According to the maximum likelihood probability, the goal of the embodiment of the present invention is to make maximum.

[0093] Optionally, based on the set of multi-tuples, a log-likelihood function of the set of multi-tuples is constructed, including: calculating the co-occurrence probability of each multi-tuple respectively, thereby obtaining the softmax function of each element in the multi-tuple; converting the softmax function of each element in the multi-tuple into a sigmoid function; taking the logarithm of the sigmoid function of each element in the multi-tuple, and summing the logarithmic results, thereby obtaining the log-likelihood function of the set of multi-tuples.

[0094] In the embodiment of the present invention, each conditional probability of a triple is described by a softmax distribution, that is,

[0095] Represent the features of user u as vector r u , the features of two items (i, j) are represented as p i and p j , then the cohesion score of the triple (u,i,j) is: s i,j,u =p i T p j +p j T r u +p i T r u , which is also the co-occurrence probability distribution function of the triple (u,i,j).

[0096] Similar to the skip gram model of Word2Vec, the embodiment of the present invention adopts a negative sampling method to generate a sample distribution of Zipf distribution, that is, the probability distribution of the item ranked α is

[0097] Therefore, we can The softmax distribution in the formula is simplified to the sigmoid function, then:

[0098]

[0099] The sigmoid function is represented by σ, so the training goal is to maximize the corresponding log-likelihood probability, that is, to minimize the following formula:

[0100]

[0101]

[0102] Optionally, the neural network is trained with each of the multi-tuples as a sample set, and the parameters of the hidden layer are optimized with the goal of maximizing the log-likelihood function, including: for each multi-tuple, a first neural network is trained with one of the items as output and the user and the remaining items as input; at the same time, for each multi-tuple, a second neural network is trained with the user as output and the items as input; the hidden layer parameters of the first neural network and the hidden layer parameters of the second neural network are optimized with the goal of maximizing the log-likelihood function. Still taking the triple as an example, all the users' shopping items are converted into a triple sample set X of the form (u, i, j); perform several trainings, and each time a random sample χ of size Batch_size is taken from the sample set X, and the sample χ is generated as follows: Figure 2 As shown in , the user in the triple is used as the label. Similarly, an item in the triple can be used as a label, and Figure 2 Therefore, in the process of training the neural network, (u, j) is used as the input of the first neural network, i is used as the output of the first neural network, and (i, j) is used as the input of the second neural network, and u is used as the output of the second neural network.

[0103] Sample χ is used as the model input, and nce loss is used as the model loss value. Taking Tensorflow as an example:

[0104] loss item =tf.reduce_mean(tf.nn.nce_loss(weights=item_embedding, biases=item_bias, labels=i, inputs=j_emb+u_emb, num_sampled=32, num_classes=n_item))

[0105] Similarly, there is also loss user , except that labels are replaced by user u, inputs are replaced by (i, j), and weights are replaced by user_embedding.

[0106] Then, the loss value of the model is loss = loss item +loss user , use Adam (Adaptive Moment Estimation) optimizer to train. Continuously optimize the model parameters until the model loss value converges.

[0107] Finally, the hidden layer parameters item_embedding of the first neural network and the hidden layer parameters user_embedding of the second neural network, that is, the embedded representations of items and users, are obtained and written to the Redis cluster cache.

[0108] Embedding representation refers to embedding high-dimensional data into a low-dimensional continuous vector space. In the embodiments of the present invention, it specifically refers to representing high-dimensional category data such as users and items as a set of low-dimensional dense vectors.

[0109] Optionally, using the optimized hidden layer parameters as the vector of each of the users and the vector of each of the items includes: using the optimized hidden layer parameters of the first neural network as the vector of each of the items, wherein a row of parameters in the hidden layer parameters represents a vector of one item; using the optimized hidden layer parameters of the second neural network as the vector of each of the users, wherein a row of parameters in the hidden layer parameters represents a vector of one user.

[0110] Build the FAISS engine for the item_embedding vector of the item and index item_embedding. For example, if the embedding vector of an item is γ, the index content is [γ γ T ]. FAISS is a high-performance engine proposed by Facebook for vector storage, retrieval, and clustering, which can support billions of vector sets.

[0111] Optionally, the first neural network may use only one layer of neural network structure, and the second neural network may use only one layer of neural network structure, which does not increase excessive resource consumption compared to the prior art and has stronger practicality.

[0112] Step 103: Receive and parse the recommendation request to obtain a target user and a target item set.

[0113] After receiving a recommendation request for recommending items to a user, the request is parsed to obtain the user ID and the item set corresponding to the user. Taking the add-to-cart behavior as an example, the target item set is the item set in the current shopping cart of the target user.

[0114] Step 104 , based on the vector of the target user and the vectors of each target item in the target item set, at least one item to be recommended is selected from each of the items, and the at least one item to be recommended is returned.

[0115] By taking the vector of the target user and the vectors of each target item in the corresponding target item set as input, a set of items to be recommended and the probability of each item to be recommended can be output.

[0116] Optionally, step 104 may include: summing and averaging the vectors of each target item in the target item set to obtain the vector of the target item set; and selecting at least one item to be recommended from each of the items according to the vector of the target user and the vector of the target item set.

[0117] Optionally, at least one item to be recommended is selected from each of the items according to the vector of the target user and the vector of the target item set, including: taking the target user, the target item set and the item to be recommended as a target triplet; constructing a co-occurrence probability of the target triplet according to the vector of the target user, the vector of the target item set and the vector of the item to be recommended; and selecting at least one item to be recommended from each of the items with the goal of maximizing the co-occurrence probability of the target triplet.

[0118] For the target user and its corresponding target item set, the first step is to sum and average the vector item_embedding of each target item in the target item set. Let the sum and average result be I, and let the user's vector user_embedding be U. The recommended goal is to find The largest batch of items J.

[0119]

[0120] =argmaxP(j|U,I)=argmax(I T p j +p j T U+I T U)

[0121] = argmax(I T p j +p j T U) = argmax([IU] T [p j p j T ])

[0122] Due to [IU] T It is known that [p j p j T ] is the vector item_embedding of the item, and the item_embedding of all items has been indexed in FAISS through step 103, then, we only need to search for the item with [IU] in FAISS. T A batch of item vectors with the largest dot product, thus obtaining a batch of items to be recommended.

[0123] This process is called Approximate Nearest Neighbour search, which can be completed in milliseconds by FAISS. Approximate Nearest Neighbour search, also known as approximate nearest neighbour search, classifies or encodes the data in the database by clustering data analysis, predicts the data category to which the target data belongs based on its data features, and returns part or all of the category as the search result.

[0124] According to the various embodiments described above, it can be seen that the present invention constructs a multi-tuple set based on the behavioral data of each user on each item, trains a neural network based on the multi-tuple set, obtains the vector of each user and the vector of each item, and thus screens out the items to be recommended based on the target user and target item set. This technical means solves the technical problem in the prior art that the possibility of hitting user needs is not high. The embodiments of the present invention establish contextual connections by constructing a multi-tuple set, and obtain the vectors of each user and each item by training a neural network. Therefore, it is possible to take into account both user behavior preferences and item similarities, accurately hit user needs, and significantly improve the recommendation effect and performance. In addition, the present invention converts item recommendation modeling into a vector-based nearest neighbor search problem, which can not only optimize the performance of the recommendation system, but also facilitate performance enhancement through hardware horizontal expansion.

[0125] Figure 3 Schematic diagram of the main process of a method for processing a request according to a reference embodiment of the present invention. As another embodiment of the present invention, Figure 3 As shown, the method for processing a request may include:

[0126] Step 301, construct a multi-tuple set based on the behavior data of each user on each item.

[0127] Step 302: construct a log-likelihood function of the tuple set according to the tuple set.

[0128] Step 303: training a neural network using each of the multi-tuples as a sample set, and optimizing the parameters of the hidden layer with the goal of maximizing the log-likelihood function.

[0129] Step 304: Use the optimized hidden layer parameters as the vectors of each of the users and the vectors of each of the items.

[0130] Step 305: Receive and parse the recommendation request to obtain a target user and a target item set.

[0131] Step 306 , summing and averaging the vectors of the target items in the target item set to obtain the vector of the target item set.

[0132] Step 307 , taking the target user, the target item set and the item to be recommended as a target triplet, and constructing the co-occurrence probability of the target triplet according to the vector of the target user, the vector of the target item set and the vector of the item to be recommended.

[0133] Step 308 , with the goal of maximizing the co-occurrence probability of the target triplet, at least one item to be recommended is selected from each of the items.

[0134] In addition, the specific implementation content of the method for processing requests in a reference embodiment of the present invention has been described in detail in the method for processing requests described above, so the repeated content will not be described here.

[0135] Figure 4 1 is an implementation architecture diagram according to an embodiment of the present invention. Figure 4 As shown, the architecture mainly includes an online recommendation system and an offline model training system. The method for processing a request in an embodiment of the present invention may include the following steps:

[0136] The front desk sends the user's behavior data on items to the Kafka message queue. At the same time, Spark Streaming pulls messages from Kafka in real time, processes the behavior data in batches (mainly user ID and item ID), and then writes the user ID and its corresponding item ID to a distributed file system (such as HDFS) for storage.

[0137] The big data computing engine Hive / Spark performs tasks such as data extraction / conversion / cleaning.

[0138] The offline model training system obtains the behavior data of each user on each item from HDFS, and then constructs a set of triples; then the neural network is trained based on the set of triples to obtain the vectors of each user and each item, and finally the vectors of each user and each item are stored in the Redis cluster.

[0139] The website frontend initiates a recommendation request to the online recommendation server, including the current user ID, the set of item IDs in the current user's shopping cart, and the number of items N that need to be recommended;

[0140] The online recommendation server requests the user ID and the IDs of each item in the current user's shopping cart from the Redis cluster to obtain the user's embedding vector and the embedding vector of each item.

[0141] Sum and average the embeddings of the items in the shopping cart, set the result as I, set the user embedding as U, and search for N items in FAISS that match [IU]T The vector with the largest dot product outputs the items represented by these N vectors and each dot product of these N vectors (for example, as a purchase probability);

[0142] The item ID and dot product are returned in pairs to the website frontend, which will choose to display them.

[0143] Figure 5 is a schematic diagram of main modules of an apparatus for processing requests according to an embodiment of the present invention, such as Figure 5 As shown, the device 500 for processing requests includes a construction module 501, a training module 502, a receiving module 503 and a returning module 504. The construction module 501 is used to construct a tuple set according to the behavior data of each user on each item; the tuple set includes multiple tuples, each tuple includes a user and at least one item; the training module 502 is used to train a neural network according to the tuple set, so as to obtain vectors of each user and vectors of each item; the receiving module 503 is used to receive and parse the recommendation request, and obtain a target user and a target item set; the returning module 504 is used to filter out at least one item to be recommended from each item according to the vector of the target user and the vector of each target item in the target item set, and return the at least one item to be recommended.

[0144] Optionally, the training module 502 is further used for:

[0145] Constructing a log-likelihood function of the multi-tuple set according to the multi-tuple set;

[0146] Training a neural network using each of the multi-tuples as a sample set and optimizing the parameters of the hidden layer with the goal of maximizing the log-likelihood function;

[0147] The optimized hidden layer parameters are used as vectors of each of the users and vectors of each of the items.

[0148] Optionally, the training module 502 is further used for:

[0149] For each tuple, train the first neural network with one of the items as output and the user and the remaining items as input. At the same time, train the second neural network with the user as output and the items as input for each tuple.

[0150] The hidden layer parameters of the first neural network and the hidden layer parameters of the second neural network are optimized with the goal of maximizing the log-likelihood function.

[0151] Optionally, the training module 502 is further used for:

[0152] Using the optimized hidden layer parameters of the first neural network as vectors of each of the items, wherein a row of parameters in the hidden layer parameters represents a vector of an item;

[0153] The optimized hidden layer parameters of the second neural network are used as vectors of each of the users, wherein a row of parameters in the hidden layer parameters represents a vector of one user.

[0154] Optionally, the training module 502 is further used for:

[0155] Calculate the co-occurrence probability of each multi-group respectively, so as to obtain the softmax function of each element in the multi-group;

[0156] Convert the softmax function of each element in the multi-tuple into a sigmoid function;

[0157] The logarithm of the sigmoid function of each element in the multi-tuple is taken, and the logarithmic results are summed to obtain the log-likelihood function of the multi-tuple set.

[0158] Optionally, the returning module 504 is further configured to:

[0159] Sum and average the vectors of each target item in the target item set to obtain the vector of the target item set;

[0160] At least one item to be recommended is screened out from each of the items according to the vector of the target user and the vector of the target item set.

[0161] Optionally, the returning module 504 is further configured to:

[0162] Taking the target user, the target item set and the item to be recommended as a target triplet, and constructing a co-occurrence probability of the target triplet according to the vector of the target user, the vector of the target item set and the vector of the item to be recommended;

[0163] With the goal of maximizing the co-occurrence probability of the target triplet, at least one item to be recommended is screened out from each of the items.

[0164] According to the various embodiments described above, it can be seen that the present invention constructs a multi-tuple set based on the behavioral data of each user on each item, trains a neural network based on the multi-tuple set, obtains the vector of each user and the vector of each item, and thus screens out the items to be recommended based on the target user and target item set. This technical means solves the technical problem in the prior art that the possibility of hitting user needs is not high. The embodiments of the present invention establish contextual connections by constructing a multi-tuple set, and obtain the vectors of each user and each item by training a neural network. Therefore, it is possible to take into account both user behavior preferences and item similarities, accurately hit user needs, and significantly improve the recommendation effect and performance. In addition, the present invention converts item recommendation modeling into a vector-based nearest neighbor search problem, which can not only optimize the performance of the recommendation system, but also facilitate performance enhancement through hardware horizontal expansion.

[0165] It should be noted that the specific implementation content of the device for processing requests in the present invention has been described in detail in the method for processing requests described above, so the repeated content will not be described here.

[0166] Figure 6 An exemplary system architecture 600 is shown to which the method for processing a request or the apparatus for processing a request according to the embodiments of the present invention can be applied.

[0167] like Figure 6 As shown, system architecture 600 may include terminal devices 601, 602, 603, network 604 and server 605. Network 604 is used to provide a medium for communication links between terminal devices 601, 602, 603 and server 605. Network 604 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0168] Users can use terminal devices 601, 602, and 603 to interact with server 605 through network 604 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 601, 602, and 603, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only examples).

[0169] The terminal devices 601 , 602 , and 603 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers, etc.

[0170] The server 605 may be a server that provides various services, such as a backend management server (only an example) that provides support for shopping websites browsed by users using the terminal devices 601, 602, and 603. The backend management server may analyze and process the received data such as the item information query request, and feed back the processing results (such as target push information, item information - only an example) to the terminal device.

[0171] It should be noted that the method for processing requests provided in the embodiment of the present invention is generally executed by the server 605 , and accordingly, the device for processing requests is generally set in the server 605 .

[0172] It should be understood that Figure 6 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to the implementation requirements.

[0173] Reference below Figure 7 , which shows a schematic diagram of the structure of a computer system 700 of a terminal device suitable for implementing an embodiment of the present invention. Figure 7 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0174] like Figure 7 As shown, the computer system 700 includes a central processing unit (CPU) 701, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage part 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the system 700 are also stored. The CPU 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.

[0175] The following components are connected to the I / O interface 705: an input section 706 including a keyboard, a mouse, etc.; an output section 707 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network interface card such as a LAN card, a modem, etc. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the I / O interface 705 as needed. A removable medium 711, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 710 as needed, so that a computer program read therefrom is installed into the storage section 708 as needed.

[0176] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 709, and / or installed from the removable medium 711. When the computer program is executed by the central processing unit (CPU) 701, the above-mentioned functions defined in the system of the present invention are executed.

[0177] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0178] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0179] The modules involved in the embodiments of the present invention may be implemented by software or hardware. The modules described may also be set in a processor, for example, it may be described as: a processor includes a construction module, a training module, a receiving module and a return module, wherein the names of these modules do not constitute a limitation on the modules themselves in some cases.

[0180] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs. When the above one or more programs are executed by a device, the device includes: constructing a set of tuples according to the behavior data of each user on each item; wherein the set of tuples includes multiple tuples, each tuple includes a user and at least one item; training a neural network according to the set of tuples, thereby obtaining vectors of each user and vectors of each item; receiving and parsing recommendation requests, obtaining a target user and a target item set; and filtering out at least one item to be recommended from each item according to the vector of the target user and the vector of each target item in the target item set, and returning the at least one item to be recommended.

[0181] According to the technical solution of the embodiment of the present invention, because a multi-tuple set is constructed according to the behavioral data of each user on each item, a neural network is trained according to the multi-tuple set to obtain the vector of each user and the vector of each item, thereby filtering out the items to be recommended based on the target user and the target item set, the technical problem of the low possibility of hitting the user's needs in the prior art is overcome. The embodiment of the present invention establishes a contextual connection by constructing a multi-tuple set, and obtains the vector of each user and each item by training a neural network. Therefore, it is possible to take into account both the user's behavioral preferences and the item similarity, accurately hit the user's needs, and significantly improve the recommendation effect and performance. In addition, the present invention converts the item recommendation modeling into a vector-based nearest neighbor search problem, which can not only optimize the performance of the recommendation system, but also facilitate performance enhancement through hardware horizontal expansion.

[0182] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for processing a request, characterized in that: include: Constructing a tuple set according to the behavior data of each user on each item; wherein the tuple set includes a plurality of tuples, each of which includes a user and at least one item; Training a neural network according to the multi-tuple set, thereby obtaining a vector of each of the users and a vector of each of the items; Receive and parse the recommendation request to obtain a target user and a set of target items corresponding to the target user; According to the vector of the target user and the vectors of each target item in the target item set, at least one item to be recommended is screened out from each of the items, and the at least one item to be recommended is returned; Training a neural network according to the multi-tuple set to obtain a vector of each user and a vector of each item includes: Constructing a log-likelihood function of the multi-tuple set according to the multi-tuple set; Training a neural network using each of the multi-tuples as a sample set and optimizing the parameters of the hidden layer with the goal of maximizing the log-likelihood function; Using the optimized hidden layer parameters as the vectors of each of the users and the vectors of each of the items; The neural network is trained using each of the multi-tuples as a sample set, and the parameters of the hidden layer are optimized with the goal of maximizing the log-likelihood function, including: For each tuple, train the first neural network with one of the items as output and the user and the remaining items as input. At the same time, train the second neural network with the user as output and the items as input for each tuple. The hidden layer parameters of the first neural network and the hidden layer parameters of the second neural network are optimized with the goal of maximizing the log-likelihood function.

2. The method according to claim 1, characterized in that The optimized hidden layer parameters are used as vectors of each user and vectors of each item, including: Using the optimized hidden layer parameters of the first neural network as vectors of each of the items, wherein a row of parameters in the hidden layer parameters represents a vector of an item; The optimized hidden layer parameters of the second neural network are used as vectors of each of the users, wherein a row of parameters in the hidden layer parameters represents a vector of one user.

3. The method according to claim 1, characterized in that Constructing a log-likelihood function of the multi-tuple set according to the multi-tuple set includes: Calculate the co-occurrence probability of each multi-group respectively, so as to obtain the softmax function of each element in the multi-group; Convert the softmax function of each element in the multi-tuple into a sigmoid function; The logarithm of the sigmoid function of each element in the multi-tuple is taken, and the logarithmic results are summed to obtain the log-likelihood function of the multi-tuple set.

4. The method according to claim 1, characterized in that: According to the vector of the target user and the vectors of each target item in the target item set, at least one item to be recommended is selected from each of the items, including: Sum and average the vectors of each target item in the target item set to obtain the vector of the target item set; At least one item to be recommended is screened out from each of the items according to the vector of the target user and the vector of the target item set.

5. The method according to claim 4, characterized in that Filtering at least one item to be recommended from each of the items according to the vector of the target user and the vector of the target item set, including: Taking the target user, the target item set and the item to be recommended as a target triplet, and constructing a co-occurrence probability of the target triplet according to the vector of the target user, the vector of the target item set and the vector of the item to be recommended; With the goal of maximizing the co-occurrence probability of the target triplet, at least one item to be recommended is screened out from each of the items.

6. A device for processing a request, characterized in that: include: A construction module, used to construct a tuple set according to the behavior data of each user on each item; wherein the tuple set includes a plurality of tuples, each of which includes a user and at least one item; A training module, used for training a neural network according to the multi-tuple set, so as to obtain a vector of each of the users and a vector of each of the items; A receiving module, used to receive and parse the recommendation request to obtain a target user and a target item set corresponding to the target user; a returning module, configured to screen out at least one item to be recommended from each of the items according to the vector of the target user and the vector of each target item in the target item set, and return the at least one item to be recommended; The training module is also used to: Constructing a log-likelihood function of the multi-tuple set according to the multi-tuple set; Training a neural network using each of the multi-tuples as a sample set and optimizing the parameters of the hidden layer with the goal of maximizing the log-likelihood function; Using the optimized hidden layer parameters as the vectors of each of the users and the vectors of each of the items; The training module is also used to: For each tuple, train the first neural network with one of the items as output and the user and the remaining items as input. At the same time, train the second neural network with the user as output and the items as input for each tuple. The hidden layer parameters of the first neural network and the hidden layer parameters of the second neural network are optimized with the goal of maximizing the log-likelihood function.

7. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 5.

8. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.

Citation Information

Patent Citations

  • Commodity recommendation method and commodity recommendation device, equipment and storage medium

    CN108182621A

  • Commodity recommendation method under mass data, electronic device and storage medium

    CN109509054A