Update Method, Device, Computer Equipment and Storage Medium of Recommendation Model
By obtaining and generating the model update sample features in real time, and performing local sparse processing during the recommended model update process, the problem of large memory space consumption in the traditional recommended model update method is solved, and the timeliness and efficiency of the recommended model is achieved.
Patent Information
- Application Number
- CN202011219021.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-04
- Publication Date
- 2025-06-03
- Estimated Expiration
- 2040-11-04
AI Technical Summary
The traditional recommended model update method has the problem of high memory space consumption during the update process.
By obtaining sample user data and sample recommendation object data in real time, generating a model to update sample features, and in the process of updating the recommended model in real time, when the corresponding model parameters of the sub-features in the model update sample features meet the model sparse conditions, local sparse processing is performed to reduce memory space consumption.
It realizes the reduction of memory space consumption during the recommended model update process, ensuring the timeliness and efficiency of the recommended model.
Smart Images

Figure CN114443671B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technologies, and particularly to a method, an apparatus, a computer device, and a storage medium for updating a recommendation model. Background Art
[0002] With the rapid development of Internet technologies, various Internet products have become increasingly popular. People can browse articles, watch videos, shop, etc. through various Internet products, thereby generating data in the tens of billions or even hundreds of billions. Enterprises can use a recommendation model to learn from a large amount of data and then recommend information related to users to the users.
[0003] In traditional technologies, usually a large amount of newly generated data is input into a recommendation model to update the recommendation model. However, in this method for updating a recommendation model, there is a problem of large memory space consumption of the recommendation model during the update process. Summary of the Invention
[0004] Based on this, it is necessary to provide a method, an apparatus, a computer device, and a storage medium for updating a recommendation model that can reduce memory space consumption during the update process of the recommendation model for the above technical problems.
[0005] A method for updating a recommendation model, the method includes:
[0006] Obtaining sample user data and sample recommendation object data in real time; the sample recommendation object data includes data related to the sample media object;
[0007] Generating model update sample features according to the sample user data and the sample recommendation object data; the model update sample features include sub-features of at least two feature dimensions;
[0008] Inputting the model update sample features into a recommendation model to update the recommendation model in real time; the recommendation model after real-time update is used to recommend media objects in real time; wherein, during the process of real-time updating the recommendation model, when the model parameters corresponding to the sub-features in the model update sample features meet the model sparsification condition, locally sparsify the model parameters that meet the model sparsification condition.
[0009] In one embodiment, the obtaining sample user data and sample recommendation object data in real time includes:
[0010] Collecting in real time sample user data corresponding to multiple sample user identifiers respectively, and sample recommendation object data corresponding to multiple sample recommendation object identifiers respectively;
[0011] Correspondingly store each of the sample user data and the corresponding sample user identifier in a user feature library, and store each of the sample recommended object data and the corresponding sample recommended object identifier in a recommended object feature library; the user feature library and the recommended object feature library are included in a real-time feature library;
[0012] Obtain the sample user data and the sample recommended object data in real time from the real-time feature library.
[0013] In one embodiment, before distributing the model update sample features to at least two training threads, the method further includes:
[0014] Write the model update sample features into a queue;
[0015] Streamingly read the model update sample features from the queue by a reading thread;
[0016] The distributing the model update sample features to at least two training threads includes:
[0017] Distribute the read model update sample features to at least two training threads by the reading thread.
[0018] An update device for a recommendation model, the device includes:
[0019] A real-time acquisition module, configured to acquire the sample user data and the sample recommended object data in real time; the sample recommended object data includes data related to the sample media object;
[0020] A feature generation module, configured to generate model update sample features according to the sample user data and the sample recommended object data; the model update sample features include sub-features of at least two feature dimensions;
[0021] A model update module, configured to input the model update sample features into a recommendation model to update the recommendation model in real time; the recommendation model after real-time update is used to recommend media objects in real time; wherein, during the process of real-time updating the recommendation model, when the model parameters corresponding to the sub-features in the model update sample features meet the model sparsification condition, locally sparsify the model parameters that meet the model sparsification condition.
[0022] A computer device, including a memory and a processor, the memory stores a computer program, and when the processor executes the computer program, the steps of the above method are implemented.
[0023] A computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above method are implemented.
[0024] The above-mentioned method, device, computer equipment and storage medium for updating a recommendation model, on the one hand, obtain sample user data and sample recommendation object data in real time to generate model update sample features, and input the model update sample features into the recommendation model to update the recommendation model in real time, which can enable the recommendation model to be continuously updated online and effectively ensure the timeliness of the recommendation model; furthermore, when the real-time updated recommendation model is used to recommend media objects in real time, the timeliness of the recommended media objects can be effectively ensured. On the other hand, since the model update sample includes sub-features of at least two feature dimensions, then during the process of real-time updating the recommendation model, when the model parameters corresponding to the sub-features in the model update sample features meet the model sparsification condition, the model parameters that meet the model sparsification condition can be locally sparsified. In this way, during the process of real-time updating the recommendation model, the model parameters can be continuously sparsified, reducing the complexity of the model parameters in the recommendation model, and thus reducing the consumption of the memory space of the recommendation model. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 FIG. is an application environment diagram of the method for updating a recommendation model in an embodiment;
[0026] Figure 2 FIG. is a schematic flowchart of the method for updating a recommendation model in an embodiment;
[0027] Figure 3 FIG. is a schematic flowchart of the step of obtaining sample user data and sample recommendation object data in real time in an embodiment;
[0028] Figure 4 FIG. is a schematic flowchart of the step of generating model update sample features according to sample user data and sample recommendation object data in an embodiment;
[0029] Figure 5 FIG. is a distribution diagram of the occurrence frequencies of each candidate sub-feature in an embodiment;
[0030] Figure 6 FIG. is a schematic flowchart of the step of inputting the model update sample features into the recommendation model to update the recommendation model in real time in an embodiment;
[0031] Figure 7 FIG. is a schematic flowchart of the step of locally sparsifying the model parameters that meet the model sparsification condition when the parameter values of the model parameters corresponding to the sub-features in the model update sample features meet the model sparsification condition in an embodiment;
[0032] Figure 8 FIG. is a comparison diagram of different ways of reducing the complexity of the recommendation model in an embodiment;
[0033] Figure 9Schematic flowchart of the step of locally sparsifying the model parameters that meet the model sparsification condition when the update time of the model parameters corresponding to the sub-features in the model update sample features meets the model sparsification condition in an embodiment;
[0034] Figure 10 Schematic flowchart of the step of using the most recently saved recommendation model to perform real-time recommendation of media objects in an embodiment;
[0035] Figure 11 Framework diagram of online streaming learning in an embodiment;
[0036] Figure 12 Structural block diagram of the update device of the recommendation model in an embodiment;
[0037] Figure 13 Internal structure diagram of a computer device in an embodiment. Detailed implementation manners
[0038] In order to make the objectives, technical solutions and advantages of the present application clearer and more understandable, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0039] The solutions provided in the embodiments of the present application relate to technologies such as artificial intelligence and machine learning (ML). Artificial intelligence uses digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, sense the environment, acquire knowledge, and use knowledge to obtain the best results, including theories, technologies, and application systems that enable machines to have the functions of perception, reasoning, and decision-making. Machine learning involves multiple disciplines such as probability theory, statistics, approximation theory, convex analysis, and algorithm complexity theory, and studies how computers simulate or implement human learning behaviors to acquire new knowledge or skills and reorganize the existing knowledge structure to continuously improve their own performance. Machine learning is the core of artificial intelligence and the fundamental way to make computers intelligent, and its applications cover all fields of artificial intelligence. Machine learning and deep learning usually include technologies such as artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and rote learning.
[0040] Through artificial intelligence and machine learning, a recommendation model and an online streaming learning system including the recommendation model can be constructed. By processing the model update sample features based on technologies such as artificial intelligence and machine learning, real-time recommendation of media objects can be performed, and the recommendation model can be sparsified, thereby reducing the consumption of the memory space of the recommendation model.
[0041] The update method of the recommendation model provided by the present application can be applied to, for example Figure 1In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The server 104 obtains sample user data and sample recommended object data from the terminal 102 in real time; generates model update sample features according to the sample user data and the sample recommended object data; the model update sample features include sub-features of at least two feature dimensions; inputs the model update sample features into the recommendation model to update the recommendation model in real time; the recommendation model updated in real time is used to recommend media objects in real time; among them, in the process of updating the recommendation model in real time, when the model parameters corresponding to the sub-features in the model update sample features meet the model sparsification condition, locally sparsify the model parameters that meet the model sparsification condition. Among them, the terminal 102 can be but is not limited to various personal computers, laptop computers, smart phones, tablet computers, and portable wearable devices, and the server 104 can be implemented by an independent server or a server cluster composed of multiple servers.
[0042] It should be noted that in the embodiments of the present application, the terminal 102 and the server 104 can be separately used to execute the method for updating the recommendation model, or the terminal 102 can cooperate with the server 104 to execute the method for updating the recommendation model.
[0043] In one embodiment, as Figure 2 shown, a method for updating a recommendation model is provided. Taking the server in Figure 1 as an example for illustration, the method includes the following steps:
[0044] Step 202, obtain sample user data and sample recommended object data in real time; the sample recommended object data includes data related to the sample media object.
[0045] Implementably, the sample user data refers to the data of the sample user. The sample user data may include user basic data. The user basic data is data reflecting the basic attributes of the user. The user basic data such as user identification, gender, age, location, hobbies, or education level, etc. The sample user data may also include user action data. The user action data is data reflecting the action characteristics of the user. The user action data such as social behavior data, etc. The social behavior data such as information on viewing, liking, commenting, forwarding, and collecting media data, etc. Among them, the media data may be articles, videos, pictures, etc.
[0046] Sample recommended object data refers to the data of the recommended object used as a sample. The sample recommended object refers to the object recommended to the user terminal. In this application, the recommended object can specifically be a media object. Therefore, the sample recommended object data includes data related to the sample media object. The sample media object refers to the media object used as a sample. The media object is a data object transmitted through an electronic device, and can specifically be an article, a picture, a video, a file to be downloaded, or an advertisement, etc. The data related to the sample media object can be the identifier of the sample media object, the data of the sample media object itself, and the interaction data between the sample media object and the user, etc. Among them, the interaction data between the sample media object and the user can specifically be the number of times the sample media object is viewed, the number of times the sample media object is downloaded, the number of times the sample media object is forwarded, the number of times the sample media object is collected, the data of the sample media object being liked, or the comment information of the user on the sample media object, etc., without limitation.
[0047] Specifically, the server collects user data and recommended object data from each user terminal in real time as samples, and obtains sample user data and sample recommended object data. The server can also obtain user data and recommended object data from the database in real time as samples, and obtain sample user data and sample recommended object data; the database stores the user data and recommended object data collected by the server in advance or currently.
[0048] In one scenario, the server communicates with each user terminal through a network. The server can pre-set sample users, so as to obtain the data of the user terminal where the sample users are located in real time. When the user terminal where the sample users are located receives a trigger operation from the user, the server can obtain the sample user data and sample recommended object data generated by the sample user terminal in real time. Among them, the trigger operation of the user can be viewing, liking, collecting, forwarding, downloading, commenting, etc., and corresponding data can be generated through the trigger operation of the user.
[0049] Step 204, generate model update sample features according to the sample user data and the sample recommended object data; the model update sample features include sub-features of at least two feature dimensions.
[0050] The model update sample features refer to the sample features used to update the recommendation model. The model update sample features include sub-features of at least two feature dimensions. The sub-features of different feature dimensions reflect the characteristics of the model update sample features at different feature levels. Here, the sub-features can be the user characteristic dimension or the feature dimension at the recommended object level. For example, in a specific video recommendation scenario, the feature dimensions at the user level such as whether to view, whether to like, whether to forward, whether to download, etc., and the feature dimensions at the recommended object level such as the number of views, the number of likes, the number of forwards, the number of downloads, etc.
[0051] In one implementation, the server splices the sample user data and the sample recommended object data to generate model update sample features. The splicing method is not limited. For example, the sample recommended object data can be spliced after the sample user data, or the sample user data can be spliced after the sample recommended object data.
[0052] In another implementation, the server aggregates the sample user data and the sample recommended object data to obtain model update sample features.
[0053] The server can also adopt other implementation methods to generate model update sample features based on the sample user data and the sample recommended object data, which is not limited.
[0054] Step 206: Input the model update sample features into the recommendation model to update the recommendation model in real time; the recommendation model after real-time update is used to recommend media objects in real time; among them, during the process of real-time updating the recommendation model, when the model parameters corresponding to the sub-features in the model update sample features meet the model sparsification conditions, locally sparsify the model parameters that meet the model sparsification conditions.
[0055] In the recommendation model, the recommendation system algorithm usually calculates the "score" or "preference" of the user for the item through the dot product operation between the embedding vectors of the user and the item. The embedding vectors of the user and the item are respectively obtained by linear transformation or non-linear transformation of the feature vectors of the user and the item. The recommendation model can be an FM (Factorization Machine) model, a Wide&Deep model, a DeepFM model, etc.
[0056] The server inputs the model update sample features into the recommendation model in real time to update the model parameters of the recommendation model in real time. The model parameters can include the hyperparameters of the recommendation model and the model parameters corresponding to the sub-features. Among them, the hyperparameters can include the number of convolution kernels, the parameters in the convolutional layer, the number of pooling layers, etc. The model parameters corresponding to the sub-features can include weight parameters, latent vector parameters, etc. The number of model parameters corresponding to the sub-features can be one or multiple.
[0057] The model sparsification condition refers to the constraint condition for sparsifying the model parameters, which can be set as needed. For example, the model sparsification condition can be a constraint condition for constraining the parameter values of the model parameters corresponding to the sub-features, and the model sparsification condition can also be a constraint condition for constraining the update time of the model parameters corresponding to the sub-features. Of course, in other embodiments, the model sparsification condition can also be a constraint condition for constraining the number of model update sample features or the size of the remaining memory space in the recommendation model, etc.
[0058] The sparsification process can be any one of the following methods: setting model parameters to 0, removing model parameters, filtering sub-features, filtering model update sample features, etc. Local sparsification refers to sparsifying the local parameters of the model parameters that meet the model sparsification conditions.
[0059] During the process of the server updating the recommendation model in real time, it traverses the sub-features of each feature dimension in the model update sample features and the corresponding model parameters of each sub-feature. When the model parameters corresponding to the sub-features in the model update sample features meet the model sparsification conditions, it determines the model parameters that meet the model sparsification conditions and performs local sparsification on the model parameters.
[0060] In one embodiment, during the process of updating the recommendation model, the following calculation formula is used to train the recommendation model to update the model parameters of the recommendation model:
[0061]
[0062] where x = {x 1 , x 2 , …, x i , … x j , … x N} is the model update sample feature, σ is a preset parameter, ω 0 is a preset one-dimensional parameter, x i represents the i-th sub-feature of x, ω i is the one-dimensional weight parameter corresponding to x i , and are k-dimensional hidden vector parameters, is the hidden vector parameter corresponding to x i , and N represents the number of sub-features. Assuming that x is generated from the user data of user A and the media object data of media object 1, then is the probability that the recommendation model recommends media object 1 to user A. The one-dimensional weight parameter ω i , the k-dimensional hidden vector parameters and are all obtained through the training and learning of the recommendation model.
[0063] As can be seen from the above formula, for a sub-feature, it is necessary to allocate 1 + k floating-point parameter spaces for this sub-feature. Then, as the model update sample features of the recommendation model increase, the memory space of the recommendation model will be gradually consumed, and when the memory consumption of the recommendation model is large, the time to load the memory and the time for the recommendation model to make predictions will both increase significantly.
[0064] In this embodiment, on the one hand, real-time acquisition of sample user data and sample recommended object data is used to generate model update sample features, which can timely capture the changes in online data. Inputting the model update sample features into the recommendation model to update the recommendation model in real time can enable the recommendation model to be continuously updated online, effectively ensuring the timeliness of the recommendation model. Furthermore, when the recommendation model after real-time update is used to recommend media objects in real time, the timeliness of the recommended media objects can be effectively guaranteed. On the other hand, since the model update sample includes sub-features of at least two feature dimensions, during the process of real-time updating the recommendation model, when the model parameters corresponding to the sub-features in the model update sample features meet the model sparsification conditions, the model parameters that meet the model sparsification conditions can be locally sparsified. In this way, during the process of real-time updating the recommendation model, the model parameters can be continuously sparsified, reducing the complexity of the model parameters in the recommendation model, avoiding the rapid expansion of the model parameters under long running of the recommendation model, and thus reducing the memory space consumption of the recommendation model.
[0065] In one embodiment, as Figure 3 shown, real-time acquisition of sample user data and sample recommended object data includes:
[0066] Step 302, real-time collect sample user data corresponding to multiple sample user identifiers respectively, and sample recommended object data corresponding to multiple sample recommended object identifiers respectively.
[0067] The sample user identifier refers to the identifier of the sample user. The sample user identifier corresponds to the sample user data one by one. The sample recommended object identifier refers to the identifier of the sample recommended object. The sample recommended object identifier corresponds to the sample recommended object data one by one.
[0068] It can be understood that in a normal scenario, after a new sample user identifier or a new sample recommended object identifier is generated, the server can collect in real time other sample user data corresponding to these new sample user identifiers (or sample recommended object identifiers). Among them, the sample user identifier is also sample user data. For existing sample user identifiers or sample recommended object identifiers, the server can also collect in real time the newly added sample user data corresponding to these sample user identifiers (or sample recommended object identifiers).
[0069] Step 304, store each sample user data corresponding to the corresponding sample user identifier into the user feature library, and store each sample recommended object data corresponding to the corresponding sample recommended object identifier into the recommended object feature library; the user feature library and the recommended object feature library are included in the real-time feature library.
[0070] The real-time feature library refers to a feature library that can be accessed in real time. The real-time feature library includes a user feature library and a recommended object feature library, that is, both the user feature library and the recommended object feature library are also feature libraries that can be accessed in real time.
[0071] Specifically, the server stores each sample user data and the corresponding sample user identifier in the user feature library in a key-value manner. Among them, the key is each sample user identifier, and the value is each sample user data; the server also stores each sample recommended object data and the corresponding sample recommended object identifier in the recommended object feature library in a key-value manner. Among them, the key is each sample recommended object identifier, and the value is each sample recommended object data.
[0072] Step 306, obtain sample user data and sample recommended object data from the real-time feature library in real time.
[0073] The server obtains sample user data from the user feature library of the real-time feature library through key-value operations, and obtains sample recommended object data from the recommended object feature library of the real-time feature library through key-value operations.
[0074] Specifically, the server determines the sample user identifier, matches the sample user identifier with each key stored in the user feature library, and obtains the value corresponding to the matched key, and the value is the sample user data. The server determines the sample recommended object identifier, matches the sample recommended object identifier with each key stored in the recommended object feature library, and obtains the value corresponding to the matched key, and the value is the sample recommended object data.
[0075] In one embodiment, since the sample user identifier is also the sample user data, and the sample recommended object identifier is also the sample recommended object data, the sample user data obtained by the server from the user feature library of the real-time feature library through key-value operations is key + value, and the sample recommended object data obtained by the server from the recommended object feature library of the real-time feature library through key-value operations is also key + value.
[0076] In this embodiment, the server collects in real time the sample user data corresponding to multiple sample user identifiers respectively, and the sample recommended object data corresponding to multiple sample recommended object identifiers respectively; stores each sample user data and the corresponding sample user identifier in the user feature library, and stores each sample recommended object data and the corresponding sample recommended object identifier in the recommended object feature library; the user feature library and the recommended object feature library are included in the real-time feature library; sample user data and sample recommended object data can be obtained from the real-time feature library in real time to generate model update sample features in real time and update the recommendation model in real time.
[0077] In one embodiment, the sample user data includes candidate sub-features of at least one feature dimension, the sample recommended object data includes candidate sub-features of at least one feature dimension, and the model update sample features include target sub-features of at least two feature dimensions. As Figure 4 shown, according to the sample user data and the sample recommended object data, generating model update sample features includes:
[0078] Step 402, respectively obtaining the sampling probabilities corresponding to each candidate sub-feature; the parameter value of the sampling probability represents the probability that the corresponding candidate sub-feature is adopted when updating the recommendation model.
[0079] The candidate sub-feature is a sub-feature included in the sample user data or the sample recommended object data. The target sub-feature is a sub-feature included in the model update sample features.
[0080] It can be understood that when generating the model update sample features according to the sample user data and the sample recommended object data, the sub-features included in the sample user data and the sample recommended object data may or may not be adopted. Then, the sub-features included in the sample user data and the sample recommended object data can be called candidate sub-features. When the candidate sub-feature, which is the sub-feature included in the sample user data and the sample recommended object data, is adopted, this sub-feature is used to generate the sub-feature included in the model update sample features, that is, the target sub-feature.
[0081] Specifically, the server respectively obtains the sampling probabilities of the candidate sub-features of at least one feature dimension included in each sample user data, and respectively obtains the sampling probabilities of the candidate sub-features of at least one feature dimension included in each sample recommended object data. For example, the sampling probability of candidate sub-feature A is 80%, indicating that the probability of candidate sub-feature A being adopted when updating the recommendation model is 80%, and the sampling probability of candidate sub-feature B is 25%, indicating that the probability of candidate sub-feature B being adopted when updating the recommendation model is 25%. The sampling probability can be expressed in percentage or in fraction, and is not limited thereto.
[0082] Step 404, filtering the candidate sub-features corresponding to the sampling probabilities whose parameter values are less than the probability threshold.
[0083] The probability threshold can be set as needed. For example, the probability threshold can be set to 50% or 70%.
[0084] The server compares the sampling probabilities corresponding to each candidate sub-feature with the probability threshold respectively, determines the candidate sub-features corresponding to the sampling probabilities whose parameter values are less than the probability threshold, and filters this candidate sub-feature, that is, removes this candidate sub-feature.
[0085] For example, the sample user data includes candidate sub-feature A of one feature dimension, and the parameter value of the sampling probability corresponding to candidate sub-feature A is 65%. The sample recommended object data includes candidate sub-features of two feature dimensions, namely candidate sub-feature B and candidate sub-feature C. The parameter value of the sampling probability corresponding to candidate sub-feature B is 89%, and the parameter value of the sampling probability corresponding to candidate sub-feature C is 46%. The probability threshold is 60%. Then, it is determined that the candidate sub-feature corresponding to the sampling probability with a parameter value less than the probability threshold is C, and candidate sub-feature C is filtered, that is, candidate sub-feature C is removed.
[0086] Step 406: Generate model update sample features according to the sample user data and the sample recommended object data after filtering the candidate sub-features.
[0087] When the sample user data includes a candidate sub-feature corresponding to a sampling probability with a parameter value less than the probability threshold, filter the candidate sub-feature in the sample user data; when the sample recommended object data includes a candidate sub-feature corresponding to a sampling probability with a parameter value less than the probability threshold, filter the candidate sub-feature in the sample recommended object data, and generate model update sample features according to the sample user data and the sample recommended object data after filtering the candidate sub-features.
[0088] In one implementation, the server splices the sample user data and the sample recommended object data after filtering the candidate sub-features to generate model update sample features. The splicing method is not limited. For example, the sample recommended object data can be spliced after the sample user data, or the sample user data can be spliced after the sample recommended object data.
[0089] In another implementation, the server summarizes the sample user data and the sample recommended object after filtering the candidate sub-features to obtain model update sample features.
[0090] In this embodiment, the sampling probabilities corresponding to each candidate sub-feature are obtained respectively; filtering the candidate sub-features corresponding to the sampling probabilities with parameter values less than the probability threshold can filter out the candidate sub-features with relatively small probabilities adopted when updating the recommendation model, thereby sparsifying the model update sample features. During the process of real-time updating the recommendation model, the model parameters can be continuously sparsified, reducing the complexity of the model parameters in the recommendation model and the consumption of the memory space of the recommendation model.
[0091] In one embodiment, the sample user data and the sample recommended object data are obtained from the real-time feature library; obtaining the sampling probabilities corresponding to each candidate sub-feature respectively includes: obtaining the occurrence frequencies corresponding to each candidate sub-feature in the real-time feature library respectively; calculating the sampling probabilities corresponding to each candidate sub-feature according to the preset probability and the occurrence frequencies corresponding to each candidate sub-feature.
[0092] The server counts the corresponding occurrence frequencies of each candidate sub-feature in the real-time feature library. The higher the occurrence frequency of a candidate sub-feature, the greater the probability that the candidate sub-feature will be adopted when updating the recommendation model, and the higher the confidence level of the model parameters obtained by the recommendation model using the candidate sub-feature for real-time update.
[0093] In one implementation, the server multiplies the preset probability by the corresponding occurrence frequency of each candidate sub-feature to calculate the sampling probability corresponding to each candidate sub-feature. For example, the preset probability is 0.5%, the corresponding occurrence frequency of candidate sub-feature A is 50, and the corresponding occurrence frequency of candidate sub-feature B is 64. Then the sampling probability corresponding to candidate sub-feature A is 0.5% * 50 = 25%, and the sampling probability corresponding to candidate sub-feature B is 0.5% * 64 = 32%.
[0094] In another implementation, the server obtains the corresponding weight factor of the feature library to which each candidate sub-feature belongs, and calculates the sampling probability corresponding to each candidate sub-feature according to the preset probability, the corresponding occurrence frequency of each candidate sub-feature, and the corresponding weight factor of the feature library to which each candidate sub-feature belongs. Specifically, the server multiplies the preset probability, the corresponding occurrence frequency of each candidate sub-feature, and the corresponding weight factor of the feature library to which each candidate sub-feature belongs to calculate the sampling probability corresponding to each candidate sub-feature. For example, the preset probability is 0.5%, the weight factor corresponding to the user feature library to which candidate sub-feature A belongs is 1.6, the corresponding occurrence frequency of candidate sub-feature A is 50, the weight factor corresponding to the user feature library to which candidate sub-feature B belongs is 0.8, and the corresponding occurrence frequency of candidate sub-feature B is 64. Then the sampling probability corresponding to candidate sub-feature A is 0.5% * 50 * 1.6 = 40%, and the sampling probability corresponding to candidate sub-feature B is 0.5% * 64 * 0.8 = 25.6%.
[0095] It should be noted that the calculation method of the sampling probability corresponding to the candidate sub-feature is not limited and can be set according to user needs.
[0096] In this embodiment, the corresponding occurrence frequencies of each candidate sub-feature in the real-time feature library are obtained respectively. According to the preset probability and the corresponding occurrence frequencies of each candidate sub-feature, the sampling probability corresponding to each candidate sub-feature can be accurately calculated. Moreover, for candidate sub-features with low occurrence frequencies, the corresponding sampling probabilities are low. When the recommendation model uses such candidate sub-features with low occurrence frequencies for training and learning, the confidence level of the updated model parameters is low. Therefore, by filtering out candidate sub-features with sampling probabilities less than the probability threshold, more accurate model update sample features can be generated based on the sample user data and sample recommended object data after filtering the candidate sub-features, so as to more accurately update the recommendation model in real time, and the updated recommendation model can perform real-time recommendation more accurately.
[0097] Figure 5 It is a distribution diagram of the occurrence frequencies of each candidate sub - feature in an embodiment. For example, the proportion of candidate sub - features with an occurrence frequency of 1 in the real - time feature library among all candidate sub - features is 0.41, the proportion of candidate sub - features with an occurrence frequency of 2 in the real - time feature library among all candidate sub - features is 0.13, and the proportion of candidate sub - features with an occurrence frequency of 5 in the real - time feature library among all candidate sub - features is 0.05. From Figure 5 it can be seen that the occurrence frequency distribution of each candidate sub - feature shows a long - tail distribution, and the candidate sub - features with an occurrence frequency less than or equal to 3 account for more than 50% of all candidate sub - features. However, candidate sub - features with low occurrence frequencies have little effect on updating the model parameters of the recommendation model. Candidate sub - features with low occurrence frequencies can be filtered, thus realizing the sparsification process of the recommendation model. Continuously performing the sparsification process on the model parameters reduces the complexity of the model parameters in the recommendation model and reduces the consumption of the memory space of the recommendation model.
[0098] In one embodiment, as Figure 6 shown, input the model update sample features into the recommendation model to update the recommendation model in real - time, including:
[0099] Step 602: Distribute the model update sample features to at least two training threads; the at least two training threads share the recommendation model.
[0100] A thread is the smallest unit that the operating system can perform operation scheduling on. It is contained within a process and is the actual operating unit within the process. Multiple threads can be concurrent within a process, and each thread executes different tasks in parallel. A training thread is a thread that trains the recommendation model to update the recommendation model.
[0101] It can be understood that at least two training threads sharing the recommendation model means that each of the at least two training threads updates the same recommendation model.
[0102] Optionally, the server can evenly distribute the model update sample features to at least two training threads, or distribute the model update sample features to at least two training threads according to the preset quantity of each thread.
[0103] Step 604: In each training thread, locally update the model parameters of the recommendation model according to the received model update sample features; different training threads update different model parameters at the same moment.
[0104] In each training thread, when the model parameters corresponding to the sub - features in the model update sample features meet the model sparsification condition, locally sparsify the model parameters that meet the model sparsification condition according to the received model update sample features, that is, locally update the model parameters of the recommendation model.
[0105] The server sets a lock function for each model parameter, which can control different training threads to update different model parameters at the same time. For example, at the same time, training thread 1 can update model parameter A, training thread 2 can update model parameter B, and training thread 3 can update model parameter C, which can not only improve the update rate of the recommendation model, but also avoid the chaos caused by multiple training threads updating the model parameters of the recommendation model, and improve the accuracy of updating the recommendation model.
[0106] Implementably, each training thread can fixedly update a certain or certain model parameters, or dynamically update different model parameters, as long as different training threads update different model parameters at the same time, or a model parameter is only updated by one training thread at the same time.
[0107] Step 606, obtain the updated recommendation model according to the model parameters updated by each training thread.
[0108] After at least two training threads have completed updating the model parameters, the server obtains the model parameters updated by each training thread, so as to generate an updated recommendation model.
[0109] In one implementation, when the update duration of each training thread for the model parameters reaches the specified duration, the update is stopped, and the model parameters updated by each training thread are obtained, so as to generate an updated recommendation model.
[0110] In another implementation, when the number of updates of each training thread for the model parameters reaches the specified number, the update is stopped, and the model parameters updated by each training thread are obtained, so as to generate an updated recommendation model.
[0111] In this embodiment, distributing the model update sample features to at least two training threads and locally updating the model parameters of the recommendation model by at least two training threads can improve the efficiency of updating the recommendation model. Moreover, different training threads update different model parameters at the same time, which can avoid the chaos when multiple training threads update the model parameters of the recommendation model and improve the accuracy of updating the recommendation model.
[0112] In one embodiment, before distributing the model update sample features to at least two training threads, it further includes: writing the model update sample features into a queue; streaming and reading the model update sample features from the queue by a reading thread; distributing the model update sample features to at least two training threads, including: distributing the read model update sample features to at least two training threads by the reading thread.
[0113] A queue is a linear storage structure. After the server obtains the model update sample features, it writes the model update sample features into the queue in the order of acquisition.
[0114] A reading thread refers to a thread that reads data from the queue. The reading thread can be a TrainReader thread. The model update sample features are streamed and read from the queue through the TrainReader thread.
[0115] In another embodiment, the queue can also include a message queue and a memory queue; the server writes the model update sample features into the message queue; in the program, the model update sample features are obtained from the message queue in real time and then written into the memory queue; the model update sample features are streamed and read from the memory queue through the reading thread.
[0116] In this embodiment, writing the model update sample features into the queue, streaming and reading the model update sample features from the queue through the reading thread, distributing the read model update sample features to at least two training threads through the reading thread, and streaming and reading the model update sample features in real time can improve the timeliness of obtaining the update sample features, thereby improving the timeliness of updating the recommendation model.
[0117] In one embodiment, when the model parameters corresponding to the sub-features in the model update sample features meet the model sparsification conditions, locally sparsify the model parameters that meet the model sparsification conditions, including: when the parameter values of the model parameters corresponding to the sub-features in the model update sample features meet the model sparsification conditions, locally sparsify the model parameters that meet the model sparsification conditions.
[0118] The model sparsification conditions can be set as needed. For example, the model sparsification conditions can be that the weight parameter corresponding to the sub-feature is less than the weight lower limit, the time interval between the last update time and the current time is greater than the preset interval, the data of the model update sample features reaches the specified quantity, the remaining memory space in the recommendation model is less than the specified threshold, and so on.
[0119] In one implementation, when the parameter values of the model parameters corresponding to the sub-features in the model update sample features meet the model sparsification conditions, the parameter values of the model parameters can be set to 0 to achieve sparsification processing of the model parameters.
[0120] In another implementation, when the parameter values of the model parameters corresponding to the sub-features in the model update sample features meet the model sparsification conditions, the model parameters that meet the model sparsification conditions can be filtered to achieve sparsification processing of the model parameters.
[0121] In another embodiment, when the parameter value of the model parameter corresponding to the sub-feature in the model update sample feature meets the model sparsification condition, it is possible to determine the sub-feature to which the model parameter meeting the model sparsification condition belongs, remove the sub-feature, and achieve the sparsification process of the model parameter.
[0122] It should be noted that when the parameter value of the model parameter corresponding to the sub-feature in the model update sample feature meets the model sparsification condition, the specific method for locally sparsifying the model parameter meeting the model sparsification condition is not limited and can be set as needed.
[0123] In one embodiment, the model parameters corresponding to the sub-features include weight parameters and latent vector parameters. As Figure 7 shown, when the parameter value of the model parameter corresponding to the sub-feature in the model update sample feature meets the model sparsification condition, locally sparsifying the model parameter meeting the model sparsification condition includes:
[0124] Step 702, when the parameter value of the weight parameter corresponding to the sub-feature in the model update sample feature approaches or reaches the weight lower limit, it is determined that the parameter value of the model parameter corresponding to the sub-feature meets the model sparsification condition.
[0125] The weight parameter is a parameter representing the weight of the sub-feature. The larger the parameter value of the weight parameter of the sub-feature, the more important the sub-feature is, and the greater the role of the sub-feature in the recommendation model learning how to recommend. The smaller the parameter value of the weight parameter of the sub-feature, the less important the sub-feature is, and the smaller the role of the sub-feature in the recommendation model learning how to recommend.
[0126] The parameter value of the weight parameter corresponding to the sub-feature approaching the weight lower limit means that the difference between the parameter value of the weight parameter and the weight lower limit is within a very small range. The parameter value of the weight parameter corresponding to the sub-feature reaching the weight lower limit means that the parameter value of the weight parameter is consistent with the weight lower limit.
[0127] The weight lower limit can be set as needed. The weight lower limit can be set to a relatively small value, such as 0 or 0.01, etc.
[0128] When the parameter value of the weight parameter corresponding to the sub-feature in the model update sample feature approaches or reaches the weight lower limit, it indicates that the sub-feature is not important, and it can be determined that the model parameter corresponding to the sub-feature meets the model sparsification condition.
[0129] Step 704, update the parameter value of the latent vector parameter corresponding to the sub-feature to be the same as the parameter value of the weight parameter corresponding to the sub-feature.
[0130] When the parameter value of the weight parameter corresponding to a sub - feature in the model - updated sample features approaches or reaches the weight lower limit, it indicates that the sub - feature is unimportant. Then the corresponding latent vector of the sub - feature is also unimportant, and the parameter value of the latent vector parameter corresponding to the sub - feature can be updated to be the same as the parameter value of the weight parameter corresponding to the sub - feature.
[0131] For example, the parameter value of the weight parameter corresponding to a sub - feature in the model - updated sample features is 0, and the weight lower limit is 0. Since the parameter value of the weight parameter corresponding to the sub - feature reaches the weight lower limit, it is determined that the parameter value of the model parameter corresponding to the sub - feature meets the model sparsification condition. Then the parameter value of the latent vector parameter corresponding to the sub - feature is updated to 0, that is, updated to be the same as the parameter value of the weight parameter corresponding to the sub - feature.
[0132] Another example, the parameter value of the weight parameter corresponding to a sub - feature in the model - updated sample features is 0.0001, and the weight lower limit is 0. Since the parameter value of the weight parameter corresponding to the sub - feature approaches the weight lower limit, it is determined that the parameter value of the model parameter corresponding to the sub - feature meets the model sparsification condition. Then the parameter value of the latent vector parameter corresponding to the sub - feature is updated to 0.0001, that is, updated to be the same as the parameter value of the weight parameter corresponding to the sub - feature.
[0133] In this embodiment, when the parameter value of the weight parameter corresponding to a sub - feature in the model - updated sample features approaches or reaches the weight lower limit, it is determined that the parameter value of the model parameter corresponding to the sub - feature meets the model sparsification condition. The parameter value of the latent vector parameter corresponding to the sub - feature is updated to be the same as the parameter value of the weight parameter corresponding to the sub - feature. This can continuously perform sparsification processing on the model parameters during the real - time update of the recommendation model, reducing the complexity of the model parameters in the recommendation model and reducing the consumption of the memory space of the recommendation model.
[0134] Implementably, when the parameter value of the weight parameter corresponding to a sub - feature in the model - updated sample features reaches the weight lower limit, the server determines that the parameter value of the model parameter corresponding to the sub - feature meets the model sparsification condition, and the parameter value of the latent vector parameter corresponding to the sub - feature can be updated to be the same as the parameter value of the weight parameter corresponding to the sub - feature, that is, updated to the weight lower limit. When the parameter value of the weight parameter corresponding to a sub - feature in the model - updated sample features approaches the weight lower limit, the server determines that the parameter value of the model parameter corresponding to the sub - feature meets the model sparsification condition. The parameter value of the latent vector parameter corresponding to the sub - feature can be updated to be the same as the parameter value of the weight parameter corresponding to the sub - feature, or the parameter values of both the latent vector parameter corresponding to the sub - feature and the weight parameter corresponding to the sub - feature can be updated to the weight lower limit.
[0135] Figure 8A comparison chart of different ways to reduce the complexity of a recommendation model in an embodiment. In the prior art, the SGD (Stochastic Gradient Descent) + L1 method can make most of the weight parameters ω of the features (f1, f2, f3) close to 0, but it is almost impossible to make the latent vector parameter ν of the feature equal to 0; using the FTRL (Follow-the-regularized-Leader) method, if the weight parameter ω of the feature is 0, it can be deleted, but once there is a sub-parameter of the latent vector parameter ν that is not 0, the entire latent vector parameter ν cannot be deleted. Therefore, when sparsifying the recommendation model using the FTRL method, it is often only possible to sparsify the weight parameter ω of the feature, and it is difficult to delete the latent vector parameter ν.
[0136] However, the FTRL optimization method adopted in this application is that when the parameter value of the weight parameter ω corresponding to the sub-feature in the model update sample feature reaches 0, it indicates that the sub-feature is unimportant, and it is determined that the parameter value of the model parameter ω corresponding to the sub-feature meets the model sparsification condition; the parameter value of the latent vector parameter ν corresponding to the sub-feature is updated to be the same as the parameter value of the weight parameter ω corresponding to the sub-feature, that is, the parameter value of the latent vector parameter ν is also updated to 0, realizing the sparsification process of the model parameters of the sub-feature, which can reduce the complexity of the recommendation model, thereby reducing the consumption of the memory space of the recommendation model.
[0137] In an embodiment, when the model parameters corresponding to the sub-features in the model update sample feature meet the model sparsification condition, locally sparsify the model parameters that meet the model sparsification condition, including: when the update time of the model parameters corresponding to the sub-features in the model update sample feature meets the model sparsification condition, locally sparsify the model parameters that meet the model sparsification condition.
[0138] The model sparsification condition can be set as needed. For example, the model sparsification condition can be a constraint condition for restricting the update time of the model parameters. For example, the update moment of the model parameters corresponding to the sub-feature is later than the specified moment, and the time interval between the last update moment of the model parameters corresponding to the sub-feature and the current moment is greater than the preset interval, etc.
[0139] When the server updates the model parameters corresponding to the sub-features in the model update sample feature, it can record the current update time. When the update time meets the model sparsification condition, locally sparsify the model parameters that meet the model sparsification condition, and can continuously sparsify the model parameters during the process of real-time updating the recommendation model, which can reduce the complexity of the model parameters in the recommendation model, and further reduce the consumption of the memory space by the recommendation model.
[0140] In one implementation, when the update time of the model parameters corresponding to the sub-features in the model update sample features meets the model sparsification condition, the parameter value of the model parameters can be set to a preset value. For example, the parameter value of the model parameters can be set to 0 to achieve the sparsification process of the model parameters.
[0141] In another implementation, when the update time of the model parameters corresponding to the sub-features in the model update sample features meets the model sparsification condition, the model parameters that meet the model sparsification condition can be filtered to achieve the sparsification process of the model parameters.
[0142] In another implementation, when the update time of the model parameters corresponding to the sub-features in the model update sample features meets the model sparsification condition, the sub-feature to which the model parameters that meet the model sparsification condition belong can be determined, and the sub-feature can be removed to achieve the sparsification process of the model parameters.
[0143] It should be noted that when the update time of the model parameters corresponding to the sub-features in the model update sample features meets the model sparsification condition, the specific method for locally sparsifying the model parameters that meet the model sparsification condition is not limited and can be set as needed.
[0144] In one embodiment, as Figure 9 shown, when the update time of the model parameters corresponding to the sub-features in the model update sample features meets the model sparsification condition, locally sparsifying the model parameters that meet the model sparsification condition includes:
[0145] Step 902, obtaining the last update time of the model parameters corresponding to the sub-features in the model update sample features.
[0146] The last update time of the model parameters corresponding to the sub-features refers to the time when the model parameters corresponding to the sub-features are updated for the last time.
[0147] Each time the server updates the model parameters corresponding to the sub-features in the model update sample features, it will record the current update time and store the current update time, or the current update time can replace the previous update time.
[0148] In one implementation, the server traverses the model parameters corresponding to the sub-features in each model update sample feature at preset time intervals to obtain the last update time of the model parameters corresponding to the sub-features in the model update sample features.
[0149] In another implementation, when the server saves the updated recommendation model, it traverses the model parameters corresponding to the sub-features in each model update sample feature to obtain the last update time of the model parameters corresponding to the sub-features in the model update sample features.
[0150] Step 904, when the time interval between the last update time and the current time is greater than a preset interval, it is determined that the update time of the model parameters corresponding to the sub-feature meets the model sparsification condition.
[0151] The preset interval can be set as needed. For example, the preset interval can be 3 minutes, 20 minutes, 24 hours, etc.
[0152] The server obtains the current time, calculates the time interval between the last update time and the current time. When the time interval is greater than the preset interval, it means that the last update time of the model parameters corresponding to this sub-feature is relatively long ago from the current time, and this sub-feature may have become invalid or obsolete. Then it is determined that the update time of the model parameters corresponding to this sub-feature meets the model sparsification condition.
[0153] Step 906, delete the model parameters corresponding to the sub-feature.
[0154] The server determines the model parameters corresponding to the sub-feature that meet the model sparsification condition and deletes the model parameters corresponding to this sub-feature, that is, performs sparsification processing on the model parameters of the recommendation model, which can reduce the complexity of the model parameters in the recommendation model and reduce the consumption of the memory space of the recommendation model.
[0155] In one embodiment, the number of model update sample features is multiple; after deleting the model parameters corresponding to the sub-feature, the above method further includes: determining the sub-feature corresponding to the deleted model parameters as an elimination object; deleting the elimination object from the model update sample features that have not been input into the recommendation model.
[0156] The elimination object refers to the sub-feature whose update time of the model parameters meets the model sparsification condition.
[0157] It can be understood that when the time interval between the last update time of the model parameters corresponding to the sub-feature and the current time is greater than the preset interval, the model parameters corresponding to this sub-feature may have become obsolete, and this sub-feature may also have become obsolete. Then delete the model parameters corresponding to the sub-feature, determine the sub-feature corresponding to the deleted model parameters as an elimination object, and delete the elimination object from the model update sample features that have not been input into the recommendation model, which can perform sparsification processing on the model parameters of the recommendation model, reduce the complexity of the model parameters in the recommendation model, and reduce the consumption of the memory space of the recommendation model.
[0158] The server performs real-time updates on the recommendation model. During the real-time update process, it continuously obtains the feature of the model update sample. When it is determined that the update time of the model parameter corresponding to the sub-feature meets the model sparsification condition, the sub-feature may be outdated, and then the sub-feature is deleted. This can avoid the problem that the feature of the model update sample includes outdated sub-features when the recommendation model is updated next time, resulting in inaccurate update of the recommendation model. It can update the recommendation model in real time, improve the timeliness of updating the recommendation model, and also improve the accuracy of updating the recommendation model.
[0159] It can be understood that in the item recommendation scenario, the real-time requirement is very high. New item features are generated at any time, and at the same time, a large number of item features are no longer suitable as training data for the recommendation model over time. These item features are regarded as elimination objects, and the probability of being adopted during the process of updating the recommendation model is very low, so the elimination objects can be deleted.
[0160] In one embodiment, after deleting the elimination object from the model update sample features that have not been input into the recommendation model, it further includes: deleting the model update sample features corresponding to the elimination object.
[0161] It can be understood that the time interval between the last update time of the model parameter corresponding to the sub-feature and the current time is greater than the preset interval. The model parameter corresponding to the sub-feature may be outdated, the sub-feature may also be outdated, and the model update sample feature corresponding to the sub-feature, that is, the model update sample feature to which the sub-feature belongs, may also be outdated. Then, deleting the model update sample features corresponding to the elimination object means deleting the model parameters included in the model update sample features, which can perform sparsification processing on the model parameters of the recommendation model, reduce the complexity of the model parameters in the recommendation model, and reduce the consumption of the memory space of the recommendation model.
[0162] In one embodiment, when the model parameter corresponding to the sub-feature in the model update sample feature meets the model sparsification condition, locally sparsify the model parameter that meets the model sparsification condition, including: when the parameter value of the model parameter corresponding to the sub-feature in the model update sample feature meets the model sparsification condition, locally sparsify the model parameter that meets the model sparsification condition; when the update time of the model parameter corresponding to the sub-feature in the model update sample feature meets the model sparsification condition, locally sparsify the model parameter that meets the model sparsification condition.
[0163] In one embodiment, the model parameters corresponding to the sub-features include weight parameters and latent vector parameters; when the parameter values of the model parameters corresponding to the sub-features in the model update sample features meet the model sparsification condition, locally sparsify the model parameters that meet the model sparsification condition, including: when the parameter value of the weight parameter corresponding to the sub-feature in the model update sample feature approaches or reaches the weight lower limit, determine that the parameter value of the model parameter corresponding to the sub-feature meets the model sparsification condition; update the parameter value of the latent vector parameter corresponding to the sub-feature to be the same as the parameter value of the weight parameter corresponding to the sub-feature.
[0164] In one embodiment, when the update time of the model parameters corresponding to the sub-features in the model update sample features meets the model sparsification condition, locally sparsify the model parameters that meet the model sparsification condition, including: obtaining the last update time of the model parameters corresponding to the sub-features in the model update sample features; when the time interval between the last update time and the current time is greater than the preset interval, determine that the update time of the model parameters corresponding to the sub-features meets the model sparsification condition; delete the model parameters corresponding to the sub-features.
[0165] In one embodiment, the number of model update sample features is multiple; after deleting the model parameters corresponding to the sub-features, the method further includes: determining the sub-features corresponding to the deleted model parameters as elimination objects; deleting the elimination objects from the model update sample features that have not been input into the recommendation model.
[0166] In one embodiment, when the model parameters corresponding to the sub-features in the model update sample features meet the model sparsification condition, after locally sparsifying the model parameters that meet the model sparsification condition, the method further includes: whenever the timing duration for real-time updating of the recommendation model reaches the preset duration, save the recommendation model updated at the current moment, reset the timing duration, and then continue to real-time update the recommendation model; use the recommendation model with the latest save time to perform real-time recommendation of media objects.
[0167] The preset duration can be set as needed. For example, the preset duration can be 1 minute, or 30 seconds, and is not limited thereto.
[0168] Whenever the timing duration for real-time updating of the recommendation model reaches the preset duration, save the recommendation model updated at the current moment, and reset the timing duration, that is, restart the timing for the update of the recommendation model, and continue to real-time update the recommendation model.
[0169] The server uses the recommendation model with the latest save time to perform real-time recommendation of media objects, and can more accurately perform the recommendation of media objects through the recommendation model with the latest save time.
[0170] In one embodiment, the most recently saved recommendation model is used in a recommendation thread to perform real-time recommendation of media objects. The recommendation thread is a thread that performs real-time recommendation of media objects. The server can pre-open a recommendation thread, obtain the most recently saved recommendation model through the recommendation thread, and use the most recently saved recommendation model to perform real-time recommendation of media objects.
[0171] In the traditional technology, after the model is trained or updated, it is applied, and the model cannot be continuously trained or updated during the application process. However, in this embodiment, by opening a new recommendation thread, the recommendation model can perform recommendation of media objects in the recommendation thread, and at the same time, the recommendation model can be continuously updated in real time, improving the efficiency of coordination between the application and training or update of the recommendation model.
[0172] In one embodiment, as Figure 10 shown, using the most recently saved recommendation model to perform real-time recommendation of media objects includes:
[0173] Step 1002, obtaining target user data corresponding to the target user identifier and candidate recommendation object data corresponding to multiple candidate recommendation object identifiers respectively; the candidate recommendation object data includes data related to candidate media objects.
[0174] The target user identifier refers to the identifier of the target user. The target user identifier corresponds to the target user data one by one. The candidate recommendation object identifier refers to the identifier of the candidate recommendation object. The candidate recommendation object identifier corresponds to the candidate recommendation object data one by one.
[0175] The target user data refers to the data of the target user. The target user data such as user identifier, user attribute information, multimedia data viewed by the user, multimedia data liked by the user, multimedia data forwarded by the user, multimedia data collected by the user, etc. Among them, the user attribute information can be the user's age, gender, location, hobbies, etc., and the multimedia data can be articles, videos, etc.
[0176] The candidate recommendation object data refers to the data of the candidate recommendation object. The candidate recommendation object refers to a candidate object to be recommended to the target user terminal. The recommendation object can be an article, a video, a file to be downloaded, an advertisement, etc. The candidate recommendation object data can be the identifier of the candidate recommendation object, the data of the candidate recommendation object itself, and the interaction data between the candidate recommendation object and other users, etc. Among them, the interaction data between the recommendation object and other users can specifically be the number of times the candidate recommendation object is viewed, the number of times the candidate recommendation object is downloaded, the number of times the candidate recommendation object is forwarded, the number of times the candidate recommendation object is collected, the data of the candidate recommendation object being liked, the comment information of other users on the candidate recommendation object, and so on.
[0177] The candidate media object data includes data related to the candidate media object. The candidate media object refers to a candidate media object that can be recommended to the user terminal. The data related to the candidate media object can be the identifier of the candidate media object, the data of the candidate media object itself, and the interaction data between the candidate media object and other users, etc. Among them, the interaction data between the candidate media object and other users can specifically be the number of times the candidate media object is viewed, the number of times the candidate media object is downloaded, the number of times the candidate media object is forwarded, the number of times the candidate media object is collected, the data of the candidate media object being liked, the comment information of other users on the candidate media object, and so on.
[0178] Step 1004: Generate model input features corresponding to each candidate recommendation object data according to the target user data and each candidate recommendation object data.
[0179] In one implementation manner, the server splices the target user data and each candidate recommendation object data to generate model input features corresponding to each candidate recommendation object data respectively. The splicing method is not limited. For example, the candidate recommendation object data can be spliced after the target user data, or the target user data can be spliced after the candidate recommendation object data.
[0180] In another implementation manner, the server maps the target user data and each candidate recommendation object data to generate model input features corresponding to each candidate recommendation object data respectively.
[0181] Step 1006: Input each model input feature into the recommendation model with the latest save time to obtain the recommendation probability corresponding to each model input feature.
[0182] The server inputs each model input feature into the recommendation model with the latest save time respectively. Through this recommendation model, the recommendation probability corresponding to each model input feature can be output. The recommendation probability refers to the probability that the model input feature is recommended. The higher the recommendation probability, the greater the possibility that the model input feature is recommended, and when the candidate recommendation object corresponding to the model input feature is recommended to the user terminal, the greater the possibility that the user interacts with the recommended object. Among them, the user's interaction with the recommended object can be that the user clicks, browses, downloads, likes, forwards, or collects the recommended object.
[0183] Step 1008: Sort the candidate media objects corresponding to the candidate recommendation object identifiers according to the recommendation probabilities corresponding to each model input feature.
[0184] The candidate recommendation object corresponding to the candidate recommendation object identifier can be an article, a video, a file to be downloaded, an advertisement, etc.
[0185] The server sorts the candidate media objects corresponding to the candidate recommendation object identifiers of the model input features according to the corresponding recommendation probabilities of the model input features.
[0186] In one implementation, the server can sort the candidate media objects corresponding to the candidate recommendation object identifiers of the model input features in descending order according to the corresponding recommendation probabilities of the model input features.
[0187] In another implementation, the server can sort the candidate media objects corresponding to the candidate recommendation object identifiers of the model input features in ascending order according to the corresponding recommendation probabilities of the model input features.
[0188] In one embodiment, the sorting includes recall and fine ranking. Recall refers to a rough ranking with low precision, and fine ranking refers to a ranking with high precision.
[0189] Step 1010, push the sorted candidate media objects to the terminal corresponding to the target user identifier.
[0190] In one implementation, the server pushes each candidate media object to the terminal corresponding to the target user identifier according to the sorted candidate media objects. For example, the server pushes each candidate video to the terminal corresponding to the target user identifier according to the sorted candidate videos.
[0191] In another implementation, the server pushes a specified number of candidate media objects with the highest recommendation probabilities to the terminal corresponding to the target user identifier according to the sorted candidate media objects. For example, the server pushes one to-be-downloaded APP (Application) with the highest recommendation probability to the terminal corresponding to the target user identifier according to the sorted to-be-downloaded APPs.
[0192] In this embodiment, using the recommendation model with the latest save time can obtain more accurate recommendation probabilities corresponding to each model input feature, so as to sort each candidate media object more accurately and push the candidate media objects to the terminal corresponding to the target user identifier more accurately.
[0193] In one embodiment, the above method further includes: obtaining the recommendation result of real-time recommendation using the recommendation model with the latest save time; evaluating the recommendation model used for real-time recommendation based on the recommendation result according to a preset evaluation index to obtain an evaluation result.
[0194] Evaluation metrics are target parameters for measuring the performance of a recommendation model. Evaluation metrics can include auc, gauc, acc, precision, recall, and f1. Among them, auc (area under curve) intuitively reflects the classification ability expressed by the ROC (receiver operating characteristic) curve; gauc (group auc) evaluates the effect of a personalized evaluation model; acc represents accuracy; precision represents precision; recall represents recall; f1 is the combined average of precision and recall, that is, the harmonic mean.
[0195] The server uses the recommendation model with the latest save time to perform real-time recommendation of media objects, obtains the data in response to the media object, and aggregates the response data to generate a recommendation result. Among them, the response data can be the number of clicks, viewing duration, download times, like times, favorite times, etc. of the media object.
[0196] The server evaluates the recommendation model used for real-time recommendation based on the recommendation result according to the preset evaluation metrics, and obtains an evaluation result. The evaluation result refers to the result of evaluating the recommendation model used for real-time recommendation. The effect of the recommendation model update can be obtained through the evaluation result. For example, the evaluation result of the recommendation model A used for real-time recommendation is 95 points, indicating that the recommendation model A has a good effect in real-time recommendation, the update effect of the recommendation model A is good, and the model parameter update of the recommendation model A is accurate. Another example is that the evaluation result of the recommendation model B used for real-time recommendation is 60 points, indicating that the recommendation model B has an average effect in real-time recommendation, the update effect of the recommendation model is average, and the accuracy of the model parameter update of the recommendation model B is low.
[0197] In this embodiment, obtaining the recommendation result of real-time recommendation using the recommendation model with the latest save time; evaluating the recommendation model used for real-time recommendation based on the recommendation result according to the preset evaluation metrics, and obtaining an evaluation result can accurately evaluate the effect of the recommendation model in real-time recommendation, so that the recommendation model can be improved in the future.
[0198] Such as Figure 11The figure shows a framework diagram of online streaming learning in an embodiment. The online streaming learning framework includes a data preparation module, a model update module, an online evaluation module, and an online recommendation module. Among them, the data preparation module is responsible for providing data for the model update module and the online evaluation module. First, the server collects the data of likes, forwards, and collections of users in the video number in real time, and uses it as the data source. The data source includes sample user data and sample recommended object data. The server stores the sample user data in the user feature library in real time through key-value operations, and stores the sample recommended object data in the recommended object feature library in real time through key-value operations. Among them, the user feature library and the recommended object feature library are included in the real-time feature library.
[0199] The server collects the sample user data corresponding to multiple sample user identifiers and the sample recommended object data corresponding to multiple sample recommended object identifiers from the user feature library in real time, and generates model update sample features according to the sample user data and the sample recommended object data. The server writes the model update sample data into the message queue. Specifically, the server first writes the model update sample data into the enqueue front-end service of the logic layer, and then writes it from the enqueue front-end service of the logic layer into the distributed file system in the data layer.
[0200] The server can obtain the model update sample features from the message queue and push the model update sample features into the memory queue. The model update sample features in the memory queue can be provided to the model update module and the online evaluation module.
[0201] The model update module is a training module that supports multi-threading. The model update sample features are read from the memory queue through a reading thread (TrainReader thread), and then distributed to multiple training threads. Different training threads update different model parameters at the same time; the updated recommendation model is obtained according to the model parameters updated by each training thread. Among them, the recommendation model is optimized by the FTRL optimizer, and the model parameters in the recommendation model are sparsified, which can reduce the complexity of the recommendation model, thereby reducing the consumption of the memory space of the recommendation model.
[0202] The server monitors the timing duration of the real-time updated recommendation model. When the timing duration is greater than 1 minute, the updated recommendation model is output. When outputting the updated recommendation model, the updated recommendation model can be stored in the model library, and the updated recommendation model can be imported into the model queue.
[0203] The online recommendation module can obtain the most recently saved recommendation model from the model library, input the model input features corresponding to the candidate recommendation object data obtained into the most recently saved recommendation model, and obtain the recommendation probabilities corresponding to the model input features; among them, the candidate recommendation object data includes data related to candidate media objects; according to the recommendation probabilities corresponding to the model input features, recall and fine-tune the candidate recommendation objects corresponding to the candidate recommendation object identifiers; and push the sorted candidate recommendation objects to the terminal corresponding to the target user identifier.
[0204] The online evaluation module monitors whether there is a recommendation model to be evaluated in the model queue. If so, it pops the recommendation model to be evaluated from the model queue and obtains the evaluation dataset from the memory queue in real time. The evaluation dataset is the response data obtained after the recommendation model to be evaluated makes real-time recommendations, and the recommendation result can be obtained through this evaluation dataset; according to the preset evaluation metrics, evaluate the recommendation model used for real-time recommendation based on the recommendation result to obtain the evaluation result. Among them, the evaluation metrics include auc, gauc, topkctr, acc, precision, recall, and f1.
[0205] The evaluation result of the recommendation model is fed back to the monitoring platform in real time and written into the model evaluation result library of the distributed file system in real time.
[0206] It should be understood that although Figures 2 to 4 、 Figure 6 、 Figure 7 、 Figure 9 and Figure 10 in the flowcharts of Figures 2 to 4 、 Figure 6 、 Figure 7 、 Figure 9 and Figure 10 are shown in sequence according to the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise clearly stated in this article, the execution of these steps has no strict order limit, and these steps can be executed in other orders. Moreover,
[0207] In one embodiment, as Figure 12As shown, a device for updating a recommendation model is provided. This device can be a software module, a hardware module, or a combination of both, and becomes part of a computer device. Specifically, the device includes a real-time acquisition module 1202, a feature generation module 1204, and a model update module 1206, where:
[0208] The real-time acquisition module 1202 is used to acquire sample user data and sample recommended object data in real time; the sample recommended object data includes data related to sample media objects.
[0209] The feature generation module 1204 is used to generate model update sample features based on the sample user data and the sample recommended object data; the model update sample features include sub-features of at least two feature dimensions.
[0210] The model update module 1206 is used to input the model update sample features into the recommendation model to update the recommendation model in real time; the recommendation model after real-time update is used to recommend media objects in real time; where, during the process of real-time updating the recommendation model, when the model parameters corresponding to the sub-features in the model update sample features meet the model sparsification condition, locally sparsify the model parameters that meet the model sparsification condition.
[0211] On the one hand, the above device for updating the recommendation model acquires sample user data and sample recommended object data in real time to generate model update sample features, which can capture the changes in online data in a timely manner. Inputting the model update sample features into the recommendation model to update the recommendation model in real time can enable the recommendation model to be continuously updated online, effectively ensuring the timeliness of the recommendation model; furthermore, when the recommendation model after real-time update is used to recommend media objects in real time, the timeliness of the recommended media objects can be effectively guaranteed. On the other hand, since the model update sample includes sub-features of at least two feature dimensions, then during the process of real-time updating the recommendation model, when the model parameters corresponding to the sub-features in the model update sample features meet the model sparsification condition, the model parameters that meet the model sparsification condition can be locally sparsified. In this way, during the process of real-time updating the recommendation model, the model parameters can be continuously sparsified, reducing the complexity of the model parameters in the recommendation model, avoiding the rapid expansion of the model parameters under long running of the recommendation model, and thus reducing the memory space consumption of the recommendation model.
[0212] In one embodiment, the above real-time acquisition module 1202 is further configured to: collect in real time the sample user data corresponding to multiple sample user identifiers and the sample recommended object data corresponding to multiple sample recommended object identifiers; store each sample user data and its corresponding sample user identifier in the user feature library, and store each sample recommended object data and its corresponding sample recommended object identifier in the recommended object feature library; the user feature library and the recommended object feature library are included in the real-time feature library; and obtain the sample user data and the sample recommended object data from the real-time feature library in real time.
[0213] In one embodiment, the sample user data includes candidate sub-features of at least one feature dimension, the sample recommended object data includes candidate sub-features of at least one feature dimension, and the model update sample features include target sub-features of at least two feature dimensions; the above feature generation module 1204 is further configured to obtain the sampling probability corresponding to each candidate sub-feature respectively; the parameter value of the sampling probability represents the probability that the corresponding candidate sub-feature is adopted when updating the recommendation model; filter out the candidate sub-features corresponding to the sampling probabilities with parameter values less than the probability threshold; and generate model update sample features according to the sample user data and the sample recommended object data after filtering the candidate sub-features.
[0214] In one embodiment, the sample user data and the sample recommended object data are obtained from the real-time feature library; the above feature generation module 1204 is further configured to obtain the occurrence frequency of each candidate sub-feature in the real-time feature library respectively; and calculate the sampling probability corresponding to each candidate sub-feature according to the preset probability and the occurrence frequency of each candidate sub-feature.
[0215] In one embodiment, the above model update module 1206 is further configured to distribute the model update sample features to at least two training threads; the at least two training threads share the recommendation model; in each training thread, locally update the model parameters of the recommendation model according to the received model update sample features; the model parameters updated by different training threads are different at the same moment; and obtain the updated recommendation model according to the model parameters updated by each training thread.
[0216] In one embodiment, the update device of the above recommendation model further includes a reading module, configured to write the model update sample features into a queue; stream-read the model update sample features from the queue through a reading thread; and the above model update module 1206 is further configured to distribute the model update sample features read by the reading thread to at least two training threads.
[0217] In one embodiment, the above model update module 1206 is further configured to locally sparsify the model parameters that meet the model sparsification condition when the parameter value of the model parameter corresponding to the sub-feature in the model update sample features meets the model sparsification condition.
[0218] In one embodiment, the model parameters corresponding to the sub-features include weight parameters and latent vector parameters; the model update module 1206 is further configured to determine that the parameter values of the model parameters corresponding to the sub-features meet the model sparsification condition when the parameter values of the weight parameters corresponding to the sub-features in the model update sample features approach or reach the weight lower limit; and update the parameter values of the latent vector parameters corresponding to the sub-features to be the same as the parameter values of the weight parameters corresponding to the sub-features.
[0219] In one embodiment, the model update module 1206 is further configured to locally sparsify the model parameters that meet the model sparsification condition when the update time of the model parameters corresponding to the sub-features in the model update sample features meets the model sparsification condition.
[0220] In one embodiment, the model update module 1206 is further configured to obtain the last update time of the model parameters corresponding to the sub-features in the model update sample features; determine that the update time of the model parameters corresponding to the sub-features meets the model sparsification condition when the time interval between the last update time and the current time is greater than a preset interval; and delete the model parameters corresponding to the sub-features.
[0221] In one embodiment, the number of model update sample features is multiple; the model update module 1206 is further configured to determine the sub-features corresponding to the deleted model parameters as the elimination objects; and delete the elimination objects from the model update sample features that have not been input into the recommendation model.
[0222] In one embodiment, the update device of the recommendation model further includes a recommendation module, configured to save the recommendation model updated at the current time whenever the timing duration for real-time updating the recommendation model reaches a preset duration, reset the timing duration, and then continue to real-time update the recommendation model; and perform real-time recommendation of media objects using the recommendation model with the latest save time.
[0223] In one embodiment, the online recommendation module is further configured to obtain target user data corresponding to the target user identifier and candidate recommendation object data corresponding to multiple candidate recommendation object identifiers respectively; the candidate recommendation object data includes data related to candidate media objects; generate model input features corresponding to each candidate recommendation object data respectively according to the target user data and each candidate recommendation object data; input each model input feature into the recommendation model with the latest save time to obtain recommendation probabilities corresponding to each model input feature; sort the candidate media objects corresponding to the candidate recommendation object identifiers according to the recommendation probabilities corresponding to each model input feature; and push the sorted candidate media objects to the terminal corresponding to the target user identifier.
[0224] In one embodiment, the updating device of the recommendation model further includes an online evaluation module, which is configured to obtain the recommendation results of real-time recommendation using the recommendation model with the latest save time; and evaluate the recommendation model used for real-time recommendation based on the recommendation results according to preset evaluation metrics to obtain an evaluation result.
[0225] For the specific limitations of the updating device of the recommendation model, reference can be made to the limitations of the updating method of the recommendation model in the foregoing text, which will not be elaborated here. Each module in the updating device of the recommendation model can be implemented in whole or in part by software, hardware, and their combination. Each of the above modules can be embedded in the processor of the computer device in hardware form or independent of it, or stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to each of the above modules.
[0226] In one embodiment, a computer device is provided. The computer device can be a server, and its internal structure diagram can be as Figure 13 shown. The computer device includes a processor, a memory, and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data such as model parameters, sample user data, sample recommendation data, model update sample features, sample user identifiers, and sample recommendation object identifiers. The network interface of the computer device is used to communicate with external terminals through a network connection. When the computer program is executed by the processor, it implements a method for updating a recommendation model.
[0227] Those skilled in the art can understand that Figure 13 the structure shown in
[0228] is only a block diagram of some structures related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine some components, or have different component arrangements.
[0229] In one embodiment, a computer device is further provided, including a memory and a processor. A computer program is stored in the memory, and when the processor executes the computer program, the steps in the foregoing method embodiments are implemented.
[0230] In one embodiment, a computer program product or a computer program is provided. The computer program product or the computer program includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, causing the computer device to perform the steps in the above method embodiments.
[0231] Those of ordinary skill in the art can understand that all or part of the processes of implementing the methods in the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the above method embodiments. Among them, any reference to a memory, storage, database, or other medium used in the various embodiments provided in the present application can include at least one of non-volatile and volatile memories. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc.
[0232] The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity of description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope described in this specification.
[0233] The above-described embodiments merely represent several implementation manners of the present application. The description is relatively specific and detailed, but it should not be construed as a limitation on the scope of the invention patent. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can still be made, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application should be subject to the appended claims.
Claims
1. A method for updating a recommendation model, characterized in that, the method includes: Obtaining sample user data and sample recommended object data in real time; the sample recommended object data includes data related to sample media objects; Generating model update sample features according to the sample user data and the sample recommended object data; the model update sample features include sub-features of at least two feature dimensions; Inputting the model update sample features into the recommendation model to update the recommendation model in real time; the recommendation model after real-time update is used to recommend media objects in real time; wherein, during the process of real-time updating the recommendation model, when the parameter value of the weight parameter corresponding to the sub-feature in the model update sample features approaches or reaches the weight lower limit, update the parameter value of the hidden vector parameter corresponding to the sub-feature to be the same as the parameter value of the weight parameter corresponding to the sub-feature.
2. The method according to claim 1, characterized in that, the sample user data includes candidate sub-features of at least one feature dimension, the sample recommended object data includes candidate sub-features of at least one feature dimension, and the model update sample features include target sub-features of at least two feature dimensions; The generating model update sample features according to the sample user data and the sample recommended object data includes: Respectively obtaining the sampling probabilities corresponding to each of the candidate sub-features; the parameter value of the sampling probability represents the probability that the corresponding candidate sub-feature is adopted when updating the recommendation model; Filtering the candidate sub-features corresponding to the sampling probabilities whose parameter values are less than the probability threshold; Generating model update sample features according to the sample user data and the sample recommended object data after filtering the candidate sub-features.
3. The method according to claim 2, characterized in that, the sample user data and the sample recommended object data are obtained from a real-time feature library; the respectively obtaining the sampling probabilities corresponding to each of the candidate sub-features includes: Respectively obtaining the occurrence frequencies corresponding to each of the candidate sub-features in the real-time feature library; Calculating the sampling probabilities corresponding to each of the candidate sub-features according to a preset probability and the occurrence frequencies corresponding to each of the candidate sub-features.
4. The method according to claim 1, characterized in that, the inputting the model update sample features into the recommendation model to update the recommendation model in real time includes: Distributing the model update sample features to at least two training threads; the at least two training threads share the recommendation model; In each of the training threads, locally updating the model parameters of the recommendation model according to the received model update sample features; the model parameters updated by different training threads are different at the same moment; Obtaining the updated recommendation model according to the model parameters updated by each of the training threads.
5. The method according to claim 1, characterized in that, the method further includes: When the update times of the weight parameter and the hidden vector parameter corresponding to the sub-feature in the model update sample features meet the model sparsification condition, locally sparsifying the weight parameter and the hidden vector parameter corresponding to the sub-feature that meet the model sparsification condition.
6. The method according to claim 5, wherein, when the update times of the weight parameters and the hidden vector parameters corresponding to the sub - features in the model update sample features meet the model sparsification condition, locally sparsifying the weight parameters and the hidden vector parameters corresponding to the sub - features that meet the model sparsification condition includes: Obtaining the last update time of the weight parameters and the hidden vector parameters corresponding to the sub - features in the model update sample features; When the time interval between the last update time and the current time is greater than a preset interval, determining that the update times of the weight parameters and the hidden vector parameters corresponding to the sub - features meet the model sparsification condition; Deleting the weight parameters and the hidden vector parameters corresponding to the sub - features.
7. The method according to claim 6, wherein, the number of the model update sample features is multiple; after deleting the weight parameters and the hidden vector parameters corresponding to the sub - features, the method further includes: Determining the sub - features corresponding to the deleted weight parameters and hidden vector parameters as elimination objects; Deleting the elimination objects from the model update sample features that have not been input into the recommendation model.
8. The method according to claim 1, wherein, when the parameter value of the weight parameter corresponding to the sub - feature in the model update sample feature approaches or reaches the weight lower limit, after updating the parameter value of the hidden vector parameter corresponding to the sub - feature to be the same as the parameter value of the weight parameter corresponding to the sub - feature, the method further includes: Whenever the timing duration for real - time updating the recommendation model reaches a preset duration, saving the recommendation model updated at the current time, resetting the timing duration, and then continuing to real - time update the recommendation model; Using the recommendation model with the latest save time to perform real - time recommendation of media objects.
9. The method according to claim 8, wherein, the using the recommendation model with the latest save time to perform real - time recommendation of media objects includes: Obtaining target user data corresponding to a target user identifier and candidate recommendation object data corresponding to multiple candidate recommendation object identifiers respectively; the candidate recommendation object data includes data related to candidate media objects; Generating model input features corresponding to each of the candidate recommendation object data according to the target user data and each of the candidate recommendation object data; Inputting each of the model input features into the recommendation model with the latest save time respectively to obtain recommendation probabilities corresponding to each of the model input features; Sorting the candidate media objects corresponding to the candidate recommendation object identifiers according to the recommendation probabilities corresponding to each of the model input features; Pushing the sorted candidate media objects to the terminal corresponding to the target user identifier.
10. The method according to claim 8, wherein, the method further includes: Obtaining a recommendation result of real - time recommendation using the recommendation model with the latest save time; Evaluating the recommendation model used for real - time recommendation based on the recommendation result according to a preset evaluation index to obtain an evaluation result.
11. An update device for a recommendation model, wherein, the device includes: A real-time acquisition module for acquiring sample user data and sample recommended object data in real time; the sample recommended object data includes data related to sample media objects; A feature generation module for generating model update sample features according to the sample user data and the sample recommended object data; the model update sample features include sub-features of at least two feature dimensions; A model update module for inputting the model update sample features into a recommendation model to update the recommendation model in real time; the recommendation model after real-time update is used for recommending media objects in real time; wherein, during the process of real-time updating the recommendation model, when the parameter value of the weight parameter corresponding to the sub-feature in the model update sample features approaches or reaches the weight lower limit, the parameter value of the hidden vector parameter corresponding to the sub-feature is updated to be the same as the parameter value of the weight parameter corresponding to the sub-feature.
12. The recommendation model update device according to claim 11, wherein, the sample user data includes candidate sub-features of at least one feature dimension, the sample recommended object data includes candidate sub-features of at least one feature dimension, and the model update sample features include target sub-features of at least two feature dimensions; the feature generation module is further configured to respectively obtain the sampling probabilities corresponding to each of the candidate sub-features; the parameter value of the sampling probability represents the probability that the corresponding candidate sub-feature is adopted when updating the recommendation model; filtering the candidate sub-features corresponding to the sampling probabilities with parameter values less than the probability threshold; generating model update sample features according to the sample user data and the sample recommended object data after filtering the candidate sub-features.
13. The recommendation model update device according to claim 12, wherein, the sample user data and the sample recommended object data are obtained from a real-time feature library; the feature generation module is further configured to respectively obtain the occurrence frequencies corresponding to each of the candidate sub-features in the real-time feature library; calculating the sampling probabilities corresponding to each of the candidate sub-features according to a preset probability and the occurrence frequencies corresponding to each of the candidate sub-features.
14. The recommendation model update device according to claim 11, wherein, the model update module is further configured to distribute the model update sample features to at least two training threads; the at least two training threads share the recommendation model; in each of the training threads, locally updating the model parameters of the recommendation model according to the received model update sample features; the model parameters updated by different training threads are different at the same moment; obtaining the updated recommendation model according to the model parameters updated by each of the training threads.
15. The recommendation model update device according to claim 11, wherein, the model update module is further configured to locally sparsify the weight parameters and hidden vector parameters corresponding to the sub-features that meet the model sparsification condition when the update times of the weight parameters and hidden vector parameters corresponding to the sub-features in the model update sample features meet the model sparsification condition.
16. The recommendation model update device according to claim 15, It is characterized in that the model update module is further configured to obtain the last update time of the weight parameter and the hidden vector parameter corresponding to the sub-feature in the model update sample feature; when the time interval between the last update time and the current time is greater than a preset interval, it is determined that the update time of the weight parameter and the hidden vector parameter corresponding to the sub-feature meets the model sparsification condition; delete the weight parameter and the hidden vector parameter corresponding to the sub-feature.
17. The update device of the recommendation model according to claim 16, It is characterized in that the number of the model update sample features is multiple; the model update module is further configured to determine the sub-feature corresponding to the deleted weight parameter and hidden vector parameter as an elimination object; delete the elimination object from the model update sample features that have not been input into the recommendation model.
18. The update device of the recommendation model according to claim 11, It is characterized in that the model update module is further configured to save the recommendation model updated at the current time whenever the timing duration for real-time updating of the recommendation model reaches a preset duration, reset the timing duration, and then continue to perform real-time updating of the recommendation model; use the recommendation model with the latest save time to perform real-time recommendation of media objects.
19. The update device of the recommendation model according to claim 18, It is characterized in that the model update module is further configured to obtain target user data corresponding to a target user identifier and candidate recommendation object data corresponding to a plurality of candidate recommendation object identifiers respectively; the candidate recommendation object data includes data related to candidate media objects; generate model input features corresponding to the candidate recommendation object data respectively according to the target user data and each candidate recommendation object data; input each model input feature into the recommendation model with the latest save time respectively to obtain recommendation probabilities corresponding to the model input features; sort the candidate media objects corresponding to the candidate recommendation object identifiers according to the recommendation probabilities corresponding to the model input features; Push the sorted candidate media objects to the terminal corresponding to the target user identifier.
20. The update device of the recommendation model according to claim 18, It is characterized in that the model update module is further configured to obtain the recommendation result of real-time recommendation using the recommendation model with the latest save time; evaluate the recommendation model used for real-time recommendation based on the recommendation result according to a preset evaluation index to obtain an evaluation result.
21. A computer device, including a memory and a processor, the memory stores a computer program, It is characterized in that when the processor executes the computer program, the method described in any one of claims 1 to 10 is implemented.
22. A computer-readable storage medium, on which a computer program is stored, It is characterized in that when the computer program is executed by a processor, the method described in any one of claims 1 to 10 is implemented.
23. A computer program product, including computer instructions, It is characterized in that when the computer instructions are executed by a processor, the method described in any one of claims 1 to 10 is implemented.
Citation Information
Patent Citations
Online model training method, pushing method, device and equipment
CN110321422A