Method and apparatus for model training and delivery time determination, storage medium, and electronic device

By setting different rate-of-change rates of the target loss function, the existing delivery time estimate model is solved to estimate deviation caused by the small number of lagged delivery orders, and the delivery time estimate is more in line with the needs of the business scenario, which improves the service experience of consumers.

CN110390503BActive Publication Date: 2025-07-22BEIJING SANKUAI ONLINE TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN201910601412.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-07-03
Publication Date
2025-07-22
Estimated Expiration
2039-07-03

AI Technical Summary

Technical Problem

In the case of a small number of lagged delivery orders, the existing delivery time estimate model tends to make the estimated time earlier, resulting in a longer lagged delivery time and affecting the consumer's service experience.

Method used

By setting the different rates of change between the first and second relationship functions of the target loss function, the model is trained to reduce training deviations, flexibly adjust the loss function to adapt to business scenario needs, and improve the accuracy of estimates.

Benefits of technology

This reduces the training deviation caused by different samples of different types of samples, improves the accuracy of the delivery time, and improves the service experience of consumers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN110390503B_ABST
    Figure CN110390503B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a method and apparatus for model training and delivery time determination, a storage medium, and an electronic device. The method for model training includes: obtaining a sample data set, where the sample data includes the actual delivery time of historical orders; training a model for predicting the delivery time according to the sample data set and a target loss function; where, when the delivery time error is a positive number, the first change rate of the first functional relationship of the target loss function of the delivery time determination model is different from the second change rate of the second functional relationship of the target loss function of the delivery time determination model when the delivery time error is a negative number.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of Internet technologies, and in particular, to a method and apparatus for model training and delivery time determination, a storage medium, and an electronic device. Background Art

[0002] In scenarios involving commodity delivery such as express delivery and food delivery, platforms that provide ordering services or delivery services for consumers can provide the estimated delivery time of commodities. Therefore, consumers can know in advance the approximate arrival time of the commodities and can adjust their own affairs and schedule according to this arrival time. At the same time, the length of the delivery time is also one of the factors for some consumers to decide whether to order commodities. Therefore, the accuracy of the delivery time will affect the actual ordering experience of consumers and further affect the trust level of the platform in the hearts of consumers.

[0003] Currently, the estimation of the delivery time mainly relies on establishing an estimation model for the delivery time, taking variable factors (such as weather, time period, distance, etc.) in the delivery scenario as variables of the model, and finally outputting the estimated delivery time. After the estimation of the delivery time, the model can also be trained according to the actual delivery time feedback by users or deliverers. Therefore, generally speaking, the delivery time estimated by this model will become more and more accurate as the number of orders increases.

[0004] However, in the actual delivery scenario, since the number of orders delivered in advance is often more than the number of orders delivered late, the optimization of the model will tend to make the relatively large number of orders delivered in advance more punctual, which will result in the estimated time of the orders delivered late being more inaccurate and affecting the service experience of consumers. Summary of the Invention

[0005] The purpose of the present disclosure is to provide a method and apparatus for model training and delivery time determination, a storage medium, and an electronic device to solve the problems existing in the related art.

[0006] To achieve the above object, a first aspect of the present disclosure provides a method for model training, the method comprising: obtaining a sample data set, the sample data including the actual delivery time of historical orders; training a model for predicting the delivery time according to the sample data set and a target loss function; wherein, the target loss function includes: when the delivery time error is positive, the first change rate of the first functional relationship of the target loss function of the delivery time determination model is different from the second change rate of the second functional relationship of the target loss function of the delivery time determination model when the delivery time error is negative, the delivery time error being positive indicates that the predicted delivery time is earlier than the actual delivery time, the delivery time error being negative indicates that the predicted delivery time is later than the actual delivery time, the target loss function being used to characterize the mapping relationship between the loss amount predicted by the model and the delivery time error; the first change rate is the rate at which the loss amount changes with the absolute value of the delivery time error in the first relationship function, and the second change rate is the rate at which the loss amount changes with the absolute value of the delivery time error in the second relationship function.

[0007] Optionally, the method further comprises: obtaining a loss function selection instruction; according to the instruction, selecting a target function expression from a plurality of preset candidate function expressions; selecting a target coefficient combination from a plurality of groups of coefficient combinations preset corresponding to the target function expression; and determining the target loss function according to the target function expression and the target coefficient combination.

[0008] Optionally, the selecting a target coefficient combination from a plurality of groups of coefficient combinations preset corresponding to the target function expression includes: substituting each coefficient combination into the target function expression to obtain a candidate loss function; for each obtained candidate loss function, performing the following operations: training a to-be-tested model through the candidate loss function and the training sample data set; testing the to-be-tested model through a test sample data set to obtain a test evaluation value; and determining the coefficient combination corresponding to the to-be-tested model with the optimal test evaluation value as the target coefficient combination.

[0009] Optionally, the plurality of candidate function expressions include any of the following types of expressions: First type expression: wherein, the is the predicted delivery time, Y is the actual delivery time, and a1 and b1 are a group of coefficient combinations of the first type expression; Second type expression: wherein, a 21 , b 21 , a 22 and b 22 are a group of coefficient combinations of the second type expression.

[0010] Optionally, the obtaining of the loss function selection instruction includes: determining the type of the loss function according to the type information of the orders in the sample data set and / or the time information at the time of order generation; generating the loss function selection instruction according to the type of the loss function; wherein, different types of the loss functions are used to represent different magnitude relationships between the first change rate of the first relationship function and the second change rate of the second relationship function.

[0011] Optionally, the sample data set includes first sample data indicating that the actual delivery time of an order is earlier than the expected delivery time, and second type of sample data indicating that the actual delivery time of an order is later than the expected delivery time. The obtaining of the sample data set includes: comparing the number of samples of the first type of sample data and the second type of sample data, and determining the target sample data category with a smaller number of samples; entering the resampled sample data of the target sample data category into the sample data set.

[0012] In a second aspect of the present disclosure, a method for determining a delivery time is provided. The method includes: obtaining the delivery characteristic information of an order to be delivered; inputting the delivery characteristic information into a delivery time determination model to obtain the predicted delivery time of the order to be delivered output by the delivery time determination model; sending the predicted delivery time to the client that generates the order to be delivered for the client to display the predicted delivery time; wherein, when the delivery time error is positive, the first change rate of the first functional relationship of the target loss function of the delivery time determination model is different from the second change rate of the second functional relationship of the target loss function of the delivery time determination model when the delivery time error is negative. The delivery time error being positive indicates that the predicted delivery time is earlier than the actual delivery time, and the delivery time error being negative indicates that the predicted delivery time is later than the actual delivery time. The target loss function is used to represent the mapping relationship between the loss amount predicted by the model and the delivery time error; the first change rate is the rate at which the loss amount changes with the absolute value of the delivery time error in the first relationship function, and the second change rate is the rate at which the loss amount changes with the absolute value of the delivery time error in the second relationship function.

[0013] Optionally, the delivery time determination model is trained through the following training steps: obtaining a sample data set, where the sample data includes the actual delivery time of historical orders; training a model for predicting the delivery time according to the sample data set and the target loss function.

[0014] Optionally, the training step further includes: obtaining a loss function selection instruction; according to the instruction, selecting a target function expression from a plurality of preset candidate function expressions; selecting a target coefficient combination from a plurality of groups of coefficient combinations corresponding to the target function expression; and determining the target loss function according to the target function expression and the target coefficient combination.

