Sample processing method and device for model training, and electronic device
By empowering the samples in model training, the problem of the inability to effectively utilize the latest samples and some positive samples in the existing technology is solved, which improves the model's responsiveness and generalization capabilities, extends the model's life cycle and reduces maintenance costs.
Patent Information
- Application Number
- CN202210066044.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-20
- Publication Date
- 2024-12-31
- Estimated Expiration
- 2042-01-20
AI Technical Summary
The existing sample label result definition scheme is insufficient in the model training of online order sales orders, and it is impossible to effectively utilize the latest user value trends and positive samples of some orders, affecting the model's rapid response and generalization capabilities.
By obtaining the activated and completed life cycle order data, counting the number of positive results determined at different days, determining the weights of positive and negative samples, and using the weighted samples for model training, realizing the new features and new results Improved response capability.
The number of available samples is expanded, the model's response ability to new features is improved, the value characteristics of the samples is strengthened, the model life cycle is extended, and maintenance costs are reduced.
Smart Images

Figure CN114547137B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a method and device for processing samples for model training, an electronic device, and a computer-readable storage medium. Background Art
[0002] The core value model prediction system in online sales orders requires a batch of sample sets containing features and label results to train the value prediction model, and then the trained value prediction model can be used to predict value parameters. After a sample event is initially generated, a period of time is allowed as a waiting period for the life cycle to appear as a positive result. For example, when an outbound call operator calls an outbound user for the first time, the online sales order is activated. In the subsequent complete life cycle (such as 30 days or 45 days, etc.), if the order result is positive, that is, the order is converted or the order is completed, then the order is a positive sample and the sample label result is positive, while the negative result (that is, the order is not converted or the order is not completed) can only be truly determined after the complete life cycle is over.
[0003] In the existing sample label result definition scheme, specifically: 1) The label results within 7 days of order activation are uniformly taken for model training. That is, the positive results within 7 days are positive samples, and the results without results are negative samples. The results within the life cycle after 7 days are discarded. 2) The samples that are determined to be positive results on any day within 7 days are regarded as consistent positive samples, and the samples that are not determined to be positive results after 7 days are regarded as consistent negative samples.
[0004] The existing sample label result definition scheme has the following deficiencies: 1) 7 days is taken as the period for determining the sample results, that is, the value prediction model can only use the order sample data from 7 days ago. The order samples of the last 7 days often contain the latest user value trends, but they cannot be learned by the value model, which greatly affects the model's ability to respond quickly. 2) If the complete life cycle of an order is 45 days, some orders will also have positive results in the life cycle after 7 days. The positive samples of these orders cannot be learned by the value model, affecting the generalization ability and accuracy of the model. 3) Samples with positive results on any day within 7 days are all consistent positive samples, but the samples with positive results determined on the first day are obviously different from the samples with positive results determined on the 7th day. Treating them uniformly will affect the accuracy of the model. Therefore, it is urgent to solve this technical problem. Summary of the invention
[0005] In view of the above problems, this application is proposed to provide a method and device for processing samples for model training that overcomes the above problems or at least partially solves the above problems, an electronic device and a computer-readable storage medium, which can realize the order results determined at different times in the complete life cycle of an online sales order after activation, that is, the label results can be introduced into the model training system, and the model's responsiveness to new features and new results can be improved while maintaining sample balance. The technical solution is as follows:
[0006] In a first aspect, a method for processing samples for model training is provided, comprising:
[0007] Obtaining order data that has been activated and completed its entire life cycle from multiple original samples to be used for model training;
[0008] According to the order data of the activated and completed life cycles in the multiple original samples, the number of orders with confirmed positive results at different days from the order activation date is counted;
[0009] Determine the weights of positive samples with determined positive results and the weights of negative samples with determined negative results among the multiple original samples based on the number of orders with determined positive results at different days from the order activation date that are statistically determined;
[0010] The model is trained using the weighted positive samples and the weighted negative samples as processed training samples.
[0011] In a possible implementation, the determining, based on the statistical number of orders with positive results determined at different days from the order activation date, the weights of the positive samples with positive results determined and the weights of the negative samples with negative results determined in the multiple original samples includes:
[0012] Based on the statistical number of orders with confirmed positive results n days before the order activation date, fit an order volume growth function that represents the relationship between the number of orders with confirmed positive results n days before the order activation date and the number of orders n days before the order activation date; where n is an integer greater than or equal to zero;
[0013] Define that the amount of information about the total number of orders in the previous n days is equivalent to the amount of information about the total number of orders in the entire life cycle, then the weight of the number of orders on the nth day is inversely proportional to the total number of orders in the previous n days;
[0014] Define the weight of the order on the last day of the complete life cycle as the preset value, then the weight of the order on the nth day is the preset value multiplied by the total number of orders completed in the complete life cycle, and then divided by the total number of orders in the previous n days;
[0015] According to the order quantity growth function and the defined order weight of the n-th day, a weight value of the order on the n-th day is obtained;
[0016] Perform function fitting according to the change of the weight value of the order on the nth day as n changes, and obtain the weight fitting function of the positive sample;
[0017] The weight fitting function of the positive sample is used to determine the weights of the positive samples for which positive results have been determined and the weights of the negative samples for which negative results have been determined in the multiple original samples.
[0018] In a possible implementation, a function is fitted according to the change of the weight value of the order on the nth day with n, to obtain a weight fitting function of the positive sample, including:
[0019] The number of days n is normalized using the complete life cycle, and a function is fitted according to the change of the weight value of the order on the nth day with n, so as to obtain the weight fitting function of the positive sample.
[0020] In a possible implementation, using the weight fitting function of the positive sample to determine the weights of the positive samples for which positive results have been determined and the weights of the negative samples for which negative results have been determined among the multiple original samples include:
[0021] Denormalizing the weight fitting function of the positive sample using the complete life cycle to obtain the weight fitting function of the positive sample related to the number of days n between the positive result determination date and the order activation date;
[0022] The weight fitting function of the positive samples related to the number of days n between the positive result determination date and the order activation date is used to determine the weights of the positive samples with determined positive results and the weights of the negative samples with determined negative results in the multiple original samples.
[0023] In a possible implementation, a function is fitted according to the change of the weight value of the order on the nth day with n, to obtain a weight fitting function of the positive sample, including:
[0024] A logarithmic function is fitted according to the change of the weight value of the order on the nth day as n changes, and a weight fitting function of the positive sample is obtained.
[0025] In a possible implementation, using the weight fitting function of the positive sample to determine the weights of the positive samples for which positive results have been determined and the weights of the negative samples for which negative results have been determined among the multiple original samples include:
[0026] Determine the weight of the positive sample with a positive result determined among the plurality of original samples by using the weight fitting function of the positive sample;
[0027] The weights of negative samples with determined negative results among the multiple original samples are determined using the inverse of the weight fitting function of the positive samples.
[0028] In a possible implementation, the weight of the negative sample for which a negative result has been determined among the multiple original samples is determined by using the inverse of the weight fitting function of the positive sample, including:
[0029] If the negative samples with negative results determined in the multiple original samples have completed a full life cycle, the weight of the negative samples that have completed a full life cycle is determined to be the preset value.
[0030] In a second aspect, a sample processing device for model training is provided, comprising:
[0031] An acquisition module, used to acquire order data that has been activated and has completed its full life cycle from multiple original samples to be used for model training;
[0032] A statistical module, for counting the number of orders with positive results determined at different days from the order activation date based on the order data that have been activated and have completed the full life cycle in the multiple original samples;
[0033] A determination module, configured to determine the weights of positive samples with determined positive results and the weights of negative samples with determined negative results among the multiple original samples based on the number of orders with determined positive results at different days from the order activation date that are statistically determined;
[0034] The training module is used to train the model by using the weighted positive samples and the weighted negative samples as processed training samples.
[0035] In a possible implementation manner, the determining module is further configured to:
[0036] Based on the statistical number of orders with confirmed positive results n days before the order activation date, fit an order volume growth function that represents the relationship between the number of orders with confirmed positive results n days before the order activation date and the number of orders n days before the order activation date; where n is an integer greater than or equal to zero;
[0037] Define that the amount of information about the total number of orders in the previous n days is equivalent to the amount of information about the total number of orders in the entire life cycle, then the weight of the number of orders on the nth day is inversely proportional to the total number of orders in the previous n days;
[0038] Define the weight of the order on the last day of the complete life cycle as the preset value, then the weight of the order on the nth day is the preset value multiplied by the total number of orders completed in the complete life cycle, and then divided by the total number of orders in the previous n days;
[0039] According to the order quantity growth function and the defined order weight of the n-th day, a weight value of the order on the n-th day is obtained;
[0040] Perform function fitting according to the change of the weight value of the order on the nth day as n changes, and obtain the weight fitting function of the positive sample;
[0041] The weight fitting function of the positive sample is used to determine the weights of the positive samples for which positive results have been determined and the weights of the negative samples for which negative results have been determined in the multiple original samples.
[0042] In a possible implementation manner, the determining module is further configured to:
[0043] The number of days n is normalized using the complete life cycle, and a function is fitted according to the change of the weight value of the order on the nth day with n, so as to obtain the weight fitting function of the positive sample.
[0044] In a possible implementation manner, the determining module is further configured to:
[0045] Denormalizing the weight fitting function of the positive sample using the complete life cycle to obtain the weight fitting function of the positive sample related to the number of days n between the positive result determination date and the order activation date;
[0046] The weight fitting function of the positive samples related to the number of days n between the positive result determination date and the order activation date is used to determine the weights of the positive samples with determined positive results and the weights of the negative samples with determined negative results in the multiple original samples.
[0047] In a possible implementation manner, the determining module is further configured to:
[0048] A logarithmic function is fitted according to the change of the weight value of the order on the nth day as n changes, and a weight fitting function of the positive sample is obtained.
[0049] In a possible implementation manner, the determining module is further configured to:
[0050] Determine the weight of the positive sample with a positive result determined among the plurality of original samples by using the weight fitting function of the positive sample;
[0051] The weights of negative samples with determined negative results among the multiple original samples are determined using the inverse of the weight fitting function of the positive samples.
[0052] In a possible implementation manner, the determining module is further configured to:
[0053] If the negative samples with negative results determined in the multiple original samples have completed a full life cycle, the weight of the negative samples that have completed a full life cycle is determined to be the preset value.
[0054] According to a third aspect, an electronic device is provided, comprising a processor and a memory, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute any one of the above-described methods for processing samples for model training.
[0055] In a fourth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, wherein the computer program is configured to execute any of the above-mentioned methods for processing samples for model training when running.
[0056] By means of the above technical scheme, the processing method and device, electronic device and computer-readable storage medium for samples for model training provided in the embodiment of the present application can obtain the order data that has been activated and completed the full life cycle in multiple original samples to be used for model training; according to the order data that has been activated and completed the full life cycle in multiple original samples, the number of orders with positive results determined at different days from the order activation date is counted; then based on the number of orders with positive results determined at different days from the order activation date, the weights of positive samples with positive results determined in multiple original samples and the weights of negative samples with negative results determined are determined; then the weighted positive samples and weighted negative samples are used as processed training samples to train the model. It can be seen that the embodiment of the present application uses the method of weighting positive samples and negative samples so that the label results of all known samples can be applied to model training, firstly expanding the number of available samples, especially the introduction of the latest samples significantly improves the model's responsiveness to new features; secondly, different weights are given to positive samples or negative samples with different days from the order activation date, which strengthens the value characteristics of the samples. After adding the weights of the above processing, the value prediction model generated by training can update the user value evaluation module of the customer relationship management system. Under the corresponding sales module, the efficiency of outbound calls and order conversion rate are improved. At the same time, the model life cycle is significantly extended and the maintenance cost is reduced. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in describing the embodiments of the present application are briefly introduced below.
[0058] Figure 1 A flowchart of a method for processing samples for model training provided in accordance with an embodiment of the present application is shown;
[0059] Figure 2 A schematic diagram of a fitted order quantity growth function provided in accordance with an embodiment of the present application is shown;
[0060] Figure 3 A schematic diagram of a weight fitting function provided according to an embodiment of the present application is shown;
[0061] Figure 4 A structural diagram of a sample processing device for model training provided according to an embodiment of the present application is shown. DETAILED DESCRIPTION
[0062] The exemplary embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present application and to fully convey the scope of the present application to those skilled in the art.
[0063] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that such use is interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the term "including" and its variants are to be interpreted as open-ended terms meaning "including but not limited to".
[0064] The present application embodiment provides a method for processing samples for model training, which can be applied to electronic devices such as servers or personal computers. Figure 1 As shown, the method for processing samples for model training may specifically include the following steps S101 to S104:
[0065] Step S101, obtaining order data that has been activated and has completed its full life cycle from a plurality of original samples to be used for model training;
[0066] Step S102, based on the order data of activated orders that have completed their full life cycle in multiple original samples, count the number of orders that have determined positive results at different days from the order activation date;
[0067] Step S103, based on the number of orders with positive results determined at different days from the order activation date, determine the weights of positive samples with positive results determined and the weights of negative samples with negative results determined in the multiple original samples;
[0068] Step S104: Use the weighted positive samples and the weighted negative samples as processed training samples to train the model.
[0069] The embodiment of the present application obtains order data that has been activated and completed the full life cycle from multiple original samples to be used for model training; based on the order data that has been activated and completed the full life cycle from multiple original samples, the number of orders with positive results determined at different days from the order activation date is counted; then based on the number of orders with positive results determined at different days from the order activation date, the weights of positive samples with positive results determined in multiple original samples and the weights of negative samples with negative results determined are determined; then the weighted positive samples and weighted negative samples are used as processed training samples to train the model. It can be seen that the embodiment of the present application uses a method for weighting positive samples and negative samples so that the label results of all known samples can be applied to model training. First, the number of available samples is expanded, especially the introduction of the latest samples significantly improves the model's responsiveness to new features; secondly, different weights are given to positive samples or negative samples with different days from the order activation date, which strengthens the value characteristics of the samples. After adding the weights of the above processing, the value prediction model generated by training can update the user value evaluation module of the customer relationship management system. Under the corresponding sales module, the efficiency of outbound calls and order conversion rate are improved. At the same time, the model life cycle is significantly extended and the maintenance cost is reduced.
[0070] The multiple original samples mentioned in step S101 above may include order data that has been activated and has completed the full life cycle, and may also include order data that has been activated but has not completed the full life cycle, etc. For example, when an outbound call operator calls an outbound user for the first time, the order is activated at this time, and the entire full life cycle is completed from the order activation date to the full life cycle date. The full life cycle here can be set according to actual business needs, such as setting the full life cycle to 30 days or 45 days, etc., which is not limited in this embodiment of the present application. In addition, the outbound users here may be users who may have needs for insurance services, real estate services, car services, course services, etc.
[0071] As introduced in the background technology section, in the subsequent complete life cycle, if the order result is positive, that is, the order is converted or the order is completed, then the order is a positive sample and the sample label result is positive, while the negative result (that is, the order is not converted or the order is not completed) can only be truly determined after the complete life cycle is over. In the embodiment of the present application, for order data that has been activated and has not completed the complete life cycle, if the order result is a positive result, then the order is a positive sample; if the order result is not a positive result, then the order result is determined to be a negative result, and the order is a negative sample.
[0072] The number of orders with confirmed positive results mentioned in step S102 above is the number of orders that have completed conversion or become orders. The number of orders with confirmed positive results at different days from the order activation date is counted. For example, the number of orders with confirmed positive results at 0 days from the order activation date is counted, that is, the number of orders with confirmed positive results on the order activation date is counted; for example, the number of orders with confirmed positive results at 1 day from the order activation date is counted, that is, the number of orders with confirmed positive results on the second day from the order activation date is counted; for example, the number of orders with confirmed positive results at 44 days from the order activation date is counted, and so on. It should be noted that the examples listed here are only illustrative and do not limit the embodiments of the present application.
[0073] In an embodiment of the present application, a possible implementation method is provided. In step S103 above, based on the number of orders with positive results determined at different days from the order activation date, the weights of positive samples with positive results determined in multiple original samples and the weights of negative samples with negative results determined are determined. Specifically, the following steps A1 to A6 may be included:
[0074] Step A1, based on the statistical number of orders with confirmed positive results n days before the order activation date, fitting an order quantity growth function representing the relationship between the number of orders with confirmed positive results n days before the order activation date and the number of orders n days before the order activation date; wherein n is an integer greater than or equal to zero;
[0075] Step A2: define the information volume of the total number of orders in the previous n days to be equivalent to the information volume of the total number of orders in the entire life cycle, and the weight of the number of orders on the nth day is inversely proportional to the total number of orders in the previous n days;
[0076] Step A3, define the weight of the order on the last day of the complete life cycle as a preset value, then the weight of the order on the nth day is the preset value multiplied by the total number of orders completed in the complete life cycle, and then divided by the total number of orders in the previous n days;
[0077] Step A4, according to the order quantity growth function and the defined order weight on the nth day, obtain the weight value of the order on the nth day;
[0078] Step A5, performing function fitting according to the change of the weight value of the order on the nth day as n changes, and obtaining the weight fitting function of the positive sample;
[0079] Step A6, using the weight fitting function of the positive samples, the weights of the positive samples with determined positive results and the weights of the negative samples with determined negative results in the multiple original samples are determined.
[0080] The preset value mentioned in step A3 above may be 1 or 2, etc., and may be set according to actual needs, and the embodiment of the present application does not limit this.
[0081] The embodiment of the present application can collect all historical sample data suitable for model training, that is, order data that has been activated regardless of whether the full life cycle has been completed. The time period pattern of order label generation is statistically calculated from the samples that have completed the full life cycle, which is used to calculate the weight of negative samples of orders that have not completed the full life cycle, and the weight of positive samples with positive results that have been determined. In this way, the weight fitting function of the positive sample is used to determine the weight of the positive sample with positive results determined in multiple original samples and the weight of the negative sample with negative results determined, which can improve the accuracy of the model.
[0082] A possible implementation method is provided in the embodiment of the present application. In step A5 above, a function is fitted according to the weight value of the order on the nth day as n changes, and the weight fitting function of the positive sample is obtained. Specifically, the number of days n can be normalized using the complete life cycle, and a function is fitted according to the weight value of the order on the nth day as n changes, to obtain the weight fitting function of the positive sample. In this way, the weight fitting function of the positive sample obtained will not be affected by the specific complete life cycle, and can be applied to the weight setting of sample training with a certain regularity. The sample regularity is that after the sample characteristics are determined, the sample labels will be determined in a certain subsequent time period in a time-decaying law.
[0083] In an embodiment of the present application, a possible implementation method is provided. In the above step A6, the weight fitting function of the positive sample is used to determine the weight of the positive sample with a positive result determined in the multiple original samples and the weight of the negative sample with a negative result determined. Specifically, the following steps A6-1 to A6-2 may be included:
[0084] Step A6-1, using the complete life cycle to denormalize the weight fitting function of the positive sample, to obtain the weight fitting function of the positive sample related to the number of days n from the positive result determination date to the order activation date;
[0085] Step A6-2, using the weight fitting function of the positive samples related to the number of days n between the positive result determination date and the order activation date, determine the weights of the positive samples with determined positive results and the weights of the negative samples with determined negative results in multiple original samples.
[0086] In the above embodiment, the number of days n is normalized using the complete life cycle, and a function is fitted according to the change in the weight value of the order on the nth day as n changes. The obtained weight fitting function of the positive sample will not be affected by the specific complete life cycle. In this way, when used specifically, the weight fitting function of the positive sample can be denormalized using the complete life cycle to obtain the weight fitting function of the positive sample related to the number of days n from the positive result determination day to the order activation day. Then, the weight fitting function of the positive sample related to the number of days n from the positive result determination day to the order activation day is used to determine the weights of the positive samples with determined positive results and the weights of the negative samples with determined negative results in multiple original samples.
[0087] A possible implementation method is provided in an embodiment of the present application. In step A5 above, a function is fitted according to the weight value of the order on the nth day as n changes, and a weight fitting function of the positive sample is obtained. Specifically, a logarithmic function is fitted according to the weight value of the order on the nth day as n changes, and a weight fitting function of the positive sample is obtained. Here, the logarithmic function satisfies the characteristic that the weight value of the order on the nth day changes with n. The weight fitting function of the positive sample is obtained by fitting a logarithmic function according to the weight value of the order on the nth day as n changes, which can improve the accuracy of the function fitting.
[0088] In an embodiment of the present application, a possible implementation method is provided. In the above step A6, the weight fitting function of the positive sample is used to determine the weight of the positive sample with a positive result determined in the multiple original samples and the weight of the negative sample with a negative result determined. Specifically, the following steps A6-3 to A6-4 may be included:
[0089] Step A6-3, using the weight fitting function of the positive samples, determining the weights of the positive samples with positive results determined in the multiple original samples;
[0090] Step A6-4, using the inverse of the weight fitting function of the positive sample, the weight of the negative sample with a determined negative result among the multiple original samples is determined.
[0091] The embodiment of the present application uses data that has completed its full life cycle to fit the weight decay coefficient, and then implements model training by setting samples that have not yet completed their full life cycle as weighted negative samples in the form of the inverse of the weight decay coefficient. By processing the weights of positive and negative samples, the label results of all known samples can be applied to model training, expanding the number of available samples. In particular, the introduction of the latest samples significantly improves the model's responsiveness to new features.
[0092] A possible implementation method is provided in an embodiment of the present application. In the above step A6-4, the inverse of the weight fitting function of the positive sample is used to determine the weight of the negative samples with determined negative results in multiple original samples. Specifically, if the negative samples with determined negative results in multiple original samples have completed their life cycle, the weight of the negative samples that have completed their life cycle is determined to be a preset value.
[0093] The above introduces Figure 1 There are multiple implementation methods for each link in the illustrated embodiment. The following is a further explanation of the sample processing method for model training provided in the embodiment of the present application through specific embodiments.
[0094] The embodiment of the present application is used to achieve that order results determined at different times within the order life cycle of up to several weeks (such as 30 days or 45 days, etc.) after the activation of an online sales order can be introduced into the value model training system. It is a technical method for improving the responsiveness of the value model to new features and new results while maintaining sample balance as much as possible.
[0095] The core value model prediction system in online sales orders requires a batch of positive sample sets and negative sample sets obtained under fair conditions with features and label results for model training. After a sample event is initially generated, a period of time is allowed as a waiting period for the positive result to appear as a life cycle. When a positive sample appears, the sample result is positive, and the negative result can only be truly determined after the complete life cycle ends. The technical solution of this application is mainly devoted to solving the problem of using the label results of the sample for value model training before the end of the complete life cycle of the event.
[0096] The value prediction model is a powerful tool for improving the intelligence of online sales operations. This application proposes a flexible and easy-to-implement solution on how to quickly and completely introduce sample information into the value prediction model while maintaining the balance and fairness of the sample information.
[0097] For the value prediction model to be studied, all historical sample data applicable to the model are collected, that is, order data that has been activated regardless of whether it has completed the full life cycle. The time cycle pattern of order tags generated from samples that have completed the full life cycle is statistically analyzed to calculate the weights of negative samples of orders that have not completed the full life cycle and the weights of positive samples that have been determined to have positive results. After the weighted value prediction model, the positive samples determined on different days in the entire life cycle and the negative sample information to be determined can all be applied to online sales operations.
[0098] First, we need to study the full sample used in the value prediction model, obtain the orders that have completed the entire life cycle, count the number of orders that have confirmed positive results n days before the order activation date, and make an order volume growth function curve that represents the relationship between the number of orders that have confirmed positive results n days before the order activation date and the number of orders n days before the order activation date, such as Figure 2 As shown. Figure 2 In the table, day represents the number of days from the order activation date, n is an integer greater than or equal to zero, and pos-label-num represents the number of orders with confirmed positive results. For example, if day=0 is the number of orders from the order activation date, 39,840 orders will be completed, and if day=20 is the number of orders from the order activation date, 109,770 orders will be completed. The number of orders here refers to the number of orders with confirmed positive results.
[0099] Define that the amount of information about the total number of orders in the previous n days is equivalent to the amount of information about the total number of orders for the entire life cycle, then the weight of the number of orders on the nth day is inversely proportional to the total number of orders in the previous n days.
[0100] like Figure 3 As shown in the pos-values point, the number of days n is normalized by the complete life cycle. The weight of the order on the last day of the complete life cycle is 1, and the weight of the order on the nth day is the total number of orders in the complete life cycle divided by the total number of orders in the previous n days, that is, the horizontal axis day (day) in the pos-values point represents the number of days n from the order activation date, and the vertical axis ratio (ratio) represents the weight of the order on the nth day.
[0101] Based on the attenuation characteristics of the pos-values point, a logarithmic function is fitted, and the fitting result is: Figure 3 The curve_fit curve and the weight fitting function of the positive sample are y=f(x)=-0.42ln(x-0.02)+1, where x is in the range (0,1]. When x=1, y=1, that is, the weight of the order on the last day of the complete life cycle is 1. Similarly, for samples that have not completed the entire life cycle, the weight of the negative sample should change accordingly. Here, the weight of the negative sample is set to 1 / f(x), that is, Figure 3 The negcurve curve y2 = 1 / y. Figure 3 In the equation, x takes values in the interval (0,1], and y=1 is the equal curve.
[0102] The value prediction model can use all samples for weighted training, wherein the weight fitting function y=f(x)=-0.42ln(x-0.02)+1 of the positive sample is denormalized using the complete life cycle to obtain the weight fitting function of the positive sample related to the number of days n from the positive result determination date to the order activation date, that is, the weight of the positive sample w(day)=-0.4lg(day+0.1)+2.6, wherein day is the number of days n from the positive result determination date to the order activation date; for negative samples that have completed the entire life cycle, the weight of the negative sample is 1; for samples that have not completed the entire life cycle, if the sample result is not a positive result, the sample result is determined to be a negative result, and then the sample is determined to be a negative sample, and the weight of the negative sample is w=1 / w(day).
[0103] The application of the sample label weight processing method in the embodiment of the present application allows the labels of all known samples to be applied to the value prediction model. First, the number of available samples is expanded, especially the introduction of the latest samples significantly improves the model's responsiveness to new features; secondly, different weights are given to positive samples at different days from the order activation date, which strengthens the value characteristics of the samples. After adding the weights processed above, the value prediction model generated by training can update the user value evaluation module of the CRM (Customer Relationship Management) system, and under the corresponding sales module, it improves the order conversion rate of outbound users. At the same time, the model life cycle is significantly extended, reducing maintenance costs.
[0104] In the embodiment of the present application, after the sample features are generated in the online sales system, the label result needs a certain time as a life cycle waiting scenario, and the weight decay coefficient is fitted using the data of the completed life cycle, so as to realize the sample that has not yet completed the life cycle as a weighted negative sample in the form of the inverse of the weight decay coefficient for model training. The technical solution of the embodiment of the present application can be applied to the weight setting of sample training with a certain regularity, and its sample regularity is manifested as that after the sample features are determined, the sample labels will be determined successively in a certain subsequent time period in a time decay law. Its time decay function and decay sample data need to be adjusted according to the actual business scenario.
[0105] It should be noted that, in practical applications, all possible implementation methods described above can be arbitrarily combined to form possible embodiments of the present application, which will not be described one by one here.
[0106] Based on the methods for processing samples for model training provided in the above embodiments, and based on the same inventive concept, an embodiment of the present application also provides a device for processing samples for model training.
[0107] Figure 4 FIG. 1 shows a structural diagram of a sample processing device for model training provided in an embodiment of the present application. Figure 4 As shown, the processing device for samples used for model training may include an acquisition module 410, a statistics module 420, a determination module 430 and a training module 440.
[0108] An acquisition module 410 is used to acquire order data that has been activated and has completed a full life cycle from a plurality of original samples to be used for model training;
[0109] A statistics module 420 is used to count the number of orders with positive results determined at different days from the order activation date based on the order data that have been activated and have completed the full life cycle in multiple original samples;
[0110] A determination module 430 is used to determine the weights of positive samples with positive results and the weights of negative samples with negative results in the multiple original samples based on the number of orders with positive results determined at different days from the order activation date.
[0111] The training module 440 is used to train the model by using the weighted positive samples and the weighted negative samples as processed training samples.
[0112] A possible implementation method is provided in the embodiments of the present application. Figure 4 The illustrated determination module 430 is also used to:
[0113] Based on the statistical number of orders with confirmed positive results n days before the order activation date, fit an order volume growth function that represents the relationship between the number of orders with confirmed positive results n days before the order activation date and the number of orders n days before the order activation date; where n is an integer greater than or equal to zero;
[0114] Define that the amount of information about the total number of orders in the previous n days is equivalent to the amount of information about the total number of orders in the entire life cycle, then the weight of the number of orders on the nth day is inversely proportional to the total number of orders in the previous n days;
[0115] Define the weight of the order on the last day of the complete life cycle as the preset value, then the weight of the order on the nth day is the preset value multiplied by the total number of orders completed in the complete life cycle, and then divided by the total number of orders in the previous n days;
[0116] According to the order volume growth function and the defined order weight on the nth day, the weight value of the order on the nth day is obtained;
[0117] Perform function fitting based on the change of the weight value of the order on the nth day as n changes, and obtain the weight fitting function of the positive sample;
[0118] The weight fitting function of the positive sample is used to determine the weights of the positive samples with determined positive results and the weights of the negative samples with determined negative results in the multiple original samples.
[0119] A possible implementation method is provided in the embodiments of the present application. Figure 4 The illustrated determination module 430 is also used to:
[0120] The number of days n is normalized using the complete life cycle, and a function is fitted based on the change in the weight value of the order on the nth day as n changes, to obtain the weight fitting function of the positive sample.
[0121] A possible implementation method is provided in the embodiments of the present application. Figure 4 The illustrated determination module 430 is also used to:
[0122] The weight fitting function of the positive sample is denormalized using the complete life cycle to obtain the weight fitting function of the positive sample related to the number of days n between the positive result determination day and the order activation day;
[0123] The weight fitting function of the positive samples related to the number of days n between the positive result determination date and the order activation date is used to determine the weights of the positive samples with determined positive results and the weights of the negative samples with determined negative results in multiple original samples.
[0124] A possible implementation method is provided in the embodiments of the present application. Figure 4 The illustrated determination module 430 is also used to:
[0125] A logarithmic function is fitted according to the change of the weight value of the order on the nth day as n changes, and the weight fitting function of the positive sample is obtained.
[0126] A possible implementation method is provided in the embodiments of the present application. Figure 4 The illustrated determination module 430 is also used to:
[0127] The weight of the positive samples with positive results determined in the multiple original samples is determined by using the weight fitting function of the positive samples;
[0128] The weights of negative samples with determined negative results in multiple original samples are determined by using the inverse of the weight fitting function of the positive samples.
[0129] A possible implementation method is provided in the embodiments of the present application. Figure 4 The illustrated determination module 430 is also used to:
[0130] If a negative sample with a determined negative result among multiple original samples has completed its full life cycle, the weight of the negative sample that has completed its full life cycle is determined to be a preset value.
[0131] Based on the same inventive concept, an embodiment of the present application also provides an electronic device, including a processor and a memory, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the sample processing method for model training of any one of the above embodiments.
[0132] Based on the same inventive concept, an embodiment of the present application also provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute a sample processing method for model training of any of the above embodiments when running.
[0133] Those skilled in the art can clearly understand that the specific working processes of the systems, devices, and modules described above can refer to the corresponding processes in the aforementioned method embodiments, and for the sake of brevity, they are not further described here.
[0134] Those skilled in the art can understand that the technical solution of the present application can be essentially or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, which includes a number of program instructions, so that an electronic device (such as a personal computer, a server, or a network device, etc.) executes all or part of the steps of the method described in each embodiment of the present application when running the program instructions. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc., various media that can store program codes.
[0135] Alternatively, all or part of the steps of implementing the aforementioned method embodiments may be accomplished by hardware associated with program instructions (such as electronic devices such as personal computers, servers, or network devices), and the program instructions may be stored in a computer-readable storage medium. When the program instructions are executed by a processor of an electronic device, the electronic device executes all or part of the steps of the methods described in the embodiments of the present application.
[0136] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that within the spirit and principles of the present application, they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not deviate from the protection scope of the present application.
Claims
1. A method for processing samples for model training, characterized in that: include: Obtaining order data that has been activated and completed its entire life cycle from multiple original samples to be used for model training; According to the order data of the activated and completed life cycles in the multiple original samples, the number of orders with confirmed positive results at different days from the order activation date is counted; Determine the weights of positive samples with determined positive results and the weights of negative samples with determined negative results among the multiple original samples based on the number of orders with determined positive results at different days from the order activation date that are statistically determined; Using the weighted positive samples and the weighted negative samples as processed training samples to train the model; The method of determining the weights of positive samples with positive results and the weights of negative samples with negative results among the multiple original samples based on the number of orders with positive results determined at different days from the order activation date according to the statistics includes: Based on the statistical number of orders with confirmed positive results n days before the order activation date, fit an order volume growth function that represents the relationship between the number of orders with confirmed positive results n days before the order activation date and the number of orders n days before the order activation date; where n is an integer greater than or equal to zero; Define that the amount of information about the total number of orders in the previous n days is equivalent to the amount of information about the total number of orders in the entire life cycle, then the weight of the number of orders on the nth day is inversely proportional to the total number of orders in the previous n days; Define the weight of the order on the last day of the complete life cycle as the preset value, then the weight of the order on the nth day is the preset value multiplied by the total number of orders completed in the complete life cycle, and then divided by the total number of orders in the previous n days; According to the order quantity growth function and the defined order weight of the n-th day, a weight value of the order on the n-th day is obtained; Perform function fitting according to the change of the weight value of the order on the nth day as n changes, and obtain the weight fitting function of the positive sample; The weight fitting function of the positive sample is used to determine the weights of the positive samples for which positive results have been determined and the weights of the negative samples for which negative results have been determined in the multiple original samples.
2. The method for processing samples for model training according to claim 1, characterized in that: Function fitting is performed according to the change of the weight value of the order on the nth day as n changes, and the weight fitting function of the positive sample is obtained, including: The number of days n is normalized using the complete life cycle, and a function is fitted according to the change of the weight value of the order on the nth day with n, so as to obtain the weight fitting function of the positive sample.
3. The method for processing samples for model training according to claim 2, characterized in that: Determining the weights of the positive samples for which positive results have been determined and the weights of the negative samples for which negative results have been determined among the multiple original samples by using the weight fitting function of the positive samples, including: Denormalizing the weight fitting function of the positive sample using the complete life cycle to obtain the weight fitting function of the positive sample related to the number of days n between the positive result determination date and the order activation date; The weight fitting function of the positive samples related to the number of days n between the positive result determination date and the order activation date is used to determine the weights of the positive samples with determined positive results and the weights of the negative samples with determined negative results in the multiple original samples.
4. The method for processing samples for model training according to claim 1 or 2, characterized in that: Function fitting is performed according to the change of the weight value of the order on the nth day as n changes, and the weight fitting function of the positive sample is obtained, including: A logarithmic function is fitted according to the change of the weight value of the order on the nth day as n changes, and a weight fitting function of the positive sample is obtained.
5. The method for processing samples for model training according to claim 1, characterized in that: Determining the weights of the positive samples for which positive results have been determined and the weights of the negative samples for which negative results have been determined among the multiple original samples by using the weight fitting function of the positive samples, including: Determine the weight of the positive sample with a positive result determined among the plurality of original samples by using the weight fitting function of the positive sample; The weights of negative samples with determined negative results among the multiple original samples are determined using the inverse of the weight fitting function of the positive samples.
6. The method for processing samples for model training according to claim 5, characterized in that: Determining the weight of the negative sample with a determined negative result among the multiple original samples by using the inverse of the weight fitting function of the positive sample includes: If the negative samples with negative results determined in the multiple original samples have completed a full life cycle, the weight of the negative samples that have completed a full life cycle is determined to be the preset value.
7. A sample processing device for model training, characterized in that: include: An acquisition module, used to acquire order data that has been activated and has completed its full life cycle from multiple original samples to be used for model training; A statistical module, for counting the number of orders with positive results determined at different days from the order activation date based on the order data that have been activated and have completed the full life cycle in the multiple original samples; A determination module, configured to determine the weights of positive samples with determined positive results and the weights of negative samples with determined negative results among the multiple original samples based on the number of orders with determined positive results at different days from the order activation date that are statistically determined; A training module, used for training the model using the weighted positive samples and the weighted negative samples as processed training samples; Wherein, the determining module is also used for: Based on the statistical number of orders with confirmed positive results n days before the order activation date, fit an order volume growth function that represents the relationship between the number of orders with confirmed positive results n days before the order activation date and the number of orders n days before the order activation date; where n is an integer greater than or equal to zero; Define that the amount of information about the total number of orders in the previous n days is equivalent to the amount of information about the total number of orders in the entire life cycle, then the weight of the number of orders on the nth day is inversely proportional to the total number of orders in the previous n days; Define the weight of the order on the last day of the complete life cycle as the preset value, then the weight of the order on the nth day is the preset value multiplied by the total number of orders completed in the complete life cycle, and then divided by the total number of orders in the previous n days; According to the order quantity growth function and the defined order weight of the n-th day, a weight value of the order on the n-th day is obtained; Perform function fitting according to the change of the weight value of the order on the nth day as n changes, and obtain the weight fitting function of the positive sample; The weight fitting function of the positive sample is used to determine the weights of the positive samples for which positive results have been determined and the weights of the negative samples for which negative results have been determined in the multiple original samples.
8. The sample processing device for model training according to claim 7, characterized in that: The determining module is also used for: The number of days n is normalized using the complete life cycle, and a function is fitted according to the change of the weight value of the order on the nth day with n, so as to obtain the weight fitting function of the positive sample.
9. The sample processing device for model training according to claim 8, characterized in that: The determining module is also used for: Denormalizing the weight fitting function of the positive sample using the complete life cycle to obtain the weight fitting function of the positive sample related to the number of days n between the positive result determination date and the order activation date; The weight fitting function of the positive samples related to the number of days n between the positive result determination date and the order activation date is used to determine the weights of the positive samples with determined positive results and the weights of the negative samples with determined negative results in the multiple original samples.
10. The sample processing device for model training according to claim 7 or 8, characterized in that: The determining module is also used for: A logarithmic function is fitted according to the change of the weight value of the order on the nth day as n changes, and a weight fitting function of the positive sample is obtained.
11. The sample processing device for model training according to claim 7, characterized in that: The determining module is also used for: Determine the weight of the positive sample with a positive result determined among the plurality of original samples by using the weight fitting function of the positive sample; The weights of negative samples with determined negative results among the multiple original samples are determined using the inverse of the weight fitting function of the positive samples.
12. The sample processing device for model training according to claim 11, characterized in that: The determining module is also used for: If the negative samples with negative results determined in the multiple original samples have completed a full life cycle, the weight of the negative samples that have completed a full life cycle is determined to be the preset value.
13. An electronic device, characterized in that: It comprises a processor and a memory, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the sample processing method for model training described in any one of claims 1 to 6.
14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program is configured to execute the method for processing samples for model training according to any one of claims 1 to 6 when running.