A distribution control method, device, equipment and medium for training samples
By using token buckets to manage the number of positive and negative samples in the recommendation system and regulating the sample distribution, the problem of estimation model deviation caused by sample distribution mutation is solved, and a more stable estimation model and higher estimation accuracy are achieved.
Patent Information
- Application Number
- CN202210163825.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-22
- Publication Date
- 2025-06-20
- Estimated Expiration
- 2042-02-22
AI Technical Summary
In the recommended system, the stability of the CTR/CVR prediction model depends on the stability of the sample distribution, especially in special scenarios, the sample distribution is prone to mutations, resulting in a large deviation in the prediction results of the trained prediction model.
The sample distribution is regulated by managing the number of tokens in the token bucket corresponding to the positive and negative samples. The specific method is to read the corresponding number of positive samples from the queue storing the positive samples and send it to the estimated model when the number of tokens in the first token bucket is greater than zero. When the number of tokens in the second token bucket is greater than zero, read the corresponding number of negative samples from the queue storing the negative samples and send it to the estimated model. The number of tokens is determined by the number of samples in the corresponding queue, ensuring that the proportion of positive and negative samples is within the preset range.
By dynamically adjusting the number of positive and negative samples sent, we ensure that the proportion of positive and negative samples received by the estimated model meets the preset standards, thereby reducing the deviation of the model prediction results and improving the prediction accuracy.
Smart Images