[0015] Optionally, the selecting a target coefficient combination from a plurality of groups of coefficient combinations corresponding to the target function expression includes: substituting each coefficient combination into the target function expression to obtain a candidate loss function; for each obtained candidate loss function, performing the following operations: training a to-be-tested model through the candidate loss function and a training sample data set; testing the to-be-tested model through a test sample data set to obtain a test evaluation value; and determining the coefficient combination corresponding to the to-be-tested model with the optimal test evaluation value as the target coefficient combination.

[0016] Optionally, the plurality of candidate function expressions include any of the following types of expressions: a first type of expression: wherein, the is the expected delivery time, the Y is the actual delivery time, and a1 and b1 are a group of coefficient combinations of the first type of expression; a second type of expression: wherein, a 21 , b 21 , a 22 and b 22 are a group of coefficient combinations of the second type of expression.

[0017] Optionally, the obtaining a loss function selection instruction includes: determining a loss function type according to the type information of the orders in the sample data set and / or the time information at the time of order generation; generating the loss function selection instruction according to the loss function type; wherein, different loss function types are used to represent different magnitude relationships between the first change rate of the first relationship function and the second change rate of the second relationship function.

[0018] Optionally, the sample data set includes first sample data indicating that the actual delivery time of the order is earlier than the expected delivery time, and second type of sample data indicating that the actual delivery time of the order is later than the expected delivery time. The obtaining the sample data set includes: comparing the number of samples of the first type of sample data and the second type of sample data, and determining the target sample data category with a smaller number of samples; and inputting the resampled sample data of the target sample data category into the sample data set.

[0019] A third aspect of the present disclosure provides an apparatus for model training. The apparatus includes: a sample acquisition module for acquiring a sample data set, where the sample data includes the actual delivery time of historical orders; a model training module for training a model for predicting the delivery time according to the sample data set and a target loss function; wherein, when the delivery time error is positive, the first change rate of the first functional relationship of the target loss function of the delivery time determination model is different from the second change rate of the second functional relationship of the target loss function of the delivery time determination model when the delivery time error is negative. The positive delivery time error indicates that the predicted delivery time is earlier than the actual delivery time, and the negative delivery time error indicates that the predicted delivery time is later than the actual delivery time. The target loss function is used to characterize the mapping relationship between the loss amount predicted by the model and the delivery time error; the first change rate is the rate at which the loss amount changes with the absolute value of the delivery time error in the first relationship function, and the second change rate is the rate at which the loss amount changes with the absolute value of the delivery time error in the second relationship function.

[0020] Optionally, the apparatus further includes: an instruction acquisition module for acquiring a loss function selection instruction; a function selection module for selecting a target function expression from a plurality of preset candidate function expressions according to the instruction; a coefficient selection module for selecting a target coefficient combination from a plurality of groups of coefficient combinations preset corresponding to the target function expression; a target determination module for determining the target loss function according to the target function expression and the target coefficient combination.

[0021] Optionally, the coefficient selection module is configured to substitute each coefficient combination into the target function expression to obtain a candidate loss function; for each obtained candidate loss function, perform the following operations: training a to-be-tested model through the candidate loss function and a training sample data set; testing the to-be-tested model through a test sample data set to obtain a test evaluation value; determining the coefficient combination corresponding to the to-be-tested model with the optimal test evaluation value as the target coefficient combination.

[0022] Optionally, the plurality of candidate function expressions include any of the following types of expressions: First type expression: Wherein, the is the predicted delivery time, Y is the actual delivery time, and a1 and b1 are a group of coefficient combinations of the first type expression; Second type expression: Wherein, a 21 , b 21 , a 22 and b 22 are a group of coefficient combinations of the second type expression.

[0023] Optionally, the instruction obtaining module is configured to determine a loss function type according to the type information of the orders in the sample data set and / or the time information when the orders are generated; generate a loss function selection instruction according to the loss function type; wherein, different loss function types are used to characterize different magnitude relationships between the first change rate of the first relationship function and the second change rate of the second relationship function.

[0024] Optionally, the sample data set includes first sample data indicating that the actual delivery time of an order is earlier than the expected delivery time, and second sample data indicating that the actual delivery time of an order is later than the expected delivery time. The sample obtaining module is configured to compare the number of samples of the first type of sample data and the second type of sample data, determine the target sample data category with a smaller number of samples; and input the resampled target sample data category into the sample data set.

[0025] In a fourth aspect of the present disclosure, there is provided a device for determining a delivery time. The device includes: a feature obtaining module, configured to obtain delivery feature information of an order to be delivered; a feature processing module, configured to input the delivery feature information into a delivery time determination model, and obtain a predicted delivery time of the order to be delivered output by the delivery time determination model; and a sending module, configured to send the predicted delivery time to a client that generates the order to be delivered, so that the client can display the predicted delivery time; wherein, when the delivery time error is a positive number, the first change rate of the first functional relationship of the target loss function of the delivery time determination model is different from the second change rate of the second functional relationship of the target loss function of the delivery time determination model when the delivery time error is a negative number. The delivery time error being a positive number indicates that the predicted delivery time is earlier than the actual delivery time, and the delivery time error being a negative number indicates that the predicted delivery time is later than the actual delivery time. The target loss function is used to characterize the mapping relationship between the loss amount predicted by the model and the delivery time error; the first change rate is the rate at which the loss amount changes with the absolute value of the delivery time error in the first relationship function, and the second change rate is the rate at which the loss amount changes with the absolute value of the delivery time error in the second relationship function.

[0026] Optionally, the device further includes a training module. The training module includes: a sample obtaining sub-module, configured to obtain a sample data set, where the sample data includes the actual delivery time of historical orders; and a model training sub-module, configured to train a model for predicting the delivery time according to the sample data set and the target loss function.

[0027] Optionally, the training module further includes: an instruction acquisition sub-module, configured to acquire a loss function selection instruction; a function selection sub-module, configured to select a target function expression from a plurality of preset candidate function expressions according to the instruction; a coefficient selection sub-module, configured to select a target coefficient combination from a plurality of groups of coefficient combinations corresponding to the target function expression; and a target determination sub-module, configured to determine the target loss function according to the target function expression and the target coefficient combination.

[0028] Optionally, the coefficient selection sub-module is configured to substitute each coefficient combination into the target function expression to obtain a candidate loss function; for each obtained candidate loss function, perform the following operations: training a to-be-tested model through the candidate loss function and a training sample data set; testing the to-be-tested model through a test sample data set to obtain a test evaluation value; and determining the coefficient combination corresponding to the to-be-tested model with the optimal test evaluation value as the target coefficient combination.

[0029] Optionally, the plurality of candidate function expressions include any of the following types of expressions: a first type of expression: wherein, the is the expected delivery time, the Y is the actual delivery time, and a1 and b1 are a group of coefficient combinations of the first type of expression; a second type of expression: wherein, a 21 , b 21 , a 22 and b 22 are a group of coefficient combinations of the second type of expression.

[0030] Optionally, the instruction acquisition sub-module is configured to determine a loss function type according to the type information of the orders in the sample data set and / or the time information at the time of order generation; and generate the loss function selection instruction according to the loss function type; wherein, different loss function types are used to represent different magnitude relationships between the first change rate of the first relationship function and the second change rate of the second relationship function.

