Online learning method, video recommendation method and related apparatus
By using an integrated model to perform unified inference and parameter updates on training data and data to be inferred, the problems of model latency and poor resource utilization in online learning are solved, and timely updates of model parameters and efficient use of resources are achieved.
Patent Information
- Application Number
- CN202311142962.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-06
- Publication Date
- 2025-11-04
- Estimated Expiration
- 2043-09-06
AI Technical Summary
The problems of untimely model parameter updates and poor resource utilization in online learning methods lead to model deployment delays and wasted computing resources.
An integrated model is used to perform unified inference on training data and data to be inferred. Predicted data is obtained through forward computation, and the loss function is determined based on the truth label for backpropagation to update the model parameters, thus achieving the unification of training and inference.
It solves the problem of model application delay, improves resource utilization, ensures timely updates of model parameters, and enhances the real-time performance and accuracy of predictions.
Smart Images

Figure CN117313821B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of artificial intelligence, in particular to an online learning method, a video recommendation method and related devices. BACKGROUND
[0002] In the business of recommendation, advertisement and search, online learning is often used, that is, the training program continuously reads the latest training samples through the data source such as the message queue and continuously trains, and exports the model every certain period of time to send to the inference program for online service.
[0003] Such learning mode mainly has the following problems:
[0004] Firstly, the training task exports the model every certain period of time and then deploys it to the service, which causes some delay in the deployment of the model, and the latest model parameters cannot be applied to online inference.
[0005] Secondly, the training and inference of the model are independent modules, each using its own resources. Sometimes the training resources are relatively idle, and sometimes the inference resources are relatively idle, and the overall resource utilization is not good. SUMMARY
[0006] The purpose of the embodiments of the present application is to provide an online learning method, a video recommendation method and related devices to solve the problem of delay in applying the latest model to online inference and improve resource utilization. The specific technical solutions are as follows:
[0007] In the first aspect of the present application, an online learning method is first provided, comprising:
[0008] For the target data of the adjacent batch, the target data of the current batch is input into the integrated model for inference to obtain the predicted data of the target data of the current batch; the target data includes training data and to-be-inferred data, and the training data corresponds to a true value label;
[0009] Based on the predicted data corresponding to the training data of the current batch and the true value label corresponding to the training data of the current batch, the loss function of the integrated model is determined;
[0010] The loss function is back propagated to obtain an updated integrated model;
[0011] For the target data of the next adjacent batch, the updated integrated model is used for inference.
[0012] Optionally, after obtaining the updated integrated model, the method further comprises:
[0013] Inference is performed on the training data in the target data of the subsequent batch based on the updated integrated model to obtain predicted data corresponding to the training data;
[0014] Based on the predicted data corresponding to the training data of the subsequent batch and the true value label corresponding to the training data of the subsequent batch, a loss function of the updated integrated model is determined.
[0015] The loss function of the updated integrated model is back-propagated to obtain a further updated integrated model.
[0016] Optionally, before inputting the target data of the current batch into the integrated model for inference, the method further comprises:
[0017] determining whether the number of inference requests in the current inference request queue is not less than a preset batch number;
[0018] If yes, reading the preset batch number of to-be-inferred data from the inference request queue, and taking the read to-be-inferred data as the target data of the current batch;
[0019] If no, reading all to-be-inferred data from the inference request queue and reading a first number of training samples from the current training sample queue, and taking the read to-be-inferred data and training data as the target data of the current batch; the first number is the difference between the preset batch number and the number of read to-be-inferred data, and each training sample includes training data and a true value label corresponding to the training data.
[0020] Optionally, in the case where the number of inference requests in the current inference request queue is less than the preset batch number, if the number of training samples in the current training sample queue is less than the first number, the method further comprises:
[0021] reading all to-be-inferred data from the current inference request queue, reading all training samples from the current training sample queue, and taking the read inference data, the training data, and the training data corresponding to a second number of empty samples as the target data of the current batch; the second number is the difference between the first number and the number of read training samples.
[0022] Optionally, the integrated model is a click rate prediction model.
[0023] The training data includes first feature information of a sample user and second feature information of a sample video, and the true value label corresponding to the training data is the real click result of the sample user on the sample video; the to-be-inferred data includes third feature information of a target user and fourth feature information of a candidate recommended video.
[0024] The prediction data includes a predicted click rate of the sample user on the sample video and a predicted click rate of the target user on the candidate recommended video.
[0025] Optionally, after the current batch of target data is input into the integrated model for inference to obtain prediction data of the current batch of target data, the method further includes:
[0026] According to a prediction request corresponding to the current batch of inference data, the method further includes: determining associated data indicated by the prediction request based on the prediction data of the current batch of inference data, and returning the associated data to a request initiator of the prediction request; the prediction request includes a video recommendation request, and the associated data includes a recommendation list of candidate recommended videos with a predicted click rate higher than a click rate threshold.
[0027] In a second aspect of the embodiment of the present application, a video recommendation method is further provided, including:
[0028] obtaining model input data of a current batch; the model input data includes inference data and training data, the training data includes first feature information of a sample user and second feature information of a sample video, the training data corresponds to a real click result of the sample user on the sample video, and the inference data includes third feature information of a target user and fourth feature information of a plurality of candidate recommended videos;
[0029] inputting the model input data of the current batch into a click rate prediction model for inference to obtain prediction data of the model input data of the current batch; the prediction data includes a predicted click rate of the sample user on the sample video and a predicted click rate of the target user on the candidate recommended video;
[0030] For the predicted click rate corresponding to the inference data, a target recommended video is selected from the candidate recommended videos based on the predicted click rate corresponding to each candidate recommended video, and video recommendation is performed based on the target recommended video;
[0031] For the predicted click rate corresponding to the training data, a loss function of the click rate prediction model is determined based on the real click result and the predicted click result of the sample user on the sample video, and the loss function is back propagated to obtain an updated click rate prediction model, which is used to infer inference data in model input data of a next batch.
[0032] In a third aspect of the embodiment of the present application, an online learning device is further provided, including:
[0033] The first inference module is configured to input the target data of the current batch into the integrated model for inference to obtain predicted data of the target data of the current batch, wherein the target data comprises training data and to-be-inferred data, and the training data corresponds to a true value label;
[0034] The determining module is configured to determine a loss function of the integrated model based on the predicted data corresponding to the training data of the current batch and the true value label corresponding to the training data of the current batch.
[0035] The back propagation module is configured to perform back propagation on the loss function to obtain an updated integrated model.
[0036] The second inference module is configured to perform inference on the to-be-inferred data in the target data of the next batch of target data by using the updated integrated model.
[0037] In the fourth aspect of the present application, a video recommendation device is also provided, comprising:
[0038] The obtaining module is configured to obtain model input data of a current batch, wherein the model input data comprises to-be-inferred data and training data, the training data comprises first feature information of a sample user and second feature information of a sample video, the training data corresponds to a real click result of the sample user on the sample video, and the to-be-inferred data comprises third feature information of a target user and fourth feature information of a plurality of candidate recommended videos.
[0039] The input module is configured to input the model input data of the current batch into a click rate prediction model for inference to obtain predicted data of the model input data of the current batch, wherein the predicted data comprises a predicted click rate of the sample user on the sample video and a predicted click rate of the target user on the candidate recommended videos.
[0040] The recommendation module is configured to select a target recommended video from the candidate recommended videos based on the predicted click rate corresponding to each of the candidate recommended videos according to the predicted click rate corresponding to the to-be-inferred data, and perform video recommendation based on the target recommended video.
[0041] The updating module is configured to determine a loss function of the click rate prediction model based on the real click result and the predicted click result of the sample user on the sample video according to the predicted click rate corresponding to the training data, perform back propagation on the loss function, and obtain an updated click rate prediction model, wherein the updated click rate prediction model is used to perform inference on to-be-inferred data in model input data of a next batch.
[0042] In a fifth aspect of the embodiments of the present application, an electronic device is provided, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus;
[0043] a memory for storing a computer program;
[0044] a processor for executing the program stored in the memory to implement the online learning method or the video recommendation method of any one of the above.
[0045] In another aspect of the embodiments of the present application, a computer readable storage medium is also provided, which stores a computer program, and the computer program is executed by a processor to implement the online learning method or the video recommendation method of any one of the above.
[0046] In another aspect of the embodiments of the present application, a computer program product containing instructions, which, when run on a computer, causes the computer to execute the online learning method or the video recommendation method of any one of the above.
[0047] The online learning method provided by the embodiments of the present application packs the to-be-reasoned data and the training data into a batch of target data, inputs the current batch of target data into an integrated model, and performs unified reasoning on the to-be-reasoned data and the training data by the integrated model. After obtaining the prediction data of the current batch of target data, the loss function of the integrated model is determined based on the prediction data and the true value label corresponding to the training data in the target data, and the loss function is back propagated to obtain the updated integrated model. Therefore, after the integrated model completes the reasoning on the current batch of target data, the model parameters of the integrated model can be updated on the basis of the reasoning function of the to-be-reasoned data. Therefore, for the to-be-reasoned data in the next batch of target data, the integrated model used for reasoning is the updated integrated model based on the previous batch of training data. It can be seen that the updated integrated model based on the training data can be immediately applied to the next wave of data reasoning, solving the problem of delay when applying the latest model to online reasoning.
[0048] In addition, the traditional model application method needs to deploy computing resources for training and reasoning of the model respectively. When the training data or the to-be-reasoned data is insufficient, the corresponding computing resources will be in an idle state, and the overall utilization rate is not good. The embodiments of the present application input the target data into the integrated model, and perform unified reasoning on the to-be-reasoned data and the training data by the integrated model, so that the training and prediction processes of the model can share computing resources, which helps to improve the resource utilization rate. BRIEF DESCRIPTION OF DRAWINGS
[0049] In order to make the technical solutions in the embodiments of the present application or the prior art clearer, the accompanying drawings needed in the embodiments or prior art description will be briefly introduced below.
[0050] Figure 1 is a flowchart of an online learning method provided by an embodiment of the present application.
[0051] Figure 2 is a schematic diagram of an online learning method provided by an embodiment of the present application.
[0052] Figure 3 is a flowchart of a video recommendation method provided by an embodiment of the present application.
[0053] Figure 4 is a structural schematic diagram of an online learning device provided by an embodiment of the present application.
[0054] Figure 5 is a structural schematic diagram of a video recommendation device provided by an embodiment of the present application.
[0055] Figure 6 is a schematic block diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0056] The technical solutions in the embodiments of the present application will be described below with reference to the accompanying drawings in the embodiments of the present application.
[0057] In order to solve the problems of the existing online learning method that the model parameter is not updated in time and the resource utilization is not good, an online learning method is provided by an embodiment of the present application. The online learning method provided by the embodiment of the present application can be specifically applied to the training and prediction process of a neural network. The neural network applying the online learning method provided by the embodiment of the present application is referred to as an integrated model, and the type of the integrated model is not specifically limited by the embodiment of the present application.
[0058] As an example, the integrated model can be a convolutional neural network, a support vector machine or a deep convolutional neural network, etc. Correspondingly, the integrated model can be specifically used for performing a probability prediction task, etc.
[0059] Figure 1 is a flowchart of an online learning method provided by an embodiment of the present application, and Figure 1 the method specifically includes the following steps:
[0060] Step S101: For the target data of the adjacent batch, input the target data of the current batch into the integrated model for inference to obtain the prediction data of the target data of the current batch. The target data includes training data and to-be-inferred data, and the training data corresponds to a true value label.
[0061] Step S102: determining a loss function of the integrated model based on the predicted data corresponding to the current batch of training data and the true value label corresponding to the current batch of training data.
[0062] Step S103: performing back propagation on the loss function to obtain an updated integrated model.
[0063] Step S104: using the updated integrated model to perform inference on the to-be-inferred data in the target data of the next batch.
[0064] The online learning method provided by the embodiment of the present application packs the to-be-inferred data and the training data into a batch of target data, inputs the target data of the current batch into the integrated model, and performs unified inference on the to-be-inferred data and the training data by the integrated model. After obtaining the predicted data of the target data of the current batch, the loss function of the integrated model is determined based on the predicted data corresponding to the training data and the true value label, back propagation is performed, and an updated integrated model is obtained. Therefore, after the integrated model completes the inference on the target data of the current batch, the model parameters of the integrated model can be updated on the basis of the inference function of the to-be-inferred data. Therefore, for the to-be-inferred data in the target data of the next batch, the integrated model used for inference is specifically the integrated model updated based on the training data of the previous batch. It can be seen that the integrated model updated based on the training data can be immediately applied to the next wave of data inference, solving the problem of delay when applying the latest model to online inference.
[0065] In addition, the traditional model application method needs to deploy computing resources for training and inference of the model respectively. When the training data or the to-be-inferred data is insufficient, the corresponding computing resources will be in an idle state, and the overall utilization rate is not good. The embodiment of the present application inputs the target data into the integrated model, and performs unified inference on the to-be-inferred data and the training data by the integrated model, so that the training and prediction processes of the model can share computing resources, which helps to improve the resource utilization rate.
[0066] For the integrated model provided by the embodiment of the present application, the target data can be input into the integrated model for inference in batches, and each batch of target data can include two types of data, i.e., training data and to-be-inferred data, and the training data corresponds to a true value label.
[0067] The true value label of the training data is the true value of the data that needs to be predicted by the integrated model. As an example, if the integrated model is specifically used to perform a click rate prediction task of a video, the true value label of the training data is the true click result of the user on the video, i.e., the user actually clicks or does not click the video.
[0068] In step S101, after the target data of the current batch is input into the integrated model, the prediction data of the to-be-inferred data of the batch and the prediction data of the training data of the batch can be obtained.
[0069] In this process, the integrated model specifically obtains the prediction data of the target data of the current batch in a forward calculation manner. Specifically, the integrated model includes a plurality of network layers, the target data is input into the input layer of the integrated model, the calculation result of the previous network layer is further calculated by each network layer in the integrated model in sequence, and the calculation result of the current layer is transmitted to the next network layer until the prediction value of the target data is output at the output layer. The specific process of forward calculation can refer to the content in the related art, which will not be described in detail here.
[0070] In step S102, after obtaining the prediction data of the target data of the current batch, the prediction data of the to-be-inferred data can be actually applied to the related business, and the use of the prediction data is not specifically limited by the embodiments of the present application. As an example, if the integrated model is specifically a classification model, a class label can be added to the to-be-inferred data based on the prediction data output by the integrated model.
[0071] For the training data, the current loss function of the integrated model can be determined based on the prediction data corresponding to the training data of the current batch and the true value label.
[0072] Specifically, the loss function can be determined based on actual requirements, and the specific algorithm of the loss function is not limited by the embodiments of the present application. As an example, the loss function of the integrated model can be calculated based on the mean square error, Euclidean distance or cross-entropy loss between the prediction data corresponding to the training data and the true value label.
[0073] For step S103, after the loss function of the integrated model is determined based on the prediction data corresponding to the training data of the current batch and the true value label, the trained loss function can be back propagated to obtain the updated integrated model.
[0074] As described above, the integrated model involved in the embodiments of the present application specifically includes a plurality of network layers. In the process of forward calculation of the target data in the foregoing step S101, the calculation result of each network layer is processed based on a certain calculation rule, and the processed data is used as the input data of the next network layer until the prediction data is obtained at the output layer.
[0075] Therefore, in the process of performing the forward calculation, when the data transmission between the network layers is performed based on a specific calculation rule, the model parameters of the integrated model are involved, and the accuracy of the model parameters has a decisive effect on the accuracy of the predicted data. The integrated model is trained, specifically, the model parameters of the integrated model are updated.
[0076] As an example, for the calculation result of a network layer, the calculation result can be multiplied by the weight matrix between the current network layer and the next network layer, and then processed through an activation function, so as to obtain the input data of the next network layer. In this example, the weight matrix of each network layer is the model parameter of the integrated model.
[0077] In this step, the loss function is back propagated, specifically, according to the chain rule of derivation, for each network layer in the integrated model, the gradient of the loss function with respect to each neuron in the network layer is calculated layer by layer in the order from the output layer to the input layer, and then the model parameters of the current integrated model are updated according to the gradient descent method, so as to obtain the updated integrated model. The specific process of back propagation can refer to the content in the related art, which will not be described in detail here.
[0078] It should be understood that in the embodiments of the present application, the target data of the adjacent batches is listed only for the purpose of illustrating the iterative updating process of the model, and does not constitute a limitation on the order of obtaining different batches of target data. As an example, the target data of the next batch can be obtained after the integrated model completes the calculation of the target data of the current batch.
[0079] The online learning method provided by the embodiments of the present application packs the to-be-reasoned data and the training data into a batch of target data, inputs the target data of the current batch into the integrated model, and performs unified reasoning on the to-be-reasoned data and the training data by the integrated model. After obtaining the predicted data of the target data of the current batch, the loss function of the integrated model is determined based on the predicted data corresponding to the training data and the true value label, back propagation is performed, and the updated integrated model is obtained. Therefore, after the integrated model completes the reasoning for the target data of the current batch, the model parameters thereof can also be updated on the basis of realizing the reasoning function for the to-be-reasoned data. Therefore, for the to-be-reasoned data in the target data of the next adjacent batch, the integrated model used for reasoning thereof is specifically the integrated model updated based on the training data of the previous batch. It can be seen that the integrated model updated based on the training data can be immediately applied to the next wave of data reasoning, solving the problem of delay when applying the latest model to online reasoning.
[0080] In addition, the traditional model application method needs to separately deploy computing resources for model training and inference, and when the training data or to-be-inferred data is insufficient, the corresponding computing resources will be in an idle state, and the overall utilization rate is poor. The embodiment of the present application inputs the target data into the integrated model, and uniformly infers the to-be-inferred data and the training data by the integrated model, so that the training and prediction processes of the model can share computing resources, which helps to improve the resource utilization rate.
[0081] In an embodiment of the present application, after obtaining the updated integrated model, the method further comprises:
[0082] inferring the training data in the target data of the subsequent batch based on the updated integrated model to obtain prediction data corresponding to the training data;
[0083] determining a loss function of the updated integrated model based on the prediction data corresponding to the training data of the subsequent batch and the true value label corresponding to the training data of the subsequent batch;
[0084] performing back propagation on the loss function of the updated integrated model to obtain a further updated integrated model.
[0085] In the embodiment of the present application, after completing the inference on one batch of target data by the integrated model and updating the model based on the prediction data corresponding to the training data of the batch and the true value label, the updated integrated model can be immediately applied to infer the to-be-inferred data and the training data of the next batch, so that after obtaining the prediction data corresponding to the training data of the next batch, the updated integrated model can be further updated.
[0086] That is, after the integrated model completes the inference on each batch of target data, the model parameters of the integrated model can be updated, and the updated integrated model can immediately participate in a new round of parameter update process by calculating the target data of the next batch. Therefore, in actual application, the specific parameters of the integrated model will be dynamically updated with the input of new batches of target data, so that the integrated model can quickly adapt to the feature changes of new data and improve the computing efficiency.
[0087] In an embodiment of the present application, the integrated model is a click rate prediction model.
[0088] The training data includes first feature information of a sample user and second feature information of a sample video, and the true value label corresponding to the training data is a real click result of the sample user on the sample video; the to-be-inferred data includes third feature information of a target user and fourth feature information of a candidate recommended video;
[0089] The prediction data includes a predicted click rate of a sample user on a sample video and a predicted click rate of a target user on a candidate recommended video.
[0090] In actual application, for a video recommendation task, a click rate prediction model is often applied, which is specifically used to predict a probability of a user clicking a specific video, so as to determine whether to recommend the video to the user based on the size of the probability.
[0091] In the embodiment of the present application, the training data specifically includes first feature information of a sample user and second feature information of a sample video, wherein the sample video can specifically be a video exposed to the sample user. The specific content of the first feature information and the second feature information can be selected based on actual needs, and the embodiment of the present application does not limit this. As an example, the first feature information can be the age, gender, and favorite label of the sample user, and the second feature information can be the video type, video label, and actor information of the sample video.
[0092] In addition, the true value label corresponding to the training data is specifically the real click result of the sample user on the sample video, which can specifically mean that the sample user actually clicked the sample video or that the sample user did not actually click the sample video.
[0093] The to-be-reasoned data specifically includes third feature information of a target user and fourth feature information of a candidate recommended video. The target user is specifically a user to whom a video needs to be recommended, and the candidate recommended video is a video on which the target user's predicted click rate needs to be predicted in the future. The third feature information and the fourth feature information correspond to the first feature information and the second feature information, respectively, and will not be described here.
[0094] After the training data and the to-be-reasoned data are input into the click rate prediction model, the click rate prediction model can output the predicted click rate of the sample user on the sample video and the predicted click rate of the target user on the candidate recommended video. Based on the predicted click rate of the sample user on the sample video, in combination with the real click result of the sample user on the sample video, the loss function of the click rate prediction model is determined and back propagation is performed, so that the update of the click rate prediction model can be realized; the predicted click rate of the target user on the candidate recommended video can be used in the execution of the video recommendation task.
[0095] Therefore, when the integrated model involved in the online learning method provided by the embodiment of the present application is specifically a click rate prediction model applied in a video recommendation task, the click rate prediction model after each training can reflect the current user's preference for different types of videos in real time, and the trained click rate prediction model can be immediately used to predict the click rate of the target user on the candidate recommended video, so that the predicted click rate obtained has higher real-time performance and accuracy.
[0096] In an embodiment of the present application, before the foregoing inputting the target data of the current batch into the integrated model for inference, further comprising:
[0097] determining whether the number of inference requests in the current inference request queue is not less than the preset batch number;
[0098] if yes, reading the preset batch number of to-be-inferred data from the inference request queue, and taking the read to-be-inferred data as the target data of the current batch;
[0099] if no, reading all to-be-inferred data from the inference request queue, and reading the first number of training samples from the current training sample queue, and taking the read to-be-inferred data and training data as the target data of the current batch; the first number is the difference between the preset batch number and the number of read to-be-inferred data, and each training sample includes training data and a true value label corresponding to the training data.
[0100] In an embodiment of the present application, the preset batch number can be set before calculation by the integrated model, that is, the number of target data of each batch. The specific value of the preset batch number can be selected based on actual needs, and the present application does not limit this.
[0101] Specifically, in the process of applying the integrated model, the to-be-predicted data that needs to be inferred by the integrated model can be obtained in real time through the inference request queue, and the training sample that can be used to train the integrated model can be obtained in real time through the training sample queue, and the inference request queue and the training sample queue can be updated in real time.
[0102] Before each batch of calculation based on the integrated model, the target data of the current batch needs to be obtained through the inference request queue and the training sample queue. In an embodiment of the present application, it is first determined whether the number of inference requests in the inference request queue is not less than the preset batch number.
[0103] if yes, reading the preset batch size of to-be-inferred data from the inference request queue as the target data of the current batch, that is, the target data of the current batch only contains to-be-inferred data, and does not contain training data.
[0104] if no, reading all to-be-inferred data from the inference request queue, and reading training samples from the training sample queue, and supplementing the number of target data of the current batch to the preset batch number through training data.
[0105] As an example, in a case that the preset batch quantity is M and the current inference request queue contains N inference requests, if N≥M, M pieces of inference data to be inferred are read from the inference request queue as the target data of the current batch; if N
[0106] In the embodiment of the present application, in a case that the preset batch quantity is preset, when determining the target data of each batch, the inference data to be inferred is preferentially read from the inference request queue as the target data, and in a case that the number of inference requests in the inference request queue is less than the preset batch quantity, the training data is read from the training sample queue to supplement the target data of the current batch. On the basis of solving the problem of delay in applying the latest model to online inference, the inference data to be inferred is preferentially used as the target data, which can ensure the instantaneity of obtaining the prediction data when the integrated model is applied for prediction.
[0107] In an embodiment of the present application, in a case that the number of inference requests in the current inference request queue is less than the preset batch quantity, if the number of training samples in the current training sample queue is less than the first quantity, the training and prediction integrated online learning method provided by the embodiment of the present application further comprises:
[0108] reading all inference data to be inferred from the current inference request queue, reading all training samples from the current training sample queue, and using the read inference data, training data and training data corresponding to the second quantity of empty samples as the target data of the current batch; the second quantity is the difference between the first quantity and the number of read training samples.
[0109] In the embodiment of the present application, between the calculation of each batch based on the integrated model, if the sum of the number of inference requests in the current inference request queue and the number of training samples in the current training sample queue is less than the preset batch quantity, the number of target data of the current batch can be supplemented to the preset batch quantity by the empty samples.
[0110] Specifically, the integrated model needs to calculate the prediction value of the target data based on the features of the target data. The empty sample in the embodiment of the present application is a sample that does not carry feature information. As an example, the empty sample can be data that can represent the attributes that the sample needs to have, but does not carry feature information. For example, if the integrated model is specifically used for predicting the click rate, the sample user in the empty sample does not carry the first feature information, and the sample video does not carry the second feature information.
[0111] As an example, if the preset batch quantity is M, and the current inference request queue contains N inference requests, and the current training sample queue contains O training samples, if N < M, and O < (M-N), then the N inference data in the inference request queue, the O training data in the training sample queue, and the training data corresponding to M-N-O empty samples can be used as the target data of the current batch.
[0112] In the embodiment of the present application, in the case that the sum of the number of inference requests in the current inference request queue and the number of training samples in the current training sample queue is less than the preset batch quantity, the target data of the current batch is supplemented by the training data corresponding to the empty samples, which helps to ensure the training effect of the integrated model, and further improves the prediction effect of the integrated model.
[0113] In an embodiment of the present application, after the foregoing inputting the target data of the current batch into the integrated model for inference to obtain the prediction data of the target data of the current batch, the method further comprises:
[0114] According to the inference request corresponding to the to-be-inferred data of the current batch, based on the prediction data of the to-be-inferred data of the current batch, the associated data indicated by the inference request is determined, and the associated data is returned to the request initiator of the inference request; the inference request includes a video recommendation request, and the associated data includes a recommendation list of candidate recommended videos whose predicted click rate is higher than a click rate threshold.
[0115] As mentioned above, the embodiment of the present application can read inference data from the inference request queue as the target data of the current batch.
[0116] In the embodiment of the present application, for the inference request in the inference request queue, the request initiator corresponding to each inference request can be recorded. After completing the inference on the target data of the current batch, for the prediction data of the to-be-inferred data, based on the inference request corresponding to the to-be-inferred data, the data actually needed by the inference request initiator can be determined, and the associated data indicated by the inference request can be determined based on the prediction data of the to-be-inferred data, and the associated data is returned to the request initiator of the inference request, so that the request initiator can obtain the associated data corresponding to the inference request in time, and further process the associated data based on the task demand.
[0117] The specific association data can be selected based on actual requirements, and embodiments of the present application do not limit this. When the integrated model is specifically a click rate prediction model participating in a video recommendation task, the inference request is specifically a video recommendation request. In this case, based on the predicted click rates obtained for each candidate recommended video, the inference list of the candidate recommended video with a predicted click rate higher than a click rate threshold is taken as the association data, and this association data is returned to the inference request party, so that the inference request party can recommend the candidate recommended video based on this.
[0118] Figure 2 is a schematic diagram of the online learning method provided by the embodiments of the present application, and the following will be described in combination with Figure 2 The online learning method provided by the embodiments of the present application is further described.
[0119] Referring to Figure 2 , Figure 2 Specifically, the process of calculating the target data of one batch based on the online learning method provided by the embodiments of the present application is shown, and in the embodiments of the present application, the preset batch quantity is specifically set as M. The calculation of the target data of each batch can be specifically divided into two processes of step 1 and step 2.
[0120] Step 1 is the model forward calculation process. Before starting the calculation of the current batch, it is first judged whether the number N of inference requests in the current inference request is not less than M. If yes, M inference data to be inferred are read from the inference request queue, and no training data is put into the target data of the current batch. If no, M-N training data are read from the message queue, and in the case that the number of training data in the current training sample queue is less than M-N, M-N training data are supplemented by empty samples. Under this request, the target data of the current batch specifically includes N inference data to be inferred and M-N training data. The model forward calculation is performed through the integrated model, and M prediction results corresponding to M target data can be specifically obtained, that is, M prediction data.
[0121] Step 2, that is, the model back propagation process, for the target data input in step 1, for the N prediction results corresponding to the N to-be-reasoned data, the associated data corresponding to the reasoning request can be determined based on the N prediction results, and the associated data is returned to the request initiator corresponding to the to-be-reasoned data; for the M-N prediction results corresponding to the M-N training data respectively, based on the M-N prediction results and the M-N labels corresponding to the M-N training data respectively, the loss function of the integrated model is calculated, the model back propagation is performed based on the loss function, and the model parameters of the integrated model are updated, that is, the updated integrated model is obtained. The updated integrated model can be specifically used for calculating the next batch of target data, and the process of calculating the next batch of target data is the same as that of steps 1-2.
[0122] It can be seen that, by applying the online learning method provided in the embodiments of the present application, the integrated model updated based on the training samples can be immediately applied to the data reasoning of the next batch, thereby solving the problem of delay in applying the latest model to online reasoning, and the unified forward calculation of the to-be-reasoned data and the training data by the integrated model also helps to improve the resource utilization rate.
[0123] Correspondingly, the embodiments of the present application also provide a video recommendation method, Figure 3 is a flowchart of the video recommendation method provided by the embodiments of the present application, referring to Figure 3 , the method specifically comprises the following steps:
[0124] Step S301: obtaining model input data of a current batch; the model input data comprises to-be-reasoned data and training data, the training data comprises first feature information of a sample user and second feature information of a sample video, the training data corresponds to a real click result of the sample user on the sample video, and the to-be-reasoned data comprises third feature information of a target user and fourth feature information of a plurality of candidate recommended videos;
[0125] Step S302: inputting the model input data of the current batch into a click rate prediction model for reasoning to obtain prediction data of the model input data of the current batch; the prediction data comprises a predicted click rate of the sample user on the sample video and a predicted click rate of the target user on the candidate recommended video;
[0126] Step S303: for the predicted click rate corresponding to the to-be-reasoned data, selecting a target recommended video from the candidate recommended videos based on the predicted click rate corresponding to each candidate recommended video, and performing video recommendation based on the target recommended video;
[0127] Step S304: For the predicted click rate corresponding to the training data, based on the real click result and the predicted click result of the sample user on the sample video, a loss function of the click rate prediction model is determined, and the loss function is back propagated to obtain an updated click rate prediction model, and the updated click rate prediction model is used to infer the to-be-inferred data in the next batch of model input data.
[0128] In the embodiments of the present application, the latest to-be-inferred data and training data can be obtained in real time through the inference request queue and the training sample queue as the current batch of model input data. The to-be-inferred data specifically includes the third feature information of the target user and the third feature information of the plurality of candidate recommended videos. Subsequently, the target recommended video that needs to be recommended to the target user needs to be determined from the candidate recommended videos. The range of the candidate recommended videos can be selected based on actual needs, and the embodiments of the present application do not limit this. As an example, the video whose video type matches the interest label of the target user can be used as the candidate recommended video.
[0129] After the current batch of model input data is input into the click rate prediction model, the click rate prediction model can output the predicted click rate of the sample user on the sample video and the predicted click rate of the target user on the candidate recommended video. Thus, the target recommended video can be selected from the candidate recommended video based on the predicted click rate corresponding to each candidate recommended video. Specifically, the video whose predicted click rate is higher than the pre-set click rate threshold can be selected as the target recommended video, and the target recommended video is recommended to the target user.
[0130] For the predicted click rate of the sample user on the sample video output by the click rate prediction model, the loss function of the click rate prediction model can be determined in combination with the real click result of the sample user on the sample video, and the loss function is back propagated to update the corresponding click rate prediction model, and the updated click rate prediction model can be immediately applied to infer the next batch of model input data. The process of obtaining the next batch of model input data is the same as step S301.
[0131] The specific details involved in this process can refer to the description in the foregoing online learning method embodiments, which will not be repeated here.
[0132] The video recommendation method provided by the embodiment of the present application specifically applies a click rate prediction model to predict the click rate of a target user on a candidate recommended video, and selects a target recommended video from the candidate recommended video based on the predicted click rate corresponding to each candidate recommended video to perform video recommendation. Moreover, in this process, the current batch of model input data input into the click rate prediction model specifically includes training data and to-be-reasoned data, so after the click rate prediction model completes reasoning on the current batch of model input data, in addition to being able to obtain the predicted click rate required by the video recommendation task, the update of the click rate prediction model can also be realized, and the updated click rate prediction model can be immediately applied to reasoning on the to-be-reasoned data in the next batch of model input data, so that the updated click rate prediction model can be immediately used to predict the click rate of a target user on a candidate recommended video, so that the predicted click rate has higher real-time performance and accuracy, and on this basis, the video recommendation effect is also better.
[0133] Based on the same inventive concept, the embodiment of the present application also provides an online learning device, see Figure 4 The device comprises:
[0134] The first reasoning module 401 is configured to input the target data of the current batch into the integrated model to perform reasoning on the target data of the adjacent batch, and obtain the predicted data of the target data of the current batch; the target data comprises training data and to-be-reasoned data, and the training data corresponds to a true value label;
[0135] The determination module 402 is configured to determine the loss function of the integrated model based on the predicted data corresponding to the training data of the current batch and the true value label corresponding to the training data of the current batch;
[0136] The back propagation module 403 is configured to perform back propagation on the loss function to obtain an updated integrated model;
[0137] The second reasoning module 404 is configured to use the updated integrated model to perform reasoning on the to-be-reasoned data in the target data of the next adjacent batch.
[0138] The online learning device provided by the embodiment of the present application packs the data to be inferred and the training data into a batch of target data, inputs the target data of the current batch into the integrated model, and performs unified inference on the data to be inferred and the training data by the integrated model. After obtaining the prediction data of the target data of the current batch, the loss function of the integrated model is determined based on the prediction data and the true value label corresponding to the training data in the target data of the current batch, and the loss function is back propagated to obtain the updated integrated model. Therefore, after the integrated model completes the inference on the target data of the current batch, the model parameters of the integrated model can be updated on the basis of realizing the inference function of the data to be inferred. Therefore, for the data to be inferred in the target data of the next batch, the integrated model used for inferring the data to be inferred is the updated integrated model based on the training data of the previous batch. It can be seen that the updated integrated model based on the training data can be immediately applied to the next wave of data inference, thereby solving the problem of delay when applying the latest model to online inference.
[0139] In addition, the traditional model application needs to deploy computing resources for the inference of the training of the model respectively. When the training data or the data to be inferred is insufficient, the corresponding computing resources will be in an idle state, and the overall utilization rate is poor. The embodiment of the present application inputs the target data into the integrated model, and performs unified inference on the data to be inferred and the target data by the integrated model, so that the training and prediction processes of the model can share computing resources, which helps to improve the resource utilization rate.
[0140] In an embodiment of the present application, the device further comprises:
[0141] The second inference module is configured to perform inference on the training data in the target data of the next batch based on the updated integrated model, and obtain prediction data corresponding to the training data.
[0142] The determination module 402 is further configured to determine the loss function of the updated integrated model based on the prediction data corresponding to the training data of the next batch and the true value label corresponding to the training data of the next batch.
[0143] The back propagation module 403 is further configured to back propagate the loss function of the updated integrated model to obtain a further updated integrated model.
[0144] In an embodiment of the present application, the device further comprises:
[0145] The reading module is configured to determine whether the number of inference requests in the current inference request queue is not less than a preset batch number; if yes, read the preset batch number of to-be-inferred data from the inference request queue, and take the read to-be-inferred data as target data of a current batch; if no, read all to-be-inferred data from the inference request queue, and read the first number of training samples from the current training sample queue, and take the read to-be-inferred data and training data as target data of the current batch; the first number is a difference between the preset batch number and the number of read to-be-inferred data, and each training sample includes training data and a true value label corresponding to the training data.
[0146] In an embodiment of the present application, in the case where the number of inference requests in the current inference request queue is less than the preset batch number, if the number of training samples in the current training sample queue is less than the first number, the reading module is further configured to:
[0147] read all to-be-inferred data from the current inference request queue, read all training samples from the current training sample queue, and take the read inference data, training data, and training data corresponding to the second number of empty samples as target data of the current batch; the second number is a difference between the first number and the number of read training samples.
[0148] In an embodiment of the present application, the integrated model is a click rate prediction model.
[0149] The training data includes first feature information of a sample user and second feature information of a sample video, and the true value label corresponding to the training data is a real click result of the sample user on the sample video; the to-be-inferred data includes third feature information of a target user and fourth feature information of a candidate recommended video.
[0150] The prediction data includes a predicted click rate of the sample user on the sample video and a predicted click rate of the target user on the candidate recommended video.
[0151] In an embodiment of the present application, the device further includes:
[0152] The returning module is configured to determine, according to an inference request corresponding to the to-be-inferred data of the current batch, associated data indicated by the inference request based on the prediction data of the to-be-inferred data of the current batch, and return the associated data to a request initiator of the inference request; the inference request includes a video recommendation request, and the associated data includes a recommendation list of a candidate recommended video with a predicted click rate higher than a click rate threshold.
[0153] Based on the same inventive concept, an embodiment of the present application further provides a video recommendation device, which is described below with reference to Figure 5 The device includes:
[0154] The acquisition module 501 is configured to acquire model input data of a current batch; the model input data comprises to-be-reasoned data and training data, the training data comprises first feature information of a sample user and second feature information of a sample video, the training data corresponds to a real click result of the sample user on the sample video, and the to-be-reasoned data comprises third feature information of a target user and fourth feature information of a plurality of candidate recommended videos;
[0155] The input module 502 is configured to input the model input data of the current batch into an integrated model for reasoning to obtain predicted data of the model input data of the current batch; the predicted data comprises a predicted click rate of the sample user on the sample video and a predicted click rate of the target user on the candidate recommended video.
[0156] The recommendation module 503 is configured to select a target recommended video from the candidate recommended video based on the predicted click rate corresponding to each candidate recommended video according to the predicted click rate corresponding to the to-be-reasoned data, and perform video recommendation based on the target recommended video.
[0157] The update module 504 is configured to determine a loss function of the integrated model based on the real click result and the predicted click result of the sample user on the sample video according to the predicted click rate corresponding to the training data, and perform back propagation on the loss function to obtain an updated integrated model, and the updated integrated model is used to reason the to-be-reasoned data in model input data of a next batch.
[0158] The video recommendation device provided by the embodiment of the application specifically applies a click rate prediction model to predict the click rate of the target user on the candidate recommended video, and selects a target recommended video from the candidate recommended video based on the predicted click rate corresponding to each candidate recommended video to perform video recommendation. In this process, the model input data of the current batch input into the click rate prediction model specifically comprises training data and to-be-reasoned data, so that after the click rate prediction model completes reasoning on the model input data of the current batch, the predicted click rate required by the video recommendation task can be obtained, and the update of the click rate prediction model can be realized, and the updated click rate prediction model can be immediately applied to reasoning the to-be-reasoned data in model input data of a next batch, so that the updated click rate prediction model can be immediately used to predict the click rate of the target user on the candidate recommended video, so that the predicted click rate has higher real-time performance and accuracy, and on this basis, the video recommendation effect is better.
[0159] The embodiment of the application further provides an electronic device, as shown in the figure, comprising a processor 601, a communication interface 602, a memory 603 and a communication bus 604, wherein the processor 601, the communication interface 602 and the memory 603 complete mutual communication through the communication bus 604, Figure 6 as shown, comprising a processor 601, a communication interface 602, a memory 603 and a communication bus 604, wherein the processor 601, the communication interface 602 and the memory 603 complete mutual communication through the communication bus 604,
[0160] a memory 603, configured to store a computer program;
[0161] a processor 601, configured to implement the following steps when executing the program stored in the memory 603:
[0162] inputting the target data of the current batch into the integrated model for inference, to obtain predicted data of the target data of the current batch, the target data comprising training data and to-be-inferred data, the training data corresponding to a true value label;
[0163] determining a loss function of the integrated model based on the predicted data corresponding to the training data of the current batch and the true value label corresponding to the training data of the current batch;
[0164] performing back propagation on the loss function to obtain an updated integrated model;
[0165] using the updated integrated model to infer the to-be-inferred data in the target data of the subsequent batch.
[0166] The communication bus mentioned above can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For the convenience of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or only one type of bus.
[0167] The communication interface is configured to communicate between the terminal and other devices.
[0168] The memory can include a Random Access Memory (RAM) and can also include a non-volatile memory, such as at least one disk memory. Optionally, the memory can also be at least one storage device located away from the aforementioned processor.
[0169] The processor described above can be a general processor, including a central processing unit (CPU), a network processor (NP), etc.; or can be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component.
[0170] In yet another embodiment provided by the present application, a computer readable storage medium is provided, and the computer readable storage medium stores a computer program. The computer program is executed by a processor to implement the training and prediction integrated online learning method according to any one of the above embodiments.
[0171] In yet another embodiment provided by the present application, a computer program product is provided, and the computer program product includes instructions. When the computer program product is executed on a computer, the computer is caused to perform the training and prediction integrated online learning method according to any one of the above embodiments.
[0172] In the above embodiments, the implementation can be achieved by software, hardware, firmware or any combination thereof, entirely or partially. When the implementation is achieved by software, the implementation can be achieved in the form of a computer program product, entirely or partially. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the flow or function described in the embodiments of the present application is entirely or partially generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network or other programmable device. The computer instructions can be stored in a computer readable storage medium or transferred from one computer readable storage medium to another computer readable storage medium, for example, the computer instructions can be transferred from one website, computer, server or data center to another website, computer, server or data center through wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) mode. The computer readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. integrated with one or more available media. The available medium can be a magnetic medium (such as a floppy disk, a hard disk, a magnetic tape), an optical medium (such as a DVD), or a semiconductor medium (such as a solid state disk (SSD)), etc.
[0173] It is to be noted that, in the present text, the relative terms such as first and second and the like are used merely to differentiate one entity or operation from another entity or operation, without necessarily requiring or implying any such actual relationship or order between such entities or operations. Moreover, the terms "comprising", "including", or any other variant thereof are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can also include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element preceded by "comprises a" does not, without more limitations, preclude the existence of additional identical elements in the process, method, article, or apparatus that includes the element.
[0174] Each of the embodiments in the present specification is described in a relevant manner, and the same or similar parts between the embodiments can be referred to each other. Each of the embodiments focuses on the difference from other embodiments. In particular, for the online learning device, the electronic device, and the readable storage medium embodiments of training and prediction integration, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the part of the method embodiments.
[0175] The above only describes the preferred embodiments of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. An online learning method, characterized by, The method comprises the following steps: inputting target data of a current batch into an integrated model to perform inference, to obtain predicted data of the target data of the current batch; the target data comprises training data and to-be-inferred data, and the training data corresponds to a true value label; determining a loss function of the integrated model based on the predicted data corresponding to the training data of the current batch and the true value label corresponding to the training data of the current batch; performing back propagation on the loss function to obtain an updated integrated model; performing inference on to-be-inferred data in target data of a subsequent batch by using the updated integrated model; before the step of inputting the target data of the current batch into the integrated model to perform inference, the method further comprises the following steps: determining whether the number of inference requests in a current inference request queue is not less than a preset batch quantity; the preset batch quantity is the number of target data of each batch; if yes, reading the preset batch quantity of to-be-inferred data from the inference request queue, and taking the read to-be-inferred data as the target data of the current batch; if no, reading all to-be-inferred data from the inference request queue, and reading a first quantity of training samples from a current training sample queue, and taking the read to-be-inferred data and training data as the target data of the current batch; the first quantity is the difference between the preset batch quantity and the number of the read to-be-inferred data, and each training sample comprises training data and a true value label corresponding to the training data.
2. The method of claim 1, wherein, after obtaining the updated integrated model, the method further comprises the following steps: performing inference on training data in target data of a subsequent batch based on the updated integrated model, to obtain predicted data corresponding to the training data; determining a loss function of the updated integrated model based on the predicted data corresponding to the training data of the subsequent batch and the true value label corresponding to the training data of the subsequent batch; performing back propagation on the loss function of the updated integrated model to obtain a further updated integrated model.
3. The method of claim 1, wherein, in the case where the number of inference requests in the current inference request queue is less than the preset batch quantity, if the number of training samples in the current training sample queue is less than the first quantity, the method further comprises the following steps: reading all to-be-inferred data from the current inference request queue, reading all training samples from the current training sample queue, and taking the read inference data, the training data and training data corresponding to a second quantity of empty samples as the target data of the current batch; the second quantity is the difference between the first quantity and the number of the read training samples.
4. The method according to any one of claims 1-3, characterized in that, the integrated model is a click rate prediction model; the training data comprises first feature information of a sample user and second feature information of a sample video, and the true value label corresponding to the training data is a real click result of the sample user on the sample video; the to-be-inferred data comprises third feature information of a target user and fourth feature information of a candidate recommended video; the predicted data comprises a predicted click rate of the sample user on the sample video and a predicted click rate of the target user on the candidate recommended video.
5. The method of claim 4, wherein, The method further includes, after the inputting the target data of the current batch into the integrated model for inference to obtain predicted data of the target data of the current batch: According to a prediction request corresponding to the to-be-inferred data of the current batch, based on the predicted data of the to-be-inferred data of the current batch, determining associated data indicated by the prediction request, and returning the associated data to a request initiator of the prediction request; the prediction request includes a video recommendation request, and the associated data includes a recommendation list of candidate recommended videos with a predicted click rate higher than a click rate threshold. 6.A video recommendation method, characterized in that, The method further includes: obtaining model input data of a current batch; the model input data includes to-be-inferred data and training data, the training data includes first feature information of a sample user and second feature information of a sample video, the training data corresponds to a real click result of the sample user on the sample video, and the to-be-inferred data includes third feature information of a target user and fourth feature information of a plurality of candidate recommended videos; inputting the model input data of the current batch into a click rate prediction model for inference to obtain predicted data of the model input data of the current batch; the predicted data includes a predicted click rate of the sample user on the sample video and a predicted click rate of the target user on the candidate recommended videos; for the predicted click rate corresponding to the to-be-inferred data, selecting a target recommended video from the candidate recommended videos based on the predicted click rate corresponding to each candidate recommended video, and performing video recommendation based on the target recommended video; for the predicted click rate corresponding to the training data, based on the real click result and the predicted click result of the sample user on the sample video, determining a loss function of the click rate prediction model, and performing back propagation on the loss function to obtain an updated click rate prediction model, the updated click rate prediction model being used to infer to-be-inferred data in model input data of a next batch; Before the inputting the model input data of the current batch into the click rate prediction model for inference, the method further includes: determining whether the number of prediction requests in a current prediction request queue is not less than a preset batch number; the preset batch number is the number of model input data of each batch; if yes, reading the preset batch number of to-be-inferred data from the prediction request queue, and taking the read to-be-inferred data as the model input data of the current batch; if no, reading all to-be-inferred data from the prediction request queue, and reading a first number of training samples from a current training sample queue, and taking the read to-be-inferred data and training data as the model input data of the current batch; the first number is the difference between the preset batch number and the number of read to-be-inferred data, and each training sample includes training data and a true value label corresponding to the training data.
7. An online learning device, characterized by, The method further includes: a first inference module configured to, for target data of an adjacent batch, input target data of a current batch into an integrated model for inference to obtain predicted data of the target data of the current batch. The target data includes training data and to-be-inferred data, and the training data corresponds to a true value label; The determining module is configured to determine a loss function of the integrated model based on the predicted data corresponding to the training data of the current batch and the true value label corresponding to the training data of the current batch; The back propagation module is configured to perform back propagation on the loss function to obtain an updated integrated model; The second inference module is configured to infer the to-be-inferred data in the target data of the next adjacent batch by using the updated integrated model. The reading module is configured to determine whether the number of inference requests in the current inference request queue is not less than a preset batch number before inputting the target data of the current batch into the integrated model for inference; if yes, reading the preset batch number of to-be-inferred data from the inference request queue, and taking the read to-be-inferred data as the target data of the current batch; if not, reading all to-be-inferred data from the inference request queue and reading a first number of training samples from the current training sample queue, and taking the read to-be-inferred data and training data as the target data of the current batch. The first number is the difference between the preset batch number and the number of read to-be-inferred data, and each training sample includes training data and a true value label corresponding to the training data; and the preset batch number is the number of target data of each batch.
8. A video recommendation apparatus, comprising: The device is used to perform the video recommendation method of claim 6, and the device comprises: The acquisition module is configured to acquire model input data of a current batch; the model input data includes to-be-inferred data and training data, the training data includes first feature information of a sample user and second feature information of a sample video, the training data corresponds to a real click result of the sample user on the sample video, and the to-be-inferred data includes third feature information of a target user and fourth feature information of a plurality of candidate recommended videos. The input module is configured to input the model input data of the current batch into a click rate prediction model for inference to obtain predicted data of the model input data of the current batch; the predicted data includes a predicted click rate of the sample user on the sample video and a predicted click rate of the target user on the candidate recommended videos. The recommendation module is configured to select a target recommended video from the candidate recommended videos based on the predicted click rate corresponding to each candidate recommended video according to the predicted click rate corresponding to the to-be-inferred data, and perform video recommendation based on the target recommended video. The update module is configured to determine a loss function of the click rate prediction model based on the real click result and the predicted click result of the sample user on the sample video according to the predicted click rate corresponding to the training data, and perform back propagation on the loss function to obtain an updated click rate prediction model, which is used to infer to-be-inferred data in model input data of a next batch.
9. An electronic device, comprising: The device comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus. a memory for storing a computer program; a processor for implementing the method steps of any one of claims 1-5 or 6 when executing the program stored in the memory.
10. A computer-readable storage medium, characterized in that, The computer program is stored in the computer readable storage medium, and the computer program is executed by the processor to implement the method steps of any one of claims 1-5 or 6.
Citation Information
Patent Citations
Multi-target prediction method and device, equipment and storage medium
CN113392359A
Classification model training method and device, emotion data classification method and related equipment
CN113962280A