A training method and device for recommendation model
Through real-time online learning and attention mechanisms, combined with a variety of recommendation algorithms, it solves the problem of the existing recommendation system's inability to adapt to changes in user preferences and lack of cross-store recommendations, and improves the interpretability and coverage of the recommendation model, reflecting different The differences between types of stores provide more scientific recommendation results.
Patent Information
- Application Number
- CN202010157347.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-03-09
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2040-03-09
AI Technical Summary
The existing recommendation system cannot adapt to changes in user preferences, has sparse data, lacks cross-store recommendation capabilities, insufficient coverage of recommendation results, and cannot reflect the differences in recommendation strategies for different types of stores.
The recommendation model is trained through real-time online learning, using attention mechanism and group optimization strategy, combined with multiple recommendation algorithms, to calculate the similarity and preference between objects, perform real-time recall and parameter adjustment, and realize cross-store recommendation and different types of stores. Reflection of difference.
It has improved the interpretability and coverage of the recommendation model, can learn changes in user preferences in a timely manner, reflect the differences in recommendation strategies for different types of stores, and make cross-store data recommendations, making the recommendation results more scientific.
Smart Images

Figure CN113378033B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a training method and device for a recommendation model. Background Art
[0002] Most existing recommendation systems train recommendation models based on users' past historical behavior data through offline prediction models, and then use the recommendation models to make personalized recommendations for users. However, for each store on an e-commerce platform, the personalized recommendations of a store are different from the recommendations on the homepage. Its user visits are small, the data is sparse, and the stores are independent of each other. The number of users is much larger than the number of products in the store. Therefore, most commonly used recommendation algorithms are not suitable for personalized recommendations of stores.
[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] (1) The recommendation model uses offline prediction and cannot adapt to changes in user preferences;
[0005] (2) The calculation of rating preference only considers the effect of a single behavior, which makes the recommendation results not comprehensive enough;
[0006] (3) When different types of stores use the same recommendation model, the differences in recommendation strategies of different types of stores cannot be reflected;
[0007] (4) The recommendation model of each store only makes recommendations within the store and cannot make recommendations for cross-store data;
[0008] (5) The algorithm used in the recommendation model is single, and the recommendation results have certain defects and limitations. Summary of the invention
[0009] In view of this, an embodiment of the present invention provides a method and device for training a recommendation model, which can train the recommendation model through real-time online learning, and timely learn the rules of changes in user preferences. The recommendation model is also more interpretable, and the recommendation results are comprehensive and can reflect the differences in recommendation strategies of different types of stores. It can realize recommendations for cross-store data, and the recommendation results are more scientific.
[0010] To achieve the above objective, according to one aspect of an embodiment of the present invention, a method for training a recommendation model is provided.
[0011] A training method for a recommendation model, comprising: performing offline calculations on underlying data to obtain target attribute values; calculating recommendation results in real time based on an attention mechanism and displaying the recommendation results according to the target attribute values and a preset recall strategy; calculating a recommendation result conversion rate according to user behavior on the recommendation results; and adjusting parameters based on a group optimization strategy to train a recommendation model according to the recommendation result conversion rate.
[0012] Optionally, the target attribute value includes at least one of the following: object popularity value, object behavior similarity, object attribute similarity and user preference for the object.
[0013] Optionally, the object behavior similarity is calculated by the following method: counting the object sets on which the user has performed behaviors; counting the number of users who have simultaneously performed behaviors on two objects in the object set, the user set corresponding to each object, and the user's preference for each object; calculating the first similarity of the intersection of the behaviors of two objects based on the counted number of users and the user set corresponding to each object; calculating the second similarity between objects based on the user's preference for each object; and performing weighted summation of the first similarity and the second similarity to obtain the object behavior similarity.
[0014] Optionally, the user's preference for each object is obtained by taking a weighted average of the preferences corresponding to different behaviors of the user for each object.
[0015] Optionally, after calculating the second similarity between the objects, the method further includes: shrinking and weighting the second similarity.
[0016] Optionally, the recall strategy includes: a decay strategy, a repurchase strategy and a behavior type strategy.
[0017] Optionally, real-time calculation of recommendation results based on the attention mechanism includes: weighted summing and activating the three factors of attenuation factor, repurchase probability factor and behavior type to obtain the attention weight of the object; multiplying the attention weight of the candidate object with the object behavior similarity and object attribute similarity of the candidate object, respectively, and adding them and multiplying them by the activation function to obtain the behavior recommendation weight and attribute recommendation weight of the candidate object; multiplying the heat recommendation weight, the behavior recommendation weight, the attribute recommendation weight and the preference recommendation weight with the corresponding recall data, respectively, and then sorting them to obtain the recommendation result, wherein the recall data corresponding to each recommendation weight is selected from the candidate object set according to the target attribute value corresponding to the recommendation weight.
[0018] Optionally, parameter adjustment based on the group optimization strategy includes: constructing a weight tensor model corresponding to the store; obtaining the tensor unit corresponding to each store; evenly grouping the stores in each tensor unit to obtain the group identifier corresponding to each store to obtain the weight vector corresponding to each group; the click rate corresponding to the weight vector corresponding to each group within the statistical period; updating the weight vector corresponding to each group until the conversion rate of the recommendation result reaches a maximum.
[0019] Optionally, the weight tensor model uniformly quantizes the stores into a grid model of the preset dimension according to the preset dimension; wherein each grid model has a multi-dimensional weight vector.
[0020] According to another aspect of an embodiment of the present invention, a training device for a recommendation model is provided.
[0021] A training device for a recommendation model includes: an offline processing module, which is used to perform offline calculations on underlying data to obtain target attribute values; a real-time recall module, which is used to calculate and display recommendation results in real time based on an attention mechanism according to the target attribute values and a preset recall strategy; a result conversion module, which is used to calculate a recommendation result conversion rate according to a user's behavior on the recommendation results; and a parameter adjustment module, which is used to adjust parameters based on a group optimization strategy according to the recommendation result conversion rate to train a recommendation model.
[0022] According to yet another aspect of an embodiment of the present invention, an electronic device for training a recommendation model is provided.
[0023] An electronic device for training a recommendation model, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the training method of the recommendation model provided in an embodiment of the present invention.
[0024] According to still another aspect of the embodiments of the present invention, a computer readable medium is provided.
[0025] A computer-readable medium stores a computer program, which, when executed by a processor, implements a training method for a recommendation model provided in an embodiment of the present invention.
[0026] An embodiment of the above invention has the following advantages or beneficial effects: by performing offline calculation on the underlying data to obtain the target attribute value; according to the target attribute value and the preset recall strategy, the recommendation result is calculated in real time based on the attention mechanism and the recommendation result is displayed; the recommendation result conversion rate is calculated according to the user's behavior on the recommendation result; according to the recommendation result conversion rate, the parameter is adjusted based on the group optimization strategy to train the recommendation model, which can realize the offline analysis of the underlying data and the behavior sequence based on the attention mechanism to calculate the recommendation result in real time, and the conversion rate of the recommendation result is introduced into the training of the recommendation model as feedback, so that the recommendation model can be trained through real-time online learning, and the law of user preference changes can be learned in time, and the interpretability of the recommendation model is also stronger. In addition, in the training method of the recommendation model of the present invention, the calculation of the scoring preference takes into account the role of multiple behaviors, so that the recommendation results cover a comprehensive coverage; when different types of stores use the recommendation model for recommendation, the model will adjust the parameters according to the store characteristics to reflect the differences in the recommendation strategies of different types of stores; because the user's cross-store behavior is considered when making recommendations, it is possible to recommend cross-store data; the recommendation model uses a variety of algorithms, so that the advantages and disadvantages of multiple recommendation algorithms complement each other, and the recommendation results are more scientific.
[0027] 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
[0028] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.
[0029] Figure 1 is a schematic diagram of the main steps of a training method for a recommendation model according to an embodiment of the present invention;
[0030] Figure 2 It is a schematic diagram of the system framework structure of an embodiment of the present invention;
[0031] Figure 3 It is a data flow diagram of an embodiment of the present invention;
[0032] Figure 4 is a schematic diagram of an offline data processing flow of an embodiment of the present invention;
[0033] Figure 5 is a similarity distribution diagram before and after transformation according to an embodiment of the present invention;
[0034] Figure 6 is a repurchase probability density distribution diagram of an embodiment of the present invention;
[0035] Figure 7 It is a schematic diagram of the implementation principle of a real-time recall algorithm according to an embodiment of the present invention;
[0036] Figure 8 is a schematic diagram of the implementation logic of a recall algorithm according to an embodiment of the present invention;
[0037] Fig. 9 is a schematic diagram of a weight tensor model of an embodiment of the present invention;
[0038] Fig.10 is a schematic diagram of main modules of a training device for a recommendation model according to an embodiment of the present invention;
[0039] Fig.11 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;
[0040] Fig.12 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
[0041] 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.
[0042] Most existing recommendation models are trained through offline prediction models, and the recommendation models used are relatively simple, such as the GBDT (Gradient Boosting Decision Tree) algorithm. The user's behavior data, user's attribute data, and product attribute data are mixed and input into a model with fixed parameters to obtain recommendation results. However, such recommendation models cannot learn online in real time, cannot adapt to changes in user preferences, and lack interpretability. The algorithm used by the recommendation model is single, and the recommendation results have certain defects and limitations.
[0043] In addition, for store recommendations, due to the small amount of user access data resulting in sparse data, the number of users is much larger than the number of products in the store, and the independence of stores, different types of stores using the same recommendation model cannot reflect the differences in recommendation strategies of each store, and there is no analysis of user cross-store behavior data, so only recommendations can be made within the store, etc. All of these have resulted in the existing recommendation system being unsuitable for store recommendations.
[0044] In order to solve the above problems existing in the prior art, the present invention provides a training method and device for a recommendation model, which can realize a complete store recommendation system, and comprehensively use collaborative filtering, content recommendation, model recommendation, hot spot recommendation and other recommendation methods. The training method of the recommendation model of the present invention is mainly reflected in the following aspects:
[0045] (1) Integrate multiple recommendation algorithms to complement each other’s strengths and weaknesses;
[0046] (2) Improve the algorithm logic of item-based collaborative filtering to improve computing efficiency. Use the distributed computing framework of Spark (a fast and general computing engine) for computing and transform the distribution of collaborative filtering data to enhance the robustness of the system.
[0047] (3) An implicit feedback preference scoring mechanism based on multiple user behaviors is implemented to enhance the robustness of the scoring data;
[0048] (4) Implemented a product behavior sequence recall strategy model based on the attention mechanism;
[0049] (5) The preference regression model based on user attributes solves the cold start problem caused by sparse user behavior data;
[0050] (6) Implemented a tensor weight optimization model for stores of different types, number of SKUs, and user visits;
[0051] (7) A tensor weighted group optimization strategy was used to make the models of different stores converge to the optimal click-through rate target;
[0052] (8) The system model is highly interpretable and can be adjusted automatically by a machine or manually based on experience.
[0053] Figure 1 FIG. 1 is a schematic diagram of the main steps of the training method of the recommendation model according to an embodiment of the present invention. Figure 1 As shown, the training method of the recommendation model in the embodiment of the present invention mainly includes the following steps S101 to S104.
[0054] Step S101: perform offline calculation on the underlying data to obtain the target attribute value;
[0055] Step S102: According to the target attribute value and the preset recall strategy, the recommendation results are calculated in real time based on the attention mechanism and the recommendation results are displayed;
[0056] Step S103: Calculating the recommendation result conversion rate based on the user's behavior on the recommendation result;
[0057] Step S104: According to the conversion rate of the recommendation results, parameters are adjusted based on the group optimization strategy to train the recommendation model.
[0058] By training the recommendation model according to the above steps S101 to S104, it is possible to calculate the recommendation results in real time through offline analysis of the underlying data and based on the behavior sequence of the attention mechanism, and introduce the conversion rate of the recommendation results as feedback into the training of the recommendation model. This enables the recommendation model to be trained through real-time online learning, and the rules of changes in user preferences can be learned in a timely manner. The recommendation model is also more interpretable.
[0059] According to one embodiment of the present invention, the target attribute value includes at least one of the following: object popularity value, object behavior similarity, object attribute similarity, and user preference for the object. By analyzing multiple target attributes to train the recommendation model, a preference scoring mechanism based on multiple user behaviors is implemented, thereby enhancing the robustness of the data scoring mechanism.
[0060] According to an embodiment of the present invention, the object behavior similarity is calculated, for example, by the following method:
[0061] Count the object sets of user behaviors;
[0062] Count the number of users who have performed actions on two objects in the object set at the same time, the user set corresponding to each object, and the user's preference for each object;
[0063] Calculate the first similarity of the intersection of behaviors of two objects based on the counted number of users and the user set corresponding to each object;
[0064] Calculate the second similarity between objects according to the user's preference for each object;
[0065] The first similarity and the second similarity are weightedly summed to obtain the object behavior similarity.
[0066] According to the above method, the object behavior similarity is calculated, and similar objects can be obtained through the similarity of user behavior and the similarity of user preference for objects.
[0067] According to an embodiment of the present invention, the user's preference for each object is obtained by weighted averaging the preferences corresponding to different behaviors of the user for each object. In the embodiment of the present invention, by counting the different behaviors of the user for each object, and then analyzing these behaviors and associating them with the user's preference for the object, the preference corresponding to the different behaviors can be obtained. After that, different weights are assigned to different behaviors, and the user's preference for each object can be obtained by weighted averaging.
[0068] According to another embodiment of the present invention, after calculating the second similarities between the objects, the second similarities may be shrunk and weighted.
[0069] According to another embodiment of the present invention, the recall strategy includes: decay strategy, repurchase strategy and behavior type strategy. Since the user's preference for an object will decay over time, the decay strategy needs to be considered when calculating the recommended object; the repurchase strategy refers to counting the probability of the user repeating the operation of the object based on the time interval between the user's two visits to the object; the behavior type strategy refers to determining the user's preference for the object based on the user's behavior type towards the object.
[0070] According to another embodiment of the present invention, when the recommendation results are calculated in real time based on the attention mechanism, the following steps may be included:
[0071] The three factors of decay factor, repurchase probability factor and behavior type are weighted and activated to obtain the attention weight of the object;
[0072] The attention weight of the candidate object is multiplied and added with the object behavior similarity and the object attribute similarity of the candidate object respectively, and then multiplied by the activation function to obtain the behavior recommendation weight and the attribute recommendation weight of the candidate object;
[0073] The heat recommendation weight, the behavior recommendation weight, the attribute recommendation weight and the preference recommendation weight are respectively multiplied by the corresponding recall data and then sorted to obtain a recommendation result, wherein the recall data corresponding to each recommendation weight is selected from the candidate object set according to the target attribute value corresponding to the recommendation weight.
[0074] In an embodiment of the present invention, the recommendation results are calculated in real time based on the attention mechanism, and the preference for objects reflected by the user's different behaviors can be converted into the user's attention to the object, so as to better determine the recommended object.
[0075] According to the technical solution of the present invention, parameter adjustment based on the group optimization strategy may specifically include:
[0076] Construct a weight tensor model corresponding to the store;
[0077] Get the tensor unit corresponding to each store;
[0078] Evenly group the stores in each tensor unit, obtain the group identifier corresponding to each store, and obtain the weight vector corresponding to each group;
[0079] The click rate corresponding to the weight vector of each group during the statistical period;
[0080] Update the weight vector corresponding to each group until the conversion rate of the recommended results reaches the maximum.
[0081] The weight tensor model uniformly quantizes the stores into a grid model of preset dimensions according to preset dimensions; each grid model has a multi-dimensional weight vector.
[0082] The specific implementation process of the technical solution of the present invention is introduced below in conjunction with a specific embodiment. In the embodiment of the present invention, the object to be recommended refers to a commodity.
[0083] Figure 2 FIG. 1 is a schematic diagram of the system framework structure of an embodiment of the present invention. Figure 2 As shown, the training process framework of the recommendation model of the embodiment of the present invention mainly includes several parts such as offline calculation, recall strategy, weighted sorting processing, result filtering, recommendation result display, conversion rate extraction and online learning group optimization strategy.
[0084] The offline calculation part is used to calculate the similarity of product behavior, the similarity of product attributes, the user's preference for products, and the product heat value. The recall strategy part calculates the recalled products based on the real-time attention mechanism of the decay strategy, repurchase strategy, and behavior type strategy. The weighted sorting processing part includes weighted sorting processing of the four parts of data calculated by the offline calculation part, and can integrate the results of multiple recommendation algorithms. The result filtering part filters the recall results according to product inventory, region, etc. Then, the filtered recommendation results are displayed. In order to optimize the click-through rate of the recommendation results and obtain a better conversion rate of the recommendation results, an embodiment of the present invention establishes a weight tensor model to use a group optimization strategy to optimize the parameters and weights of the recommendation model, including offline parameters and weights, recall parameters and weights, sorting parameters and weights, and so on.
[0085] Figure 3 FIG. 1 is a schematic diagram of data flow according to an embodiment of the present invention. Figure 3 , which shows the data flow of an embodiment of the present invention. First, for the underlying data in the data mart, which mainly refers to user behavior data, Spark is used to calculate four parts of data offline, including item-based commodity behavior similarity, commodity attribute similarity, user preference for commodities, commodity heat value, etc. Then, these four parts of offline data are saved in Hbase, and the offline data is read from Hbase when calculating the recalled commodities, and Redis cache is used to solve the problem of repeated reading of the same data. After the recalled data is calculated, the recalled data is also persistently stored using Hbase and cached using Redis. Finally, when further processing such as data sorting and filtering is performed to obtain the recommendation results, the sorted and filtered recommendation result data is stored in the Redis cache to wait for the display interface of the recommendation results to be called.
[0086] In the embodiment of the present invention, a mechanism for calculating the user's preference for a product based on the user's behavior data is also proposed. The user's preference for a product is calculated by a comprehensive weighting of the user's browsing, collection, purchase, adding to shopping cart, length of stay and other behavior scores. b Indicates browsing preference, R c Indicates collection preference, R p Indicates purchase preference, R a Indicates the preference for adding to cart, R s represents the preference for length of stay, N b 、N c 、N p 、N a 、N s represents the number of occurrences of these behaviors within the statistical period, and R represents the weighted average of these preferences. Then:
[0087]
[0088]
[0089] R b =tanh(N b ,T b );R p =tanh(N p ,T p );R a =tanh(N a ,T a );R s =tanh(N s ,T s );
[0090] R=W b *R b +W c *R c +W p *R p +W a *R a +W s *R s ;
[0091] Among them, tanh(x,T) is the activation function, T is the current time, T b , T c , T p , T a , T s are the parameters of the corresponding activation functions respectively.
[0092] However, for users who have not performed any user behavior on a product, when calculating their preference for a product, a regression model based on user attributes is used to predict the user's preference for the product. Specifically, the GBDT (Gradient Boosting Decision Tree) algorithm can be used to establish a prediction model of user attributes and user preferences for products. Since the data of a single product in a store is relatively sparse, the data set is upgraded to a data set with the specific category to which the product belongs as the object for regression training, and then the single product in the store is weighted by popularity.
[0093] According to an embodiment of the present invention, the obtained regression table based on user attributes is, for example, the following Table 1.
[0094] Table 1
[0095] gender age area Preference male 30 Sichuan 0.9 female 20 Beijing 0.8 male 50 Shandong 0.1 female 18 Henan 0.6
[0096] The calculation formula for a user's preference for a single product is as follows:
[0097] P us =H i *P uc ;
[0098] Among them, H i is the heat value of the product, P uc It is the user's preference for the product and is the output of the regression model based on user attributes.
[0099] Recommendations based on product content rely on the similarity of product attributes. Generally, products in the same category have high attribute similarity. Therefore, in the embodiment of the present invention, the popularity of products in the same category is used as the user's preference for the product. The popularity of products in the same category is calculated as follows:
[0100] B t =∑A t *P t ;
[0101]
[0102] Among them, P t Indicates the user's preference for the product, A t represents the decay value of the user's preference for the product at time t, B i Indicates the cumulative heating temperature of the product, H i Indicates the normalized heat value.
[0103] Furthermore, the user's preference for all categories of goods (denoted as S) is the heat value of the goods obtained by weighted accumulation of the decay factors and preferences at different times:
[0104] B t =∑A t *P t ;
[0105] The obtained heat value is standardized as follows:
[0106]
[0107] Figure 4 FIG. 1 is a schematic diagram of an offline data processing flow chart of an embodiment of the present invention. Figure 4 As shown, in the embodiment of the present invention, the distributed computing based on spark needs to partition the data so that the behavior data of all stores in the partition are stored in this partition. The data of each partition is grouped and aggregated within the store through the groupbykey operation, and then the item-based computing of the data in the store is implemented. This design enables a distributed computing node to store only the data of one store. The algorithm directly fetches data in the memory without using elastic distributed data, thereby improving the efficiency of offline computing.
[0108] Since the double-loop calculation of the Item_based algorithm is relatively large, we first count the user's behavior and then implement a double-loop calculation of similarity in the user's behavior set. The algorithm steps are as follows:
[0109] 1) Count the product sets that users have performed actions on, and filter out users who have performed actions on too many products to prevent data generated by web crawlers;
[0110] 2) The number of times two products are purchased by the same person is counted in the user's product set, and the user set of the product and the user's rating of the product are counted. After counting all the user's product sets, the first similarity of the intersection of two product behaviors is calculated using the Jaccard coefficient jcd:
[0111]
[0112]
[0113] 3) According to the user set corresponding to each product and the user's preference score for the product, calculate the second similarity between the products:
[0114]
[0115] Among them, R u,i is the user's rating of product i, is the average of user u’s preference scores for all products, and S(i,j) is the similarity between product i and product j.
[0116] 4) The first similarity and the second similarity are weightedly summed to obtain the commodity behavior similarity SIM(k,j), and then an item k (which may be one or more) similar to item j is determined.
[0117] Since the number of product SKUs in different stores is different, the similarity between products in stores with a small number of products is relatively large, while the similarity between products in stores with a large number of SKUs is relatively small. At the same time, the similarity data will have a long-tail distribution. Therefore, the calculated second similarity needs to be shrunk and weighted. The second similarity obtained after processing is:
[0118] S(i,j)=1-tanh(-ln(x*N sku ),T);
[0119] Among them, N sku Represents the number of store sku, and T is the parameter of the activation function tanh.
[0120] Figure 5 : is a similarity distribution diagram before and after the transformation of an embodiment of the present invention. Figure 5 As shown, the left side is the original distribution map before shrinkage and weighting transformation, and the right side is the distribution map after transformation. The transformed distribution avoids the appearance of long-tail distribution.
[0121] According to the above combination Figures 2 to 5 By offline processing the underlying data, target attribute values such as object heat value, object behavior similarity, object attribute similarity and user preference for the object can be obtained.
[0122] The following introduces each recall strategy and its specific implementation. First, the similarity decay strategy. Considering that the user's preference for a product will decay over time, a decay function is established here, t max represents the time when the user's most recent behavior occurred, t represents the time when the historical behavior occurred, and the attenuation factor A at time t t As follows:
[0123] A t =1-tanh(t max ,T a );
[0124] Among them, T a is the parameter of the activation function tanh.
[0125] Secondly, the user’s repurchase strategy for the product. Figure 6This is a probability density distribution diagram of repurchase in one embodiment of the present invention. In the embodiment of the present invention, each category is taken as the statistical object. Different categories have different attenuation utilities on users. By counting the data samples of the time interval between two visits of users to the goods of each category, a Gaussian mixture model GMM is established, and the probability density function of the repurchase time is estimated according to the EM (Expectation-Maximization algorithm):
[0126]
[0127] in,
[0128] Figure 7 FIG. 1 is a schematic diagram of the implementation principle of a real-time recall algorithm according to an embodiment of the present invention. Figure 7 , S in the figure t , S t+1 , S t+2 A represents the time series of a user's behavior on a certain product. t , T t 、F t Represent the attenuation factor, behavior type factor and repurchase probability factor respectively. The weighted sum of these three factors is performed and tanh activation is performed to obtain the user's attention weight on the product. Then, the user's attention weight on the product is selected from the candidate product set S k Specifically, the attention weights and similarity values of all behavior sequences are multiplied and added together and then multiplied by the activation function tanh to obtain the final behavior recommendation weight of the candidate product. and the attribute recommendation weight W of the candidate product ck :
[0129]
[0130] W ck =tanh(∑ j∈S H j *M s ,T);
[0131] Among them, M s =tanh(W t *T t +W A *A t +W F *F t ,T);W t represents the attention weight of the action, T t represents the preference score corresponding to the behavior at time t, W A represents the attention weight of the decay factor, A t represents the attenuation factor, WF is the attention weight of the repurchase probability factor, F t is the repurchase probability factor, M s is the attention weight of browsing product s, and SIM(k,j) is the product behavior similarity between the browsed product k and other products.
[0132] In the embodiment of the present invention, since the popularity recommendation weight and preference recommendation weight of the candidate commodities are not very important, they can be preset as fixed values.
[0133] Finally, the heat recommendation weight, behavior recommendation weight, attribute recommendation weight, and preference recommendation weight are multiplied by the corresponding recall data and sorted to get the recommendation result. b , Real-time content recall data I c , User attribute regression data I r 、All product hot data I h These four parts of data are weighted W b , W c , W r , W h After sorting, the final recommendation results are obtained. The specific process is as follows:
[0134] (I b1 ,I b2 ,...)*W b , (I c1 ,I c2 ,...)*W c , (I r1 ,I r2 ,...)*W r , (I h1 ,I h2 ,...)*W h →I b1 *W b , I b2 *W b ,…,I c1 *W c , I c2 *W c ,…,I r1 *W r , I r2 *W r , …→I b1 *W b , I c2 *W c , I r1 *W r , I h1 *W h , I b2 *Wb ,….
[0135] Figure 8 It is a logical diagram of the implementation of the recall algorithm of an embodiment of the present invention. There are two situations when users browse the store. One is that the user browses the store homepage, and the other is that the user browses the single product page of the store. If the user browses the single product page, the four data of behavior similarity, category, user attribute, and hot spot are processed to calculate the four target attribute values of object heat value, object behavior similarity, object attribute similarity, and user preference for the object, and the recalled goods are calculated; if the user browses the store homepage, the three data of product category, user attribute, and hot spot are processed to calculate the three target attribute values of object heat value, object attribute similarity, and user preference for the object, and the recalled goods are calculated.
[0136] like Figure 8 As shown in the figure, if the user enters the single product page, the product is recalled according to the behavior similarity to obtain the recall data within the category, and the recall data obtained according to the behavior similarity is saved. Then, the recall data corresponding to the object heat value, the object attribute similarity and the user's preference for the object is obtained, and the weighted summation and sorting of all the recall data are performed to obtain the recommendation result. If the user does not enter the single product page, but enters the store homepage, first check whether there is a product category of the previous store in the store. If so, recall the hot data with the same category as the previous store and save the category recall data; if not, obtain the historical recall data. Then, the recall data corresponding to the object heat value, the object attribute similarity and the user's preference for the object is obtained, and the weighted summation and sorting of all the recall data are performed to obtain the recommendation result.
[0137] Fig. 9 This is a schematic diagram of a weight tensor model of an embodiment of the present invention. Considering that stores have different numbers of product SKUs and different numbers and types of visitors, these three variables are discretized, and weight vectors are assigned to different discrete units to obtain a tensor of m*n*l*h dimensions. Fig. 9 In the example, the number of SKUs, number of visitors, and store types of the store are equally divided into 4*4*4 matrix weight tensors, and each group of weight vectors is 5-dimensional [T a , W b , W c , W r , W h ], and the initialization parameters are all random parameters ranging from 0 to 1.
[0138] Among them, the weight tensor model can be established according to the following steps:
[0139] 1. Sort all store IDs by sku quantity and divide them into m groups;
[0140] 2. Sort each group of sku quantity by the number of visitors and divide them into n groups;
[0141] 3. Group each group of visitor numbers by store type and divide it into l groups.
[0142] In order to improve the click-through rate of the recommendation system (used to measure the conversion rate of recommendation results), the previous weight tensor is optimized. Since the click-through rate data of the recommendation algorithm needs to be completed after the T time window, the group optimization strategy is used.
[0143] In the embodiment of the present invention, g particles are used, that is, all stores are divided into g groups, and the grouping is performed according to the following steps.
[0144] (1) Find the tensor unit corresponding to each store id. The tensor unit is encoded according to the number of sku, the number of visitors, and the number of store type groups: id s =i*n*l+j*l+k;
[0145] (2) Evenly group the store IDs in each tensor unit to obtain the group ID corresponding to each store: id g =idex s %g;
[0146] (3) According to the above steps, g groups of weights can be obtained. The weight vector of each group is the concatenation of the weights of all the tensor units above. The dimension of the synthesized vector is m*n*l*5. The synthesized vector is:
[0147] v=[T a ,W b ,W c ,W p ,W h ]*M*N*L;
[0148] (4) Initialize g and combine it into a vector v;
[0149] (5) Click rate corresponding to the g group of vectors within the statistical period;
[0150] (6) Update g to form vector v:
[0151] v=V rand +(V b -V rand )*Lr b +(V g -V rand )*Lr g ;
[0152] Among them, V b represents the local optimal solution in group g in one round of optimization, V grepresents the global optimal solution in one round of optimization, Lr b Represents the learning rate of the local optimal solution, Lr g represents the learning rate of the global optimal solution, V rand represents a random vector;
[0153] (7) Repeat the above steps (5) and (6) until the difference between the click-through rates of the two periods is less than the set threshold value, so that the click-through rate reaches the optimal value. Since the statistical period of click-through rate data is relatively long, generally 1 day, according to the condition g can be taken as more than 100 to speed up the convergence of the model.
[0154] Fig.10 Schematic diagram of the main modules of the training device of the recommendation model according to an embodiment of the present invention. Fig.10 As shown, the training device 1000 of the recommendation model according to the embodiment of the present invention mainly includes an offline processing module 1001 , a real-time recall module 1002 , a result conversion module 1003 and a parameter adjustment module 1004 .
[0155] Offline processing module 1001, used to perform offline calculation on underlying data to obtain target attribute values;
[0156] A real-time recall module 1002 is used to calculate the recommendation results in real time based on the attention mechanism according to the target attribute value and the preset recall strategy and display the recommendation results;
[0157] A result conversion module 1003, used to calculate a recommendation result conversion rate according to the user's behavior on the recommendation result;
[0158] The parameter adjustment module 1004 is used to adjust the parameters based on the group optimization strategy according to the recommendation result conversion rate to train the recommendation model.
[0159] According to an embodiment of the present invention, the target attribute value includes at least one of the following: object popularity value, object behavior similarity, object attribute similarity and user preference for the object.
[0160] According to another embodiment of the present invention, the object behavior similarity is calculated by the following method:
[0161] Count the object set of the user's behavior;
[0162] Counting the number of users who have simultaneously performed actions on two objects in the object set, the user set corresponding to each object, and the user's preference for each object;
[0163] Calculate the first similarity of the intersection of behaviors of two objects based on the counted number of users and the user set corresponding to each object;
[0164] Calculate the second similarity between objects according to the user's preference for each object;
[0165] The first similarity and the second similarity are weightedly summed to obtain the object behavior similarity.
[0166] According to yet another embodiment of the present invention, the user's preference for each object is obtained by taking a weighted average of the preferences corresponding to different behaviors of the user for each object.
[0167] According to another embodiment of the present invention, the training device 1000 for the recommendation model further includes a data adjustment module (not shown in the figure) for:
[0168] After calculating the second similarity between the objects, the second similarity is subjected to shrinkage and weighting processing.
[0169] According to an embodiment of the present invention, the recall strategy may include, for example: a decay strategy, a repurchase strategy, and a behavior type strategy.
[0170] According to another embodiment of the present invention, when the real-time recall module 1002 calculates the recommendation results in real time based on the attention mechanism, it can also be used to:
[0171] The three factors of decay factor, repurchase probability factor and behavior type are weighted and activated to obtain the attention weight of the object;
[0172] The attention weight of the candidate object is multiplied and accumulated by the object behavior similarity and the object attribute similarity of the candidate object respectively, and then multiplied by the activation function to obtain the behavior recommendation weight and the attribute recommendation weight of the candidate object;
[0173] The heat recommendation weight, the behavior recommendation weight, the attribute recommendation weight and the preference recommendation weight are respectively multiplied by the corresponding recall data and then sorted to obtain a recommendation result, wherein the recall data corresponding to each recommendation weight is selected from the candidate object set according to the target attribute value corresponding to the recommendation weight.
[0174] According to yet another embodiment of the present invention, when performing parameter adjustment based on the group optimization strategy, the parameter adjustment module 1004 may also be used to:
[0175] Construct a weight tensor model corresponding to the store;
[0176] Get the tensor unit corresponding to each store;
[0177] Evenly group the stores in each tensor unit, obtain the group identifier corresponding to each store, and obtain the weight vector corresponding to each group;
[0178] The click rate corresponding to the weight vector of each group during the statistical period;
[0179] Update the weight vector corresponding to each group until the conversion rate of the recommended results reaches the maximum.
[0180] According to yet another embodiment of the present invention, the weight tensor model uniformly quantizes the stores into a grid model of the preset dimension according to the preset dimension; wherein each grid model has a multi-dimensional weight vector.
[0181] According to the technical solution of the embodiment of the present invention, the target attribute value is obtained by offline calculation of the underlying data; according to the target attribute value and the preset recall strategy, the recommendation result is calculated in real time based on the attention mechanism and the recommendation result is displayed; the conversion rate of the recommendation result is calculated according to the user's behavior on the recommendation result; according to the conversion rate of the recommendation result, the parameter is adjusted based on the group optimization strategy to train the recommendation model, which can realize the offline analysis of the underlying data and the real-time calculation of the recommendation result based on the behavior sequence of the attention mechanism, and the conversion rate of the recommendation result is introduced into the training of the recommendation model as feedback, so that the recommendation model can be trained through real-time online learning, and the law of user preference changes can be learned in time, and the interpretability of the recommendation model is also stronger. In addition, the training method of the recommendation model of the present invention considers the role of multiple behaviors in the calculation of the scoring preference, so that the recommendation results are fully covered; when different types of stores use the recommendation model for recommendation, the model will adjust the parameters according to the store characteristics, thereby reflecting the differences in the recommendation strategies of different types of stores; because the user's cross-store behavior is considered when making recommendations, it is possible to recommend cross-store data; the recommendation model uses a variety of algorithms, so that the advantages and disadvantages of multiple recommendation algorithms complement each other, and the recommendation results are more scientific.
[0182] Fig.11 An exemplary system architecture 1100 is shown to which the recommendation model training method or recommendation model training device according to the embodiments of the present invention can be applied.
[0183] like Fig.11 As shown, system architecture 1100 may include terminal devices 1101, 1102, 1103, a network 1104, and a server 1105. Network 1104 is used to provide a medium for communication links between terminal devices 1101, 1102, 1103 and server 1105. Network 1104 may include various connection types, such as wired, wireless communication links, or optical fiber cables, etc.
[0184] Users can use terminal devices 1101, 1102, 1103 to interact with server 1105 through network 1104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 1101, 1102, 1103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only as examples).
[0185] The terminal devices 1101 , 1102 , and 1103 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.
[0186] The server 1105 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 1101, 1102, and 1103. The backend management server may analyze and process the received data such as product information query requests, and feed back the processing results (such as target push information, product information - only an example) to the terminal device.
[0187] It should be noted that the training method of the recommendation model provided in the embodiment of the present invention is generally executed by the server 1105 , and accordingly, the training device of the recommendation model is generally set in the server 1105 .
[0188] It should be understood that Fig.11 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.
[0189] Reference below Fig.12 , which shows a schematic diagram of the structure of a computer system 1200 of a terminal device or a server suitable for implementing an embodiment of the present invention. Fig.12 The terminal device or server 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.
[0190] like Fig.12 As shown, the computer system 1200 includes a central processing unit (CPU) 1201, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1202 or a program loaded from a storage part 1208 into a random access memory (RAM) 1203. In the RAM 1203, various programs and data required for the operation of the system 1200 are also stored. The CPU 1201, the ROM 1202, and the RAM 1203 are connected to each other via a bus 1204. An input / output (I / O) interface 1205 is also connected to the bus 1204.
[0191] The following components are connected to the I / O interface 1205: an input section 1206 including a keyboard, a mouse, etc.; an output section 1207 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1208 including a hard disk, etc.; and a communication section 1209 including a network interface card such as a LAN card, a modem, etc. The communication section 1209 performs communication processing via a network such as the Internet. A drive 1210 is also connected to the I / O interface 1205 as needed. A removable medium 1211, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1210 as needed, so that a computer program read therefrom is installed into the storage section 1208 as needed.
[0192] 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 product, 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 1209, and / or installed from the removable medium 1211. When the computer program is executed by the central processing unit (CPU) 1201, the above-mentioned functions defined in the system of the present invention are executed.
[0193] 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.
[0194] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product 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.
[0195] The units or modules involved in the embodiments of the present invention may be implemented in software or hardware. The units or modules described may also be provided in a processor. For example, they may be described as: a processor including an offline processing module, a real-time recall module, a result conversion module, and a parameter adjustment module. The names of these units or modules do not, in some cases, constitute limitations on the units or modules themselves. For example, an offline processing module may also be described as a "module for performing offline calculations on underlying data to obtain target attribute values."
[0196] 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, and when the above one or more programs are executed by a device, the device includes: performing offline calculations on the underlying data to obtain target attribute values; according to the target attribute values and the preset recall strategy, calculating the recommendation results in real time based on the attention mechanism and displaying the recommendation results; calculating the recommendation result conversion rate based on the user's behavior on the recommendation results; according to the recommendation result conversion rate, adjusting parameters based on the group optimization strategy to train the recommendation model.
[0197] According to the technical solution of the embodiment of the present invention, the target attribute value is obtained by offline calculation of the underlying data; according to the target attribute value and the preset recall strategy, the recommendation result is calculated in real time based on the attention mechanism and the recommendation result is displayed; the conversion rate of the recommendation result is calculated according to the user's behavior on the recommendation result; according to the conversion rate of the recommendation result, the parameter is adjusted based on the group optimization strategy to train the recommendation model, which can realize the offline analysis of the underlying data and the real-time calculation of the recommendation result based on the behavior sequence of the attention mechanism, and the conversion rate of the recommendation result is introduced into the training of the recommendation model as feedback, so that the recommendation model can be trained through real-time online learning, and the law of user preference changes can be learned in time, and the interpretability of the recommendation model is also stronger. In addition, the training method of the recommendation model of the present invention considers the role of multiple behaviors in the calculation of the scoring preference, so that the recommendation results are fully covered; when different types of stores use the recommendation model for recommendation, the model will adjust the parameters according to the store characteristics, thereby reflecting the differences in the recommendation strategies of different types of stores; because the user's cross-store behavior is considered when making recommendations, it is possible to recommend cross-store data; the recommendation model uses a variety of algorithms, so that the advantages and disadvantages of multiple recommendation algorithms complement each other, and the recommendation results are more scientific.
[0198] 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 training method for a recommendation model, characterized in that: include: Perform offline calculations on the underlying data to obtain the target attribute value; According to the target attribute value and the preset recall strategy, the recommendation result is calculated in real time based on the attention mechanism and the recommendation result is displayed; Calculate the recommendation result conversion rate based on the user's behavior on the recommendation result; According to the conversion rate of the recommendation results, adjusting parameters based on a group optimization strategy to train a recommendation model; Parameter adjustment based on group optimization strategy includes: constructing a weight tensor model corresponding to the store; obtaining a tensor unit corresponding to each store; evenly grouping the stores in each tensor unit to obtain a group identifier corresponding to each store to obtain a weight vector corresponding to each group; calculating the click rate corresponding to the weight vector corresponding to each group within a statistical period; updating the weight vector corresponding to each group until the conversion rate of the recommendation result reaches the maximum; The weight tensor model uniformly quantizes the stores into a grid model of the preset dimension according to the preset dimension; wherein each grid model has a multi-dimensional weight vector.
2. The method according to claim 1, characterized in that The target attribute value includes at least one of the following: object popularity value, object behavior similarity, object attribute similarity, and user preference for the object.
3. The method according to claim 2, characterized in that The object behavior similarity is calculated by the following method: Count the object sets of user behaviors; Counting the number of users who have simultaneously performed actions on two objects in the object set, the user set corresponding to each object, and the user's preference for each object; Calculate the first similarity of the intersection of behaviors of two objects based on the counted number of users and the user set corresponding to each object; Calculate the second similarity between objects according to the user's preference for each object; The first similarity and the second similarity are weightedly summed to obtain the object behavior similarity.
4. The method according to claim 3, characterized in that The user's preference for each object is obtained by taking a weighted average of the preferences corresponding to the user's different behaviors for each object.
5. The method according to claim 3, characterized in that: After calculating the second similarity between objects, it also includes: The second similarity is subjected to shrinkage and weighting processing.
6. The method according to claim 1, characterized in that The recall strategy includes: a user preference attenuation strategy for the object, a repurchase strategy, and a behavior type strategy.
7. The method according to claim 1 or 6, characterized in that: The recommendation results calculated in real time based on the attention mechanism include: The three factors of decay factor, repurchase probability factor and behavior type are weighted and activated to obtain the attention weight of the object; The attention weight of the candidate object is multiplied and added with the object behavior similarity and the object attribute similarity of the candidate object respectively, and then multiplied by the activation function to obtain the behavior recommendation weight and the attribute recommendation weight of the candidate object; The heat recommendation weight, the behavior recommendation weight, the attribute recommendation weight and the preference recommendation weight are respectively multiplied by the corresponding recall data and then sorted to obtain a recommendation result, wherein the recall data corresponding to each recommendation weight is selected from the candidate object set according to the target attribute value corresponding to the recommendation weight.
8. A training device for a recommendation model, characterized in that: include: The offline processing module is used to perform offline calculations on the underlying data to obtain the target attribute value; A real-time recall module, used to calculate the recommendation results in real time based on the attention mechanism according to the target attribute value and the preset recall strategy and display the recommendation results; A result conversion module, used to calculate the recommendation result conversion rate according to the user's behavior on the recommendation result; A parameter adjustment module, used to adjust parameters based on a group optimization strategy according to the recommendation result conversion rate to train a recommendation model; The parameter adjustment module is also used to: construct a weight tensor model corresponding to the store; obtain a tensor unit corresponding to each store; evenly group the stores in each tensor unit, obtain a group identifier corresponding to each store, and obtain a weight vector corresponding to each group; The click rate corresponding to the weight vector of each group during the statistical period; Update the weight vector corresponding to each group until the recommendation result conversion rate reaches the maximum; The weight tensor model uniformly quantizes the stores into a grid model of the preset dimension according to the preset dimension; wherein each grid model has a multi-dimensional weight vector.
9. An electronic device for training a recommendation model, 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 7.
10. 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 7 is implemented.