[0031] Optionally, the sample data set includes first sample data indicating that the actual delivery time of an order is earlier than the expected delivery time, and second type of sample data indicating that the actual delivery time of an order is later than the expected delivery time. The sample acquisition module is configured to compare the number of samples of the first type of sample data and the second type of sample data, determine the target sample data category with a smaller number of samples; and input the resampled sample data of the target sample data category into the sample data set.

[0032] In a fifth aspect of the present disclosure, there is provided a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the method according to any one of the first aspects of the present disclosure.

[0033] In a sixth aspect of the present disclosure, there is provided a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the method according to any one of the second aspects of the present disclosure.

[0034] In a seventh aspect of the present disclosure, there is provided an electronic device including: a memory having stored thereon a computer program; and a processor configured to execute the computer program in the memory to implement the steps of the method according to any one of the first aspects of the present disclosure.

[0035] In an eighth aspect of the present disclosure, there is provided an electronic device including: a memory having stored thereon a computer program; and a processor configured to execute the computer program in the memory to implement the steps of the method according to any one of the second aspects of the present disclosure.

[0036] Through the above technical solutions, at least the following technical effects can be achieved:

[0037] By setting the relationship between the first change rate of the first relationship function and the second change rate of the second relationship function of the target loss function, and training the model for predicting the delivery time according to the target loss function and the sample data set, the training of the model is corrected by the target loss function with different change rates on both sides, reducing the training deviation of the model caused by different numbers of different types of samples, and thus reducing the deviation of the prediction result obtained by using the trained model. In addition, the setting of the loss function is more flexible, and the estimation of the delivery time is more in line with the requirements of the business scenario, improving the service experience of consumers.

[0038] Other features and advantages of the present disclosure will be described in detail in the following detailed implementation section. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] The drawings are used to provide a further understanding of the present disclosure, and constitute a part of the specification, and are used to explain the present disclosure together with the following detailed implementation, but do not constitute a limitation to the present disclosure. In the drawings:

[0040] Figure 1 is a flowchart of a method for model training shown according to an exemplary embodiment of the present disclosure.

[0041] Figure 2 is a function graph of a loss function shown according to an exemplary embodiment of the present disclosure.

[0042] Figure 3It is a flowchart of another method for model training shown according to an exemplary disclosed embodiment.

[0043] Figure 4 It is a function graph of a function expression shown according to an exemplary disclosed embodiment.

[0044] Figure 5 It is a function graph of another function expression shown according to an exemplary disclosed embodiment.

[0045] Figure 6 It is a flowchart of a method for determining delivery time shown according to an exemplary disclosed embodiment.

[0046] Figure 7 It is a block diagram of a device for model training shown according to an exemplary disclosed embodiment.

[0047] Figure 8 It is a block diagram of a device for determining delivery time shown according to an exemplary disclosed embodiment.

[0048] Figure 9 It is a block diagram of an electronic device shown according to an exemplary disclosed embodiment.

[0049] Figure 10 It is a block diagram of an electronic device shown according to an exemplary disclosed embodiment. Detailed Embodiments

[0050] The following provides a detailed description of the specific embodiments of the present disclosure in conjunction with the accompanying drawings. It should be understood that the specific embodiments described herein are only for the purpose of illustrating and explaining the present disclosure, and are not used to limit the present disclosure.

[0051] The implementation scenarios of the present disclosure are described below. The present disclosure is applied to business scenarios that require estimating the delivery time, such as express delivery, food delivery, supermarket delivery, home service, etc. In these services, since the model for predicting the delivery time may have biases in estimating the delivery time, during subsequent use, the model will be continuously corrected and trained based on the information of a large number of historical orders and a loss function, so that the model's estimation of the delivery time is closer to the actual delivery time. In the existing model training process, the loss amounts set for early delivery and late delivery by the loss function used for model training are the same. However, in the actual order information, the number of orders for early delivery and on-time delivery is much larger than that of late delivery. To ensure the punctuality of most orders, such a loss function and training set will train the model to make the model more inclined to estimate the delivery time of most orders (i.e., early delivery and on-time delivery) more accurately. Under such long-term training, the estimated delivery time of late orders will become earlier and earlier, and the actual delay time will also become longer and longer, thus affecting the user experience of this part of users.

[0052] Figure 1 is a flowchart of a method for model training shown according to an exemplary disclosed embodiment, as Figure 1 shown, the method includes the following steps.

[0053] S11. Obtain a sample data set, where the sample data includes the actual delivery time of historical orders.

[0054] The sample data set may be the data set of the above-mentioned historical orders used for continuously correcting and training the model, and the data includes the actual delivery time of order delivery. Among the data of these historical orders, there are orders delivered in advance (i.e., the delivery time error is a positive number), orders delivered on time (i.e., the delivery time error is 0), and orders delivered late (i.e., the delivery time error is a negative number), and also includes the feature information of each order, for example, the time when the order is generated, the address where the order is generated, the weather at the order generation location, the traffic conditions near the order generation location, and other information.

[0055] In an alternative embodiment, the sample data set includes first sample data representing that the actual delivery time of the order is earlier than the expected delivery time, and second sample data representing that the actual delivery time of the order is later than the expected delivery time. The obtaining of the sample data set includes: comparing the number of samples of the first type of sample data and the second type of sample data, determining the target sample data category with a smaller number of samples, and entering the resampled target sample data category into the sample data set.

[0056] In this way, when the number of a certain type of sample data is small, this type of data can be resampled to make up the number of samples, so that the prediction result is more objective and accurate.

[0057] S12. Train a model for predicting the delivery time according to the sample data set and the target loss function.

[0058] Wherein, the target loss function includes: a first relationship function between the absolute value of the delivery time error and the loss amount when the delivery time error is a positive number, and a second relationship function between the absolute value of the delivery time error and the loss amount when the delivery time error is a negative number. The delivery time error is the time difference between the expected delivery time and the actual delivery time.

[0059] The first change rate of the first relationship function is different from the second change rate of the second relationship function. The first change rate is the rate at which the loss amount changes with the absolute value of the delivery time error in the first relationship function, and the second change rate is the rate at which the loss amount changes with the absolute value of the delivery time error in the second relationship function.

[0060] For example, if there are 100 pieces of data in the sample dataset, among which 80 are historical order data with early delivery, 5 are historical order data with on-time delivery, and 15 are historical order data with late delivery, the on-time rate is 5%. Since the number of historical order data with early delivery is much larger than that of other order data, in order to make the estimated time of a large number of order data accurate (i.e., a higher on-time rate), if the model is trained according to the loss function of the original model (the first change rate is the same as the second change rate), the estimated time of the model will be advanced as a whole.

