Recommendation model training method and device, equipment and medium
Through the training sample set and the recommendation model updated by the loss function based on user historical operation information, the problem of different user needs is solved, the effect of recommending interesting content to users is achieved, and the user experience is improved.
Patent Information
- Application Number
- CN202411350214.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-25
- Publication Date
- 2025-01-10
AI Technical Summary
How to recommend information that is more in line with user needs to solve the problem of differences in different user needs.
By obtaining a training sample set based on user historical operation information, inputting the recommended model to be trained, calculating the loss impact factor, using the loss function to update the recommended model, and obtaining the trained recommended model to improve the user experience.
It realizes the recommendation of content of interest to users, improves user experience, and simplifies the information acquisition process.
Smart Images

Figure CN119293503A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a training method, device, equipment and medium for a recommendation model. Background Art
[0002] With the diversification of user life, users can learn a variety of information from online channels such as videos, topics and consultations without leaving home, such as public opinion information, financial information, product information, sports information, learning materials, etc. However, different users may need different information, so how to recommend information that better meets user needs is a technical problem that needs to be solved urgently. Summary of the invention
[0003] The embodiments of this specification provide a method, apparatus, device and medium for training a recommendation model so as to provide users with information that better meets their needs and improve user experience.
[0004] To solve the above technical problems, the embodiments of this specification are implemented as follows: The present invention provides a method for training a recommendation model, including: Acquire a training sample set; the training sample set includes a plurality of training samples, wherein the training samples are generated based on historical operation information of sample users on sample recommendation objects; Inputting a number of the training samples into the recommendation model to be trained to obtain a model prediction value; Based on the historical operation information, determining a loss impact factor corresponding to the sample user; the loss impact factor is used to reflect the amount of resources consumed by the sample user in the training sample for the sample recommendation object; Based on the model prediction value, a loss value corresponding to the model prediction value is calculated using a loss function including the loss impact factor; The recommendation model to be trained is updated based on the loss value to obtain a trained recommendation model.
[0005] The present invention provides a training device for a recommendation model, including: A training sample acquisition module is used to acquire a training sample set; the training sample set includes a number of training samples, and the training samples are generated based on the historical operation information of the sample user on the sample recommendation object; A model prediction value obtaining module is used to input a number of the training samples into the recommendation model to be trained to obtain a model prediction value; A loss impact factor determination module, used to determine the loss impact factor corresponding to the sample user based on the historical operation information; the loss impact factor is used to reflect the amount of resources consumed by the sample user in the training sample for the sample recommendation object; A loss value calculation module, used to calculate the loss value corresponding to the model prediction value based on the model prediction value using a loss function including the loss impact factor; The recommendation model updating module is used to update the recommendation model to be trained based on the loss value to obtain a trained recommendation model.
[0006] The present invention provides a training device for a recommendation model, including: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to: Acquire a training sample set; the training sample set includes a plurality of training samples, wherein the training samples are generated based on historical operation information of sample users on sample recommendation objects; Inputting a number of the training samples into the recommendation model to be trained to obtain a model prediction value; Based on the historical operation information, determining a loss impact factor corresponding to the sample user; the loss impact factor is used to reflect the amount of resources consumed by the sample user in the training sample for the sample recommendation object; Based on the model prediction value, a loss value corresponding to the model prediction value is calculated using a loss function including the loss impact factor; The recommendation model to be trained is updated based on the loss value to obtain a trained recommendation model.
[0007] An embodiment of the present specification provides a computer-readable medium having computer-readable instructions stored thereon, and the computer-readable instructions can be executed by a processor to implement a training method for a recommendation model.
[0008] At least one embodiment of the present specification can achieve the following beneficial effects: by obtaining a training sample set generated based on the historical operation information of sample users on sample recommendation objects, inputting several training samples in the training sample set into the recommendation model to be trained, obtaining the model prediction value, and determining the loss impact factor used to reflect the number of resources consumed by the sample user for the sample recommendation object based on the historical operation information of the sample user, using the loss function including the loss impact factor to calculate the loss value corresponding to the model prediction value, and then updating the recommendation model to be trained according to the obtained loss value to obtain the trained recommendation model. Then, the trained recommendation model can be used to recommend content that the user is interested in to improve the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] In order to more clearly illustrate the technical solutions in the embodiments of this specification or the prior art, the drawings required for use in the embodiments or the prior art description are briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this application, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0010] Figure 1 It is a schematic diagram of an application scenario of a training method for a recommendation model provided in an embodiment of this specification; Figure 2 It is a flowchart of a training method for a recommendation model provided in an embodiment of this specification; Figure 3 It is a structural schematic diagram of a training device for a recommendation model provided in an embodiment of this specification; Figure 4 It is a structural diagram of a training device for a recommendation model provided in an embodiment of this specification. DETAILED DESCRIPTION
[0011] In order to make the purpose, technical solutions and advantages of one or more embodiments of this specification clearer, the technical solutions of one or more embodiments of this specification will be clearly and completely described below in combination with the specific embodiments of this specification and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of one or more embodiments of this specification.
[0012] For ease of understanding, some terms in the embodiments of this specification are explained as follows: Content: It can also be called information available to users. It is a service provided by the application platform. It can be short videos, topics, consultations, etc. The creator of the content can be a user, an organization, or a platform. After the content is published on the application platform, users can read, watch, like, comment, forward, etc.
[0013] Gross Merchandise Volume (GMV): is an important indicator to measure the sales scale of e-commerce platforms or retail industries. It refers to the total original price of all goods and services sold through a specific platform within a certain period of time. The transaction amount of users who purchase goods embedded in the content details page (such as funds, insurance, clothing, and home furnishings) can be called the GMV of content-driven goods.
[0014] Loss function: The loss function is used to measure the inconsistency between the predicted value f(x) of the algorithm model and the true value Y. Generally speaking, the smaller the loss function value, the better the robustness of the algorithm model.
[0015] Dynamic weights: Weights change dynamically.
[0016] In actual applications, there are many recommended contents in recommendation scenarios, such as professional generated content (PGC), user generated content (UGC), etc. The platform can recommend different content to different users through algorithm distribution, and the content details page can be associated with products.
[0017] The technical solutions provided by the embodiments of this specification are described in detail below in conjunction with the accompanying drawings.
[0018] In order to solve the defects in the prior art, this solution provides the following embodiments: Figure 1 A schematic diagram of an application scenario of a training method for a recommendation model provided in an embodiment of this specification.
[0019] like Figure 1As shown, the scheme may include a training sample set 1, a server 2, and a trained recommendation model 3. The training sample set 1 may be generated based on the historical operation information of the sample user on the sample recommendation object. The server 2 may obtain the training sample set 1, and the server 2 may contain the recommendation model to be trained. The model prediction value is obtained by inputting each training sample in the training sample set into the recommendation model to be trained. The loss value corresponding to the model prediction value may also be calculated based on the model prediction value using a loss function including a loss influence factor. The recommendation model to be trained is updated according to the loss value to obtain the trained recommendation model 3. Content may be recommended to users based on the trained recommendation model, so that the recommended content is more in line with the needs of users and the user experience is improved.
[0020] Next, a training method for a recommendation model provided in an embodiment of the specification is specifically described with reference to the accompanying drawings: Figure 2 A flowchart of a training method for a recommendation model provided in an embodiment of the present specification. From a program perspective, the execution subject of the process can be a program installed on an application server or an application client.
[0021] like Figure 2 As shown, the process may include the following steps: Step 202: Obtain a training sample set.
[0022] The training sample set includes a plurality of training samples, and the training samples are generated based on historical operation information of sample users on sample recommendation objects.
[0023] The training sample set may include one or more training samples. A training sample may be information indicating a user's recommendation for a sample object. A sample recommendation object may be a specific recommendation object or a class of recommendation objects.
[0024] In the embodiments of this specification, the recommended object may be an object displayed in an application. The recommended object may be a static object or a dynamic object, such as live video, short video, advertisement, graphic, text, link and other objects. The recommended object may be recommended to the user by the platform, or it may be searched by the user through the search control. The historical operation information may be the information generated by the user's operation on the recommended object; or it may be the information generated by the user's operation on the details page of the recommended object after entering the details page of the recommended object. The operations performed by the user may specifically be clicks, favorites, shares, forwards, likes, purchases and other operations. The sample recommended object represents the recommended object as a training sample. The sample user represents the user involved in the training sample.
[0025] The training samples may include sample feature information such as user features of sample users, object features of sample recommended objects, and sample user operation features on sample recommended objects. In practical applications, sample feature information may be obtained by extracting features from sample data using a feature extraction model. The training samples may be obtained based on log data stored in the data management center of the platform. The log data may include historical operation information of sample users on sample recommended objects.
[0026] Step 204: inputting a number of the training samples into the recommendation model to be trained to obtain a model prediction value.
[0027] The recommendation model to be trained can be a pre-trained network model, a network model to be updated, etc., such as collaborative filtering models, such as user-based collaborative filtering (User-based CF), item-based collaborative filtering (Item-based CF), matrix decomposition (such as SVD, ALS), etc.; another example is a deep learning model, such as deep neural network (DNN), convolutional neural network (CNN), recurrent neural network (RNN), long short-term memory network (LSTM), gated recurrent unit (GRU), attention mechanism model, double tower model, etc.; another example is content-based recommendation, such as using NLP technology to analyze text content, using image recognition technology to analyze visual content, etc.; another example is a neural collaborative filtering model, a refined ranking model, a click-through rate prediction deep learning model, etc. Models. It can be used to calculate the recommendation probability or recommendation degree for the recommended object. The specific type of recommendation model is not specifically limited here.
[0028] In the embodiments of this specification, the recommendation model to be trained can process the input training samples and output the prediction values corresponding to the training samples. In practical applications, several training samples can be input into the recommendation model to be trained, and the model extracts features from the training samples to obtain the features of each training sample, processes the features according to preset weights, obtains the output results, and can also convert the output results into probability distribution to obtain the model prediction value.
[0029] Step 206: Based on the historical operation information, determine the loss impact factor corresponding to the sample user.
[0030] The loss impact factor is used to reflect the amount of resources consumed by the sample user in the training sample for the sample recommendation object.
[0031] In actual applications, users can click, collect, forward, and other operations on the recommended objects, and can also purchase the products associated with the recommended objects. The amount of resources consumed for the recommended objects can be determined based on information such as order information and shopping record information that records the user's consumption. The amount of resources consumed can represent the amount of one or more resources such as the funds spent by the user, the points consumed, the virtual currency consumed, and the discount coupons consumed.
[0032] The more resources consumed, the higher the sample user's interest in the sample recommended object. The loss impact factor can also indicate the sample user's interaction with the sample recommended object, such as the length of time the sample recommended object is displayed on the page, the sample recommended object is collected, etc. The higher the interaction, the higher the user's interest in the recommended object. The loss impact factor can be obtained based on the sample user's operations on the sample recommended object within a preset time period.
[0033] Step 208: Based on the model prediction value, a loss value corresponding to the model prediction value is calculated using a loss function including the loss impact factor.
[0034] In the embodiments of the present specification, the loss impact factor can be a calculation factor in the loss function, specifically a multiplier factor, which can be used to represent the weight of the model prediction values corresponding to different training samples in the obtained loss value, wherein the loss value represents the loss value obtained using multiple training samples, and can also be the loss value obtained after a round of training of the training recommendation model using multiple training samples.
[0035] In practical applications, the loss function including the loss influence factor may be a loss function obtained by adding the loss influence factor to the relevant loss function. The relevant loss functions may include mean square error loss function, mean absolute error loss function, quantile loss function, cross entropy loss function, and the like.
[0036] Step 210: Update the recommendation model to be trained based on the loss value to obtain a trained recommendation model.
[0037] In practical applications, loss values can be fed back layer by layer. Based on the obtained loss values, each neural network layer can use an optimization algorithm to update parameters so as to reduce the loss value of the loss function. If the loss value reaches a preset threshold, or the number of training times or time reaches a preset number of training times or time, the model training can be terminated to obtain a recommended model after training.
[0038] It is understandable that if the recommendation model cannot meet the requirements after one adjustment or one round of training, it can be trained multiple times or multiple rounds of iterative training to obtain a model that can meet the requirements. In practical applications, if the recommendation model to be trained needs to undergo multiple rounds of training, the training sample sets selected in each round can be different or partially the same, which is not specifically limited here.
[0039] In the embodiments of this specification, the trained recommendation model can be applied to business scenarios with recommendation needs, such as financial management recommendations, shopping recommendations, consulting service recommendations, text content recommendations, and short video recommendations. The recommendation model can recommend content of interest to the user based on the user's current usage scenario. For example, if the user's current usage scenario is a shopping scenario, the recommendation model can recommend items of interest to the user; for example, if the user's current usage scenario is a financial management scenario, the recommendation model can recommend financial products of interest to the user.
[0040] The platform recommends different information to different users. The recommended information page or information details page may be associated with some products, such as insurance products, financial products, food, clothing, etc. The greater the amount of resources consumed by users to purchase products, the more recognized and interested the users are in the products. Therefore, the model can be trained and updated based on the amount of resources consumed by users to purchase products. The trained model can recommend content that users are willing to click on and purchase, allowing users to purchase more conveniently without having to search and find through cumbersome links, simplifying user operations.
[0041] It should be understood that the order of some steps in the methods described in one or more embodiments of this specification can be interchanged according to actual needs, or some steps can be omitted or deleted.
[0042] Figure 2 The method in the embodiment of the present invention obtains a training sample set generated based on the historical operation information of the sample user on the sample recommendation object, inputs several training samples in the training sample set into the recommendation model to be trained, obtains the model prediction value, and determines the loss impact factor used to reflect the amount of resources consumed by the sample user on the sample recommendation object based on the historical operation information of the sample user, calculates the loss value corresponding to the model prediction value using the loss function including the loss impact factor, and then updates the recommendation model to be trained according to the obtained loss value to obtain the trained recommendation model. Then, the trained recommendation model can be used to recommend the content that the user is interested in to the user, thereby improving the user experience.
[0043] based on Figure 2 The method, the examples of this specification also provide some specific implementation plans of the method, which are described below.
[0044] Optionally, as an implementation mode, the method described in the embodiments of this specification may further include: Obtaining log information of the sample user; Extracting historical operation information of the sample user on the sample recommended object from the log information; Based on the historical operation information, determine a sample label; the sample label is used to reflect whether the sample user is interested in the sample recommendation object; Generate training samples containing the sample labels.
[0045] In actual applications, users can access various information through terminal applications, applets, browsers, etc. During the user operation, the server or terminal can record the user's log information. In the embodiments of this specification, the log information can be generated based on the sample user's operation on the sample recommendation object.
[0046] The log information may be recorded by the log system in a preset data log format. The preset data log format may include information of different dimensions, such as user ID, content ID, exposure time, whether an operation is performed, and the amount of resources consumed by the user.
[0047] User id can be used to uniquely identify the user's identity. It can be the user's ID number information, or the user's account information, email information, and mobile phone number information in the platform. Content id can be the label, number, and other information set by the platform to uniquely identify the published content. The content here can represent the recommended object. Exposure time can be the time when the sample recommended object is recommended to the sample user, which can also be understood as the time when the recommended object is displayed in the terminal used by the sample user. The exposure time can be recorded in the format of a timestamp. Whether to operate can indicate whether the user has performed a substantial operation on the sample recommended object, such as click, favorite, forward, purchase, and other operations. It can be understood that if a user performs multiple operations on a recommended object, the number of user operations can be recorded in the log information, and information such as the operation type can also be recorded. For example, if the user clicks, favorites, and forwards, the number of user operations can be recorded as 3; these three types of operations can also be recorded. The specific log recording rules are set according to the actual situation. The number of resources consumed by the user can indicate the number of resources of the recommended object that the user has pre-purchased or purchased.
[0048] The historical operation information may be information in the log information indicating the operation of the user on the recommended object, which may specifically include information on operations such as collection, click, purchase, etc. The sample label may be used to reflect whether the sample user is interested in the sample recommended object, or the degree of interest, and may be determined based on the historical operation information. For example, if the user performs a substantial operation on the recommended object, such as click, collection, forward, purchase, etc., the sample label label may be recorded as 1; if the user does not perform a substantial operation on the recommended object, such as only staying on the content page corresponding to the recommended object, swiping away, or exiting the content page, the sample label label may be recorded as 0. Different label information may also be set based on the number or type of operations performed by the sample user on the sample recommended object. For example, if the user likes the recommended object, the sample label label may be recorded as 0.8; if the user forwards the recommended object, the sample label label may be recorded as 0.7; if the user collects the recommended object, the sample label label may be recorded as 0.9; if multiple operations are performed, the value of the sample label may also be determined by weighted summation or average. If the user does not perform any substantial operation on the recommended object, such as closing the recommended object before browsing or playing, it can be said that the user is not very interested in the recommended object, and the sample label label can be recorded as 0. In actual applications, the sample label can also be set according to the length of time the user stays on the page displaying the recommended object. The longer the time, the higher the user's interest in the program, and the value of the sample label can be set larger. It can be understood that the sample labels here are only for schematic illustration, and specific sample labels can be set based on actual needs.
[0049] In actual applications, if the user operates the recommended object, it can be determined that the user is interested in the recommended object. The acquired log information can be log information of sample users within a preset time period.
[0050] As an implementation mode, optionally, the method described in the embodiments of this specification may further include: Determining user characteristics of the sample users; Determining content features of the sample recommendation object; A training sample including the user feature and the content feature is generated.
[0051] In the embodiments of this specification, user features may include at least one of basic user features and user statistical features. Among them, basic user features may include at least one of age, gender, occupation, education, hobbies and user location. User statistical features may include at least one of number of visits, online time, click-through rate, purchase frequency, retention rate, and churn rate. Content features may include at least one of the category to which the sample recommendation object belongs, click-through rate, exposure rate, release time, number of views, and corresponding hot tag information.
[0052] Basic user characteristics can be used to describe some inherent attributes or characteristics of users, and can be used to reflect the user's social background, demographic information, etc. For example, age, gender, occupation, education level, living standard, geographic location, marital status, hobbies, etc. are all basic user characteristics. These characteristics can be used to locate user needs and accurately recommend content of interest to users.
[0053] The statistical characteristics of users can be the result information obtained after quantitative analysis of user behavior and attributes. User statistical characteristics can be used to reflect quantifiable activity indicators such as the frequency, intensity, preference, and change trend of user activities, such as the number of website visits, average online time, click-through rate, purchase frequency, and retention rate. User statistical characteristics can be used for analysis to understand user behavior, predict future user behavior, and optimize user experience. The average online time can be the average daily online time of users, or the average weekly online time of users, which is not specifically limited here. The click-through rate can be the frequency of users clicking on the same type of recommended objects, such as 10 times / day. The retention rate can be calculated by daily retention rate, weekly retention rate, and monthly retention rate to evaluate the short-term and long-term retention of users.
[0054] The training samples can be stored in the form of triples, such as [feature, gmv, label]. Feature can represent user features and content features. These features can be multi-dimensional feature data, such as feature_1, feature_2, feature_n and other multi-dimensional feature data. Gmv can represent the amount of resources consumed by sample users for a certain recommendation object within a preset time period, such as the amount of funds spent in a certain live broadcast room within a month, the amount of funds invested in a certain financial recommendation within three months, etc. Label can represent the sample label, and the specific value and format can be set according to actual needs. In actual applications, training samples can also be stored in the form of key-value pairs, or in other formats such as JOIN format, XML format, etc., which are not specifically limited here.
[0055] As an implementation manner, optionally, the historical operation information in the embodiments of this specification includes historical order information generated by the sample user based on the sample recommendation object; and determining the loss impact factor corresponding to the sample user based on the historical operation information may specifically include: Determine the total GMV of the merchandise transaction of the user for the sample recommendation object according to the historical order information; Based on the total commodity transaction amount GMV, the loss impact factor is obtained.
[0056] The historical order information may be order information generated after the sample user performs an additional purchase or purchase operation based on the sample recommended object, for example, order information obtained when a user purchases a financial product from a financial recommendation channel.
[0057] The sample recommendation object can be a live video containing the commodity object in the shopping cart, a recommendation page containing shopping introduction information of the commodity object, or a short video containing financial management information of the commodity object, etc.; the user can select the commodity to be purchased from the recommended objects by clicking or other operations and jump to the commodity details page. After the user adds the commodity to the shopping cart or clicks to purchase or submits the order, the terminal or server can generate order information.
[0058] In the embodiments of this specification, the historical order information may include the order information submitted by the sample user, the order information that the sample user has completed payment, and the order information that the sample user has not completed payment. The total transaction amount GMV of goods can be the total transaction amount GMV of goods generated based on the recommended object, and can be the total transaction amount of goods generated with the sample recommended object as the transaction entry, such as clicking on the goods in the shopping cart of the sample recommended object, clicking on the link to buy the goods, clicking on the picture to jump to the product details page, scanning the code image in the sample recommended object to enter the product details page, etc. GMV can be used to represent the total number of resources generated after the sample user performs a transaction operation on the sample recommended object within a preset time period. For example, if the user places an order for a certain recommended object 10 times within a week, the sum of the resources consumed by the user for these 10 orders can be used as the GMV of the sample user for the sample recommended object. The loss impact factor can represent the weight of the recommended object in the loss function value. It can be understood that the larger the GMV value, the higher the corresponding loss impact factor. The GMV statistical period of different types of sample recommended objects is different, such as the statistical period of goods with higher consumption frequency is relatively short; the statistical period of goods with lower consumption frequency is longer.
[0059] In practical applications, the greater the GMV generated by a user in a recommended object, the more the user recognizes the recommended object. In this way, training samples with larger GMV are more valuable for model training. In order to enable the recommendation model to learn these samples better and more fully, in the embodiment of this specification, samples with larger GMV can be dynamically weighted in the loss function of calculating the model loss, so that the weight of training samples with larger GMV in the loss function is larger, and the weight depends on the GMV of the sample itself. In this way, the recommendation model can focus on learning training samples with larger GMV, so that the trained model can recommend content that users are interested in and content that users are more willing to buy, thereby improving user experience.
[0060] As an implementation manner, optionally, obtaining the loss impact factor based on the total commodity transaction amount GMV in the embodiments of this specification may specifically include: The total commodity transaction amount GMV is transformed by using a preset operation to obtain the loss impact factor.
[0061] The preset operation can be able to perform an operation to compress the value of the GMV of the total merchandise transaction amount, thereby reducing the magnitude of the value of the GMV of the total merchandise transaction amount. The obtained loss impact factor can be a value within a preset range, such as a value between 0 and 1, a value between 0 and 200, and so on.
[0062] In the embodiments of this specification, it can be determined whether the GMV value is less than or equal to a preset value; if the GMV value is less than or equal to the preset value, the GMV data may not be transformed, that is, the GMV may be used as a loss influencing factor; if the GMV value is greater than the preset value, the GMV data may be transformed using a preset operation, thereby avoiding the problem that the GMV value is too large, causing the model to be unable to fully learn other features in the sample. Through data transformation, the GMV distribution in the training sample is more uniform, which can improve the accuracy of the recommendation model in recommending content to users and improve user experience.
[0063] As an implementation mode, optionally, the preset operation in the embodiment of this specification includes a logarithmic operation; the preset operation performs data transformation on the total commodity transaction amount GMV to obtain the loss impact factor, which may specifically include: The log function is used to calculate the logarithm of the total commodity transaction amount GMV to obtain the loss impact factor.
[0064] Among them, the loss impact factor can be expressed as: ; Represents the loss impact factor of the i-th training sample; represents the GMV value of the ith training sample; the value of the base of the log function can be determined based on expert experience or historical data, and can be 10, e, or any other positive number except zero.
[0065] In the embodiments of this specification, other algorithms can also be used to process the total commodity transaction amount GMV, such as normalization processing, so that the value corresponding to the total commodity transaction amount GMV in each training sample can be between 0-1; or other algorithms can be used to make the value of the total commodity transaction amount GMV after processing be between 0-100, etc.; the processed GMV can also be between 0-10, which is not specifically limited here, and the corresponding preset operation can be set based on the actual situation.
[0066] As an implementation mode, optionally, the method described in the embodiments of this specification uses a log function to calculate the logarithm of the total commodity transaction amount GMV to obtain the loss impact factor, which may specifically include: Add the total commodity transaction amount GMV to a preset positive number to obtain calculation data; The logarithmic value of the calculated data is calculated using a log function to obtain the loss impact factor.
[0067] Among them, the loss impact factor can be expressed as: ; Represents the loss impact factor of the i-th training sample; represents the GMV value of the ith training sample; the value of the base of the log function can be determined based on expert experience or historical data, and can be 10, e, or any other positive number except zero; the preset positive number can be a preset value greater than or equal to 1 to avoid negative weight values or abnormal calculations.
[0068] In the embodiments of this specification, the preset positive number can be 1; it can also be a value greater than 1, such as 2, 5, 10, etc.; the preset positive number required for quantile calculation can also be used, for example, the transaction amount of the orders of each recommended object can be sorted from small to large, and the first decile value can be used as the preset positive number; other quantile values can also be used as the preset positive number, and the average value of the orders of the recommended objects can also be used as the preset positive number, which can be set specifically according to the numerical value of GMV.
[0069] The loss impact factor described in the embodiments of this specification is used to reflect the weight of the loss value generated by the training sample in the overall loss value generated by the training sample set. The loss value can be calculated based on the weight, and the recommendation model can be trained based on the loss value, so that the content recommended by the trained recommendation model is more in line with the user's preferences and needs.
[0070] As an implementation manner, optionally, the loss function including the loss impact factor described in the embodiments of this specification is: ; Among them, loss represents the loss value generated by n training samples; n represents the number of training samples; Represents the loss impact factor corresponding to the i-th training sample; Represents the sample label of the i-th training sample; Represents the model prediction value corresponding to the i-th training sample.
[0071] In the embodiments of the present specification, the loss impact factor can be determined based on the number of resources consumed by the sample users in the training samples for the sample recommendation objects. In the training sample set, if the number of resources consumed by the sample users in a certain training sample is higher, the influence of the training sample in the loss function is higher. In model training, the smaller the loss function value, the better the model performance. In order to reduce the model loss value, the model will iterate more for samples with a high degree of influence on the loss function. In this way, the model can learn more about the characteristics of such samples, which will strengthen the model's feature learning of such samples, and thus better capture the corresponding characteristics of such samples. The obtained trained model has better recommendation capabilities and can recommend recommended objects that users are interested in and willing to purchase.
[0072] Other loss functions may also be used in the embodiments of this specification. As another implementation, the loss function may be a loss function obtained based on the mean square error loss function and the loss impact factor, which may be: ; in, It can represent the sample label of the i-th training sample; It can represent the model prediction value corresponding to the i-th training sample; It can represent the loss impact factor corresponding to the i-th training sample; loss represents the loss value generated by n training samples; n represents the number of training samples.
[0073] As another implementation, the loss function may be a loss function obtained based on the mean absolute error loss function and the loss impact factor, and may be specifically: ; in, It can represent the sample label of the i-th training sample; It can represent the model prediction value corresponding to the i-th training sample; It can represent the loss impact factor corresponding to the i-th training sample; loss represents the loss value generated by n training samples; n represents the number of training samples.
[0074] Other loss functions can also be used for calculation, which are not listed here. The recommendation model can be trained and updated at a preset frequency to avoid the inability to make timely recommendation adjustments when user preferences change.
[0075] In practical applications, the model parameters can be updated by back propagation. For example, the chain rule can be used to calculate the gradient of the loss function relative to the model parameters. This process starts from the output layer and passes the gradient forward layer by layer until the input layer. In this process, the partial derivative of each weight parameter is calculated. After obtaining the gradient of each parameter, an optimization algorithm such as gradient descent, Adam, RMSprop, etc. can be used to update the model parameters. Specifically, the recommendation model can propagate the gradient of the model output backward based on the loss value of the loss function. For each layer, the gradient of the previous layer and the derivative of the activation function of the current layer can be used to calculate the gradient of the current layer, and then the calculated value is propagated backward to the next layer to calculate the value of the next layer. After obtaining the gradient of each parameter, the parameter update is performed to obtain the updated model. The updated model is retrained based on the training sample set to calculate the loss value. If the loss value does not reach the preset loss value range, the parameter value of the model is continued to be updated for iterative training. If the preset loss value is reached, the training of the model is stopped to obtain the trained model; or when the number of iterations of the model reaches the preset number of iterations, the iteration is stopped to obtain the trained model. It is understandable that the process of model training is a process of minimizing the model prediction loss value. The lower the model loss value, the more the model recommends content to the user in line with the user's needs. It is understandable that the user-related data used in each embodiment of this specification is obtained or used on the basis of user authorization.
[0076] Through the above method, a training sample set can be generated according to the user's historical operation information, so that the user's real operation information can be used as the training sample set to train the recommendation model, so that the content recommended by the trained recommendation model is more in line with the user's needs, and can accurately recommend content of interest to each user, thereby improving the user experience.
[0077] Based on the same idea, the embodiments of this specification also provide a device corresponding to the above method. Figure 3 This is a schematic diagram of the structure of a training device for a recommendation model provided in an embodiment of this specification. Figure 3 As shown, the device may include: The training sample acquisition module 302 is used to acquire a training sample set; the training sample set includes a number of training samples, and the training samples are generated based on the historical operation information of the sample users on the sample recommendation objects.
[0078] The model prediction value obtaining module 304 is used to input a number of the training samples into the recommendation model to be trained to obtain the model prediction value.
[0079] The loss impact factor determination module 306 is used to determine the loss impact factor corresponding to the sample user based on the historical operation information; the loss impact factor is used to reflect the amount of resources consumed by the sample user in the training sample for the sample recommendation object.
[0080] The loss value calculation module 308 is used to calculate the loss value corresponding to the model prediction value based on the model prediction value using a loss function including the loss impact factor.
[0081] The recommendation model updating module 310 is used to update the recommendation model to be trained based on the loss value to obtain a trained recommendation model.
[0082] based on Figure 3 The present specification also provides some specific implementation schemes of the method, which are described below.
[0083] Optionally, the device further includes a training sample generating module, which can be specifically used for: Obtaining log information of the sample user; Extracting historical operation information of the sample user on the sample recommended object from the log information; Based on the historical operation information, determine a sample label; the sample label is used to reflect whether the sample user is interested in the sample recommendation object; Generate training samples containing the sample labels.
[0084] Optionally, the training sample generation module may be specifically used for: Determining user characteristics of the sample users; Determining content features of the sample recommendation object; A training sample including the user feature and the content feature is generated.
[0085] Optionally, the user characteristics include at least one of basic user characteristics and user statistical characteristics; the basic user characteristics include at least one of age, gender, occupation, education, hobbies, and location; the user statistical characteristics include at least one of number of visits, online time, click-through rate, purchase frequency, retention rate, and churn rate; The content features include at least one of the category to which the sample recommendation object belongs, click-through rate, exposure rate, release time, number of views, and corresponding hot tag information.
[0086] Optionally, the historical operation information includes historical order information generated by the sample user based on the sample recommendation object; the loss impact factor determination module can be specifically used to: Determine the total GMV of the merchandise transaction of the user for the sample recommendation object according to the historical order information; Based on the total commodity transaction amount GMV, the loss impact factor is obtained.
[0087] Optionally, the loss impact factor determination module may be specifically used for: The total commodity transaction amount GMV is transformed by using a preset operation to obtain the loss impact factor.
[0088] Optionally, the loss impact factor determination module may be specifically used for: The log function is used to calculate the logarithm of the total commodity transaction amount GMV to obtain the loss impact factor.
[0089] Optionally, the loss impact factor determination module may be specifically used for: Add the total commodity transaction amount GMV to a preset positive number to obtain calculation data; The logarithmic value of the calculated data is calculated using a log function to obtain the loss impact factor.
[0090] Optionally, the loss value calculation module may specifically include: ; Among them, loss represents the loss value generated by n training samples; n represents the number of training samples; Represents the loss impact factor corresponding to the i-th training sample; Represents the sample label of the i-th training sample; Represents the model prediction value corresponding to the i-th training sample.
[0091] Based on the same idea, the embodiments of this specification also provide a device corresponding to the above method.
[0092] Figure 4 This is a schematic diagram of a training device for a recommendation model provided in an embodiment of this specification. Figure 4 As shown, the device 400 may include: at least one processor 410; and, A memory 430 is communicatively connected to the at least one processor; wherein, The memory 430 stores instructions 420 executable by the at least one processor 410. The instructions are executed by the at least one processor 410 to enable the at least one processor 410 to: Acquire a training sample set; the training sample set includes a plurality of training samples, wherein the training samples are generated based on historical operation information of sample users on sample recommendation objects; Inputting a number of the training samples into the recommendation model to be trained to obtain a model prediction value; Based on the historical operation information, determining a loss impact factor corresponding to the sample user; the loss impact factor is used to reflect the amount of resources consumed by the sample user in the training sample for the sample recommendation object; Based on the model prediction value, a loss value corresponding to the model prediction value is calculated using a loss function including the loss impact factor; The recommendation model to be trained is updated based on the loss value to obtain a trained recommendation model.
[0093] Based on the same idea, the embodiment of this specification also provides a computer-readable medium corresponding to the above method. The computer-readable medium stores computer-readable instructions, and the computer-readable instructions can be executed by a processor to implement the above recommendation model training method.
[0094] Each embodiment in this specification is described in a progressive manner. The same or similar parts between the embodiments can be referred to each other. Each embodiment focuses on the differences from other embodiments. Figure 4 As for the device shown, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0095] In the 1990s, it was very clear whether the improvement of a technology was hardware improvement (for example, improvement of the circuit structure of diodes, transistors, switches, etc.) or software improvement (improvement of the method flow). However, with the development of technology, many improvements of the method flow today can be regarded as direct improvements of the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that the improvement of a method flow cannot be implemented with hardware entity modules. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to ask chip manufacturers to design and make dedicated integrated circuit chips. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one kind of HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.
[0096] The controller may be implemented in any suitable manner, for example, the controller may take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (e.g., software or firmware) executable by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller, examples of which include but are not limited to the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320, and the memory controller may also be implemented as part of the control logic of the memory. It is also known to those skilled in the art that, in addition to implementing the controller in a purely computer-readable program code manner, the controller may be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, such a controller may be considered as a hardware component, and the devices for implementing various functions included therein may also be considered as structures within the hardware component. Or even, the devices for implementing various functions may be considered as both software modules for implementing the method and structures within the hardware component.
[0097] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0098] For the convenience of description, the above device is described in various units according to their functions. Of course, when implementing the present application, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0099] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0100] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0101] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0102] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0103] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0104] Memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
[0105] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined in this article, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0106] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0107] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, the present application may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0108] The present application may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
[0109] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
Claims
1. A training method for a recommendation model, comprising: Get a training sample set; The training sample set includes a plurality of training samples, wherein the training samples are generated based on historical operation information of sample users on sample recommendation objects; Inputting a number of the training samples into the recommendation model to be trained to obtain a model prediction value; Based on the historical operation information, determining a loss impact factor corresponding to the sample user; The loss impact factor is used to reflect the amount of resources consumed by the sample user in the training sample for the sample recommendation object; Based on the model prediction value, a loss value corresponding to the model prediction value is calculated using a loss function including the loss impact factor; The recommendation model to be trained is updated based on the loss value to obtain a trained recommendation model.
2. The method according to claim 1, further comprising: Obtaining log information of the sample user; Extracting historical operation information of the sample user on the sample recommended object from the log information; Determine a sample label based on the historical operation information; The sample label is used to reflect whether the sample user is interested in the sample recommendation object; Generate training samples containing the sample labels.
3. The method according to claim 1, further comprising: Determining user characteristics of the sample users; Determining content features of the sample recommendation object; A training sample including the user feature and the content feature is generated.
4. The method according to claim 3, wherein the user characteristics include at least one of basic user characteristics and user statistical characteristics; the basic user characteristics include at least one of age, gender, occupation, education, hobbies, and location; the user statistical characteristics include at least one of number of visits, online time, click-through rate, purchase frequency, retention rate, and churn rate; The content features include at least one of the category to which the sample recommendation object belongs, click-through rate, exposure rate, release time, number of views, and corresponding hot tag information.
5. The method according to claim 1, wherein the historical operation information includes historical order information generated by the sample user based on the sample recommendation object; The determining, based on the historical operation information, a loss impact factor corresponding to the sample user specifically includes: Determine the total GMV of the merchandise transaction of the user for the sample recommendation object according to the historical order information; Based on the total commodity transaction amount GMV, the loss impact factor is obtained.
6. According to the method of claim 5, obtaining the loss impact factor based on the total commodity transaction amount GMV specifically includes: The total commodity transaction amount GMV is transformed by using a preset operation to obtain the loss impact factor.
7. According to the method of claim 6, the preset operation includes a logarithmic operation; the preset operation performs data transformation on the total commodity transaction amount GMV to obtain the loss impact factor, specifically including: The log function is used to calculate the logarithm of the total commodity transaction amount GMV to obtain the loss impact factor.
8. According to the method of claim 7, the method of calculating the logarithm of the total commodity transaction amount GMV by using a log function to obtain the loss impact factor specifically comprises: Add the total commodity transaction amount GMV to a preset positive number to obtain calculation data; The logarithmic value of the calculated data is calculated using a log function to obtain the loss impact factor.
9. According to the method of claim 1, the loss function including the loss impact factor is: ; in, loss represents the loss value generated by n training samples; n represents the number of training samples; Represents the loss impact factor corresponding to the i-th training sample; Represents the sample label of the i-th training sample; Represents the model prediction value corresponding to the i-th training sample.
10. A training device for a recommendation model, comprising: A training sample acquisition module is used to acquire a training sample set; The training sample set includes a plurality of training samples, wherein the training samples are generated based on historical operation information of sample users on sample recommendation objects; A model prediction value obtaining module is used to input a number of the training samples into the recommendation model to be trained to obtain a model prediction value; A loss impact factor determination module, used to determine the loss impact factor corresponding to the sample user based on the historical operation information; the loss impact factor is used to reflect the amount of resources consumed by the sample user in the training sample for the sample recommendation object; A loss value calculation module, used to calculate the loss value corresponding to the model prediction value based on the model prediction value using a loss function including the loss impact factor; The recommendation model updating module is used to update the recommendation model to be trained based on the loss value to obtain a trained recommendation model.
11. A training device for a recommendation model, comprising: at least one processor; as well as, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to: Acquire a training sample set; the training sample set includes a plurality of training samples, wherein the training samples are generated based on historical operation information of sample users on sample recommendation objects; Inputting a number of the training samples into the recommendation model to be trained to obtain a model prediction value; Based on the historical operation information, determining a loss impact factor corresponding to the sample user; the loss impact factor is used to reflect the amount of resources consumed by the sample user in the training sample for the sample recommendation object; Based on the model prediction value, a loss value corresponding to the model prediction value is calculated using a loss function including the loss impact factor; The recommendation model to be trained is updated based on the loss value to obtain a trained recommendation model.
12. A computer-readable medium having computer-readable instructions stored thereon, wherein the computer-readable instructions can be executed by a processor to implement the training method of the recommendation model described in any one of claims 1 to 9.