Figure CN114547456B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and particularly to a method, apparatus, device, and medium for controlling the distribution of training samples. Background Art
[0002] In a recommendation system, the click-through rate (CTR) and conversion rate (CVR) of recommended content are two very important reference indicators, and usually a CTR / CVR prediction model is used for prediction. CTR prediction is to predict the click situation of each piece of recommended content, that is, to predict whether the user clicks or not, that is, to predict the probability that the user clicks. CVR prediction refers to the prediction of the conversion that occurs when the recommended content is clicked, and predicts the probability that the user makes a purchase.
[0003] In practical applications, the CTR / CVR prediction model is trained and generated by using a streaming training method, and the stability of the prediction model trained by streaming strongly depends on the stability of the sample distribution (the ratio of positive and negative samples). Among them, in the CTR prediction scenario, the positive samples are user-item records of in-site clicks, and the negative samples are records that are displayed but not clicked; in the CVR prediction scenario, the positive samples are user-item records of in-site payments (conversions occur), and the negative samples are records that are clicked but not paid. However, in some special scenarios, the sample distribution is prone to mutation, resulting in a large deviation in the prediction results output by the trained prediction model during prediction. Summary of the Invention
[0004] In view of this, embodiments of this application provide a method, apparatus, device, and medium for controlling the distribution of training samples to reduce the deviation of the prediction model by regulating the sample distribution.
[0005] To achieve the above object, the technical solutions provided by the embodiments of this application are as follows:
[0006] In the first aspect of the embodiments of this application, a method for controlling the distribution of training samples is provided, and the method includes:
[0007] When the number of tokens in the first token bucket is greater than zero, read a first number of positive samples from the first queue according to the number of tokens in the first token bucket and send them to the prediction model for training the prediction model. The first queue is used to store the positive samples, and the first token bucket is the token bucket corresponding to the positive samples;
[0008] When the number of tokens in the second token bucket is greater than zero, read a second number of negative samples from the second queue according to the number of tokens in the second token bucket and send them to the prediction model for training the prediction model. The second queue is used to store the negative samples, and the second token bucket is the token bucket corresponding to the negative samples;
[0009] Among them, the number of tokens in the first token bucket is determined according to the number of negative samples added to the second queue, and the number of tokens in the second token bucket is determined according to the number of positive samples added to the first queue.
[0010] In a second aspect of the embodiments of the present application, a training sample distribution control device is provided. The device includes:
[0011] A first sending unit, configured to, when the number of tokens in the first token bucket is greater than zero, read a first number of positive samples from the first queue according to the number of tokens in the first token bucket and send them to the prediction model for training the prediction model. The first queue is used to store the positive samples, and the first token bucket is the token bucket corresponding to the positive samples;
[0012] A second sending unit, configured to, when the number of tokens in the second token bucket is greater than zero, read a second number of negative samples from the second queue according to the number of tokens in the second token bucket and send them to the prediction model for training the prediction model. The second queue is used to store the negative samples, and the second token bucket is the token bucket corresponding to the negative samples;
[0013] Among them, the number of tokens in the first token bucket is determined according to the number of negative samples added to the second queue, and the number of tokens in the second token bucket is determined according to the number of positive samples added to the first queue.
[0014] In a third aspect of the embodiments of the present application, an electronic device is provided. The device includes: a processor and a memory;
[0015] The memory is used to store instructions or computer programs;
[0016] The processor is configured to execute the instructions or computer programs in the memory so that the electronic device executes the training sample distribution control method described in the first aspect.
[0017] In a fourth aspect of the embodiments of the present application, a computer-readable storage medium is provided. Instructions are stored in the computer-readable storage medium, and when the instructions are run on a device, the device is caused to execute the training sample distribution control method described in the first aspect.
[0018] In a fifth aspect of the embodiments of the present application, a computer program product is provided. When the computer program product runs on a computer, the computer is caused to execute the training sample distribution control method described in the first aspect.
[0019] Thus, the embodiments of the present application have the following beneficial effects:
[0020] In the embodiments of the present application, when training a prediction model using positive and negative samples, if the number of tokens in the first token bucket is greater than zero, read the first number of positive samples from the first queue storing positive samples and send them to the prediction model. If the number of tokens in the second token bucket is greater than zero, read the second number of negative samples from the second queue storing negative samples and send them to the prediction model. Among them, the number of tokens in the first token bucket is determined according to the number of negative samples added to the second queue, and the number of tokens in the second token bucket is determined according to the number of positive samples added to the first queue. That is, when training the prediction model, the number of positive samples sent and the number of negative samples sent will be determined according to the number of tokens in the token buckets corresponding to the positive and negative samples respectively. Since the number of tokens in the token bucket corresponding to the positive samples is determined by the number of negative samples added to the second queue and the number of tokens in the token bucket corresponding to the negative samples is determined by the number of positive samples added to the first queue, the number of positive and negative samples sent to the prediction model can be restricted and adjusted to each other, ensuring that the ratio of the number of positive and negative samples sent to the prediction model meets a preset ratio and ensuring the prediction accuracy of the prediction model. Description of the Drawings
[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings described below are only some embodiments recorded in the present application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0022] Figure 1 It is a schematic diagram of an application scenario provided by the embodiments of the present application;
[0023] Figure 2 It is a flowchart of a method for controlling the distribution of training samples provided by the embodiments of the present application;
[0024] Figure 3 It is a schematic diagram of the structure of a device for controlling the distribution of training samples provided by the embodiments of the present application;
[0025] Figure 4 It is a schematic diagram of the structure of an electronic device provided by the embodiments of the present application. Detailed Embodiments
[0026] To enable those skilled in the art to better understand the solution of this application, the following will clearly and completely describe the technical solution in the embodiments of this application in conjunction with the accompanying drawings in the embodiments of this application. Obviously, the described embodiments are only a part of the embodiments of this application, rather than all the embodiments. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of this application.
[0027] To facilitate the understanding of the technical solution provided by the embodiments of this application, the following will first explain the technical background involved in this application.
[0028] In this embodiment, token buckets are pre-allocated for positive samples and negative samples respectively, that is, the token bucket corresponding to positive samples is the first token bucket, and the token bucket corresponding to negative samples is the second token bucket. Among them, the number of tokens in the first token bucket is determined according to the number of negative samples added to the second queue (the queue storing negative samples), and the number of tokens in the second token bucket is determined according to the number of positive samples added to the first queue (the queue storing positive samples). The following will introduce the specific implementation of increasing the number of tokens in the first token bucket and the second token bucket.
[0029] Specifically, when a positive sample is collected, add a third number of tokens to the second token bucket and add the positive sample to the first queue. Among them, the third number is determined by the lower threshold of the positive-negative sample ratio. For example, if the lower threshold of the positive-negative sample ratio is L, then the third number is equal to 1 / L.
[0030] When a negative sample is collected, add a fourth number of tokens to the first token bucket and add the negative sample to the second queue. Among them, the fourth number is determined by the upper threshold of the positive-negative sample ratio. For example, if the upper threshold of the positive-negative sample ratio is U, then the fourth number is equal to U.
[0031] As can be seen from the above, when a positive sample is obtained, add a first number of tokens to the token bucket corresponding to negative samples, that is, the first token bucket, and at the same time add the positive sample to the first queue for storage. When a negative sample is obtained, add a second number of tokens to the token bucket corresponding to positive samples, that is, the second token bucket, and at the same time add the negative sample to the second queue for storage. Among them, the first number is determined by the lower threshold of the positive-negative sample ratio, and the second number is determined by the upper threshold of the positive-negative sample ratio. That is, this application controls the ratio of positive and negative samples in the positive and negative sample queues through the token buckets corresponding to different types of samples, avoiding the ratio of the positive and negative sample queues getting out of control in a disaster scenario and affecting the prediction results of the prediction model.
[0032] To facilitate the understanding that the third number is equal to the reciprocal of the lower threshold of the positive-negative sample ratio and the fourth number is equal to the upper threshold of the positive-negative sample ratio, the following will be explained.
[0033] For example, the collection rate of positive samples is Rp, and the collection rate of negative samples is Rn. For each positive sample added to the first queue, x tokens are added to the second token bucket, and for each negative sample added to the second queue, y tokens are added to the first token bucket. L is the lower threshold of the estimation model, U is the upper threshold of the prediction model, and T is the maximum window time of sample anomalies that the prediction model can tolerate. The goal is to control the distribution ratio P of positive and negative samples to be between [L, U] within the window time T.
[0034] The number of negative samples sent in the T time window is less than the number of tokens triggered by positive samples in the T time window, that is, Rp*T*x>=Rn*T;
[0035] The number of positive samples sent within the T time window is less than the number of tokens caused by negative samples within the T time window, that is, Rn*T*y>=Rp*T;
[0036] From Rp*T*x>=Rn*T, we can infer that Rp / Rn>=1 / x;
[0037] From Rn*T*y>=Rp*T, we can infer that Rp / Rn<=y;
[0038] Given the ratio of positive and negative samples P = Rp*T / Rn*T = Rp / Rn, then 1 / x <= P <= U;
[0039] It is known that L<=P<=U, then L=1 / x, U=y.
[0040] Therefore, the reciprocal (1 / x) of the number of tokens x that are added to the second token bucket due to the issuance of positive samples within the T time window is the lower bound threshold of P;
[0041] The number of tokens y that are added to the first token bucket due to the issuance of negative samples within the T time window is the upper threshold of P.
[0042] See also Figure 1 , the figure is a schematic diagram of an application scenario. When a positive sample is obtained through a web crawler, the positive sample is added to the first queue and triggers the addition of 1 / L tokens to the second token bucket; when a negative sample is obtained, the negative sample is added to the second queue and triggers the addition of U tokens to the first token bucket. When a positive sample is sent from the first queue to the estimation model, a token is removed from the first token bucket; when a negative sample is sent from the second queue to the estimation model, a token is removed from the second token bucket.
[0043] It should be noted that, usually, the number of positive samples in the network is less than the number of negative samples. The specific definitions of positive and negative samples will be determined according to the actual application scenario, and are not limited in this embodiment.
[0044] Based on the above, the technical solutions provided in the embodiments of the present application will be described below with reference to the accompanying drawings.
[0045] See Figure 2 , which is a prediction model training method provided in an embodiment of the present application, and this training method can be executed by a training device. The training device can be an electronic device or other devices, which is not limited here. Among them, the electronic device can include devices with communication functions such as mobile phones, tablet computers, desktop computers, laptop computers, vehicle-mounted terminals, wearable electronic devices, all-in-one machines, and smart home devices, or can also be a device simulated by a virtual machine or simulator. As Figure 2 shown, the method may include:
[0046] S201: When the number of tokens in the first token bucket is greater than zero, read the first number of positive samples from the first queue according to the number of tokens in the first token bucket and send them to the prediction model for training the prediction model.
[0047] In this embodiment, before sending the positive samples to the prediction model, it is first necessary to determine whether there are tokens in the first token bucket corresponding to the positive samples. If the number of tokens in the first token bucket is greater than zero, read the first number of positive samples from the first queue according to the number of tokens in the first token, and then enable the prediction model to be trained using the positive samples. Among them, the number of tokens in the first token bucket is determined according to the number of negative samples added to the second queue. For the specific addition process, please refer to Figure 1 the addition process shown.
[0048] Among them, reading the first number of positive samples from the first queue according to the number of tokens in the first token bucket and sending them to the prediction model includes: determining the minimum value between the number of tokens in the first token bucket and the number of positive samples in the first queue as the first number; reading the first number of positive samples from the first queue. That is, the first number is the minimum value between the number of tokens in the first token bucket and the number of positive samples in the first queue. For example, the first number = min(p_token_count, size(p_queue)), where p_token_count represents the number of tokens in the first token bucket, and size(p_queue) represents the number of positive samples in the first queue.
[0049] Optionally, when reading the first quantity of positive samples from the first queue and sending them to the prediction model, the first quantity of tokens will also be removed from the first token bucket. That is, for each positive sample sent to the prediction model, one token will be removed from the first token bucket.
[0050] Among them, the prediction model includes an advertisement click-through rate prediction model and / or an advertisement conversion rate prediction model. The advertisement click-through rate prediction model is used to predict the click-through rate of an advertisement. The predicted click-through rate refers to the probability that the system predicts an advertisement may be clicked before it is shown in a certain situation. If an advertisement has a high probability of being clicked, the advertisement will be shown to the user; if the probability is low, it will not be shown. The advertisement conversion rate model is used to predict the conversion rate of an advertisement. The conversion rate is an indicator reflecting the impact degree of the advertisement on product sales, mainly referring to the proportion of browsers who have purchase, registration, or information demand behaviors affected by the online advertisement among the total number of advertisement clickers.
[0051] S202: When the number of tokens in the second token bucket is greater than zero, read the second quantity of negative samples from the second queue according to the number of tokens in the second token bucket and send them to the prediction model to train the prediction model.
[0052] In this embodiment, before sending negative samples to the prediction model, it is necessary to determine whether the number of tokens in the second token bucket is zero. If it is not zero, read the second quantity of negative samples from the second queue according to the number of tokens in the second token bucket and send them to the prediction model to train the prediction model using negative samples. Among them, the number of tokens in the second token bucket is determined according to the number of positive samples added to the first queue. For the specific addition process, please refer to Figure 1 the addition process shown.
[0053] Among them, reading the second quantity of negative samples from the second queue according to the number of tokens in the second token bucket and sending them to the prediction model is specifically: determining the minimum value between the number of tokens in the second token bucket and the number of negative samples in the second queue as the second quantity; reading the second quantity of negative samples from the second queue and sending them to the prediction model. That is, the second quantity is the minimum value between the number of tokens in the second token bucket and the number of negative samples in the second queue. For example, the second quantity = min(n_token_count, size(n_queue)), where n_token_count represents the number of tokens in the second token bucket, and size(n_queue) represents the number of positive samples in the second queue.
[0054] It should be noted that when reading the second quantity of negative samples from the second queue and sending them to the prediction model, the second quantity of tokens will also be removed from the second token bucket. That is, for each negative sample sent to the prediction model, one token will be removed from the second token bucket.
[0055] In some application scenarios, there may be a disconnection of a certain sample. To enable another sample to converge as soon as possible, when the time of disconnection reaches the time threshold, the number of tokens in the token bucket corresponding to the other sample is set to zero. Specifically, when the first sample has a disconnection and the time of disconnection reaches the time threshold, the number of tokens in the token bucket corresponding to the second sample is set to zero. The first sample is a positive sample or a negative sample, and the second sample is another sample other than the first sample.
[0056] For example, if the prediction model has sufficient tolerance for abnormal sample distribution within the time window T, when a positive sample has a disconnection, it means that no positive sample can be crawled from the network. At this time, the number of tokens in the second token bucket no longer increases. However, when reading negative samples from the second queue and sending them to the prediction model, the same number of tokens need to be removed from the second token bucket. As time goes by, the number in the second token bucket will become less and less. Since negative samples can be normally crawled, the number of tokens in the first token bucket is constantly increasing. To avoid the abnormal distribution of positive and negative samples from lasting for a long time, when the time of disconnection of the positive sample is equal to T, the number of tokens in the token bucket corresponding to the negative sample is set to zero. Among them, the specific value of the time threshold can be set according to the actual application situation, such as 1 minute.
[0057] It can be seen that through this embodiment, when training a prediction model using positive and negative samples, if the number of tokens in the first token bucket is greater than zero, then the first number of positive samples are read from the first queue storing positive samples and sent to the prediction model. If the number of tokens in the second token bucket is greater than zero, then the second number of negative samples are read from the second queue storing negative samples and sent to the prediction model. Among them, the number of tokens in the first token bucket is determined according to the number of negative samples added to the second queue, and the number of tokens in the second token bucket is determined according to the number of positive samples added to the first queue. That is, when training the prediction model, the number of positive samples and the number of negative samples sent will be determined according to the number of tokens in the token buckets corresponding to the positive and negative samples respectively. Since the number of tokens in the token bucket corresponding to the positive sample is determined by the number of negative samples added to the second queue and the number of tokens in the token bucket corresponding to the negative sample is determined by the number of positive samples added to the first queue, the number of positive and negative samples sent to the prediction model can be mutually restricted and adjusted, ensuring that the ratio of the number of positive and negative samples sent to the prediction model meets the preset ratio and ensuring the prediction accuracy of the prediction model.
[0058] Based on the above method embodiments, the embodiments of the present application provide a distribution control device and an electronic device for training samples, which will be described below with reference to the accompanying drawings.
[0059] See Figure 3 , this figure is a schematic structural diagram of a distribution control device for training samples provided by an embodiment of the present application. AsFigure 3 As shown, the control device 300 may include: a first sending unit 301 and a second sending unit 302.
[0060] The first sending unit 301 is configured to, when the number of tokens in the first token bucket is greater than zero, read a first number of positive samples from the first queue according to the number of tokens in the first token bucket and send them to the prediction model for training the prediction model. The first queue is used to store the positive samples, and the first token bucket is the token bucket corresponding to the positive samples;
[0061] The second sending unit 302 is configured to, when the number of tokens in the second token bucket is greater than zero, read a second number of negative samples from the second queue according to the number of tokens in the second token bucket and send them to the prediction model for training the prediction model. The second queue is used to store the negative samples, and the second token bucket is the token bucket corresponding to the negative samples;
[0062] Wherein, the number of tokens in the first token bucket is determined according to the number of negative samples added to the second queue, and the number of tokens in the second token bucket is determined according to the number of positive samples added to the first queue.
[0063] In a specific implementation manner, the device further includes: a removal unit;
[0064] The removal unit is configured to remove the first number of tokens from the first token bucket and remove the second number of tokens from the second token bucket.
[0065] In a specific implementation manner, the first number is the minimum value between the number of tokens in the first token bucket and the number of positive samples in the first queue; the second number is the minimum value between the number of tokens in the second token bucket and the number of negative samples in the second queue.
[0066] In a specific implementation manner, the device further includes: a first adding unit and a second adding unit;
[0067] The first adding unit is configured to, when a positive sample is collected, add a third number of tokens to the second token bucket and add the positive sample to the first queue. The third number is determined by the lower threshold of the positive-negative sample ratio;
[0068] The second adding unit is configured to, when a negative sample is collected, add a fourth number of tokens to the first token bucket and add the negative sample to the second queue. The fourth number is determined by the upper threshold of the positive-negative sample ratio.
[0069] In a specific implementation manner, the third quantity is equal to the reciprocal of the lower threshold, and the fourth quantity is equal to the upper threshold.
[0070] In a specific implementation manner, the apparatus further includes: a processing unit;
[0071] The processing unit is configured to set the number of tokens in the token bucket corresponding to the second sample to zero when a disconnection occurs in the first sample and the disconnection time reaches the time threshold, where the first sample is the positive sample or the negative sample, and the second sample is another sample other than the first sample.
[0072] In a specific implementation manner, the prediction model includes a point advertisement click-through rate prediction model and / or an advertisement conversion rate prediction model.
[0073] It should be noted that the implementation of each unit in this embodiment can refer to the relevant descriptions in the above method embodiment, and will not be elaborated herein.
[0074] As Figure 4 shown, the electronic device 400 may include a processing device (such as a central processing unit, a graphics processing unit, etc.) 401, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 402 or a program loaded from a storage device 408 into a random access memory (RAM) 403. In the RAM 403, various programs and data required for the operation of the electronic device 400 are also stored. The processing device 401, the ROM 402, and the RAM 403 are connected to each other through a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.
[0075] Generally, the following devices may be connected to the I / O interface 405: an input device 406 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 407 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 408 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 409. The communication device 409 may allow the electronic device 400 to communicate with other devices wirelessly or wiredly to exchange data. Although Figure 4 the electronic device 400 with various devices is shown, it should be understood that it is not required to implement or include all the shown devices. Instead, more or fewer devices may be implemented or included.
[0076] In particular, according to the embodiments of the present application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, the embodiments of the present application include a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program codes for executing the methods shown in the flowcharts. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 409, or installed from the storage device 408, or installed from the ROM 402. When the computer program is executed by the processing device 401, the above-mentioned functions defined in the methods of the embodiments of the present application are executed.
[0077] The electronic device provided by the embodiments of the present application and the method provided by the above embodiments belong to the same inventive concept. Technical details not described in detail in this embodiment can be referred to the above embodiments, and this embodiment has the same beneficial effects as the above embodiments.
[0078] The embodiments of the present application provide a computer-readable medium, on which a computer program is stored, and when the program is executed by a processor, the method described in any of the above embodiments is implemented.
[0079] It should be noted that the computer-readable medium described above in this application can be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of a computer-readable storage medium can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this application, a computer-readable storage medium can be any tangible medium that contains or stores a program, and this program can be used by or in combination with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium can include a data signal propagated in a baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, and this computer-readable signal medium can send, propagate, or transmit a program for use by or in combination with an instruction execution system, apparatus, or device. The program code contained on a computer-readable medium can be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0080] In some embodiments, the client and the server can communicate using any currently known or future-developed network protocol such as HTTP (Hyper Text Transfer Protocol), and can be interconnected with digital data communication in any form or medium (e.g., a communication network). Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), the Internet (e.g., the Internet), and end-to-end networks (e.g., ad hoc end-to-end networks), as well as any currently known or future-developed networks.
[0081] The above computer-readable medium can be included in the above electronic device; or it can exist separately without being assembled into the electronic device.
[0082] The above computer-readable medium carries one or more programs, and when the one or more programs are executed by the electronic device, the electronic device is caused to execute the above method.
[0083] Computer program code for performing the operations of this application can be written in one or more programming languages or combinations thereof. The above-mentioned programming languages include, but are not limited to, object-oriented programming languages such as Java, Smalltalk, C++, and also include conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, executed as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (for example, by using an Internet service provider to connect through the Internet).
[0084] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in the flowchart or block diagram can represent a module, a program segment, or a part of the code, and this module, program segment, or part of the code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks can occur in a different order than marked in the accompanying drawings. For example, two consecutively represented blocks can actually be executed substantially in parallel, and they can sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, and the combination of blocks in the block diagram and / or flowchart, can be implemented by a dedicated hardware-based system for performing the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.
[0085] The units involved in the embodiments described in this application can be implemented in software or in hardware. Among them, the name of the unit / module does not constitute a limitation on the unit itself in some cases. For example, the voice data acquisition module can also be described as the "data acquisition module".
[0086] The functions described above in this article can be performed at least in part by one or more hardware logic components. For example, without limitation, the exemplary types of hardware logic components that can be used include: field programmable gate arrays (FPGA), application specific integrated circuits (ASIC), application specific standard products (ASSP), system on a chip (SOC), complex programmable logic devices (CPLD), and so on.
[0087] In the context of the present application, a machine-readable medium may be a tangible medium that can contain or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of the machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0088] According to one or more embodiments of the present application, there is provided a method for controlling the distribution of training samples, the method comprising:
[0089] When the number of tokens in the first token bucket is greater than zero, read a first number of positive samples from the first queue according to the number of tokens in the first token bucket and send them to the prediction model for training the prediction model, the first queue being used to store the positive samples, and the first token bucket being the token bucket corresponding to the positive samples;
[0090] When the number of tokens in the second token bucket is greater than zero, read a second number of negative samples from the second queue according to the number of tokens in the second token bucket and send them to the prediction model for training the prediction model, the second queue being used to store the negative samples, and the second token bucket being the token bucket corresponding to the negative samples;
[0091] Wherein, the number of tokens in the first token bucket is determined according to the number of negative samples added to the second queue, and the number of tokens in the second token bucket is determined according to the number of positive samples added to the first queue.
[0092] According to one or more embodiments of the present application, the method further comprises:
[0093] Remove the first number of tokens from the first token bucket and the second number of tokens from the second token bucket.
[0094] According to one or more embodiments of the present application, the first number is the minimum value between the number of tokens in the first token bucket and the number of positive samples in the first queue; the second number is the minimum value between the number of tokens in the second token bucket and the number of negative samples in the second queue.
[0095] According to one or more embodiments of the present application, the method further includes:
[0096] When a positive sample is collected, add a third number of tokens to the second token bucket, and add the positive sample to the first queue, where the third number is determined by the lower threshold of the positive-negative sample ratio;
[0097] When a negative sample is collected, add a fourth number of tokens to the first token bucket, and add the negative sample to the second queue, where the fourth number is determined by the upper threshold of the positive-negative sample ratio.
[0098] According to one or more embodiments of the present application, the third number is equal to the reciprocal of the lower threshold, and the fourth number is equal to the upper threshold.
[0099] According to one or more embodiments of the present application, the method further includes:
[0100] When the first sample has a flow interruption and the time of the flow interruption reaches the time threshold, set the number of tokens in the token bucket corresponding to the second sample to zero, where the first sample is the positive sample or the negative sample, and the second sample is another sample other than the first sample.
[0101] According to one or more embodiments of the present application, the prediction model includes a point advertisement click-through rate prediction model and / or an advertisement conversion rate prediction model.
[0102] According to one or more embodiments of the present application, there is provided a distribution control device for training samples, and the device includes:
[0103] A first sending unit, configured to, when the number of tokens in the first token bucket is greater than zero, read a first number of positive samples from the first queue according to the number of tokens in the first token bucket and send them to the prediction model for training the prediction model, where the first queue is used to store the positive samples, and the first token bucket is the token bucket corresponding to the positive samples;
[0104] A second sending unit, configured to, when the number of tokens in the second token bucket is greater than zero, read a second number of negative samples from the second queue according to the number of tokens in the second token bucket and send them to the prediction model for training the prediction model, where the second queue is used to store the negative samples, and the second token bucket is the token bucket corresponding to the negative samples;
[0105] Wherein, the number of tokens in the first token bucket is determined according to the number of negative samples added to the second queue, and the number of tokens in the second token bucket is determined according to the number of positive samples added to the first queue.
[0106] According to one or more embodiments of the present application, the apparatus further includes: a removal unit;
[0107] The removal unit is configured to remove the first number of tokens from the first token bucket and remove the second number of tokens from the second token bucket.
[0108] According to one or more embodiments of the present application, the first number is the minimum value of the number of tokens in the first token bucket and the number of positive samples in the first queue; the second number is the minimum value of the number of tokens in the second token bucket and the number of negative samples in the second queue.
[0109] According to one or more embodiments of the present application, the apparatus further includes: a first addition unit and a second addition unit;
[0110] The first addition unit is configured to, when a positive sample is collected, add a third number of tokens to the second token bucket and add the positive sample to the first queue, where the third number is determined by a lower threshold of the positive-negative sample ratio;
[0111] The second addition unit is configured to, when a negative sample is collected, add a fourth number of tokens to the first token bucket and add the negative sample to the second queue, where the fourth number is determined by an upper threshold of the positive-negative sample ratio.
[0112] According to one or more embodiments of the present application, the third number is equal to the reciprocal of the lower threshold, and the fourth number is equal to the upper threshold.
[0113] According to one or more embodiments of the present application, the apparatus further includes: a processing unit;
[0114] The processing unit is configured to, when a first sample has a flow interruption and the time of the flow interruption reaches a time threshold, set the number of tokens in the token bucket corresponding to a second sample to zero, where the first sample is the positive sample or the negative sample, and the second sample is another sample other than the first sample.
[0115] According to one or more embodiments of the present application, the prediction model includes a point advertisement click-through rate prediction model and / or an advertisement conversion rate prediction model.
[0116] According to one or more embodiments of the present application, there is provided an electronic device, the device includes: a processor and a memory;
[0117] The memory is configured to store instructions or computer programs;
[0118] The processor is configured to execute the instructions or computer programs in the memory, so that the electronic device executes the method for controlling the distribution of the training samples as described above.
[0119] According to one or more embodiments of the present application, there is provided a computer-readable storage medium storing instructions, which, when running on a device, cause the device to execute the method for controlling the distribution of the training samples.
[0120] It should be noted that the embodiments in this specification are described in a progressive manner, and the key point of each embodiment is the difference from other embodiments. The same or similar parts among the embodiments can be referred to each other. For the systems or devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple, and the relevant parts can be referred to the description of the method part.
[0121] It should be understood that in the present application, "at least one (item)" means one or more, and "a plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that there can be three relationships. For example, "A and / or B" can mean: only A exists, only B exists, and both A and B exist at the same time. Among them, A and B can be singular or plural. The character " / " generally means that the associated objects before and after are in an "or" relationship. "At least one (one) of the following" or its similar expression means any combination of these items, including any combination of single item (one) or plural items (ones). For example, at least one (one) of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0122] It should also be noted that in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprising", "including" or any other variant thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not expressly listed, or elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "including a..." does not exclude the existence of additional identical elements in the process, method, article or device including the element.
[0123] The steps of the methods or algorithms described in connection with the embodiments disclosed herein may be implemented directly in hardware, in a software module executed by a processor, or in a combination thereof. The software module may be disposed in a random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0124] The foregoing description of the disclosed embodiments enables those skilled in the art to make or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for controlling the distribution of training samples, characterized in that, The method is used for training a prediction model, including: When the number of tokens in the first token bucket is greater than zero, read a first number of positive samples from the first queue according to the number of tokens in the first token bucket, and use the first number of positive samples to train the prediction model. The first queue is used to store the positive samples, and the first token bucket is the token bucket corresponding to the positive samples. The prediction model includes a click-through rate prediction model and / or a conversion rate prediction model. The positive samples corresponding to the click-through rate prediction model refer to the samples where the user has a click behavior for the recommended content, and the negative samples corresponding to the click-through rate prediction model refer to the samples where the user does not have a click behavior for the recommended content. The positive samples corresponding to the conversion rate prediction model refer to the samples where conversion occurs when the recommended content is clicked, and the negative samples corresponding to the conversion rate prediction model refer to the samples where no conversion occurs when the recommended content is clicked. When the number of tokens in the second token bucket is greater than zero, read a second number of negative samples from the second queue according to the number of tokens in the second token bucket, and use the second number of negative samples to train the prediction model. The second queue is used to store the negative samples, and the second token bucket is the token bucket corresponding to the negative samples. Wherein, the number of tokens in the first token bucket is determined according to the number of negative samples added to the second queue, and the number of tokens in the second token bucket is determined according to the number of positive samples added to the first queue.
2. The method according to claim 1, characterized in that, The method further includes: Remove the first number of tokens from the first token bucket and remove the second number of tokens from the second token bucket.
3. The method according to claim 1, characterized in that, The first number is the minimum value between the number of tokens in the first token bucket and the number of positive samples in the first queue; the second number is the minimum value between the number of tokens in the second token bucket and the number of negative samples in the second queue.
4. The method according to claim 1, characterized in that, The method further includes: When a positive sample is collected, add a third number of tokens to the second token bucket, and add the positive sample to the first queue. The third number is determined by the lower threshold of the positive-negative sample ratio. When a negative sample is collected, add a fourth number of tokens to the first token bucket, and add the negative sample to the second queue. The fourth number is determined by the upper threshold of the positive-negative sample ratio.
5. The method according to claim 4, characterized in that, The third number is equal to the reciprocal of the lower threshold, and the fourth number is equal to the upper threshold.
6. The method according to claim 1, characterized in that, The method further includes: When the first sample has a traffic interruption and the time of the traffic interruption reaches the time threshold, set the number of tokens in the token bucket corresponding to the second sample to zero. The first sample is the positive sample or the negative sample, and the second sample is the other sample except the first sample.
7. The method according to any one of claims 1-6, characterized in that, The prediction model includes an advertisement click-through rate prediction model and / or an advertisement conversion rate prediction model.
8. A device for controlling the distribution of training samples, characterized in that, The device is used for training a prediction model, including: A first sending unit, configured to, when the number of tokens in a first token bucket is greater than zero, read a first number of positive samples from a first queue according to the number of tokens in the first token bucket, and use the first number of positive samples to train the prediction model. The first queue is used to store the positive samples, and the first token bucket is the token bucket corresponding to the positive samples. The prediction model includes a click-through rate prediction model and / or a conversion rate prediction model. The positive samples corresponding to the click-through rate prediction model refer to the samples where the user has a click behavior for the recommended content, and the negative samples corresponding to the click-through rate prediction model refer to the samples where the user does not have a click behavior for the recommended content. The positive samples corresponding to the conversion rate prediction model refer to the samples where the recommended content is converted when clicked, and the negative samples corresponding to the conversion rate prediction model refer to the samples where the recommended content is not converted when clicked. A second sending unit, configured to, when the number of tokens in a second token bucket is greater than zero, read a second number of negative samples from a second queue according to the number of tokens in the second token bucket, and use the second number of negative samples to train the prediction model. The second queue is used to store the negative samples, and the second token bucket is the token bucket corresponding to the negative samples. Wherein, the number of tokens in the first token bucket is determined according to the number of negative samples added to the second queue, and the number of tokens in the second token bucket is determined according to the number of positive samples added to the first queue.
9. An electronic device, characterized in that, The device includes: a processor and a memory; The memory is used to store instructions or computer programs; The processor is configured to execute the instructions or computer programs in the memory, so that the electronic device executes the training sample distribution control method according to any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, Instructions are stored in the computer-readable storage medium, and when the instructions are run on the device, the device executes the training sample distribution control method according to any one of claims 1-7.
Citation Information
Patent Citations
Burst mode control
CN105409171A
Method and device for submitting training task to speed-limiting queue
CN112202684A