[0061] For example, for the convenience of expression, the actual delivery time and the estimated delivery time are expressed in minutes. Among 100 pieces of sample data, the estimated delivery time for all orders is 40 minutes. There are 40 orders with an actual delivery time of 30 minutes (i.e., early delivery), 40 orders with an actual delivery time of 10 - 20 minutes, 5 orders with an actual delivery time of 40 minutes, and 15 orders with an actual delivery time of 45 minutes. The on-time rate is 5%. To make more orders on time, the model of the existing technology may tend to advance the estimated delivery time of all orders by 10 minutes. That is, if the trained model is used to estimate the original 100 pieces of data again, the estimated delivery time of these 100 pieces of sample data by the trained model will all become 30 minutes. At this time, the number of on-time delivered orders becomes 40, the number of early delivered orders becomes 40, and the number of late delivered orders becomes 20, and the on-time rate becomes 40%. Although the on-time rate has increased and the overall estimated accuracy of the model has improved, this has caused more late delivered orders, and the lag time of the late orders is longer than that of the previous model. Although both early delivery and late delivery belong to the situation of inaccurate estimated delivery time, in fact, in scenarios such as food delivery, users are more accepting of early delivered orders, and have a lower tolerance for late delivered orders. Therefore, even if the model trained in this way has a more accurate estimated delivery time for a large number of orders, it may affect the service experience of consumers.

[0062] As Figure 2 shown is a function graph of a possible target loss function. Figure 2 The second change rate of the shown function (i.e., the change rate of the function on the right side of the Y-axis) is higher than the first change rate (i.e., the change rate of the function on the left side of the Y-axis), which means that if an order is late, a higher loss amount will be given to the model, so that the model can be more inclined to make late orders more on time during training.

[0063] For the same 100 sample data mentioned above, the estimated delivery time is 40 minutes for all. Among them, the number of orders with the actual delivery time of 30 minutes (i.e., early delivery) is 40, the number of orders with the actual delivery time of 10 - 20 minutes is 40, the number of orders with the actual delivery time of 40 minutes is 5, and the number of orders with the actual delivery time of 45 minutes is 15. The on-time rate is 5%. If Figure 2 the loss function shown is used to train the model, since the loss amount of late delivery is much larger than that of early delivery, the model will tend to make the estimated time of the orders that were originally late for delivery more punctual, that is, the model may tend to make the estimated delivery time later. Therefore, when the model re - estimates the original 100 data, the estimated delivery time of these 100 sample data after training may all become 45 minutes. At this time, the number of on - time delivery orders becomes 15, the number of early delivery orders becomes 85, and the on - time rate becomes 15%. Although the on - time rate is lower than that of the model trained by the previous loss function, the number of late delivery orders decreases, thus improving the user experience.

[0064] Through the above - mentioned method, at least the following technical effects can be achieved:

[0065] By setting the relationship between the first change rate of the first relationship function and the second change rate of the second relationship function of the target loss function, and training the model for predicting the delivery time according to the target loss function and the sample data set, the training of the model is corrected by the target loss function with different change rates on both sides, reducing the training bias caused by different numbers of different types of samples in the model, and thus reducing the deviation of the prediction result obtained by using the trained model. In addition, the setting of the loss function is more flexible, the estimation of the delivery time is more in line with the requirements of the business scenario, and the service experience of consumers is improved.

[0066] Figure 3 is a flowchart of another method for model training shown according to an exemplary disclosed embodiment. As Figure 3 shown, the method includes:

[0067] S21. Obtain a sample data set, where the sample data includes the actual delivery time of historical orders.

[0068] The sample data set can be the data set of the historical orders used for continuously correcting and training the model, and the data includes the actual delivery time of order delivery. Among the data of these historical orders, there are orders with early delivery (i.e., the delivery time error is positive), orders with on - time delivery (i.e., the delivery time error is 0), and orders with late delivery (i.e., the delivery time error is negative), and also includes the feature information of each order, such as the time when the order is generated, the address where the order is generated, the weather at the order - generating place, the traffic conditions near the order - generating place, etc.

[0069] In an alternative embodiment, the sample data set includes first sample data indicating that the actual delivery time of an order is earlier than the expected delivery time, and second sample data indicating that the actual delivery time of an order is later than the expected delivery time. Obtaining the sample data set includes: comparing the number of samples of the first type of sample data and the second type of sample data, determining the target sample data type with a smaller number of samples, and entering the resampled target sample data type into the sample data set.

[0070] In this way, when the number of a certain type of sample data is small, this type of data can be resampled to make up the number of samples, so that the prediction result is more objective and accurate.

[0071] S22. Obtain a loss function selection instruction.

[0072] The loss function selection instruction is used to select a specific loss function. The relationships between the first change rate and the second change rate of different loss functions are different, and the prediction results of the trained models are also different. For example, for a loss function with a first change rate greater than the second change rate, the predicted expected arrival time of the trained model will be earlier. For a loss function with a first change rate less than the second change rate, the predicted expected arrival time of the trained model will be later.

[0073] In a possible implementation, the type of loss function can be determined according to the type information of the orders in the sample data set and / or the time information when the orders are generated, and the loss function selection instruction is generated according to the type of loss function. Among them, different types of loss functions are used to represent different magnitude relationships between the first change rate of the first relationship function and the second change rate of the second relationship function.

[0074] For example, when the model is used to predict the takeaway delivery time and all the orders in the sample data set are takeaway delivery orders, since consumers of takeaways have a lower tolerance for late delivery, a loss function with a second change rate higher than the first change rate can be selected. In this way, the time predicted by the trained model will be more inclined to make the overtime degree of late delivery smaller. When the model is used to predict the arrival time of door-to-door services and other services that need to arrive after a certain time point, and all the orders in the sample data set are such orders, since consumers of such orders have a lower tolerance for early arrival and a higher tolerance for late arrival, a loss function with a first change rate higher than the second change rate can be selected. In this way, the time predicted by the trained model will be more inclined to make the early degree of early arrival smaller.

[0075] For example, the model is used to predict the delivery time of takeout, and the generation times of the orders in the sample dataset are all in summer or all in winter. Since the weather is hot in summer and it is not easy for takeout to get cold, while the weather is cold in winter and it is easy for takeout to get cold, users have a higher tolerance for late delivery in summer than in winter. Therefore, the second change rate of the loss function used in training the model for determining the delivery time of takeout delivery orders in summer can be lower than that of the loss function used in training the model for determining the delivery time of takeout delivery orders in winter.

[0076] S23. Select a target function expression from a plurality of preset candidate function expressions according to the instruction.

[0077] Optionally, the plurality of candidate function expressions include any of the following types of expressions:

[0078] First type of expression:

[0079]

[0080] wherein, the is the expected delivery time, the Y is the actual delivery time, and a1 and b1 are a set of coefficient combinations of the first type of expression.

[0081] Figure 4 is the function graph of the first type of expression, where a1 and b1 are 0.004 and 0.01 respectively. As Figure 4 can be seen, the change degrees of the first change rate and the second change rate of this function are very gentle.

[0082] Second type of expression:

[0083]

[0084] wherein, a 21 , b 21 , a 22 and b 22 are a set of coefficient combinations of the second type of expression.

[0085] Figure 5 is the function graph of the second type of expression, where a 21 , b 21 , a 22 and b 22 are 20, 20, 0.005, 0.005 respectively. As Figure 5 can be seen, the change degree of the change rate of this function is very gentle near the axis of symmetry, and the change degree of the change rate suddenly increases far from the axis of symmetry.

