Content recommendation method, device, computer equipment and storage medium
By obtaining a set of training samples, extracting feature vectors and adjusting weights based on identification information, the small sample problem is solved, high-accuracy recommendation effects are achieved after model training, overfitting is avoided, and the accuracy of content recommendations is improved.
Patent Information
- Application Number
- CN202110034688.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-01-12
- Publication Date
- 2025-09-12
- Estimated Expiration
- 2041-01-12
AI Technical Summary
In the existing technology, the difficulty of model training increases due to the small sample problem, and the accuracy and reliability of the trained model in content recommendation decreases. Especially when the number of positive samples is insufficient, copying the target samples does not improve the model training effect.
By obtaining a training sample set, extracting the feature vector of the historical content, determining the weight adjustment parameter of the feature vector based on the identification information, adjusting the weight value according to the weight adjustment parameter, obtaining the target weight value, and predicting it through the initial recommendation model, finally converging the predicted recommendation result with the target recommendation result to train the initial recommendation model and obtain the trained recommendation model.
The accuracy of recommendation model training has been improved, enabling the trained model to more accurately recommend relevant content to the terminal, avoiding overfitting and improving the accuracy of recommendations.
Smart Images

Figure CN114764469B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technology, and in particular to a content recommendation method, apparatus, computer equipment, and storage medium. Background Art
[0002] Currently, many applications use personalized recommendation technology to recommend content that suits users' preferences. For example, they can recommend music, videos, news and other content to users. Historical recommended content can be used as training data for machine learning models (also called models), and content of interest can be pushed to users based on the trained models.
[0003] The small sample size problem often occurs during personalized recommendation. This means that the number of target samples is insufficient for model training. For example, the number of positive samples in the model's training data is insufficient. This increases the difficulty of training and prevents the trained model from accurately recommending content to users. This problem is often addressed by replicating target samples. This method replicates the target sample so that multiple identical target samples exist in the training data, increasing the number of target samples and their proportion in the training data.
[0004] During the research and practice of the prior art, the inventors of this application discovered that when the target sample is copied, there will be multiple identical samples in the training data, which increases the number of times the model is trained on the same sample. However, using the same sample to train the model does not improve the training effect of the model, resulting in a decrease in the accuracy and reliability of the content recommendation by the trained model. Summary of the Invention
[0005] The embodiments of the present application provide a content recommendation method, apparatus, computer device, and storage medium. The embodiments of the present application can improve the accuracy of training a recommendation model to improve the accuracy of content recommendations by the trained recommendation model.
[0006] An embodiment of the present application provides a content recommendation method, including:
[0007] Acquire a training sample set, where the training sample set includes at least one historical content recommended to the terminal, where the historical content carries a target recommendation result;
[0008] Extracting a feature vector of the historical content, where the feature vector carries identification information;
[0009] determining a weight adjustment parameter of the feature vector based on the identification information;
[0010] Adjusting the weight value of the feature vector according to the weight adjustment parameter to obtain a target weight value;
[0011] Predicting the historical content based on the feature vector and the target weight value using an initial recommendation model to obtain a predicted recommendation result;
[0012] The predicted recommendation result and the target recommendation result are converged to train the initial recommendation model to obtain a trained recommendation model, so as to recommend content to the terminal through the trained recommendation model.
[0013] Accordingly, an embodiment of the present application further provides a content recommendation device, including:
[0014] an acquisition unit, configured to acquire a training sample set, wherein the training sample set includes at least one historical content recommended to the terminal, the historical content carrying a target recommendation result;
[0015] A vector unit, configured to extract a feature vector of the historical content, wherein the feature vector carries identification information;
[0016] a parameter unit, configured to determine a weight adjustment parameter of the feature vector based on the identification information;
[0017] A weight unit, configured to adjust the weight value of the feature vector according to the weight adjustment parameter to obtain a target weight value;
[0018] A prediction unit, configured to predict the historical content based on the feature vector and the target weight value using an initial recommendation model to obtain a predicted recommendation result;
[0019] A convergence unit is used to converge the predicted recommendation result and the target recommendation result to train the initial recommendation model to obtain a trained recommendation model, so as to recommend content to the terminal through the trained recommendation model.
[0020] Correspondingly, an embodiment of the present application also provides a computer device, including a memory and a processor; the memory stores an application program, and the processor is used to run the computer program in the memory to execute any content recommendation method provided in the embodiment of the present application.
[0021] Accordingly, an embodiment of the present application further provides a storage medium, which is used to store a computer program, and the computer program is loaded by a processor to execute any content recommendation method provided in the embodiment of the present application.
[0022] The embodiment of the present application can obtain the historical content of the training sample set and extract the feature vector carrying identification information of the historical content; determine the weight adjustment parameter of the feature vector based on the identification information; adjust the weight value of the feature vector according to the weight adjustment parameter to obtain the target weight value; then, predict the historical content based on the feature vector and the target weight value through the initial recommendation model to obtain the predicted recommendation result; finally, converge the predicted recommendation result with the target recommendation result to train the initial recommendation model to obtain the trained recommendation model, so as to recommend content to the terminal through the trained recommendation model. The embodiment of the present application adjusts the weight value by determining the weight adjustment parameter according to the identification information, so that the difference of the target weight value obtained by adjustment can be used to train the initial recommendation model, thereby improving the accuracy of the recommendation model training, so that the trained recommendation model can accurately recommend relevant content to the terminal. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0024] Figure 1 Schematic diagram of a scenario of a content recommendation method provided in an embodiment of the present application;
[0025] Figure 2 This is a flowchart of the content recommendation method provided by an embodiment of the present application;
[0026] Figure 3 is another flow chart of the content recommendation method provided by an embodiment of the present application;
[0027] Figure 4 Schematic diagram of iterative training of the initial recommendation model provided in an embodiment of the present application;
[0028] Figure 5 is a schematic diagram of a content recommendation device provided in an embodiment of the present application;
[0029] Figure 6 It is a structural diagram of the server provided in an embodiment of the present application. DETAILED DESCRIPTION
[0030] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without making creative efforts are within the scope of protection of this application.
[0031] The present invention provides a content recommendation method, apparatus, computer device, and storage medium. The content recommendation apparatus can be integrated into a computer device, which can be a server or other device.
[0032] For example, Figure 1 As described, the server can obtain the historical content of the training sample set; extract the feature vector carrying identification information of the historical content; determine the weight adjustment parameter of the feature vector based on the identification information; adjust the weight value of the feature vector according to the weight adjustment parameter to obtain the target weight value; then, the historical content is predicted based on the feature vector and the target weight value through the initial recommendation model to obtain the predicted recommendation result; finally, the predicted recommendation result and the target recommendation result are converged to train the initial recommendation model to obtain the trained recommendation model, so as to recommend content to the terminal through the trained recommendation model. The embodiment of the present application determines the weight adjustment parameter according to the identification information and adjusts the weight. When the initial recommendation model is trained, there are differences between the weights, so that the prediction result output by the trained recommendation model has a high accuracy rate, thereby achieving accurate recommendation of relevant content.
[0033] It should be noted that the order of description of the following embodiments is not intended to limit the preferred order of the embodiments.
[0034] This embodiment will be described from the perspective of a content recommendation device. Specifically, the content recommendation device can be integrated into a computer device, such as a server. The server can be a standalone physical server, a server cluster or distributed system consisting of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms.
[0035] like Figure 2 As shown, a content recommendation method is provided. The content recommendation method can be executed by a server, and the specific process can be as follows:
[0036] 101. Obtain a training sample set, where the training sample set includes at least one historical content recommended to a terminal, and the historical content carries a target recommendation result.
[0037] Among them, the training sample set can include historical content recommended to the terminal by the server, such as advertisements, music, articles, or commodities, etc., and can also include user information of the user corresponding to the terminal, such as the user information can include the user's nickname, age, and gender, etc.
[0038] Among them, historical content can carry target recommendation results (which can be simply referred to as recommendation results). For example, if the server recommends an advertisement to the terminal, the recommendation result can be that the user clicks on the advertisement through the terminal, or that the user does not click on the recommendation information through the terminal, that is, ignores the recommendation information; if the server recommends an article to the terminal, the recommendation result can be that the user reads the article, or that the user does not read the article.
[0039] The recommendation result can be obtained by monitoring the user's operation behavior through the terminal of the recommended content.
[0040] For example, the historical content in the training sample set may be obtained periodically, or the historical content in the training sample set may be obtained at a preset training time to train the initial training model.
[0041] When the content recommended to the terminal is an advertisement, the advertisement for which the user clicks on the terminal is defined as a positive sample, and the advertisement for which the user does not click on the terminal is defined as a negative sample. In actual application scenarios, there may be a large number of advertisements, but a small number of advertisements clicked by users. At this time, the proportion of positive and negative samples in the obtained training sample set in the training sample set is very different. The training results obtained by training based on the training sample set are under-fitting, and the accuracy of the prediction results of the recommendation model after training is not high.
[0042] In other practical application scenarios, there is also a large gap between the proportion of positive and negative samples. This may be due to the small number of positive samples or the small number of negative samples. The small number of samples can be copied to increase the number of samples to reduce the gap between the proportion of positive and negative samples in the training sample set, so that the number of positive and negative samples meets the quantity requirements of the recommendation model training.
[0043] Alternatively, the time for collecting samples can be increased. For example, the time for collecting candidate historical content can be increased from 24 hours after recommending content to users to 48 hours after recommending content to users. Increasing the sample collection time can accumulate more target samples, but it affects the timeliness of the initial recommendation model training.
[0044] It should be noted that the target sample can be set as a positive sample, a negative sample, or other samples according to the application scenario. The distinction between positive and negative samples is not limited to whether the user clicks or not, and can be defined according to the actual application scenario.
[0045] In one embodiment, the identification information of the sample can be used to determine whether it is a target sample (i.e., the identification information is a candidate historical content of the target identification information). If it is a target sample, the target sample is sampled to obtain a training sample set. Specifically, before the step of "obtaining the training sample set", the following steps may be included:
[0046] Obtain candidate historical content, where the candidate historical content carries identification information, including a sampling rate;
[0047] If the identification information is target identification information, the candidate historical content is sampled according to the sampling rate to obtain the historical content, and a training sample set is generated based on the historical content.
[0048] The candidate historical content may be content recommended to the terminal, and the recommendation result corresponding to the content.
[0049] The identification information can be used to identify whether the candidate historical content is sampled, as well as the sampling rate of the candidate historical content. The identification information can include a label for the target recommendation result, such as a label of 1 if a user clicks on the result and a label of 0 if no user clicks on the result. Other forms of sample differentiation are also possible, and are not limited here.
[0050] The sampling rate may represent the number of times the candidate historical content is copied.
[0051] For example, a specific method may be to obtain candidate historical content, determine whether the candidate historical content is a target sample based on the identification information of the candidate historical content, and if the identification information is target identification information, then the candidate historical content is the target sample. Based on the sampling rate, the candidate historical content is copied to obtain historical content. A training sample set is generated based on the historical content, i.e., the training sample set includes the candidate historical content and the copied identical candidate historical content.
[0052] In one embodiment, candidate historical content can be obtained based on the content recommended to the terminal and the recommendation results corresponding to the content, and the candidate historical content within a first preset time can be obtained. According to the identification information of the candidate historical content, the candidate historical content is sampled to obtain a training sample set.
[0053] The first preset time may be flexibly set according to actual needs, for example, it may be 1 hour, 2 hours, 5 hours, or 1 day before updating the content recommended to the terminal.
[0054] Optionally, the user's operating behavior can be monitored through the terminal to which the content is recommended within a second preset time to obtain a recommendation result of the recommended content. Based on the content recommended to the terminal and the recommendation result corresponding to the content, candidate historical content can be obtained. Based on the identification information of the candidate historical content, the candidate historical content can be sampled to obtain a training sample set.
[0055] The second preset time can be flexibly set according to actual needs, for example, it can be 1 hour, 2 hours, or 1 day after the content is recommended to the terminal.
[0056] 102. Extract a feature vector of the historical content, where the feature vector carries identification information.
[0057] Among them, the feature vector can be obtained by converting the historical content into a vector form, which is another representation of the historical content.
[0058] The identification information may be used to identify whether the historical content corresponding to the feature vector is sampled, or whether the historical content is sampled.
[0059] For example, it can be to extract keywords from historical content. If the historical content includes pictures, feature information can be obtained through picture recognition. For example, if the historical content is a product, the feature information obtained may include the type, color, price, brand, and / or type of the product. By converting the feature information into a vector form, a feature vector of the historical content can be obtained. The feature vector of the historical content can also be obtained through Item2Vec.
[0060] Optionally, the feature information can be converted into a feature vector based on one-hot encoding.
[0061] If the feature information includes a large number of features, the feature vector obtained by one-hot encoding will be very sparse, which increases the difficulty of calculating and processing the initial recommendation model. The sparse vector can be converted into a dense vector. For example, the conversion can be performed based on a conversion matrix. Specifically, the step of "extracting the feature vector of historical content" may include:
[0062] Extract feature information of historical content;
[0063] Mapping the feature information to a corresponding preset dimension to obtain a sparse vector of the feature information;
[0064] Convert a sparse vector into a feature vector based on a transformation matrix.
[0065] Among them, feature information can be extracted from historical content. For example, a neural network can be used to process historical content to extract feature information of the historical content.
[0066] Among them, the preset dimensions may include category, color, and / or price, etc., which can be flexibly set according to actual analysis needs. The preset dimensions may also be gender and age, etc.
[0067] The sparse vector may be obtained by processing each feature in the feature information mapped to a preset dimension according to one-hot encoding.
[0068] The transformation matrix can convert sparse vectors into dense vectors. For example, if a sparse vector is an a-dimensional vector, the transformation matrix can convert it into a b-dimensional vector, or eigenvector, where a is much smaller than b. This transformation matrix can be implemented using an embedding layer, which converts discrete variables into continuous vector representations. In neural networks, embedding can reduce the spatial dimensionality of discrete variables while also reflecting relationships between vectors.
[0069] For example, the feature information can be mapped to the corresponding preset dimensions. If the preset dimensions are category, color, and price, where there are 5 categories and 8 colors, the dimension of the resulting sparse vector is 14. The sparse vector can be reduced in dimension through the conversion matrix to obtain a low-dimensional feature vector.
[0070] In one embodiment, after obtaining a feature vector through embedding, the most adjacent feature vector is found in the embedding space, and the feature vector and the feature vector most adjacent to the feature vector are appropriately weighted to obtain a fused feature vector, which is then input into the initial recommendation model for training.
[0071] 103. Determine a weight adjustment parameter of the feature vector based on the identification information.
[0072] Among them, the weight adjustment parameters may include random parameters, mean parameters and standard deviation parameters, which can be used to adjust the weight value to obtain the target weight value.
[0073] For example, it can be specifically to determine whether the identification information is target identification information. If the identification information is target identification information, random parameters are generated; weight adjustment parameters are determined based on random parameters, mean parameters and standard deviation parameters. For example, in one embodiment, the weight adjustment parameters can be random parameters, mean parameters and standard deviation parameters.
[0074] If the identification information is not target identification information, the weight adjustment parameter is determined according to the mean parameter. For example, in one embodiment, the weight adjustment parameter may be the mean parameter.
[0075] 104. Adjust the weight value of the feature vector according to the weight adjustment parameter to obtain a target weight value.
[0076] The weight value may be a parameter of the initial recommendation model. When the weight value is not adjusted, the weight value may be the weight assigned to the feature vector when the input feature vector is calculated.
[0077] The target weight value can be obtained by adjusting the weight value through the weight adjustment parameter, and is used to assign the weight value to the feature vector when calculating the feature vector.
[0078] In step 101, the candidate historical content carrying the target identification information is copied. Therefore, there are multiple identical historical contents in the training sample set. The initial recommendation model training the same historical content multiple times will lead to overfitting of the training results, and the prediction accuracy of the recommendation model after training is low.
[0079] Overfitting can be understood as a hypothesis (for example, a recommendation model after training) that fits the training data well, such as the historical content of the training sample set, but cannot fit the data well on data sets outside the training sample set, such as the content to be predicted. In this case, the hypothesis is considered to be overfitting.
[0080] By exploring weight values based on mean and standard deviation parameters, we can obtain target feature weights that are different from the weight values of the current initial recommendation model but relatively stable, thus avoiding overfitting. The step "adjusting the weight values of the feature vectors according to the weight adjustment parameters to obtain the target weight values" can be specifically:
[0081] If the identification information is target identification information, the weight value is adjusted according to the random parameter, mean parameter and standard deviation parameter to obtain the target weight value;
[0082] If the identification information is not the target identification information, the weight value is adjusted according to the mean parameter to obtain the target weight value.
[0083] For example, it can be, Figure 3 As shown, if the identification information is target identification information, the target weight value is obtained according to the relationship between the target weight value and the random parameter, the mean parameter, and the standard deviation parameter: ω = m + s·r.
[0084] If the identification information is not the target identification information, the target weight value is obtained according to the relationship between the target weight value and the mean parameter: ω=m.
[0085] The obtained target weight value is used as the weight value assigned to the feature vector when the feature vector is calculated and processed by the initial recommendation model.
[0086] Among them, ω is the target weight value, m is the mean parameter, s is the standard deviation parameter, and r is the random parameter.
[0087] In one embodiment, if the identification information is target identification information, the weight value is adjusted according to the target weight value and the relationship between the weight value and the standard deviation parameter: ω = ω0 + s·r to obtain the target weight value; if the identification information is not target identification information, the weight value is the target weight value, that is, ω = ω0; the obtained target weight value is used as the initial recommendation model to calculate and process the feature vector, and the weight of the feature vector is assigned.
[0088] Among them, ω is the target weight value and ω0 is the weight value.
[0089] In one embodiment, the random parameter satisfies a standard normal distribution r~(0, 1).
[0090] In one embodiment, the random parameter r has a value range that satisfies the interval [-1, 1].
[0091] Optionally, when the initial recommendation model is initialized, m=0, s=1.
[0092] Optionally, the initial recommendation model may include at least one deep neural network hidden layer, and the weight value may be adjusted according to the weight adjustment parameter in the first deep neural network, i.e., deep neural network 1, or the weight value may be adjusted according to the weight adjustment parameter in multiple or all neural network hidden layers.
[0093] Step 106 of adjusting the weight adjustment parameters through back propagation can be applied in one or more layers of deep neural networks and will not be described in detail here.
[0094] In one embodiment, the weight value of the initial recommendation model may not be adjusted. By performing noise processing on the feature vector whose identification information is the target identification information, a processed feature vector is obtained. The purpose of the noise processing is to make a difference between the processed feature vector and the initial feature vector, so that the initial recommendation model will not overfit when training repeated historical content in the training sample set.
[0095] 105. The initial recommendation model is used to predict historical content based on the feature vector and target weight value to obtain the predicted recommendation result.
[0096] The initial recommendation model may be a machine learning model that has not yet completed training and is used to recommend content to the terminal.
[0097] Among them, the predicted recommendation result can be the result obtained by predicting the historical content in the training sample set. For example, if the historical content is an advertisement, the predicted result can be any value between 0 and 1, indicating the probability of the user clicking on the advertisement; if the historical content is a product, the predicted result can be the matching degree between the product and the user, etc.
[0098] For example, a weighted summation of the target weight value and the feature vector may be performed, and a prediction may be performed based on the result of the weighted summation to obtain a recommendation result for the historical content. Specifically, the step of "predicting the historical content based on the feature vector and the target weight value using the initial recommendation model to obtain a predicted recommendation result" includes:
[0099] Through the initial recommendation model, the feature vector is weighted and summed according to the target weight value to obtain a weighted feature vector;
[0100] The historical content is predicted based on the weighted feature vector to obtain the predicted recommendation results for the historical content.
[0101] For example, a weighted summation process may be performed based on the target weight value corresponding to each feature in the feature vector to obtain a weighted feature vector of the feature vector, and the weighted vector may be mapped to (0, 1) through an activation function, such as a sigmoid function, to obtain a predicted recommendation result.
[0102] In one embodiment, if the historical content is product and user information, the feature vectors corresponding to the product and user information, as well as the corresponding target weight values, are weighted and summed to obtain the weighted feature vector of the product and the weighted feature vector of the user information, and the distance between the two vectors is calculated to obtain the predicted recommendation result based on the distance.
[0103] 106. Converging the predicted recommendation result and the target recommendation result to train the initial recommendation model and obtain a trained recommendation model, so as to recommend content to the terminal through the trained recommendation model.
[0104] Among them, there is an error between the predicted recommendation result and the target recommendation result, and the predicted recommendation result and the target recommendation result are converged, that is, the initial recommendation model is converged through back propagation to obtain the trained recommendation model.
[0105] The weight adjustment parameters are determined based on the identification information. The weight adjustment parameters corresponding to historical content with different identification information are different, and the weight adjustment parameters adjusted by back propagation are different. Specifically, the step of "converging the predicted recommendation results with the target recommendation results" includes:
[0106] If the identification information is a target identification, calculating the mean gradient of the mean parameter and the standard deviation gradient of the standard deviation parameter based on the predicted recommendation result and the target recommendation result through a loss function;
[0107] Adjust the mean parameter according to the mean gradient to obtain the adjusted mean parameter;
[0108] Adjust the standard deviation parameter according to the standard deviation gradient to obtain the adjusted standard deviation parameter;
[0109] According to the adjusted mean parameter and the adjusted standard deviation parameter, the predicted recommendation results and the target recommendation results are converged.
[0110] Among them, the loss function can be used to calculate the gap between the predicted recommendation result and the target recommendation result. The loss function can be a mean square error function, a root mean square error function, a mean absolute error function, or a cross entropy loss function, or other loss functions not listed here.
[0111] It is understandable that the loss function can be selected as needed and is not limited here.
[0112] Among them, the mean gradient can be obtained by differentiating the loss function with respect to the mean parameter, which can be used to adjust the mean parameter to obtain the adjusted mean parameter.
[0113] Among them, the standard deviation gradient can be obtained by differentiating the loss function with respect to the standard deviation parameter, which can be used to adjust the standard deviation parameter to obtain the adjusted standard deviation parameter.
[0114] For example, Figure 3 As shown, specifically, if the identification information is the target identification information, the loss function is a function of the mean parameter m and the standard deviation parameter s, which can be expressed as: It can also be called function F. By solving the derivative of function F with respect to m and the derivative of function F with respect to s respectively, the mean gradient Δm of the mean parameter and the standard deviation gradient Δs of the standard deviation parameter are obtained.
[0115] According to m′=m+Δm·θ m , get the adjusted mean parameter; according to s′=s+Δs·θ s , and obtain the adjusted standard deviation parameter.
[0116] Among them, x i is the input feature vector, is the target recommendation result, m′ is the adjusted mean parameter, s′ is the adjusted standard deviation parameter, Δm is the mean gradient, Δs is the standard deviation gradient, θ m is the mean learning rate of the mean parameter, θ s is the standard deviation learning rate for the standard deviation parameter.
[0117] The mean learning rate and standard deviation learning rate can be adjusted according to actual conditions.
[0118] If the identification information is not the target identification information, the weight adjustment parameter of the back propagation adjustment is the mean parameter. Specifically, the method provided in the embodiment of the present application further includes:
[0119] If the identification information is not the target identification information, calculating the mean gradient based on the predicted recommendation result and the target recommendation result through a loss function;
[0120] The mean parameter is adjusted according to the mean gradient to obtain the adjusted mean parameter.
[0121] According to the adjusted mean parameter, the predicted recommendation results and the target recommendation results are converged.
[0122] For example, if the identification information is not the target identification information, the target weight value corresponding to the feature vector is the mean parameter, that is, the loss function is Also called function F′, by solving the derivative of function F′ with respect to m, we can get the mean gradient Δm of the mean parameter. According to m′=m+Δm·θ m , and obtain the adjusted mean parameter.
[0123] The initial recommendation model obtains the corresponding target feature weight for the feature vector input later based on the adjusted mean parameter and adjusted standard deviation, and obtains the prediction result by predicting the feature vector. Then, the weight parameter is adjusted again through back propagation, and the initial model is continuously iterated until the initial recommendation model is trained.
[0124] Optionally, the condition for completing the initial model training may be that the error between the output predicted recommendation result and the target recommendation result meets a preset threshold.
[0125] Optionally, the condition for completing the initial model training may be that the training sample set is trained a preset number of times, that is, each historical content in the training sample set is input into the initial recommendation model for training a preset number of times.
[0126] In one embodiment, if the target feature weight is obtained according to ω=ω0+s·r, then the loss function is a function of the weight value and the standard deviation parameter. By respectively solving the derivatives of the function with respect to the weight value and the standard deviation parameter, the gradient of the weight value and the gradient of the standard deviation parameter are obtained, and the weight value and the standard deviation parameter are adjusted according to the gradient of the weight value and the gradient of the standard deviation parameter to obtain the adjusted weight value and the adjusted standard deviation parameter.
[0127] If the target weight value is the weight value, then the loss function is a function of the weight value. By solving the derivative of the function with respect to the weight value, the gradient of the weight value is obtained. The weight value is adjusted according to the gradient of the weight value to obtain the adjusted weight value.
[0128] The initial recommendation model obtains the corresponding target feature weight for the feature vector input later based on the adjusted standard deviation and adjusted weight value, and obtains the prediction result by predicting the feature vector. Then, the weight parameters are adjusted again through back propagation, and the initial model is continuously iterated until the initial recommendation model is trained.
[0129] After the initial recommendation model training is completed, the trained model can be obtained. In one embodiment, a method of differentiating training and application weights can be adopted, that is, when training the initial recommendation model, the weight value is explored based on the mean parameter and the standard deviation parameter. The trained recommendation model can predict the recommended content based on the mean parameter obtained after training.
[0130] Optionally, when training the initial recommendation model, the weight value is explored based on the mean parameter, and the trained recommendation model can predict the recommended content based on the weight value obtained after training.
[0131] Based on the prediction result of the content to be recommended, the content to be recommended is recommended to the terminal. Specifically, the method provided in this embodiment further includes:
[0132] Acquire content to be recommended, and perform feature extraction on the content to be recommended to obtain a content feature vector;
[0133] Performing recommendation prediction based on the content feature vector using the trained recommendation model to obtain a prediction result;
[0134] Target recommended content is screened out from the content to be recommended based on the recommendation prediction result, and the target recommended content is recommended to the terminal.
[0135] The content to be recommended may be of the same type as the historical content, such as advertisements, music, articles, or commodities.
[0136] The feature extraction may be to extract keywords of the content to be recommended, and use the extracted keywords as features of the content to be recommended.
[0137] For example, the specific method may be to obtain the content to be recommended, extract the features of the content to be recommended, convert the features into content feature vectors according to Embedding, and perform weighted summation of the content feature vectors based on the trained weight values through the trained recommendation model to obtain a prediction result. For example, the prediction result may be the matching degree between the recommended content and the user. The target recommended content is filtered out from the content to be recommended according to the matching degree, and the target recommended content is recommended to the terminal.
[0138] The embodiment of the present application adopts the method of obtaining the historical content of the training sample set; extracting the feature vector carrying identification information of the historical content; determining the weight adjustment parameter of the feature vector based on the identification information; adjusting the weight value of the feature vector according to the weight adjustment parameter to obtain the target weight value; then, using the initial recommendation model to predict the historical content based on the feature vector and the target weight value to obtain the predicted recommendation result; finally, converging the predicted recommendation result with the target recommendation result to train the initial recommendation model to obtain the trained recommendation model, so as to recommend content to the terminal through the trained recommendation model. By determining the weight adjustment parameter based on the identification information and adjusting the weight, there are differences between the weights when the initial recommendation model is trained, so that the prediction result output by the trained recommendation model has a high accuracy rate, thereby achieving accurate recommendation of relevant content.
[0139] Based on the above embodiments, further detailed description will be given below with examples.
[0140] This embodiment will be described from the perspective of a content recommendation device. Specifically, the content recommendation device may be integrated into a computer device, which may be a server or other device.
[0141] The embodiment of the present application provides a content recommendation method, which can be executed by a server, such as Figure 3 As shown, the specific process of the logic code running method can be as follows:
[0142] 201. Obtain candidate historical content, sample the candidate historical content according to a sampling rate, and obtain a training sample set.
[0143] For example, the server can retrieve pre-stored candidate historical content from a database and, based on the identification information of the candidate historical content, determine whether the candidate historical content is a target sample. If the identification information is target identification information, the candidate historical content is the target sample. The server then replicates the candidate historical content based on the sampling rate to obtain the historical content. A training sample set is generated based on the historical content, i.e., the training sample set includes the candidate historical content and the replicated identical candidate historical content.
[0144] In one embodiment, candidate historical content may include advertisements and user information, and the target recommendation result of the advertisement is that the user clicks on it, or that the user does not click on it. The candidate historical content that the user clicks on is defined as a positive sample, and the candidate historical content that the user does not click on is defined as a negative sample. In actual application scenarios, the number of candidate historical content that the user clicks on accounts for a very small proportion of the number of advertisements recommended to the user's terminal. Therefore, the positive sample is set as the target sample, and the target recommendation result can be used as identification information. That is, if it is a positive sample, it is copied according to the sampling rate. Based on the data required for the initial recommendation model training, you can choose to copy the advertisement, or copy the advertisement and user information.
[0145] In one embodiment, candidate historical content can be obtained based on the content recommended to the terminal and the recommendation results corresponding to the content, and the candidate historical content within a first preset time can be obtained. According to the identification information of the candidate historical content, the candidate historical content is sampled to obtain a training sample set.
[0146] The first preset time may be flexibly set according to actual needs, for example, it may be 1 hour, 2 hours, 5 hours, or 1 day before updating the content recommended to the terminal.
[0147] Optionally, the user's operating behavior can be monitored through the terminal to which the content is recommended within a second preset time to obtain a recommendation result of the recommended content. Based on the content recommended to the terminal and the recommendation result corresponding to the content, candidate historical content can be obtained. Based on the identification information of the candidate historical content, the candidate historical content can be sampled to obtain a training sample set.
[0148] The second preset time can be flexibly set according to actual needs, for example, it can be 1 hour, 2 hours, or 1 day after the content is recommended to the terminal.
[0149] 202. Extract feature vectors of historical content in the training sample set.
[0150] For example, the server may extract keywords from historical content. If the historical content includes pictures, feature information may be obtained through picture recognition. For example, if the historical content is a commodity, the feature information obtained may include the type, color, price, brand, combination and / or type of the commodity. By converting the feature information into a vector form, a feature vector of the historical content may be obtained.
[0151] Optionally, the server may convert the feature information into a feature vector based on one-hot encoding.
[0152] If the feature information includes a large number of features, the feature vector obtained by one-hot encoding will be very sparse, which increases the difficulty of calculating and processing the initial recommendation model. The sparse vector can be converted into a dense vector.
[0153] For example, the server may map feature information to corresponding preset dimensions. If the preset dimensions include category, color, and price, where there are 5 categories and 8 colors, the dimension of the resulting sparse vector is 14. The sparse vector can be reduced in dimension through the conversion matrix to obtain a low-dimensional feature vector.
[0154] 203. If the identification information is target identification information, a target weight value is obtained based on the random parameter, the mean parameter, and the standard deviation parameter.
[0155] For example, it can be specifically to determine whether the identification information is the target identification information. If the identification information is the target identification information, a random parameter is generated; the weight adjustment parameter is determined according to the random parameter, the mean parameter and the standard deviation parameter, and the weight value is adjusted according to the weight adjustment parameter to obtain the target weight value.
[0156] For example, in one embodiment, Figure 4 As shown, the weight adjustment parameters can be random parameters, mean parameters and standard deviation parameters. The server obtains the target weight value according to the relationship between the target weight value and the random parameters, mean parameters, and standard deviation parameters: ω = m + s·r.
[0157] The server uses the obtained target weight value as the weight value assigned to the feature vector when performing calculation processing on the feature vector by the initial recommendation model.
[0158] Among them, ω is the target weight value, m is the mean parameter, s is the standard deviation parameter, and r is the random parameter.
[0159] Optionally, the random parameter satisfies the standard normal distribution r~(0,1).
[0160] Optionally, the random parameter r has a value range that satisfies the interval [-1, 1].
[0161] 204. The historical content is predicted based on the feature vector and the target weight value through the initial recommendation model to obtain the predicted recommendation result.
[0162] For example, the target weight value and the feature vector may be weightedly summed, and prediction may be performed based on the result of the weighted summation to obtain a recommendation result for the historical content.
[0163] In one embodiment, if the historical content is product and user information, the feature vectors corresponding to the product and user information, as well as the corresponding target weight values, are weighted and summed to obtain the weighted feature vector of the product and the weighted feature vector of the user information, and the distance between the two vectors is calculated to obtain the predicted recommendation result based on the distance.
[0164] 205. Based on the predicted recommendation results and the target recommendation results, the mean gradient of the mean parameter and the standard deviation gradient of the standard deviation parameter are calculated through the loss function.
[0165] For example, the loss function can be a function of the mean parameter m and the standard deviation parameter s, which can be expressed as: It can also be called function F. By solving the derivative of function F with respect to m and the derivative of function F with respect to s respectively, the mean gradient Δm of the mean parameter and the standard deviation gradient Δs of the standard deviation parameter are obtained.
[0166] Among them, x iis the input feature vector, is the target recommendation result, m is the mean parameter, and s is the standard deviation parameter.
[0167] 206. Converging the predicted recommendation result and the target recommendation result according to the mean gradient and the standard deviation gradient to train the initial recommendation model and obtain a trained recommendation model, so as to recommend content to the terminal through the trained recommendation model.
[0168] For example, the server may obtain an adjusted mean parameter and an adjusted standard deviation parameter according to the mean gradient and the standard deviation gradient, and then converge the predicted recommendation result and the target recommendation result based on the adjusted mean parameter and the adjusted standard deviation parameter.
[0169] In one embodiment, if Figure 4 As shown, according to m′=m+Δm·θ m , get the adjusted mean parameter; according to s′=s+Δs·θ s , and obtain the adjusted standard deviation parameter.
[0170] Among them, m′ is the adjusted mean parameter, s′ is the adjusted standard deviation parameter, Δm is the mean gradient, Δs is the standard deviation gradient, θ m is the mean learning rate of the mean parameter, θ s is the standard deviation learning rate for the standard deviation parameter.
[0171] Among them, the mean learning rate and standard deviation learning rate can be adjusted according to actual conditions.
[0172] The initial recommendation model selects the adjusted mean parameter and adjusted standard deviation, or the adjusted mean parameter, for the feature vector input later according to the identification information to obtain its corresponding target feature weight, and obtains the prediction result by predicting the feature vector. Then, the weight parameter is adjusted again through back propagation, and the initial model is continuously iterated and trained until the initial recommendation model is completed.
[0173] 207. If the identification information is not target identification information, a target weight value is obtained based on the mean parameter.
[0174] For example, if the identification information is not the target identification information, the server determines the weight adjustment parameter according to the mean parameter, and adjusts the weight value according to the weight adjustment parameter to obtain the target weight value.
[0175] For example, in one embodiment, Figure 4 The weight adjustment parameter may be a mean parameter, and the server obtains the target weight value according to the relationship between the target weight value and the mean parameter: ω=m.
[0176] The server uses the obtained target weight value as the weight value assigned to the feature vector when performing calculation processing on the feature vector by the initial recommendation model.
[0177] Among them, ω is the target weight value and m is the mean parameter.
[0178] 208. The historical content is predicted based on the feature vector and the target weight value through the initial recommendation model to obtain the predicted recommendation result.
[0179] For example, the server may perform a weighted summation on the target weight value and the feature vector, perform a prediction based on the result of the weighted summation, and obtain a recommendation result for the historical content.
[0180] In one embodiment, if the historical content is product and user information, the feature vectors corresponding to the product and user information, as well as the corresponding target weight values, are weighted and summed to obtain the weighted feature vector of the product and the weighted feature vector of the user information. The server calculates the distance between the two vectors and obtains the predicted recommendation result based on the distance.
[0181] 209. Calculate the mean gradient of the mean parameter based on the predicted recommendation results and the target recommendation results through the loss function.
[0182] For example, if the identification information is not the target identification information, the target weight value corresponding to the feature vector is the mean parameter, that is, the loss function is Also called function F′, the server obtains the mean gradient Δm of the mean parameter by solving the derivative of function F′ with respect to m. According to m′=m+Δm·θ m , and obtain the adjusted mean parameter.
[0183] Among them, x i is the input feature vector, is the target recommendation result, and m is the mean parameter.
[0184] 210. Converging the predicted recommendation result and the target recommendation result according to the mean gradient to train the initial recommendation model and obtain a trained recommendation model, so as to recommend content to the terminal through the trained recommendation model.
[0185] For example, the server may obtain an adjusted mean parameter and an adjusted standard deviation parameter according to the mean gradient and the standard deviation gradient, and then converge the predicted recommendation result and the target recommendation result based on the adjusted mean parameter.
[0186] In one embodiment, if Figure 4 As shown, the server is based on m′=m+Δm·θ m , get the adjusted mean parameter, and perform back propagation to adjust the mean parameter.
[0187] Among them, m′ is the adjusted mean parameter, Δm is the mean gradient, θ m is the mean learning rate of the mean parameter.
[0188] Among them, the mean learning rate can be adjusted according to actual conditions.
[0189] In one embodiment, determining the target weight value through the weight adjustment parameter according to the identification information, predicting the historical content according to the target weight value, and adjusting the weight value through back propagation can be applied to a single deep neural network hidden layer, such as deep neural network hidden layer 1, and can also be applied to multiple deep neural network hidden layers.
[0190] The server then inputs the feature vector of the initial recommendation model, and selects the adjusted mean parameter and adjusted standard deviation, or the adjusted mean parameter, based on the identification information, to obtain the corresponding target feature weight. The server predicts the feature vector to obtain the prediction result, and then adjusts the weight parameter again through back propagation, and continuously iterates the initial model until the initial recommendation model is trained.
[0191] After the initial recommendation model training is completed, a trained model can be obtained. The server can use the trained model to perform recommendation predictions on the content to be recommended, and recommend the content to be recommended to the terminal based on the prediction results. Specifically, the method provided in this embodiment also includes:
[0192] Obtain the content to be recommended, and perform feature extraction on the content to be recommended to obtain a content feature vector;
[0193] Performing recommendation prediction based on the content feature vector using the trained recommendation model to obtain a prediction result;
[0194] Based on the recommendation prediction result, target recommended content is filtered out from the content to be recommended, and the target recommended content is recommended to the terminal.
[0195] The embodiment of the present application adopts the method of obtaining candidate historical content, sampling the candidate historical content according to the sampling rate, and obtaining a training sample set; obtaining the training sample set, extracting the feature vector of the historical content in the training sample set, and if the identification information is the target identification information, obtaining the target weight value based on the random parameter, the mean parameter, and the standard deviation parameter, and predicting the historical content based on the feature vector and the target weight value through the initial recommendation model to obtain the predicted recommendation result, and calculating the mean gradient of the mean parameter and the standard deviation gradient of the standard deviation parameter based on the predicted recommendation result and the target recommendation result through the loss function, and comparing the predicted recommendation result with the target recommendation result according to the mean gradient and the standard deviation gradient. The target recommendation results are converged to train the initial recommendation model to obtain a trained recommendation model, so as to recommend content to the terminal through the trained recommendation model; if the identification information is not the target identification information, the target weight value is obtained based on the mean parameter, and the historical content is predicted based on the feature vector and the target weight value by the initial recommendation model to obtain a predicted recommendation result. The mean gradient of the mean parameter is calculated based on the predicted recommendation result and the target recommendation result through the loss function, and the predicted recommendation result and the target recommendation result are converged according to the mean gradient to train the initial recommendation model to obtain a trained recommendation model, so as to recommend content to the terminal through the trained recommendation model. By determining the weight adjustment parameters according to the identification information and adjusting the weights, there are differences between the weights when the initial recommendation model is trained, so that the prediction results output by the trained recommendation model are highly accurate, and accurate recommendation of relevant content is achieved.
[0196] In order to better implement the above method, the embodiment of the present application also provides a content recommendation device, wherein the meaning of the nouns is the same as that in the above content promotion method, and the specific implementation details can refer to the description in the method embodiment. Figure 5 As shown, the content recommendation device may include an acquisition unit 301, a vector unit 302, a parameter unit 303, a weight unit 304, a prediction unit 305, and a convergence unit 306, as follows:
[0197] (1) Acquisition unit 301:
[0198] The acquisition unit 301 is configured to acquire a training sample set, where the training sample set includes at least one historical content recommended to a terminal, and the historical content carries a target recommendation result.
[0199] For example, the historical content in the training sample set may be obtained periodically, or the historical content in the training sample set may be obtained at a preset training time to train the initial training model.
[0200] In one embodiment, the acquisition unit 301 may further include a sampling subunit, which may be used to determine whether the sample is a target sample based on the identification information of the sample. If it is a target sample, the target sample is sampled to obtain a training sample set. Specifically, the sampling subunit is used to:
[0201] Obtain candidate historical content, where the candidate historical content carries identification information, including a sampling rate;
[0202] If the identification information is target identification information, the candidate historical content is sampled according to the sampling rate to obtain the historical content, and a training sample set is generated based on the historical content.
[0203] For example, a specific method may be to obtain candidate historical content, determine whether the candidate historical content is a target sample based on the identification information of the candidate historical content, and if the identification information is target identification information, then the candidate historical content is the target sample. Based on the sampling rate, the candidate historical content is copied to obtain historical content. A training sample set is generated based on the historical content, i.e., the training sample set includes the candidate historical content and the copied identical candidate historical content.
[0204] (2) Vector unit 302:
[0205] The vector unit 302 is configured to extract a feature vector of the historical content, where the feature vector carries identification information.
[0206] For example, it can be specifically to extract keywords from historical content. If the historical content includes pictures, feature information can be obtained through picture recognition. For example, if the historical content is a product, the feature information obtained may include the type, color, price, brand and / or type of the product. By converting the feature information into a vector form, a feature vector of the historical content can be obtained.
[0207] If the feature information includes a large number of features, the feature vector obtained by one-hot encoding will be very sparse, which increases the difficulty of calculating and processing the initial recommendation model. The sparse vector can be converted into a dense vector. For example, the conversion can be performed according to a conversion matrix. Specifically, the vector unit 302 includes a vector conversion subunit, which can be used to:
[0208] Extract feature information of historical content;
[0209] Mapping the feature information to a corresponding preset dimension to obtain a sparse vector of the feature information;
[0210] Convert a sparse vector into a feature vector based on a transformation matrix.
[0211] For example, the feature information can be mapped to the corresponding preset dimensions. If the preset dimensions are category, color, and price, where there are 5 categories and 8 colors, the dimension of the resulting sparse vector is 14. The sparse vector can be reduced in dimension through the conversion matrix to obtain a low-dimensional feature vector.
[0212] (3) Parameter unit 303:
[0213] The parameter unit 303 is configured to determine a weight adjustment parameter of the feature vector based on the identification information.
[0214] For example, it can be specifically to determine whether the identification information is target identification information. If the identification information is target identification information, random parameters are generated; weight adjustment parameters are determined based on random parameters, mean parameters and standard deviation parameters. For example, in one embodiment, the weight adjustment parameters can be random parameters, mean parameters and standard deviation parameters.
[0215] If the identification information is not target identification information, the weight adjustment parameter is determined according to the mean parameter. For example, in one embodiment, the weight adjustment parameter may be the mean parameter.
[0216] (4) Weight unit 304:
[0217] The weight unit 304 is configured to adjust the weight value of the feature vector according to the weight adjustment parameter to obtain a target weight value.
[0218] For example, the weight value can be adjusted according to the random parameter, the mean parameter and the standard deviation parameter to obtain the target weight value, or the weight value can be adjusted according to the mean parameter to obtain the target weight value.
[0219] Optionally, the weighting unit 304 may include a regulating subunit and a second regulating subunit, wherein the regulating subunit is configured to:
[0220] If the identification information is target identification information, the weight value is adjusted according to the random parameter, mean parameter and standard deviation parameter to obtain the target weight value;
[0221] If the identification information is not the target identification information, the weight value is adjusted according to the mean parameter to obtain the target weight value.
[0222] For example, specifically, if the identification information is target identification information, the target weight value is obtained according to the relationship between the target weight value and the random parameter, the mean parameter, and the standard deviation parameter: ω=m+s·r.
[0223] If the identification information is not the target identification information, the target weight value is obtained according to the relationship between the target weight value and the mean parameter: ω=m.
[0224] The obtained target weight value is used as the weight value assigned to the feature vector when the feature vector is calculated and processed by the initial recommendation model.
[0225] Among them, ω is the target weight value, m is the mean parameter, s is the standard deviation parameter, and r is the random parameter.
[0226] (5) Prediction unit 305:
[0227] The prediction unit 305 is configured to predict the historical content based on the feature vector and the target weight value using an initial recommendation model to obtain a predicted recommendation result.
[0228] For example, a weighted summation may be performed on the target weight value and the feature vector, and a prediction may be performed based on the result of the weighted summation to obtain a recommendation result for the historical content. Specifically, the prediction unit 305 may include a weighted subunit, which may be used to:
[0229] Through the initial recommendation model, the feature vector is weighted and summed according to the target weight value to obtain a weighted feature vector.
[0230] The historical content is predicted based on the weighted feature vector to obtain the predicted recommendation results for the historical content.
[0231] For example, if the historical content is product and user information, the feature vectors corresponding to the product and user information, as well as the corresponding target weight values, are weighted and summed to obtain the weighted feature vector of the product and the weighted feature vector of the user information, and the distance between the two vectors is calculated to obtain the predicted recommendation result based on the distance.
[0232] (6) Convergence unit 306:
[0233] The convergence unit 306 is configured to converge the predicted recommendation result and the target recommendation result to train the initial recommendation model to obtain a trained recommendation model, so as to recommend content to the terminal through the trained recommendation model.
[0234] For example, the weight adjustment parameters may be specifically determined based on the identification information, the weight adjustment parameters corresponding to historical contents with different identification information are different, and the weight adjustment parameters for back propagation adjustment are different.
[0235] Optionally, the convergence unit 306 may include a gradient subunit, which is configured to:
[0236] If the identification information is a target identification, the mean gradient of the mean parameter and the standard deviation gradient of the standard deviation parameter are calculated based on the predicted recommendation result and the target recommendation result through the loss function.
[0237] The mean parameter is adjusted according to the mean gradient to obtain the adjusted mean parameter.
[0238] The standard deviation parameter is adjusted according to the standard deviation gradient to obtain the adjusted standard deviation parameter.
[0239] According to the adjusted mean parameter and the adjusted standard deviation parameter, the predicted recommendation results and the target recommendation results are converged.
[0240] For example, if the identification information is the target identification information, the loss function is a function of the mean parameter m and the standard deviation parameter s, which can be expressed as: It can also be called function F. By solving the derivative of function F with respect to m and the derivative of function F with respect to s respectively, the mean gradient Δm of the mean parameter and the standard deviation gradient Δs of the standard deviation parameter are obtained.
[0241] According to m′=m+Δm·θ m , and obtain the adjusted mean parameter.
[0242] According to s′=s+Δs·θ s , and obtain the adjusted standard deviation parameter.
[0243] Among them, x i is the input feature vector, is the target recommendation result, m′ is the adjusted mean parameter, s′ is the adjusted standard deviation parameter, Δm is the mean gradient, Δs is the standard deviation gradient, θ m is the mean learning rate of the mean parameter, θ s is the standard deviation learning rate for the standard deviation parameter.
[0244] The mean learning rate and standard deviation learning rate can be adjusted according to actual conditions.
[0245] If the identification information is not the target identification information, the weight adjustment parameter of the back propagation adjustment is the mean parameter. Specifically, the method provided in the embodiment of the present application further includes:
[0246] If the identification information is not the target identification information, calculating the mean gradient based on the predicted recommendation result and the target recommendation result through a loss function;
[0247] Adjust the mean parameter according to the mean gradient to obtain the adjusted mean parameter;
[0248] According to the adjusted mean parameter, the predicted recommendation results and the target recommendation results are converged.
[0249] For example, if the identification information is not the target identification information, the target weight value corresponding to the feature vector is the mean parameter, that is, the loss function is Also called function F′, by solving the derivative of function F′ with respect to m, we can get the mean gradient Δm of the mean parameter. According to m′=m+Δm·θ m , and obtain the adjusted mean parameter.
[0250] The initial recommendation model obtains the corresponding target feature weight for the feature vector input later based on the adjusted mean parameter and adjusted standard deviation, and obtains the prediction result by predicting the feature vector. Then, the weight parameter is adjusted again through back propagation, and the initial model is continuously iterated until the initial recommendation model is trained.
[0251] Optionally, the convergence unit 306 may further include a recommendation subunit, which is configured to:
[0252] Obtain the content to be recommended, and perform feature extraction on the content to be recommended to obtain a content feature vector;
[0253] After training, the recommendation model is used to make recommendation predictions based on the content feature vector to obtain the prediction results;
[0254] Based on the recommendation prediction result, target recommended content is filtered out from the content to be recommended, and the target recommended content is recommended to the terminal.
[0255] For example, the specific process may be to obtain the content to be recommended, extract the features of the content to be recommended, and then the copper hot pot embedding may convert the features into content feature vectors. The trained recommendation model may perform weighted summation on the content feature vectors based on the trained weight values to obtain the prediction results, and recommend the content to be recommended to the terminal based on the prediction results.
[0256] In the embodiment of the present application, the acquisition unit 301 acquires the historical content of the training sample set; the vector unit 302 extracts the feature vector carrying identification information of the historical content; the parameter unit 303 determines the weight adjustment parameter of the feature vector based on the identification information; the weight unit 304 adjusts the weight value of the feature vector according to the weight adjustment parameter to obtain the target weight value; then, the prediction unit 305 predicts the historical content based on the feature vector and the target weight value through the initial recommendation model to obtain a predicted recommendation result; finally, the predicted recommendation result and the target recommendation result are converged by the convergence unit 306 to train the initial recommendation model to obtain a trained recommendation model, so as to recommend content to the terminal through the trained recommendation model. By determining the weight adjustment parameter based on the identification information and adjusting the weight, when the initial recommendation model is trained, there are differences between the weights, so that the prediction result output by the trained recommendation model is highly accurate, and accurate recommendation of relevant content is achieved.
[0257] The embodiment of the present application also provides a computer device. The embodiment of the present application also provides a computer device, which can be a server, such as Figure 6 As shown, it shows a schematic diagram of the structure of the server involved in the embodiment of the present application, specifically:
[0258] The server may include one or more processing core processors 401, one or more computer-readable storage media memories 402, a power supply 403, an input unit 404 and other components. Those skilled in the art will appreciate that Figure 6 The server structure shown in the figure does not constitute a limitation to the server, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0259] in:
[0260] Processor 401 is the server's control center, connecting various components of the server using various interfaces and circuits. By running or executing software programs and / or modules stored in memory 402 and accessing data stored in memory 402, it performs various server functions and processes data, thereby performing overall server testing. Optionally, processor 401 may include one or more processing cores; preferably, processor 401 may integrate an application processor and a modem processor, with the application processor primarily processing the operating system, user interface, and application programs, while the modem processor primarily handles wireless communications. It is understood that the modem processor may not be integrated into processor 401.
[0261] The memory 402 can be used to store software programs and modules. The processor 401 executes various functional applications and data processing by running the software programs and modules stored in the memory 402. The memory 402 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the server, etc. In addition, the memory 402 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage device. Accordingly, the memory 402 may also include a memory controller to provide the processor 401 with access to the memory 402.
[0262] The server also includes a power supply 403 for supplying power to various components. Preferably, the power supply 403 can be logically connected to the processor 401 via a power management system, thereby enabling the power management system to manage charging, discharging, and power consumption. The power supply 403 can also include one or more DC or AC power supplies, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and other arbitrary components.
[0263] The server may further include an input unit 404, which may be configured to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.
[0264] Although not shown, the server may further include a display unit, etc., which will not be described in detail here. Specifically, in this embodiment, the processor 401 in the server will load the executable files corresponding to one or more computer program processes into the memory 402 according to the following instructions, and the processor 401 will run the computer programs stored in the memory 402 to implement various functions as follows:
[0265] Acquire a training sample set; extract feature vectors of historical content; determine weight adjustment parameters of the feature vectors based on identification information; adjust the weight values of the feature vectors according to the weight adjustment parameters to obtain target weight values; predict historical content based on the feature vectors and the target weight values through an initial recommendation model to obtain predicted recommendation results; converge the predicted recommendation results with the target recommendation results to train the initial recommendation model to obtain a trained recommendation model, and recommend content to the terminal through the trained recommendation model.
[0266] The specific implementation of the above operations can be found in the previous embodiments and will not be described in detail here.
[0267] From the above, it can be seen that the server of this embodiment determines the weight adjustment parameters based on the identification information and adjusts the weights. When the initial recommendation model is trained, there are differences between the weights, so that the prediction results output by the recommendation model after training are highly accurate, thereby achieving accurate recommendation of relevant content.
[0268] Those skilled in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be accomplished by a computer program, or by controlling related hardware through a computer program. The computer program may be stored in a computer-readable storage medium and loaded and executed by a processor.
[0269] According to one aspect of the present application, a computer program product or computer program is provided, the computer program product or computer program including 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 executes the computer instructions, causing the computer device to perform the methods provided in various optional implementations of the above embodiments.
[0270] To this end, an embodiment of the present application provides a storage medium storing a computer program, which is loaded by a processor to execute any content recommendation method provided in the embodiment of the present application.
[0271] The specific implementation of each operation of the above-mentioned recommended method can be found in the previous embodiments and will not be repeated here.
[0272] The storage medium may include a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0273] Since the computer program stored in the storage medium can execute the steps of any content recommendation method provided in the embodiments of the present application, the beneficial effects that can be achieved by any content recommendation method provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.
[0274] The above is a detailed introduction to a content recommendation method, device, computer equipment and storage medium provided in the embodiments of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for technical personnel in this field, based on the ideas of the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A content recommendation method, characterized in that: include: Acquire a training sample set, where the training sample set includes at least one historical content recommended to the terminal, where the historical content carries a target recommendation result; Extracting a feature vector of the historical content, where the feature vector carries identification information; determining a weight adjustment parameter of the feature vector based on the identification information; Adjusting the weight value of the feature vector according to the weight adjustment parameter to obtain a target weight value; The weight adjustment parameters include a random parameter, a mean parameter, and a standard deviation parameter, and the weight value of the feature vector is adjusted according to the weight adjustment parameters to obtain a target weight value, including: if the identification information is target identification information, the weight value is adjusted according to the random parameter, the mean parameter, and the standard deviation parameter to obtain the target weight value; if the identification information is not target identification information, the weight value is adjusted according to the mean parameter to obtain the target weight value; Predicting the historical content based on the feature vector and the target weight value using an initial recommendation model to obtain a predicted recommendation result; Converging the predicted recommendation result with the target recommendation result to train the initial recommendation model and obtain a trained recommendation model, so as to recommend content to the terminal through the trained recommendation model; wherein, converging the predicted recommendation result with the target recommendation result comprises: if the identification information is target identification information, calculating the mean gradient of the mean parameter and the standard deviation gradient of the standard deviation parameter based on the predicted recommendation result and the target recommendation result through a loss function; adjusting the mean parameter according to the mean gradient to obtain an adjusted mean parameter; adjusting the standard deviation parameter according to the standard deviation gradient to obtain an adjusted standard deviation parameter; and converging the predicted recommendation result with the target recommendation result according to the adjusted mean parameter and the adjusted standard deviation parameter; If the identification information is not the target identification information, calculating the mean gradient based on the predicted recommendation result and the target recommendation result using a loss function; Adjusting the mean parameter according to the mean gradient to obtain an adjusted mean parameter; The predicted recommendation result and the target recommendation result are converged according to the adjusted mean parameter.
2. The method according to claim 1, characterized in that The initial recommendation model predicts the historical content based on the feature vector and the target weight value to obtain a predicted recommendation result, including: Performing weighted summation processing on the feature vector according to the target weight value using the initial recommendation model to obtain a weighted feature vector; The historical content is predicted according to the weighted feature vector to obtain a predicted recommendation result for the historical content.
3. The method according to any one of claims 1 to 2, characterized in that: The training sample set includes a sample set. Before obtaining the training sample set, the method further includes: Acquire candidate historical content in a sample set, where the candidate historical content carries the identification information, and the identification information includes a sampling rate; If the identification information is target identification information, the candidate historical content is sampled according to the sampling rate to obtain the historical content, and a training sample set is generated based on the historical content.
4. The method according to claim 1, wherein The extracting of the feature vector of the historical content, wherein the feature vector carries identification information, includes: extracting feature information of the historical content; Mapping the feature information to a corresponding preset dimension to obtain a sparse vector of the feature information; The sparse vector is converted into a feature vector based on a transformation matrix.
5. The method according to claim 1, wherein The method further comprises: Acquire content to be recommended, and perform feature extraction on the content to be recommended to obtain a content feature vector; Performing recommendation prediction based on the content feature vector using the trained recommendation model to obtain a prediction result; Target recommended content is screened out from the content to be recommended based on the recommendation prediction result, and the target recommended content is recommended to the terminal.
6. A content recommendation device, characterized in that: include: an acquisition unit, configured to acquire a training sample set, wherein the training sample set includes at least one historical content recommended to the terminal, the historical content carrying a target recommendation result; A vector unit, configured to extract a feature vector of the historical content, wherein the feature vector carries identification information; a parameter unit, configured to determine a weight adjustment parameter of the feature vector based on the identification information; a weight unit, configured to adjust the weight value of the feature vector according to the weight adjustment parameter to obtain a target weight value; the weight adjustment parameter includes a random parameter, a mean parameter, and a standard deviation parameter, and the weight unit is specifically configured to: if the identification information is target identification information, adjust the weight value according to the random parameter, the mean parameter, and the standard deviation parameter to obtain the target weight value; if the identification information is not target identification information, adjust the weight value according to the mean parameter to obtain the target weight value; A prediction unit, configured to predict the historical content based on the feature vector and the target weight value using an initial recommendation model to obtain a predicted recommendation result; A convergence unit, configured to converge the predicted recommendation result with the target recommendation result, so as to train the initial recommendation model and obtain a trained recommendation model, so as to recommend content to the terminal through the trained recommendation model; wherein the convergence unit is specifically configured to: if the identification information is target identification information, calculate the mean gradient of the mean parameter and the standard deviation gradient of the standard deviation parameter based on the predicted recommendation result and the target recommendation result through a loss function; adjust the mean parameter according to the mean gradient to obtain an adjusted mean parameter; adjust the standard deviation parameter according to the standard deviation gradient to obtain an adjusted standard deviation parameter; and converge the predicted recommendation result with the target recommendation result according to the adjusted mean parameter and the adjusted standard deviation parameter; If the identification information is not the target identification information, calculating the mean gradient based on the predicted recommendation result and the target recommendation result using a loss function; Adjusting the mean parameter according to the mean gradient to obtain an adjusted mean parameter; The predicted recommendation result and the target recommendation result are converged according to the adjusted mean parameter.
7. A storage medium, characterized in that: The storage medium is used to store a computer program, and the computer program is loaded by a processor to execute the content recommendation method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Click rate prediction method, prediction model training method and device and equipment
CN110363346A