[0086] According to the instruction, select a target function expression from multiple predicted candidate function expressions, so that function expressions with different characteristics can be selected according to different business scenario requirements. For example, if it is used to predict the delivery time of on-time delivery (users have a very low tolerance for orders delivered in advance), a second-type expression can be selected because when the absolute value of the delivery time error of the second-type expression reaches a critical point, the change rate of the function will suddenly increase. Therefore, when training the function to predict the expected delivery time, it will avoid making the delivery time error reach the critical point value, that is, the expected delivery time will be as close as possible to the actual delivery time.

[0087] S24. Select a target coefficient combination from multiple groups of coefficient combinations corresponding to the target function expression preset.

[0088] Optionally, substitute each coefficient combination into the target function expression to obtain a candidate loss function, and for each obtained candidate loss function, perform the following operations:

[0089] First, train a model to be tested through the candidate loss function and the training sample data set.

[0090] Then, test the model to be tested through the test sample data set to obtain a test evaluation value.

[0091] After obtaining the test evaluation value of each model to be tested, determine the coefficient combination corresponding to the model to be tested with the optimal test evaluation value as the target coefficient combination.

[0092] The training sample data set can be a different data set from the sample data set or the same data set. The test evaluation value can be the on-time rate of the prediction result, or the ratio of the number of delivery time errors of the prediction result that meet the preset conditions to the total number of samples. According to different business requirements, different evaluation criteria for the evaluation value can be preset.

[0093] S25. Determine the target loss function according to the target function expression and the target coefficient combination.

[0094] S26. Train a model for predicting the delivery time according to the sample data set and the target loss function.

[0095] The first change rate of the first relation function of the target loss function and the second change rate of the second relation function are different according to different function expression types and different parameter combinations.

[0096] For example, if there are 100 pieces of data in the sample dataset, among which 80 are historical order data with early delivery, 5 are historical order data with on-time delivery, and 15 are historical order data with late delivery, the on-time rate is 5%. Since the number of historical order data with early delivery is much larger than that of other order data, in order to make the estimated time of a large number of order data accurate (i.e., a higher on-time rate), if the model is trained according to the loss function of the original model (the first change rate is the same as the second change rate), the overall estimated time of the model will be advanced.

[0097] For example, for the convenience of expression, the actual delivery time and the estimated delivery time are expressed in minutes. Among 100 pieces of sample data, the estimated delivery time of each order is 40 minutes. There are 40 orders with an actual delivery time of 30 minutes (i.e., early delivery), 40 orders with an actual delivery time of 10 - 20 minutes, 5 orders with an actual delivery time of 40 minutes, and 15 orders with an actual delivery time of 45 minutes. The on-time rate is 5%. In order to make more orders on time, the model may tend to advance the estimated delivery time of all orders by 10 minutes. That is, if the trained model is used to estimate the original 100 pieces of data again, the estimated delivery time of these 100 pieces of sample data by the trained model will all become 30 minutes. At this time, the number of orders with on-time delivery becomes 40, the number of orders with early delivery becomes 40, and the number of orders with late delivery becomes 20. The on-time rate becomes 40%. Although the on-time rate has increased and the overall estimated accuracy of the model has improved, this has resulted in more orders with late delivery, and the late time of the late orders is longer than that of the previous model. Although both early delivery and late delivery belong to the situation of inaccurate estimated delivery time, in fact, in scenarios such as food delivery, users are more accepting of orders with early delivery and have a lower tolerance for orders with late delivery. Therefore, even if the model trained in this way has a more accurate estimated delivery time for a large number of orders, it may affect the service experience of consumers.

[0098] In the scenario of food delivery, users have a lower tolerance for late delivery. Therefore, a target function with a second change rate higher than the first change rate can be selected to train the model.

[0099] Still the above 100 pieces of sample data, the estimated delivery time of each order is 40 minutes. There are 40 orders with an actual delivery time of 30 minutes (i.e., early delivery), 40 orders with an actual delivery time of 10 - 20 minutes, 5 orders with an actual delivery time of 40 minutes, and 15 orders with an actual delivery time of 45 minutes. The on-time rate is 5%. If according to Figure 2The loss function shown above is used to train the model. Since the loss amount caused by late delivery is much greater than that caused by early delivery, the model will tend to make the estimated delivery time of orders that were originally late more punctual, that is, the model may tend to make the estimated delivery time later. Therefore, the model estimates the original 100 pieces of data again. After training, the estimated delivery times of these 100 sample data may all become 45 minutes. At this time, the number of orders delivered on time becomes 15, the number of orders delivered early becomes 85, and the on-time rate becomes 15%. Although the on-time rate is lower than that of the model trained by the previous loss function, the number of orders with late delivery has decreased, thus improving the user experience.

[0100] Through the above method, at least the following technical effects can be achieved:

[0101] By setting different target loss functions according to different business scenarios, the relationship between the first change rate of the first relationship function and the second change rate of the second relationship function of different target loss functions is different, and the model for predicting the delivery time is trained according to the target loss function and the sample data set. By correcting the training of the model through target loss functions with different change rates on both sides, the training bias caused by different numbers of different types of samples in the model is reduced, and the deviation of the prediction result obtained by using the trained model is also reduced. In addition, the setting of the loss function is more flexible, the estimation of the delivery time is more in line with the requirements of the business scenario, the service experience of consumers is improved, and the risk of customer loss and increased compensation amount on the platform providing ordering or delivery services is reduced.

[0102] Figure 6 is a flowchart of a method for determining delivery time shown according to an exemplary disclosed embodiment, as Figure 6 shown, the method includes:

[0103] S31. Obtain the delivery feature information of the order to be delivered.

[0104] The delivery feature information of the order to be delivered refers to the information that will affect the delivery time of the order. For example, the time when the order is generated, the address where the order is generated, the address of the order destination, the weather at the order generation location, the weather at the order destination, the traffic conditions between the order generation location and the order destination, and other information.

[0105] S32. Input the delivery feature information into the delivery time determination model, and obtain the predicted delivery time of the order to be delivered output by the delivery time determination model.

[0106] Among them, when the delivery time error is a positive number, the first change rate of the first functional relationship of the target loss function of the delivery time determination model is different from the second change rate of the second functional relationship of the target loss function of the delivery time determination model when the delivery time error is a negative number. The positive delivery time error indicates that the predicted delivery time is earlier than the actual delivery time, and the negative delivery time error indicates that the predicted delivery time is later than the actual delivery time. The target loss function is used to characterize the mapping relationship between the loss amount predicted by the model and the delivery time error; when the delivery moment error is a positive number, the first relationship function between the absolute value of the delivery moment error and the loss amount, and when the delivery moment error is a negative number, the second relationship function between the absolute value of the delivery moment error and the loss amount. The delivery moment error is the time difference between the predicted delivery moment and the actual delivery moment.

[0107] The first change rate of the first relationship function is different from the second change rate of the second relationship function. The first change rate is the rate at which the loss amount changes with the absolute value of the delivery moment error in the first relationship function, and the second change rate is the rate at which the loss amount changes with the absolute value of the delivery moment error in the second relationship function.

[0108] S33. Send the predicted delivery time to the client that generates the order to be delivered, so that the client can display the predicted delivery time.

[0109] Optionally, the delivery time determination model is trained through the following training steps: Obtain a sample data set, and the sample data includes the actual delivery moment of historical orders; Train a model for predicting the delivery moment according to the sample data set and the target loss function.

[0110] Optionally, the training steps further include: Obtain a loss function selection instruction; According to the instruction, select a target function expression from multiple preset candidate function expressions; Select a target coefficient combination from multiple groups of coefficient combinations corresponding to the target function expression; Determine the target loss function according to the target function expression and the target coefficient combination.

[0111] Optionally, the selection of the target coefficient combination from multiple groups of coefficient combinations corresponding to the target function expression includes: Substitute each coefficient combination into the target function expression to obtain a candidate loss function; For each obtained candidate loss function, perform the following operations: Train a model to be tested through the candidate loss function and the training sample data set; Test the model to be tested through the test sample data set to obtain a test evaluation value; Determine the coefficient combination corresponding to the model to be tested with the optimal test evaluation value as the target coefficient combination.

[0112] Optionally, the multiple candidate function expressions include any of the following types of expressions: First type expression: wherein, the is the expected delivery time, the Y is the actual delivery time, and a1 and b1 are a set of coefficient combinations of the first type expression; Second type expression: wherein, a 21 , b 21 , a 22 and b 22 are a set of coefficient combinations of the second type expression.

[0113] Optionally, the obtaining of the loss function selection instruction includes: determining the loss function type according to the type information of the orders in the sample data set and / or the time information at the time of order generation; generating the loss function selection instruction according to the loss function type; wherein, different loss function types are used to characterize the different magnitude relationships between the first change rate of the first relationship function and the second change rate of the second relationship function, wherein, the first relationship function is the relationship function between the absolute value of the delivery time error and the loss amount of the loss function when the delivery time error is a positive number, and the second relationship function is the relationship function between the absolute value of the delivery time error and the loss amount of the loss function when the delivery time error is a negative number.

[0114] Optionally, the sample data set includes first sample data indicating that the actual delivery time of the order is earlier than the expected delivery time, and second type sample data indicating that the actual delivery time of the order is later than the expected delivery time. The obtaining of the sample data set includes: comparing the number of samples of the first type of sample data and the second type of sample data, and determining the target sample data category with fewer sample numbers; entering the resampled sample data of the target sample data category into the sample data set.

[0115] By the above method, at least the following technical effects can be achieved:

[0116] By obtaining the delivery characteristic information of the order to be delivered and inputting the delivery characteristic information into the delivery time determination model trained by a target loss function with different change rates in the case where the delivery time error is a positive number and in the case where the delivery time error is a negative number, the predicted delivery time of the order to be delivered output by the delivery time determination model is obtained. The deviation of the prediction result caused by the training deviation due to different numbers of different types of samples is reduced, the estimation of the delivery time is more in line with the requirements of the business scenario, and the service experience of consumers is improved.

[0117] Figure 7It is a block diagram of a device for model training shown according to an exemplary disclosed embodiment. As Figure 7 shown, the device 700 includes a sample acquisition module 701 and a model training module 702.

[0118] The sample acquisition module 701 is configured to acquire a sample data set, and the sample data includes the actual delivery time of historical orders.

[0119] The model training module 702 is configured to train a model for predicting the delivery time according to the sample data set and a target loss function.

[0120] Wherein, the target loss function includes: a first relationship function between the absolute value of the delivery time error and the loss amount when the delivery time error is positive, and a second relationship function between the absolute value of the delivery time error and the loss amount when the delivery time error is negative. The delivery time error is the time difference between the predicted delivery time and the actual delivery time; the first change rate of the first relationship function is different from the second change rate of the second relationship function. The first change rate is the rate at which the loss amount changes with the absolute value of the delivery time error in the first relationship function, and the second change rate is the rate at which the loss amount changes with the absolute value of the delivery time error in the second relationship function.

[0121] Optionally, the device further includes: an instruction acquisition module configured to acquire a loss function selection instruction; a function selection module configured to select a target function expression from a plurality of preset candidate function expressions according to the instruction; a coefficient selection module configured to select a target coefficient combination from a plurality of groups of coefficient combinations preset corresponding to the target function expression; and a target determination module configured to determine the target loss function according to the target function expression and the target coefficient combination.

[0122] Optionally, the coefficient selection module is configured to substitute each coefficient combination into the target function expression to obtain a candidate loss function; for each obtained candidate loss function, perform the following operations: train a to-be-tested model through the candidate loss function and a training sample data set; test the to-be-tested model through a test sample data set to obtain a test evaluation value; and determine the coefficient combination corresponding to the to-be-tested model with the optimal test evaluation value as the target coefficient combination.

[0123] Optionally, the plurality of candidate function expressions include any of the following types of expressions: a first type of expression: Wherein, the is the predicted delivery time, Y is the actual delivery time, and a1 and b1 are a group of coefficient combinations of the first type of expression; a second type of expression: Wherein, a21 , b 21 , a 22 and b 22 are a set of coefficient combinations of the second type of expression.

[0124] Optionally, the instruction acquisition module is configured to determine a loss function type according to the type information of the orders in the sample data set and / or the time information at the time of order generation; generate a loss function selection instruction according to the loss function type; wherein, different loss function types are used to characterize different magnitude relationships between the first change rate of the first relationship function and the second change rate of the second relationship function.

[0125] Optionally, the sample data set includes first sample data indicating that the actual delivery time of an order is earlier than the estimated delivery time, and second type of sample data indicating that the actual delivery time of an order is later than the estimated delivery time. The sample acquisition module is configured to compare the number of samples of the first type of sample data and the second type of sample data, determine the target sample data category with a smaller number of samples; enter the resampled target sample data category into the sample data set.

[0126] Through the above technical solution, at least the following technical effects can be achieved:

[0127] By setting the relationship between the first change rate of the first relationship function and the second change rate of the second relationship function of the target loss function, and training the model for predicting the delivery time according to the target loss function and the sample data set, the training of the model is corrected by the target loss function with different change rates on both sides, reducing the training deviation caused by different numbers of different types of samples in the model, and thus reducing the deviation of the prediction result obtained by using the trained model. In addition, the setting of the loss function is more flexible, the estimation of the delivery time is more in line with the requirements of the business scenario, and the service experience of consumers is improved.

[0128] Figure 8 is a block diagram of a device for determining delivery time shown according to an exemplary disclosed embodiment. As Figure 8 shown, the device 800 includes a feature acquisition module 801, a feature processing module 802, and a sending module 803.

[0129] The feature acquisition module 801 is configured to acquire delivery feature information of an order to be delivered;

[0130] The feature processing module 802 is configured to input the delivery feature information into a delivery time determination model to obtain the predicted delivery time of the order to be delivered output by the delivery time determination model;

[0131] The sending module 803 is configured to send the predicted delivery time to the client that generates the order to be delivered, so that the client can display the predicted delivery time.

[0132] Optionally, the device 800 further includes a training module, and the training module includes a sample acquisition sub-module and a model training sub-module.

[0133] The sample acquisition sub-module is configured to acquire a sample data set, and the sample data includes the actual delivery time of historical orders.

[0134] The model training sub-module is configured to train a model for predicting the delivery time according to the sample data set and a target loss function.

[0135] Wherein, the target loss function includes: when the delivery time error is positive, the first change rate of the first functional relationship of the target loss function of the delivery time determination model is different from the second change rate of the second functional relationship of the target loss function of the delivery time determination model when the delivery time error is negative. The delivery time error being positive indicates that the predicted delivery time is earlier than the actual delivery time, and the delivery time error being negative indicates that the predicted delivery time is later than the actual delivery time. The target loss function is used to characterize the mapping relationship between the loss amount predicted by the model and the delivery time error; when the delivery time error is positive, the first relationship function between the absolute value of the delivery time error and the loss amount, and when the delivery time error is negative, the second relationship function between the absolute value of the delivery time error and the loss amount. The delivery time error is the time difference between the predicted delivery time and the actual delivery time; the first change rate of the first relationship function is different from the second change rate of the second relationship function. The first change rate is the rate at which the loss amount changes with the absolute value of the delivery time error in the first relationship function, and the second change rate is the rate at which the loss amount changes with the absolute value of the delivery time error in the second relationship function.

[0136] Optionally, the training module further includes: an instruction acquisition sub-module, configured to acquire a loss function selection instruction; a function selection sub-module, configured to select a target function expression from a plurality of preset candidate function expressions according to the instruction; a coefficient selection sub-module, configured to select a target coefficient combination from a plurality of groups of coefficient combinations corresponding to the target function expression; and a target determination sub-module, configured to determine the target loss function according to the target function expression and the target coefficient combination.

[0137] Optionally, the coefficient selection sub-module is configured to substitute each of the coefficient combinations into the target function expression to obtain a candidate loss function; for each obtained candidate loss function, perform the following operations: training a to-be-tested model through the candidate loss function and a training sample data set; testing the to-be-tested model through a test sample data set to obtain a test evaluation value; determining the coefficient combination corresponding to the to-be-tested model with the optimal test evaluation value as the target coefficient combination.

[0138] Optionally, the multiple candidate function expressions include any of the following types of expressions: First type expression: wherein, the is the expected delivery time, the Y is the actual delivery time, and a1 and b1 are a set of coefficient combinations of the first type expression; Second type expression: wherein, a 21 , b 21 , a 22 and b 22 are a set of coefficient combinations of the second type expression.

[0139] Optionally, the instruction acquisition sub-module is configured to determine a loss function type according to the type information of the orders in the sample data set and / or the time information at the time of order generation; generate a loss function selection instruction according to the loss function type; wherein, different loss function types are used to characterize different magnitude relationships between the first change rate of the first relationship function and the second change rate of the second relationship function.

[0140] Optionally, the sample data set includes first sample data indicating that the actual delivery time of the order is earlier than the expected delivery time, and second type sample data indicating that the actual delivery time of the order is later than the expected delivery time. The sample acquisition module is configured to compare the sample numbers of the first type sample data and the second type sample data, determine the target sample data category with a smaller sample number; input the resampled sample data of the target sample data category into the sample data set.

[0141] Through the above technical solutions, at least the following technical effects can be achieved:

[0142] By obtaining the delivery feature information of the order to be delivered and inputting the delivery feature information into a delivery time determination model trained by a target loss function with different change rates when the delivery time error is positive and when the delivery time error is negative, the predicted delivery time of the order to be delivered output by the delivery time determination model is obtained. The deviation of the prediction result caused by the training deviation due to different numbers of different types of samples is reduced, the estimation of the delivery time is more in line with the requirements of the business scenario, and the service experience of consumers is improved.

[0143] An embodiment of the present disclosure also provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, the steps of the method for model training and delivery time determination are implemented.

[0144] An embodiment of the present disclosure also provides an electronic device, including:

[0145] A memory, on which a computer program is stored;

[0146] A processor, configured to execute the computer program in the memory to implement the steps of the method for model training and delivery time determination.

[0147] Figure 9 is a block diagram of an electronic device shown according to an exemplary embodiment. As Figure 9 shown, the electronic device 900 may include: a processor 901, a memory 902. The electronic device 900 may also include one or more of a multimedia component 903, an input / output (I / O) interface 904, and a communication component 905.

[0148] Among them, the processor 901 is used to control the overall operation of the electronic device 900 to complete all or part of the steps in the above-mentioned method for model training and delivery time determination. The memory 902 is used to store various types of data to support the operation of the electronic device 900. These data may include, for example, instructions for any application or method operating on the electronic device 900, as well as instruction-related data, such as data required for model training in the embodiments of the present disclosure, historical order data, function data, parameter data, etc. The memory 902 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read-Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The multimedia component 903 may include a screen and an audio component. The screen may be, for example, a touch screen, and the audio component is used to output and / or input audio signals. For example, the audio component may include a microphone for receiving external audio signals. The received audio signals may be further stored in the memory 902 or transmitted through the communication component 905. The audio component further includes at least one speaker for outputting audio signals. The I / O interface 904 provides an interface between the processor 901 and other interface modules, and the above-mentioned other interface modules may be a keyboard, a mouse, buttons, etc. These buttons may be virtual buttons or physical buttons. The communication component 905 is used for wired or wireless communication between the electronic device 900 and other devices. Wireless communication, such as Wi-Fi, Bluetooth, Near Field Communication (NFC), 2G, 3G or 4G, or a combination of one or more of them. Accordingly, the communication component 905 may include: a Wi-Fi module, a Bluetooth module, an NFC module.

[0149] In an exemplary embodiment, the electronic device 900 may be implemented by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components, and is used to execute the methods for model training and delivery time determination described above.

[0150] In another exemplary embodiment, a computer-readable storage medium including program instructions is also provided. When the program instructions are executed by a processor, the steps of the methods for model training and delivery time determination described above are implemented. For example, the computer-readable storage medium may be the memory 902 including the program instructions described above, and the program instructions may be executed by the processor 901 of the electronic device 900 to complete the methods for model training and delivery time determination described above.

[0151] In a possible manner, the block diagram of the electronic device may be as Figure 10 shown. Referring to Figure 10 , the electronic device 1000 may be provided as a server. Referring to Figure 10 , the electronic device 1000 includes a processor 1001, the number of which may be one or more, and a memory 1002 for storing computer programs executable by the processor 1001. The computer programs stored in the memory 1002 may include one or more modules each corresponding to a set of instructions. In addition, the processor 1001 may be configured to execute the computer program to perform the steps executed by the server in the methods for model training and delivery time determination described above.

[0152] In addition, the electronic device 1000 may further include a power supply component 1003 and a communication component 1004. The power supply component 1003 may be configured to perform power management of the electronic device 1000, and the communication component 1004 may be configured to implement communication of the electronic device 1000, for example, wired or wireless communication. In addition, the electronic device 1000 may further include an input / output (I / O) interface 1005. The electronic device 1000 may operate based on an operating system stored in the memory 1002, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, etc.

[0153] In another exemplary embodiment, a computer-readable storage medium including program instructions is further provided. When the program instructions are executed by a processor, the steps performed by the server in the above method for model training and delivery time determination are implemented. For example, the computer-readable storage medium may be the above-mentioned memory 1002 including program instructions, and the above program instructions may be executed by the processor 1001 of the electronic device 1000 to complete the steps of the above method for model training and delivery time determination.

[0154] The preferred embodiments of the present disclosure have been described in detail above in conjunction with the accompanying drawings. However, the present disclosure is not limited to the specific details in the above embodiments. Within the scope of the technical concept of the present disclosure, various simple modifications can be made to the technical solutions of the present disclosure, and these simple modifications all fall within the protection scope of the present disclosure.

[0155] In addition, it should be noted that, among the various specific technical features described in the above specific embodiments, they can be combined in any suitable manner without contradiction. To avoid unnecessary repetition, the present disclosure will not separately describe various possible combination methods.

[0156] Furthermore, any combination can be made between various different embodiments of the present disclosure, as long as it does not violate the idea of the present disclosure, and it should also be regarded as the content disclosed by the present disclosure.

Claims

1. A method for model training, characterized in that, The method includes: Obtaining a sample data set, where the sample data includes the actual delivery time of historical orders; Training a model for predicting the delivery time according to the sample data set and a target loss function; Wherein, the target loss function includes: when the delivery time error is a positive number, the first change rate of the first relationship function of the target loss function of the delivery time determination model is different from the second change rate of the second relationship function of the target loss function of the delivery time determination model when the delivery time error is a negative number. The delivery time error being a positive number indicates that the predicted delivery time is earlier than the actual delivery time, and the delivery time error being a negative number indicates that the predicted delivery time is later than the actual delivery time. The target loss function is used to characterize the mapping relationship between the loss amount predicted by the model and the delivery time error. The first change rate is the rate at which the loss amount changes with the absolute value of the delivery time error in the first relationship function, and the second change rate is the rate at which the loss amount changes with the absolute value of the delivery time error in the second relationship function. Among them, the target loss function is determined by the following method: obtaining a loss function selection instruction; according to the instruction, selecting a target function expression from a plurality of preset candidate function expressions; selecting a target coefficient combination from a plurality of groups of coefficient combinations corresponding to the target function expression; and determining the target loss function according to the target function expression and the target coefficient combination.

2. The method according to claim 1, wherein The step of selecting a target coefficient combination from a plurality of groups of coefficient combinations corresponding to the target function expression includes: Substituting each coefficient combination into the target function expression to obtain a candidate loss function; For each obtained candidate loss function, perform the following operations: Training a model to be tested through the candidate loss function and the training sample data set; Testing the model to be tested through the test sample data set to obtain a test evaluation value; Determining the coefficient combination corresponding to the model to be tested with the optimal test evaluation value as the target coefficient combination.

3. The method according to claim 1 or 2, characterized in that, The plurality of candidate function expressions include any of the following types of expressions: The first type of expression: Among them, the is the predicted delivery time, and the Y is the actual delivery time. and are a set of coefficient combinations of the first type of expression; The second type of expression: Among them, , , and are a set of coefficient combinations of the second type of expression.

4. The method according to claim 1 or 2, characterized in that, The step of obtaining a loss function selection instruction includes: Determining the loss function type according to the type information of the orders in the sample data set and / or the time information when the orders are generated; Generating the loss function selection instruction according to the loss function type; Wherein, different loss function types are used to characterize different magnitude relationships between the first change rate of the first relationship function and the second change rate of the second relationship function.

5. A method for determining the delivery time, characterized in that, The method further includes: Obtaining the delivery feature information of the order to be delivered; Inputting the delivery feature information into the delivery time determination model to obtain the predicted delivery time of the order to be delivered output by the delivery time determination model; Sending the predicted delivery time to the client that generates the order to be delivered for the client to display the predicted delivery time. Among them, when the delivery time error is a positive number, the first change rate of the first relationship function of the target loss function of the delivery time determination model is different from the second change rate of the second relationship function of the target loss function of the delivery time determination model when the delivery time error is a negative number. The positive delivery time error indicates that the predicted delivery time is earlier than the actual delivery time, and the negative delivery time error indicates that the predicted delivery time is later than the actual delivery time. The target loss function is used to characterize the mapping relationship between the loss amount predicted by the model and the delivery time error. The first change rate is the rate at which the loss amount changes with the absolute value of the delivery time error in the first relationship function, and the second change rate is the rate at which the loss amount changes with the absolute value of the delivery time error in the second relationship function. Among them, the target loss function is determined as follows: Obtain a loss function selection instruction; According to the instruction, select a target function expression from multiple preset candidate function expressions; Select a target coefficient combination from multiple groups of coefficient combinations corresponding to the target function expression; Determine the target loss function according to the target function expression and the target coefficient combination.

6. An apparatus for model training, characterized in that, The device includes: A sample acquisition module, configured to acquire a sample data set, where the sample data includes the actual delivery time of historical orders; A model training module, configured to train a model for predicting the delivery time according to the sample data set and the target loss function; Among them, the target loss function includes: when the delivery time error is a positive number, the first change rate of the first relationship function of the target loss function of the delivery time determination model is different from the second change rate of the second relationship function of the target loss function of the delivery time determination model when the delivery time error is a negative number. The positive delivery time error indicates that the predicted delivery time is earlier than the actual delivery time, and the negative delivery time error indicates that the predicted delivery time is later than the actual delivery time. The target loss function is used to characterize the mapping relationship between the loss amount predicted by the model and the delivery time error. The first change rate is the rate at which the loss amount changes with the absolute value of the delivery time error in the first relationship function, and the second change rate is the rate at which the loss amount changes with the absolute value of the delivery time error in the second relationship function. Among them, the target loss function is determined as follows: Obtain a loss function selection instruction; According to the instruction, select a target function expression from multiple preset candidate function expressions; Select a target coefficient combination from multiple groups of coefficient combinations corresponding to the target function expression; Determine the target loss function according to the target function expression and the target coefficient combination.

7. A device for determining delivery time, characterized in that, The device includes: A feature acquisition module, configured to acquire the delivery feature information of the order to be delivered; A feature processing module, configured to input the delivery feature information into the delivery time determination model to obtain the predicted delivery time of the order to be delivered output by the delivery time determination model; A sending module, configured to send the predicted delivery time to the client that generates the order to be delivered, so that the client can display the predicted delivery time; Wherein, when the delivery time error is a positive number, the first change rate of the first relationship function of the target loss function of the delivery time determination model is different from the second change rate of the second relationship function of the target loss function of the delivery time determination model when the delivery time error is a negative number. The delivery time error being a positive number indicates that the predicted delivery time is earlier than the actual delivery time, and the delivery time error being a negative number indicates that the predicted delivery time is later than the actual delivery time. The target loss function is used to characterize the mapping relationship between the loss amount predicted by the model and the delivery time error; The first change rate is the rate at which the loss amount changes with the absolute value of the delivery time error in the first relationship function, and the second change rate is the rate at which the loss amount changes with the absolute value of the delivery time error in the second relationship function. Wherein, the target loss function is determined in the following manner: Obtain a loss function selection instruction; According to the instruction, select a target function expression from a plurality of preset candidate function expressions; Select a target coefficient combination from a plurality of groups of coefficient combinations corresponding to the target function expression; Determine the target loss function according to the target function expression and the target coefficient combination.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by a processor, it implements the steps of the method according to any one of claims 1-4.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by a processor, it implements the steps of the method according to claim 5.

10. An electronic device, characterized in that, Comprising: A memory, on which a computer program is stored; A processor, configured to execute the computer program in the memory to implement the steps of the method according to any one of claims 1-4.

11. An electronic device, characterized in that, Comprising: A memory, on which a computer program is stored; A processor, configured to execute the computer program in the memory to implement the steps of the method according to claim 5.

Citation Information

Patent Citations

  • Method for predicting inventory allocation proportion, device and electronic device

    CN106156880A

  • Trace ratio criterion-based triple loss function design method

    CN108399428A