Incremental training method and device, electronic equipment and storage medium
Through the incremental training method, the space-time incremental network and incremental loss function are used to solve the problem of insufficient accuracy in delivery time prediction, and more efficient training and more accurate delivery time prediction are achieved.
Patent Information
- Application Number
- CN202411788852.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-05
- Publication Date
- 2025-03-28
AI Technical Summary
The prior art has accuracy challenges in estimating delivery time, resulting in insufficient accuracy in the prediction of delivery time, affecting rider delivery efficiency and user satisfaction.
The incremental training method is adopted to obtain the incremental delivery sample data and historical delivery data and the spatiotemporal prediction network after training, and the spatiotemporal incremental network is generated, and the spatiotemporal incremental network is trained based on the incremental loss function to improve the accuracy of delivery time prediction.
Through the incremental training method, training time is reduced, the performance of the prediction network is improved, thereby improving the prediction accuracy of delivery time and ensuring user experience and rider efficiency.
Smart Images

Figure CN119721158A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to incremental training methods, devices, electronic devices and storage media. Background Art
[0002] In today's fast-paced society, real-time prediction of delivery time plays a vital role in the logistics industry. Accurate delivery incremental training is not only related to user satisfaction, but also directly affects the delivery efficiency of riders. However, the accuracy of estimated delivery time is still facing challenges, and fast and accurate prediction has become a difficult problem that needs to be solved urgently for business development. Summary of the invention
[0003] The main purpose of this application is to provide an incremental training method, device, electronic device and storage medium, aiming to provide an incremental training method that reduces training time, improves prediction network performance and thus improves the prediction accuracy of the estimated delivery time. The technical solution is as follows:
[0004] In a first aspect, an embodiment of the present application provides an incremental training method, comprising:
[0005] Acquire incremental delivery sample data and a spatiotemporal prediction network trained with historical delivery data; the spatiotemporal prediction network is used to generate a predicted delivery time for a delivery order; the incremental delivery sample data includes sample spatiotemporal feature data of each incremental delivery order and the actual delivery time of the first sample;
[0006] Generate a spatiotemporal incremental network based on the spatiotemporal prediction network, wherein initial incremental network parameters of the spatiotemporal incremental network are consistent with network parameters of the spatiotemporal prediction network;
[0007] Inputting the sample spatiotemporal feature data into the spatiotemporal prediction network to obtain a historical predicted delivery time;
[0008] Inputting the sample spatiotemporal feature data into the spatiotemporal incremental network to obtain a first sample predicted delivery time;
[0009] Determine a first difference between the historical predicted delivery time and the first sample actual delivery time and a second difference between the first sample predicted delivery time and the first sample actual delivery time;
[0010] Determine a reference delivery time from the first sample actual delivery time and the historical predicted delivery time based on the first difference and the second difference;
[0011] The spatiotemporal incremental network is trained based on the incremental loss function, the predicted arrival time of the first sample and the reference delivery time to obtain a trained spatiotemporal incremental network.
[0012] In a second aspect, an embodiment of the present application provides an incremental training device, comprising:
[0013] An acquisition unit, used to acquire incremental delivery sample data and a spatiotemporal prediction network trained with historical delivery data; the spatiotemporal prediction network is used to generate a predicted delivery time of a delivery order; the incremental delivery sample data includes sample spatiotemporal feature data and sample actual delivery time of each incremental delivery order;
[0014] A generating unit, configured to generate a spatiotemporal incremental network based on the spatiotemporal prediction network, wherein an initial incremental network parameter of the spatiotemporal incremental network is consistent with that of the spatiotemporal prediction network;
[0015] A historical prediction unit, used for inputting the sample spatiotemporal feature data into the spatiotemporal prediction network to obtain a historical prediction delivery time;
[0016] A sample prediction unit, used for inputting the sample spatiotemporal feature data into the spatiotemporal incremental network to obtain a first sample predicted delivery time;
[0017] a difference calculation unit, configured to determine a first difference between the historical predicted delivery time and the actual delivery time of the first sample and a second difference between the predicted delivery time of the first sample and the actual delivery time of the first sample;
[0018] A comparing unit, configured to determine a reference delivery time from the first sample actual delivery time and the historical predicted delivery time based on the first difference and the second difference;
[0019] A training unit is used to train the spatiotemporal incremental network based on the incremental loss function, the predicted arrival time of the first sample and the reference delivery time to obtain a trained spatiotemporal incremental network.
[0020] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the steps of the above method when executed by the processor.
[0021] In a fourth aspect, an embodiment of the present application provides a storage medium having a computer program stored thereon, and the computer program implements the steps of the above method when executed by a processor.
[0022] In an embodiment of the present application, by acquiring incremental distribution sample data and a spatiotemporal prediction network trained with historical distribution data, a spatiotemporal incremental network is generated based on the spatiotemporal prediction network, the initial incremental network parameters of the spatiotemporal incremental network are consistent with the network parameters of the spatiotemporal prediction network, the sample spatiotemporal feature data is input into the spatiotemporal prediction network to obtain the historical predicted delivery time, the sample spatiotemporal feature data is input into the spatiotemporal incremental network to obtain the first sample predicted delivery time, the first difference between the historical predicted delivery time and the first sample actual delivery time and the second difference between the first sample predicted delivery time and the first sample actual delivery time are determined, the reference delivery time is determined based on the first difference and the second difference between the first sample actual delivery time and the historical predicted delivery time, the spatiotemporal incremental network is trained based on the incremental loss function, the first sample predicted arrival time and the reference delivery time to obtain a trained spatiotemporal incremental network. By constructing a spatiotemporal incremental network with the same network parameters as the historically trained spatiotemporal prediction network, the spatiotemporal incremental network is trained according to the newly acquired incremental delivery sample data, so that the spatiotemporal incremental network can learn the knowledge in the new samples. In order to prevent the model from forgetting historical information, the historical predicted delivery time is obtained through the spatiotemporal prediction network, and the learning object of the spatiotemporal incremental network, that is, the reference delivery time, is determined by comparing the prediction results of the spatiotemporal incremental network and the prediction results of the historical spatiotemporal prediction network with the true label value of the sample, so that the new network obtained by the incremental update can retain the existing network capabilities as much as possible. The spatiotemporal incremental network incrementally updated in this way not only realizes the follow-up training of new samples but also reduces the attenuation of historical capabilities. As time accumulates, the spatiotemporal incremental network can predict the space-time with relatively few samples more accurately, which brings about an improvement in model capabilities. Improving the prediction accuracy of delivery time can more accurately and effectively guarantee the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0024] Figure 1 It is a schematic diagram of an application of an incremental training method provided in an embodiment of the present application;
[0025] Figure 2 It is a flowchart of an incremental training method provided in an embodiment of the present application;
[0026] Figure 3 It is a flowchart of an incremental training method provided in an embodiment of the present application;
[0027] Figure 4 It is a flowchart of an incremental training method provided in an embodiment of the present application;
[0028] Figure 5 It is a model schematic diagram of an incremental training method provided in an embodiment of the present application;
[0029] Figure 6 It is a structural schematic diagram of an incremental training device provided in an embodiment of the present application;
[0030] Figure 7 It is a structural schematic diagram of an incremental training device provided in an embodiment of the present application;
[0031] Figure 8 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0032] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this specification.
[0033] In the description of this specification, it should be understood that the terms "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying relative importance. In the description of this specification, it should be noted that, unless otherwise clearly specified and limited, "including" and "having" and any of their variations are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally also includes steps or units that are not listed, or optionally also includes other steps or units inherent to these processes, methods, products or devices. For those of ordinary skill in the art, the specific meanings of the above terms in this specification can be understood in specific circumstances. In addition, in the description of this specification, unless otherwise specified, "multiple" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B, which can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects before and after are an "or" relationship.
[0034] The incremental training device in the embodiment of the present application can be a terminal device such as a mobile phone, a computer, a tablet computer or a vehicle-mounted device, or it can be a module in the terminal device for implementing the incremental training method. The incremental training device can obtain incremental delivery sample data and a spatiotemporal prediction network trained with historical delivery data, generate a spatiotemporal incremental network based on the spatiotemporal prediction network, input the sample spatiotemporal feature data into the spatiotemporal prediction network to obtain the historical predicted delivery time, input the sample spatiotemporal feature data into the spatiotemporal incremental network to obtain the first sample predicted delivery time, determine a first difference between the historical predicted delivery time and the actual delivery time of the first sample and a second difference between the first sample predicted delivery time and the actual delivery time of the first sample, determine a reference delivery time between the actual delivery time of the first sample and the historical predicted delivery time based on the first difference and the second difference, and train the spatiotemporal incremental network based on the incremental loss function, the first sample predicted arrival time and the reference delivery time to obtain a trained spatiotemporal incremental network.
[0035] It should be noted that the estimated arrival time or predicted delivery time (ETA) in the embodiments of the present application refers to the time taken from the user placing an order to the delivery object arriving at the location specified by the user in the instant delivery scenario. In the instant delivery scenario, there are many factors that affect the estimated delivery time, such as delivery party characteristics, time characteristics, spatial characteristics, order characteristics, etc. Optionally, the incremental training method can also be applied to taxi / online car-hailing scheduling scenarios and logistics scenarios. Similarly, in these scenarios, the estimated delivery time is also affected by delivery party / driver characteristics, time characteristics, spatial characteristics, order characteristics, etc.
[0036] Please also see Figure 1, an application schematic diagram of an incremental training method is provided for an embodiment of the present application, by obtaining a spatiotemporal prediction network trained with historical distribution data, a spatiotemporal incremental network is generated based on the spatiotemporal prediction network, and the initial incremental network parameters of the spatiotemporal incremental network are consistent with the network parameters of the spatiotemporal prediction network, that is, the spatiotemporal incremental network can directly obtain the knowledge learned from the historical distribution data, then, the incremental distribution sample data is obtained, the sample spatiotemporal feature data in the incremental distribution sample data is input into the spatiotemporal prediction network, and the historical predicted delivery time is obtained, and the sample spatiotemporal feature data is input into the spatiotemporal incremental network to obtain the first sample predicted delivery time. It can be understood that when the sample spatiotemporal feature data is input into the spatiotemporal incremental network, the parameters of the spatiotemporal incremental network will be updated, so that the spatiotemporal prediction network with fixed parameters can be obtained. Different predicted delivery times, in order to avoid the forgetting problem of the model, determine the first difference between the historical predicted delivery time and the actual delivery time of the first sample and the second difference between the predicted delivery time of the first sample and the actual delivery time of the first sample, determine the reference delivery time based on the first difference and the second difference between the actual delivery time of the first sample and the historical predicted delivery time, take the reference delivery time as the learning target of the spatiotemporal incremental network, train the spatiotemporal incremental network based on the incremental loss function, the first sample predicted arrival time and the reference delivery time to obtain a trained spatiotemporal incremental network, so that the spatiotemporal incremental network can retain the prediction ability obtained by learning the historical distribution data, and obtain the association between the latest spatiotemporal feature data and the estimated delivery time by learning new incremental samples, thereby improving the prediction accuracy.
[0037] The incremental training method provided in this specification is described in detail below in conjunction with specific embodiments.
[0038] See also Figure 2 , which is a flow chart of an incremental training method provided in an embodiment of the present application. Figure 2 As shown, the method in the embodiment of the present application may include the following steps S101 to S107.
[0039] S101, obtaining incremental delivery sample data and a spatiotemporal prediction network trained with historical delivery data;
[0040] In one embodiment, the spatiotemporal prediction network is used to generate a predicted delivery time for a delivery order. Specifically, the spatiotemporal prediction network can generate a predicted delivery time based on the spatiotemporal characteristics of the delivery order. The spatiotemporal prediction network can be a prediction model that is currently or historically in use. The spatiotemporal prediction network is trained based on a certain amount of historical delivery data. However, under the limited data scale, the model cannot have a correct understanding of some scenes, for example, some scenes that have never appeared or appeared less frequently before (small scenes), resulting in differences in the performance of different scene models. To solve this problem, this solution introduces an incremental update mechanism so that the model accumulates and increases its understanding of small scenes over time, and the spatiotemporal prediction network can be continuously updated by obtaining incremental delivery sample data. Through the incremental update mechanism, it is not necessary to retrain the network with the newly acquired samples together with all the historical delivery samples at each update. Instead, only some newly added samples are used to train the network, thereby reducing training time and consumption.
[0041] In a feasible implementation, incremental delivery sample data can be collected every day. For example, after the delivery of daily delivery orders is completed, all delivery orders for today are collected as incremental delivery sample data. The incremental delivery sample data may include one or more incremental delivery orders. The incremental delivery sample data includes the sample spatiotemporal feature data of each incremental delivery order and the actual delivery time of the first sample (that is, the real order delivery time). It can be understood that when making delivery time predictions, it is necessary to reason based on multiple features of the delivery order. The features of the delivery order can be mainly divided into spatiotemporal features and non-spatiotemporal features. Spatiotemporal features refer to features related to the time and space of the delivery order, such as delivery locations (cities, regions), time periods (holidays, weekends, peak hours, bad weather). Non-spatiotemporal features refer to numerical features (real-time features and statistical features) related to delivery orders, such as the average delivery time of the delivery party, the number of orders to be delivered by the delivery party, the number of delivery parties, etc.
[0042] S102, generating a spatiotemporal incremental network based on the spatiotemporal prediction network;
[0043] In one embodiment, a spatiotemporal incremental network is constructed based on the spatiotemporal prediction network. The initial incremental network parameters of the spatiotemporal incremental network are consistent with the network parameters of the spatiotemporal prediction network. The initial network parameters may include a network structure and a model parameter. That is, the network structure of the spatiotemporal incremental network is consistent with the spatiotemporal prediction network, and the model parameters of the spatiotemporal incremental network can be directly copied from the already trained spatiotemporal prediction network.
[0044] S103, inputting the sample spatiotemporal feature data into the spatiotemporal prediction network to obtain a historical predicted delivery time;
[0045] In one embodiment, in order to prevent the model from forgetting historical information, the newly acquired incremental delivery sample data can be inferred based on the historical model (space-time prediction network) to obtain a new sample prediction value (historical predicted delivery time). Specifically, since the space-time prediction network and the space-time incremental network mainly perform estimated delivery time inference on the space-time feature data of the delivery order, it is only necessary to input the sample space-time feature data of each incremental delivery order in the incremental delivery sample data into the space-time prediction network one by one to obtain the historical predicted delivery time of each incremental delivery order.
[0046] S104, inputting the sample spatiotemporal feature data into the spatiotemporal incremental network to obtain a first sample predicted delivery time;
[0047] In one embodiment, the sample spatiotemporal feature data is input into the spatiotemporal incremental network. The spatiotemporal incremental network can acquire new knowledge based on the sample spatiotemporal feature data and update its parameters in the process of continuously receiving sample spatiotemporal feature data of different incremental delivery orders. Therefore, although its initial network parameters are consistent with the spatiotemporal prediction network, during the sample learning process, it may output a predicted delivery time that is inconsistent with the spatiotemporal prediction network.
[0048] S105, determining a first difference between the historical predicted delivery time and the actual delivery time of the first sample and a second difference between the first sample predicted delivery time and the actual delivery time of the first sample;
[0049] In one embodiment, the difference between the historical predicted delivery time and the actual delivery time of the first sample is calculated to obtain a first difference, and the difference between the first sample predicted delivery time and the actual delivery time of the first sample is calculated to obtain a second difference.
[0050] S106, determining a reference delivery time from the first sample actual delivery time and the historical predicted delivery time based on the first difference and the second difference;
[0051] In one embodiment, by calculating the first difference and the second difference, the advantages and disadvantages of the spatiotemporal prediction network and the spatiotemporal incremental network in model performance can be compared. When the prediction effect of the spatiotemporal prediction network is better than that of the spatiotemporal incremental network, the historical predicted delivery time output by the spatiotemporal prediction network is selected as the reference time. When the prediction effect of the spatiotemporal prediction network is worse than that of the spatiotemporal incremental network, the actual delivery time of the first sample is selected as the reference time. For example, the predicted delivery time of the first sample is 60 minutes, the historical predicted delivery time is 70 minutes, and the actual delivery time of the first sample is 80 minutes. The difference between the historical predicted delivery time and the first sample predicted delivery time is smaller, and the historical predicted delivery time is selected as the reference delivery time. It is understandable that the historical predicted delivery time is closer to the actual delivery time of the first sample than the predicted delivery time of the first sample, indicating that the time prediction model can already predict the incremental order sample well, and it is easier to let the space-time incremental network learn the value of 70. Therefore, selecting the historical predicted delivery time as the reference delivery time can enable the time incremental network to at least reach the same ability as the old model (space-time prediction network), and the learning difficulty is lower, and the knowledge of the old model will not be forgotten. If the actual delivery time of the first sample is directly selected as the reference delivery time, since the difference between the actual delivery time of the first sample and the actual delivery time of the first sample is relatively large, then to learn this reference value, a large number of parameters need to be adjusted, which may lead to other parameters when adjusting the parameters, affecting the judgment of other samples, and may even fail to reach or forget the prediction ability of the old model (time prediction network). Therefore, by comparing the time difference, the space-time incremental network can be close to the output of the space-time prediction network when the space-time prediction network predicts well, so that the new model obtained by incremental update can retain the existing model capabilities as much as possible.
[0052] S107, training the spatiotemporal incremental network based on the incremental loss function, the predicted arrival time of the first sample and the reference delivery time to obtain a trained spatiotemporal incremental network.
[0053] In one embodiment, after selecting the reference delivery time, the space-time incremental network is trained according to the incremental loss function, the first sample predicted arrival time and the reference delivery time, thereby obtaining a trained space-time incremental network. Exemplarily, the incremental prediction loss value of the space-time incremental network can be calculated by the incremental loss function, the first sample predicted arrival time and the reference delivery time, and the space-time incremental network is adjusted by constraining the incremental prediction loss value to be as small as possible. This training method not only realizes the follow-up training of new samples (incremental delivery sample data) but also reduces the attenuation of historical capabilities. As time accumulates, the model can predict space-time with relatively few samples more accurately, which brings about an improvement in model capabilities and greatly reduces the time consumption of model training.
[0054] In an embodiment of the present application, by constructing a spatiotemporal incremental network with network parameters consistent with the historically trained spatiotemporal prediction network, the spatiotemporal incremental network is trained according to the newly acquired incremental distribution sample data, so that the spatiotemporal incremental network can learn the knowledge in the new sample. In order to prevent the model from forgetting historical information, the historical predicted delivery time is obtained through the spatiotemporal prediction network, and the prediction results of the spatiotemporal incremental network and the prediction results of the historical spatiotemporal prediction network are compared with the true label value of the sample to determine the learning object of the spatiotemporal incremental network, and the learning object of the spatiotemporal incremental network is determined, that is, the reference delivery time, so that the new network obtained by the incremental update can retain the existing network capabilities as much as possible. Based on the data accumulation capability of the incremental update, the difficulty of insufficient learning due to sparse data in some areas in the short term can be compensated in time and space, while better learning long-term information and reducing training time. And when the model is incrementally updated in this way, the accurate output of the old model is learned at the same time, reducing the degradation of model capabilities caused by the incremental update model.
[0055] See also Figure 3 , is a flow chart of an incremental training method provided in an embodiment of the present application. Figure 3 As shown, the method in the embodiment of the present application may include the following steps S201-S209.
[0056] S201, inputting the sample spatiotemporal feature data into the spatiotemporal prediction network to obtain a historical predicted delivery time;
[0057] Specifically, when the spatiotemporal incremental network is trained by using incremental delivery sample data, the sample spatiotemporal feature data of the incremental delivery sample data can be input into the spatiotemporal prediction network to obtain the historical predicted delivery time output by the spatiotemporal prediction network.
[0058] S202, inputting the sample spatiotemporal feature data into the incremental feature extraction layer to obtain a spatiotemporal feature vector;
[0059] In one embodiment, the spatiotemporal incremental network includes an incremental feature extraction layer and a spatiotemporal prediction layer. The sample spatiotemporal feature data of the incremental distribution sample data is input into the incremental feature extraction layer in the spatiotemporal incremental network to extract the spatiotemporal feature vector (Embedding vector) of the sample spatiotemporal feature data. For example, if the sample spatiotemporal feature data includes N features, the number of spatiotemporal feature vectors extracted is N. In the process of continuously inputting samples into the incremental feature extraction layer, the Embedding vector in the incremental feature extraction layer will be incrementally updated.
[0060] S203, inputting the spatiotemporal feature vector into the spatiotemporal prediction layer to obtain a first sample predicted delivery time;
[0061] In one embodiment, after obtaining the spatiotemporal feature vector, the spatiotemporal feature vector is input into the spatiotemporal prediction layer, and the first sample predicted delivery time is obtained through the spatiotemporal prediction layer. The incremental feature extraction layer and the spatiotemporal prediction layer have the same network structure and initial network parameters as the historical feature extraction network and the historical spatiotemporal prediction network in the spatiotemporal prediction network. After receiving new incremental delivery sample data, the incremental feature extraction layer can obtain new spatiotemporal features from the sample spatiotemporal feature data, thereby assisting the spatiotemporal prediction layer in performing delivery time reasoning.
[0062] Optionally, in one embodiment, an incremental training method provided in an embodiment of the present application further includes the following steps S2031-S2033:
[0063] S2031, inputting the spatiotemporal feature vector into the feature combination layer to obtain a combined spatiotemporal feature vector;
[0064] In one embodiment, the spatiotemporal incremental network also includes a feature combination layer for cross-combining spatiotemporal feature vectors. It is understandable that the extracted spatiotemporal feature vectors are vectors representing different spatiotemporal features (labels), such as vector 1 representing Monday, vector 2 representing typhoon weather, and vector 3 representing high pressure (the number of orders is more than the number of delivery parties), and there may be a certain correlation between these spatiotemporal features. By combining the spatiotemporal features, potential correlations can be mined, thereby improving the prediction accuracy of different scenarios. For example, the spatiotemporal scenarios involved in the incremental delivery samples are Sunday / typhoon / high pressure, and the estimated delivery time under the Monday / typhoon / high pressure scenario can be predicted by learning this part of the samples. It is understandable that if there are N spatiotemporal feature vectors, a maximum of (N!) (factorial of N) combined spatiotemporal feature vectors can be obtained by random permutations and combinations.
[0065] S2032: Input the combined spatiotemporal feature vector into the spatiotemporal prediction layer to obtain a first sample predicted delivery time.
[0066] In one embodiment, after the combined spatiotemporal feature vector is obtained, it is input into a spatiotemporal prediction layer, and the spatiotemporal prediction layer outputs the predicted delivery time of the first sample.
[0067] S204, determining a first difference between the historical predicted delivery time and the actual delivery time of the first sample and a second difference between the predicted delivery time of the first sample and the actual delivery time of the first sample;
[0068] For details, please refer to the description of step S105 in the above-mentioned embodiment of the specification, which will not be elaborated here.
[0069] S205, if the product of the first difference and the second difference is greater than zero and the absolute value of the first difference is less than the absolute value of the second difference, selecting the historical predicted delivery time as the reference delivery time;
[0070] S206, if the product of the first difference and the second difference is greater than zero and the absolute value of the first difference is greater than the absolute value of the second difference, selecting the actual delivery time of the first sample as the reference delivery time;
[0071] Specifically, if the product of the first difference and the second difference is greater than zero, it means that the predicted delivery time of the first sample and the historical predicted delivery time are both greater than or less than the actual delivery time of the first sample. In this case, if the absolute value of the first difference is less than the absolute value of the second difference, it means that the historical predicted delivery time is closer to the actual delivery time of the first sample, and the historical predicted delivery time is selected as the reference delivery time; if the absolute value of the first difference is greater than the absolute value of the second difference, it means that the predicted delivery time of the first sample is closer to the actual delivery time of the first sample, and the actual delivery time of the first sample is selected as the reference delivery time to help the model select the correct learning target. Exemplarily, the predicted delivery time of the first sample is 60 minutes, the historical predicted delivery time is 65 minutes, and the actual delivery time of the first sample is 70 minutes. The historical predicted delivery time is selected as the reference delivery time. In another exemplary embodiment, the predicted delivery time of the first sample is 75 minutes, the historical predicted delivery time is 90 minutes, and the actual delivery time of the first sample is 80 minutes. The actual delivery time of the first sample is selected as the reference delivery time.
[0072] S207, if the product of the first difference and the second difference is less than or equal to zero, selecting the actual delivery time of the first sample as the reference delivery time;
[0073] Specifically, if the product of the first difference and the second difference is less than or equal to zero, it indicates that the historical predicted delivery time and the first sample predicted delivery time are distributed on both sides of the first sample actual delivery time. In this case, the first sample actual delivery time is directly selected as the reference delivery time. For example, the first sample predicted delivery time is 60 minutes, the historical predicted delivery time is 80 minutes, and the first sample actual delivery time is 70 minutes. The first sample actual delivery time is selected as the reference delivery time.
[0074] S208, calculating an incremental loss value between the predicted arrival time of the first sample and the reference delivery time based on an incremental loss function;
[0075] In one embodiment, when calculating the predicted delivery time of the first sample according to the incremental loss function, the incremental loss value between the predicted arrival time of the first sample and the reference delivery time can be calculated according to the incremental loss function. In order to prevent the model from forgetting historical information, this solution obtains the historical predicted delivery time based on the new data inferred by the spatiotemporal prediction network. At the same time, drawing on the idea of knowledge distillation, the historical predicted delivery time of the new sample and the actual delivery time of the first sample are combined. For samples with good predictions by the spatiotemporal prediction network but large prediction deviations by the spatiotemporal incremental network, a reversal loss based on KL divergence is designed so that the spatiotemporal incremental network obtained by the incremental update can retain the existing model capabilities as much as possible. It can be understood that knowledge distillation is mostly used to reduce the size of the model when it goes online, so as to improve the reasoning performance while minimizing the loss of accuracy. In the embodiment of the present application, knowledge distillation is mainly used as a constraint for incremental updates to innovatively retain historical information.
[0076] In information theory and probability theory, Kullback-Leibler divergence (KL divergence for short) is an asymmetric measurement formula for two probability distributions. The incremental loss function is the inversion loss based on KL divergence. Specifically, the loss function is as follows:
[0077]
[0078] R on the left side of the formula KL-div (f φold , f φnew , D reg ) is the inversion loss based on KL divergence, f φold is the reference delivery time, f φnew is the first sample predicted delivery time.
[0079] For example, f φnew Examples of values: predicted value 1, predicted value 2, predicted value 3, ..., predicted value n; f φold Examples of values: label value 1, old predicted value 2, label value 3, ..., old label value n. The label value is the actual delivery time of the first sample, and the old predicted value is the historical predicted delivery time. For each sample in a batch, a label value (actual delivery time of the first sample) and a historical predicted value (historical predicted delivery time) are selected that is closer to the predicted delivery time of the first sample as the reference delivery time.
[0080] Right D KL To measure p φold (y|x) and p φnew The similarity between (y|x). φold (y|x) is the class probability distribution of the reference delivery time, p φnew(y|x) is the class probability distribution of the predicted delivery time of the first sample. x∈D reg , refers to the reg Samples obtained from the incremental delivery sample dataset.
[0081] S209, based on the incremental loss value, adjust the initial incremental network parameters of the spatiotemporal incremental network until the incremental loss value converges, and proceed to execute the step of inputting the sample spatiotemporal feature data into the spatiotemporal prediction network to obtain the historical predicted delivery time, so as to obtain the adjusted target incremental network parameters, and obtain a trained spatiotemporal incremental network based on the target incremental network parameters.
[0082] Specifically, the initial incremental network parameters of the spatiotemporal incremental network are adjusted according to the calculated incremental loss function. If the incremental loss value has not converged, the initial incremental network parameters are further adjusted according to the incremental loss value, and the sample spatiotemporal feature data is input into the spatiotemporal prediction network to obtain the historical predicted delivery time, the sample spatiotemporal feature data is input into the incremental feature extraction layer to obtain the spatiotemporal feature vector, the spatiotemporal feature vector is input into the spatiotemporal prediction layer to obtain the first sample predicted delivery time, a first difference between the historical predicted delivery time and the first sample actual delivery time and a second difference between the first sample predicted delivery time and the first sample actual delivery time are determined, a reference delivery time is determined between the first sample actual delivery time and the historical predicted delivery time based on the first difference and the second difference, and an incremental loss value between the first sample predicted arrival time and the reference delivery time is calculated based on the incremental loss function, until the incremental loss value converges, and the adjusted target incremental network parameters are obtained, and a trained spatiotemporal incremental network is obtained according to the target incremental network parameters.
[0083] Optionally, in one embodiment, an incremental training method provided in an embodiment of the present application further includes the following steps S2091-S2092:
[0084] S2091, calculating a regression loss value between the predicted arrival time of the first sample and the actual delivery time of the first sample based on a regression loss function;
[0085] In one embodiment, the space-time incremental network can be adjusted according to the incremental loss function and the regression loss function. The regression loss function is used to determine the difference between the predicted delivery time of the first sample and the actual delivery time of the first sample. The incremental loss function focuses on not forgetting the output of the old model, and the regression loss function focuses on learning labels (that is, the actual delivery time). By combining the two to train the space-time incremental network, it can be ensured that the space-time incremental network obtains the ability to predict new samples while not forgetting the ability learned historically.
[0086] For example, the regression loss function may select the quantile mean square error loss (MAELoss), as shown in the following formula:
[0087]
[0088] Among them, L base is the regression loss function, q is the required quantile, and its value is between 0 and 1. Due to the existence of quantiles, the penalty for predicted values greater than the true value and less than the true value is different. You can choose according to the model effect or business needs. y represents the label value (the actual delivery time of the first sample). represents the predicted value (the predicted arrival time of the first sample). n represents the total number of training samples.
[0089] It can be understood that the above-mentioned loss function is only an optional loss function for the regression loss function, and other loss functions that can be used for regression tasks can also be selected.
[0090] S2072, adjusting the initial incremental network parameters of the spatiotemporal incremental network based on the incremental loss value and the regression loss value, and entering the step of inputting the sample spatiotemporal feature data into the spatiotemporal prediction network to obtain the historical predicted delivery time, until the sum of the incremental loss value and the regression loss value converges to obtain the adjusted target network parameters, and obtaining a trained spatiotemporal incremental network based on the target network parameters.
[0091] In one embodiment, the initial incremental network parameters of the spatiotemporal incremental network are adjusted according to the sum of the incremental loss value and the regression loss value. If the sum of the incremental loss value and the regression loss value converges, the training is stopped. If the sum of the incremental loss value and the regression loss value does not converge, the step of inputting the sample spatiotemporal feature data into the spatiotemporal prediction network to obtain the historical predicted delivery time is executed, and the parameters are adjusted until the sum of the incremental loss value and the regression loss value converges to obtain the adjusted target network parameters, and the trained spatiotemporal incremental network is obtained based on the target network parameters. Optionally, weights can be set for the incremental loss value and the regression loss value respectively, for example, the first weight × incremental loss value + second weight × regression loss value = the sum of loss values, and the first weight + second weight = 1.
[0092] In an embodiment of the present application, the sample spatiotemporal feature data is input into the spatiotemporal prediction network to obtain the historical predicted delivery time, the sample spatiotemporal feature data is input into the incremental feature extraction layer to obtain the spatiotemporal feature vector, the spatiotemporal feature vector is input into the spatiotemporal prediction layer to obtain the first sample predicted delivery time, and then the first difference between the historical predicted delivery time and the first sample actual delivery time and the second difference between the first sample predicted delivery time and the first sample actual delivery time are determined. If the product of the first difference and the second difference is greater than zero and the absolute value of the first difference is less than the absolute value of the second difference, the first sample actual delivery time is selected as the reference delivery time. If the product of the first difference and the second difference is greater than zero and the absolute value of the first difference is less than the absolute value of the second difference, the first sample actual delivery time is selected as the reference delivery time. If the absolute value of the first difference is greater than zero and the absolute value of the first difference is greater than the absolute value of the second difference, the historical predicted delivery time is selected as the reference delivery time. If the product of the first difference and the second difference is less than or equal to zero, the actual delivery time of the first sample is selected as the reference delivery time. After that, the incremental loss value between the predicted arrival time of the first sample and the reference delivery time is calculated based on the incremental loss function, and the initial incremental network parameters of the spatiotemporal incremental network are adjusted based on the incremental loss value until the incremental loss value converges, and the step of inputting the sample spatiotemporal feature data into the spatiotemporal prediction network to obtain the historical predicted delivery time is entered to obtain the target incremental network parameters after parameter adjustment, and the trained spatiotemporal incremental network is obtained based on the target incremental network parameters. The training method of the spatiotemporal incremental network provided by the embodiment of the present application can extract sample spatiotemporal feature data from the incremental distribution sample data, and the model is trained by inputting the sample spatiotemporal feature data into the incremental feature extraction layer and the spatiotemporal prediction layer of the spatiotemporal incremental network, so that the spatiotemporal incremental network can update the spatiotemporal feature vector therein, accumulate samples, and effectively optimize the prediction accuracy of time estimation.
[0093] See also Figure 4 , is a flow chart of an incremental training method provided in an embodiment of the present application. Figure 4 As shown, the method of the embodiment of the present application may include the following steps S301-S304.
[0094] S301, obtaining target delivery order data;
[0095] In one embodiment, the target delivery order data is the delivery order that currently needs to be predicted for the delivery time, which may be an order that the user has just placed. The target delivery order data may include a variety of feature data such as the delivery starting point, delivery destination, planned delivery route, city, time, date, weather, whether it is high pressure (large order volume), and delivery party data. Depending on the type of feature data in the target delivery order data, at least two types of data can be obtained from the target delivery order data, one is the target spatiotemporal feature data, and the other is the target non-spatiotemporal feature data. The target spatiotemporal feature data refers to feature data related to time, space, and scenes in the target delivery order data. For example, season, date, city, etc. The target non-spatiotemporal feature data refers to feature data related to numerical classes in the target delivery order data. For example, the average delivery time of the delivery party, the number of delivery parties, the number of orders, etc.
[0096] In a feasible implementation, the time prediction model includes a spatiotemporal incremental network, a non-spatiotemporal extension network and a time combination network. The time prediction model is a model for predicting the delivery time of a target delivery order.
[0097] S302, inputting the target spatiotemporal feature data of the target delivery order data into the trained spatiotemporal incremental network to obtain a first target predicted delivery time;
[0098] In one embodiment, the spatiotemporal incremental network is a trained network that can predict the delivery time according to the spatiotemporal features. The target spatiotemporal feature data of the target delivery order data is input into the trained spatiotemporal incremental network to obtain the first target predicted delivery time.
[0099] S303, inputting the non-temporal and spatial feature data of the target delivery order data into the non-temporal and spatial extension network to obtain a second target predicted delivery time;
[0100] In one embodiment, the non-spatiotemporal extended network is a trained network capable of predicting delivery time based on non-spatiotemporal features. The non-spatiotemporal feature data of the target delivery order data is input into the non-spatiotemporal extended network to obtain a second target predicted delivery time.
[0101] S304: Input the first target predicted delivery time and the second target predicted delivery time into a time combination network to obtain a third target predicted delivery time, and determine the third target predicted delivery time as the target predicted delivery time of the target delivery order data.
[0102] In one embodiment, since the delivery time can be predicted according to different types of sample features through the spatiotemporal incremental network and the non-spatiotemporal extension network, it is also necessary to combine the first target predicted delivery time and the second target predicted delivery time through the time combination network to obtain the third target predicted delivery time after the sum of the two parts. The third target predicted delivery time is determined as the target predicted delivery time of the target delivery order data. After that, the target predicted delivery time can be output to the user end and the delivery end. The time combination network is a multi-layer DNN deep network.
[0103] See also Figure 5 , Figure 5 A model schematic diagram of an incremental training method provided for an embodiment of the present application. The time prediction model includes a spatiotemporal incremental network, a non-spatiotemporal extension network, and a time combination network. The target spatiotemporal feature data of the target delivery order data is input into the trained spatiotemporal incremental network to obtain the first target predicted delivery time, the non-spatiotemporal feature data of the target delivery order data is input into the non-spatiotemporal extension network to obtain the second target predicted delivery time, and the first target predicted delivery time and the second target predicted delivery time are input into the time combination network to obtain the third target predicted delivery time.
[0104] Optionally, in one embodiment, the training method of the non-spatiotemporal extended network includes the following steps S401-S404:
[0105] S401, obtaining extended delivery sample data within a preset time period and a non-spatiotemporal prediction network trained with historical delivery data; the extended delivery sample data includes sample non-spatiotemporal feature data of each sample delivery order and actual delivery time of the second sample;
[0106] In one embodiment, the non-spatial-temporal prediction network is trained based on historical delivery data and is used to infer non-spatial-temporal features to obtain an estimated delivery time. It should be noted that the historical delivery data used by the non-spatial-temporal prediction network can be samples within a preset historical time period. The numerical data in the non-spatial-temporal prediction network has no concept of accumulation, which is equivalent to using the full amount of samples. Generally, it is trained with historical 7- or 14-day window data. The purpose is to learn the most recent data, such as recent changes in platform operating strategies, changes in personalized features such as the delivery habits of the delivery party. And there is no need to use historical accumulated data (such as data from the past year) for training, thereby reducing training costs.
[0107] The non-spatial-temporal extended network is obtained by retraining the non-spatial-temporal prediction network according to the extended delivery sample data. The extended delivery sample data includes the sample non-spatial-temporal feature data of each sample delivery order and the actual delivery time of the second sample. There are multiple sample delivery orders. The sample non-spatial-temporal feature data is the data extracted from the extended delivery sample data and is related to the non-spatial-temporal features of the sample delivery order.
[0108] The update frequency of the non-time-space extended network can be lower than that of the time-space incremental network. For example, the time-space incremental network can be updated every day, and the non-time-space extended network can be updated once a week or every two weeks. When updated once a week, a cycle of data can be learned, which can ensure that when the non-time-space extended network is used to predict the next week, the distribution is close to that of the previous week.
[0109] S402, generating a non-spatiotemporal extension network based on the non-spatiotemporal prediction network;
[0110] In one embodiment, a non-spacetime extension network is generated based on the non-spacetime prediction network trained in the previous cycle, so as to learn the recent extended delivery sample data. The network structure of the non-spacetime extension network is consistent with that of the non-spacetime prediction network, and the initial network parameters of the non-spacetime extension network can be consistent with the initial network parameters of the non-spacetime prediction network before training.
[0111] S403, inputting the sample non-temporal and spatial feature data into the non-temporal and spatial extension network to obtain a second sample predicted delivery time;
[0112] In one embodiment, the sample non-spatiotemporal feature data is input into the constructed non-spatiotemporal extension network to obtain the second sample predicted delivery time. The non-spatiotemporal extension network may include a non-spatiotemporal feature prediction layer and a non-spatiotemporal feature extraction layer. The sample non-spatiotemporal feature vector corresponding to the sample non-spatiotemporal feature data is extracted by the non-spatiotemporal feature extraction layer, and then input into the non-spatiotemporal feature prediction layer to obtain the second sample predicted delivery time.
[0113] S404: Training the non-space-time extended network based on the prediction loss function, the predicted arrival time of the second sample and the actual delivery time of the second sample to obtain a trained non-space-time extended network.
[0114] In one embodiment, the non-space-time extended network is trained according to the prediction loss function, the predicted arrival time of the second sample, and the actual delivery time of the second sample. For regression tasks, the mean square error (MSE) can be used as the prediction loss function. The loss value between the predicted arrival time of the second sample and the actual delivery time of the second sample is calculated by the prediction loss function. The gradient is calculated based on the loss value, and the model parameters are updated to reduce the loss. The non-space-time extended network is trained to ensure the adaptability of the model to changes in data quality, and new features can be added or some features can be removed according to needs.
[0115] Optionally, in one embodiment, the training of the non-space-time extended network based on the prediction loss function, the predicted arrival time of the second sample and the actual delivery time of the second sample to obtain a trained non-space-time extended network includes the following steps S4041-S4042:
[0116] S4041, calculating a predicted loss value between the predicted arrival time of the second sample and the actual delivery time of the second sample based on a predicted loss function;
[0117] Specifically, the predicted loss value between the predicted arrival time of the second sample and the actual delivery time of the second sample is calculated according to the predicted loss function. The predicted loss value can be calculated for each sample delivery order in this way.
[0118] S4042, adjusting the initial extended network parameters of the non-spatiotemporal extended network based on the predicted loss value, and entering the step of inputting the sample non-spatiotemporal feature data into the non-spatiotemporal extended network to obtain the predicted delivery time of the second sample, until the predicted loss value converges to obtain the adjusted target extended network parameters, and obtaining a trained non-spatiotemporal extended network based on the target extended network parameters.
[0119] In one embodiment, if the predicted loss value has not converged, the initial extended network parameters of the non-spatiotemporal extended network are adjusted based on the predicted loss value, and the step of inputting the sample non-spatiotemporal feature data into the non-spatiotemporal extended network to obtain the predicted delivery time of the second sample is executed, and multiple rounds of training are performed until the predicted loss value converges to obtain the target extended network parameters, and a trained non-spatiotemporal extended network is generated according to the target extended network parameters.
[0120] In an embodiment of the present application, by acquiring the target delivery order data, the target spatiotemporal feature data of the target delivery order data is input into the trained spatiotemporal incremental network to obtain the first target predicted delivery time, the non-spatiotemporal feature data of the target delivery order data is input into the non-spatiotemporal extension network to obtain the second target predicted delivery time, the first target predicted delivery time and the second target predicted delivery time are input into the time combination network to obtain the third target predicted delivery time, and the third target predicted delivery time is determined as the target predicted delivery time of the target delivery order data. By generating the predicted delivery time of the target delivery order data through the two parts of the spatiotemporal incremental network and the non-spatiotemporal extension network, it is possible to combine multiple types of features to achieve a higher prediction accuracy for the predicted delivery time.
[0121] The following will be combined with the attached Figure 6-Figure 7 , the incremental training device provided in the embodiment of the present application is introduced in detail. It should be noted that the attached Figure 6-Figure 7 The incremental training device in the embodiment of the present invention is used to execute the Figure 2-Figure 5 For the convenience of explanation, only the part related to the embodiment of the present application is shown. For the specific technical details not disclosed, please refer to this specification. Figure 2-Figure 5 The embodiment shown.
[0122] See also Figure 6 , which shows a schematic diagram of the structure of an incremental training device provided by an exemplary embodiment of the present application. The incremental training device can be implemented as all or part of the device through software, hardware or a combination of both. The device 1 includes an acquisition unit 11, a generation unit 12, a history prediction unit 13, a sample prediction unit 14, a difference calculation unit 15, a comparison unit 16 and a training unit 17.
[0123] An acquisition unit 11 is used to acquire incremental delivery sample data and a spatiotemporal prediction network trained with historical delivery data; the spatiotemporal prediction network is used to generate a predicted delivery time of a delivery order; the incremental delivery sample data includes sample spatiotemporal feature data and sample actual delivery time of each incremental delivery order;
[0124] A generating unit 12, configured to generate a spatiotemporal incremental network based on the spatiotemporal prediction network, wherein an initial incremental network parameter of the spatiotemporal incremental network is consistent with that of the spatiotemporal prediction network;
[0125] A historical prediction unit 13, used for inputting the sample spatiotemporal feature data into the spatiotemporal prediction network to obtain a historical prediction delivery time;
[0126] A sample prediction unit 14, configured to input the sample spatiotemporal feature data into the spatiotemporal incremental network to obtain a first sample predicted delivery time;
[0127] A difference calculation unit 15, configured to determine a first difference between the historical predicted delivery time and the first sample actual delivery time and a second difference between the first sample predicted delivery time and the first sample actual delivery time;
[0128] A comparison unit 16, configured to determine a reference delivery time from the first sample actual delivery time and the historical predicted delivery time based on the first difference and the second difference;
[0129] The training unit 17 is used to train the spatiotemporal incremental network based on the incremental loss function, the predicted arrival time of the first sample and the reference delivery time to obtain a trained spatiotemporal incremental network.
[0130] Optionally, the spatiotemporal incremental network includes an incremental feature extraction layer and a spatiotemporal prediction layer, and the sample prediction unit 14 is specifically used to input the sample spatiotemporal feature data into the incremental feature extraction layer to obtain a spatiotemporal feature vector;
[0131] The spatiotemporal feature vector is input into the spatiotemporal prediction layer to obtain a first sample predicted delivery time.
[0132] Optionally, the spatiotemporal incremental network includes a feature combination layer, and the sample prediction unit 14 is further used to input the spatiotemporal feature vector into the feature combination layer to obtain a combined spatiotemporal feature vector;
[0133] The combined spatiotemporal feature vector is input into the spatiotemporal prediction layer to obtain a first sample predicted delivery time.
[0134] Optionally, the comparison unit 16 is specifically configured to select the historical predicted delivery time as the reference delivery time if the product of the first difference and the second difference is greater than zero and the absolute value of the first difference is less than the absolute value of the second difference;
[0135] If the product of the first difference and the second difference is greater than zero and the absolute value of the first difference is greater than the absolute value of the second difference, selecting the actual delivery time of the first sample as the reference delivery time;
[0136] If the product of the first difference and the second difference is less than or equal to zero, the actual delivery time of the first sample is selected as the reference delivery time.
[0137] Optionally, the training unit 17 is specifically used to calculate the incremental loss value between the predicted arrival time of the first sample and the reference delivery time based on the incremental loss function;
[0138] Based on the incremental loss value, the initial incremental network parameters of the spatiotemporal incremental network are adjusted until the incremental loss value converges, and the step of inputting the sample spatiotemporal feature data into the spatiotemporal prediction network to obtain the historical predicted delivery time is executed to obtain the adjusted target incremental network parameters, and a trained spatiotemporal incremental network is obtained based on the target incremental network parameters.
[0139] Optionally, the training unit 17 is specifically used to calculate the regression loss value between the predicted arrival time of the first sample and the actual delivery time of the first sample based on the regression loss function;
[0140] Based on the incremental loss value and the regression loss value, the initial incremental network parameters of the spatiotemporal incremental network are adjusted, and the step of inputting the sample spatiotemporal feature data into the spatiotemporal prediction network to obtain the historical predicted delivery time is executed until the sum of the incremental loss value and the regression loss value converges to obtain the adjusted target network parameters, and a trained spatiotemporal incremental network is obtained based on the target network parameters.
[0141] See also Figure 7 , which shows a schematic diagram of the structure of an incremental training device provided by an exemplary embodiment of the present application. The incremental training device can be implemented as all or part of the device through software, hardware or a combination of both. Figure 7 As shown, the device 1 further includes an application unit 18 for acquiring target delivery order data; the target delivery order data includes target spatiotemporal feature data and non-spatial feature data;
[0142] Inputting the target spatiotemporal feature data of the target delivery order data into the trained spatiotemporal incremental network to obtain a first target predicted delivery time;
[0143] Inputting the non-temporal and spatial feature data of the target delivery order data into the non-temporal and spatial extension network to obtain a second target predicted delivery time;
[0144] The first target predicted delivery time and the second target predicted delivery time are input into a time combination network to obtain a third target predicted delivery time, and the third target predicted delivery time is determined as the target predicted delivery time of the target delivery order data.
[0145] Optionally, the application unit 18 is specifically used to obtain extended delivery sample data within a preset time period and a non-spatiotemporal prediction network trained with historical delivery data; the extended delivery sample data includes sample non-spatiotemporal feature data of each sample delivery order and the actual delivery time of the second sample;
[0146] Generating a non-space-time extension network based on the non-space-time prediction network, wherein the network structure of the non-space-time extension network is consistent with that of the non-space-time prediction network;
[0147] Inputting the sample non-spatiotemporal feature data into the non-spatiotemporal extension network to obtain a second sample predicted delivery time;
[0148] The non-space-time extended network is trained based on the prediction loss function, the predicted arrival time of the second sample and the actual delivery time of the second sample to obtain a trained non-space-time extended network.
[0149] Optionally, the application unit 18 is specifically configured to calculate a predicted loss value between the predicted arrival time of the second sample and the actual delivery time of the second sample based on a predicted loss function;
[0150] Based on the predicted loss value, the initial extended network parameters of the non-spatiotemporal extended network are adjusted, and the step of inputting the sample non-spatiotemporal feature data into the non-spatiotemporal extended network to obtain the predicted delivery time of the second sample is executed until the predicted loss value converges to obtain the adjusted target extended network parameters, and a trained non-spatiotemporal extended network is obtained based on the target extended network parameters.
[0151] It should be noted that the incremental training device provided in the above embodiment only uses the division of the above functional modules as an example when executing the incremental training method. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the incremental training device provided in the above embodiment and the incremental training method embodiment belong to the same concept, and the implementation process thereof is detailed in the method embodiment, which will not be repeated here.
[0152] The serial numbers of the embodiments of the present application are for description only and do not represent the advantages and disadvantages of the embodiments. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0153] The present application also provides a storage medium having a computer program stored thereon. When the computer program is executed by a processor, the above-mentioned Figure 2-Figure 5 The method of the embodiment shown in the figure can be specifically executed by referring to Figure 2-Figure 5 The specific description of the illustrated embodiment will not be repeated here.
[0154] Please refer to Figure 8 , which shows a schematic diagram of the structure of an electronic device provided by an exemplary embodiment of this specification. The electronic device in this specification may include one or more of the following components: a processor 110, a memory 120, an input device 130, an output device 140, and a bus 150. The processor 110, the memory 120, the input device 130, and the output device 140 may be connected via the bus 150.
[0155] The processor 110 may include one or more processing cores. The processor 110 uses various interfaces and lines to connect various parts of the entire electronic device, and executes various functions and processes data of the terminal 100 by running or executing instructions, programs, code sets or instruction sets stored in the memory 120, and calling data stored in the memory 120. Optionally, the processor 110 can be implemented in at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA), and programmable logic array (PLA). The processor 110 can integrate one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), and a modem. Among them, the CPU mainly processes the operating system, user pages, and applications; the GPU is responsible for rendering and drawing display content; and the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 110, but may be implemented separately through a communication chip.
[0156] The memory 120 may include a random access memory (RAM) or a read-only memory (ROM). Optionally, the memory 120 includes a non-transitory computer-readable medium (Non-Transitory Computer-Readable Storage Medium). The memory 120 may be used to store instructions, programs, codes, code sets or instruction sets. The memory 120 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc. The operating system may be an Android system, including a system deeply developed based on the Android system, an IOS system developed by Apple, including a system deeply developed based on the IOS system or other systems.
[0157] The memory 120 can be divided into an operating system space and a user space. The operating system runs in the operating system space, and native and third-party applications run in the user space. In order to ensure that different third-party applications can achieve good operating results, the operating system allocates corresponding system resources to different third-party applications. However, the requirements for system resources in different application scenarios in the same third-party application are also different. For example, in the local resource loading scenario, the third-party application has higher requirements for disk reading speed; in the animation rendering scenario, the third-party application has higher requirements for GPU performance. The operating system and third-party applications are independent of each other, and the operating system often cannot perceive the current application scenario of the third-party application in a timely manner, resulting in the operating system being unable to perform targeted system resource adaptation according to the specific application scenario of the third-party application.
[0158] In order for the operating system to distinguish the specific application scenarios of third-party applications, it is necessary to open up data communication between third-party applications and the operating system so that the operating system can obtain the current scenario information of third-party applications at any time, and then perform targeted system resource adaptation based on the current scenario.
[0159] Among them, the input device 130 is used to receive input instructions or data, and the input device 130 includes but is not limited to a keyboard, a mouse, a camera, a microphone or a touch device. The output device 140 is used to output instructions or data, and the output device 140 includes but is not limited to a display device and a speaker. In one example, the input device 130 and the output device 140 can be combined, and the input device 130 and the output device 140 are touch screen displays. The touch screen display can be designed as a full screen, a curved screen or a special-shaped screen. The touch screen display can also be designed as a combination of a full screen and a curved screen, or a combination of a special-shaped screen and a curved screen, which is not limited in the embodiments of the present application.
[0160] In addition, those skilled in the art can understand that the structure of the electronic device shown in the above drawings does not constitute a limitation on the electronic device, and the electronic device may include more or fewer components than shown, or combine certain components, or arrange the components differently. For example, the electronic device also includes components such as a radio frequency circuit, an input unit, a sensor, an audio circuit, a WiFi module, a power supply, and a Bluetooth module, which will not be described in detail here.
[0161] exist Figure 8 In the electronic device shown, the processor 110 may be used to call a computer application stored in the memory 120 and specifically perform the following operations:
[0162] Acquire incremental delivery sample data and a spatiotemporal prediction network trained with historical delivery data; the spatiotemporal prediction network is used to generate a predicted delivery time for a delivery order; the incremental delivery sample data includes sample spatiotemporal feature data of each incremental delivery order and the actual delivery time of the first sample;
[0163] Generate a spatiotemporal incremental network based on the spatiotemporal prediction network, wherein initial incremental network parameters of the spatiotemporal incremental network are consistent with network parameters of the spatiotemporal prediction network;
[0164] Inputting the sample spatiotemporal feature data into the spatiotemporal prediction network to obtain a historical predicted delivery time;
[0165] Inputting the sample spatiotemporal feature data into the spatiotemporal incremental network to obtain a first sample predicted delivery time;
[0166] Determine a first difference between the historical predicted delivery time and the first sample actual delivery time and a second difference between the first sample predicted delivery time and the first sample actual delivery time;
[0167] Determine a reference delivery time from the first sample actual delivery time and the historical predicted delivery time based on the first difference and the second difference;
[0168] The spatiotemporal incremental network is trained based on the incremental loss function, the predicted arrival time of the first sample and the reference delivery time to obtain a trained spatiotemporal incremental network.
[0169] In one embodiment, the spatiotemporal incremental network includes an incremental feature extraction layer and a spatiotemporal prediction layer. When the processor 110 inputs the sample spatiotemporal feature data into the spatiotemporal incremental network to obtain the first sample predicted delivery time, the processor 110 specifically performs the following operations:
[0170] Inputting the sample spatiotemporal feature data into the incremental feature extraction layer to obtain a spatiotemporal feature vector;
[0171] The spatiotemporal feature vector is input into the spatiotemporal prediction layer to obtain a first sample predicted delivery time.
[0172] In one embodiment, the spatiotemporal incremental network includes a feature combination layer, and the processor 110 performs the following operations when inputting the spatiotemporal feature vector into the spatiotemporal prediction layer to obtain the predicted delivery time of the first sample:
[0173] Inputting the spatiotemporal feature vector into the feature combination layer to obtain a combined spatiotemporal feature vector;
[0174] The combined spatiotemporal feature vector is input into the spatiotemporal prediction layer to obtain a first sample predicted delivery time.
[0175] In one embodiment, when determining the reference delivery time from the first sample actual delivery time and the historical predicted delivery time based on the first difference and the second difference, the processor 110 specifically performs the following operations:
[0176] If the product of the first difference and the second difference is greater than zero and the absolute value of the first difference is less than the absolute value of the second difference, selecting the historical predicted delivery time as the reference delivery time;
[0177] If the product of the first difference and the second difference is greater than zero and the absolute value of the first difference is greater than the absolute value of the second difference, selecting the actual delivery time of the first sample as the reference delivery time;
[0178] If the product of the first difference and the second difference is less than or equal to zero, the actual delivery time of the first sample is selected as the reference delivery time.
[0179] In one embodiment, when the processor 110 trains the spatiotemporal incremental network based on the incremental loss function, the predicted arrival time of the first sample, and the reference delivery time to obtain a trained spatiotemporal incremental network, the processor 110 specifically performs the following operations:
[0180] Calculate the incremental loss value between the predicted arrival time of the first sample and the reference delivery time based on the incremental loss function;
[0181] Based on the incremental loss value, the initial incremental network parameters of the spatiotemporal incremental network are adjusted until the incremental loss value converges, and the step of inputting the sample spatiotemporal feature data into the spatiotemporal prediction network to obtain the historical predicted delivery time is executed to obtain the adjusted target incremental network parameters, and a trained spatiotemporal incremental network is obtained based on the target incremental network parameters.
[0182] In one embodiment, the processor 110 adjusts the initial incremental network parameters of the spatiotemporal incremental network based on the incremental loss value until the incremental loss value converges, and enters the step of inputting the sample spatiotemporal feature data into the spatiotemporal prediction network to obtain the historical predicted delivery time, so as to obtain the adjusted target incremental network parameters, and obtains the trained spatiotemporal incremental network based on the target incremental network parameters, and specifically performs the following operations:
[0183] Calculate the regression loss value between the predicted arrival time of the first sample and the actual delivery time of the first sample based on the regression loss function;
[0184] Based on the incremental loss value and the regression loss value, the initial incremental network parameters of the spatiotemporal incremental network are adjusted, and the step of inputting the sample spatiotemporal feature data into the spatiotemporal prediction network to obtain the historical predicted delivery time is executed until the sum of the incremental loss value and the regression loss value converges to obtain the adjusted target network parameters, and a trained spatiotemporal incremental network is obtained based on the target network parameters.
[0185] In one embodiment, the processor 110 further performs the following operations:
[0186] Acquire target delivery order data; the target delivery order data includes target spatiotemporal feature data and non-spatial feature data;
[0187] Inputting the target spatiotemporal feature data of the target delivery order data into the trained spatiotemporal incremental network to obtain a first target predicted delivery time;
[0188] Inputting the non-temporal and spatial feature data of the target delivery order data into the non-temporal and spatial extension network to obtain a second target predicted delivery time;
[0189] The first target predicted delivery time and the second target predicted delivery time are input into a time combination network to obtain a third target predicted delivery time, and the third target predicted delivery time is determined as the target predicted delivery time of the target delivery order data.
[0190] In one embodiment, when the processor 110 performs training of the non-spatiotemporal extended network, the processor 110 specifically performs the following operations:
[0191] Acquire extended delivery sample data within a preset time period and a non-spatiotemporal prediction network trained with historical delivery data; the extended delivery sample data includes sample non-spatiotemporal feature data of each sample delivery order and actual delivery time of the second sample;
[0192] Generating a non-space-time extension network based on the non-space-time prediction network, wherein the network structure of the non-space-time extension network is consistent with that of the non-space-time prediction network;
[0193] Inputting the sample non-spatiotemporal feature data into the non-spatiotemporal extension network to obtain a second sample predicted delivery time;
[0194] The non-space-time extended network is trained based on the prediction loss function, the predicted arrival time of the second sample and the actual delivery time of the second sample to obtain a trained non-space-time extended network.
[0195] In one embodiment, when the processor 110 trains the non-space-time extended network based on the prediction loss function, the predicted arrival time of the second sample, and the actual delivery time of the second sample to obtain the trained non-space-time extended network, the following operations are specifically performed:
[0196] Calculate the predicted loss value between the predicted arrival time of the second sample and the actual delivery time of the second sample based on the predicted loss function;
[0197] Based on the predicted loss value, the initial extended network parameters of the non-spatiotemporal extended network are adjusted, and the step of inputting the sample non-spatiotemporal feature data into the non-spatiotemporal extended network to obtain the predicted delivery time of the second sample is executed until the predicted loss value converges to obtain the adjusted target extended network parameters, and a trained non-spatiotemporal extended network is obtained based on the target extended network parameters.
[0198] In an embodiment of the present application, by constructing a spatiotemporal incremental network with network parameters consistent with the historically trained spatiotemporal prediction network, the spatiotemporal incremental network is trained according to the newly acquired incremental distribution sample data, so that the spatiotemporal incremental network can learn the knowledge in the new sample. In order to prevent the model from forgetting historical information, the historical predicted delivery time is obtained through the spatiotemporal prediction network, and the prediction results of the spatiotemporal incremental network and the prediction results of the historical spatiotemporal prediction network are compared with the true label value of the sample to determine the learning object of the spatiotemporal incremental network, that is, the reference delivery time, so that the new network obtained by the incremental update can retain the existing network capabilities as much as possible. Based on the data accumulation capability of the incremental update, the difficulty of insufficient learning due to sparse data in some areas in the short term can be compensated in time and space, while better learning long-term information and reducing training time. And when the model is incrementally updated in this way, the accurate output of the old model is learned at the same time, reducing the degradation of model capabilities caused by the incremental update model.
[0199] Furthermore, by inputting the sample spatiotemporal feature data into the spatiotemporal prediction network to obtain the historical predicted delivery time, the sample spatiotemporal feature data is input into the incremental feature extraction layer to obtain the spatiotemporal feature vector, and the spatiotemporal feature vector is input into the spatiotemporal prediction layer to obtain the first sample predicted delivery time, and then by determining the first difference between the historical predicted delivery time and the first sample actual delivery time and the second difference between the first sample predicted delivery time and the first sample actual delivery time, if the product of the first difference and the second difference is greater than zero and the absolute value of the first difference is less than the absolute value of the second difference, then the first sample actual delivery time is selected as the reference delivery time, and if the product of the first difference and the second difference is greater than If the absolute value of the first difference is zero and the absolute value of the first difference is greater than the absolute value of the second difference, the historical predicted delivery time is selected as the reference delivery time. If the product of the first difference and the second difference is less than or equal to zero, the actual delivery time of the first sample is selected as the reference delivery time. After that, the incremental loss value between the predicted arrival time of the first sample and the reference delivery time is calculated based on the incremental loss function, and the initial incremental network parameters of the spatiotemporal incremental network are adjusted based on the incremental loss value until the incremental loss value converges, and the step of inputting the sample spatiotemporal feature data into the spatiotemporal prediction network to obtain the step of historical predicted delivery time is entered to obtain the target incremental network parameters after parameter adjustment, and the trained spatiotemporal incremental network is obtained based on the target incremental network parameters. The training method of the spatiotemporal incremental network provided by the embodiment of the present application can extract sample spatiotemporal feature data from incremental distribution sample data, and by inputting the sample spatiotemporal feature data into the incremental feature extraction layer and the spatiotemporal prediction layer of the spatiotemporal incremental network for model training, the spatiotemporal incremental network can update the spatiotemporal feature vector therein, accumulate samples, and effectively optimize the prediction accuracy of time estimation.
[0200] Furthermore, by acquiring the target delivery order data, the target spatiotemporal feature data of the target delivery order data is input into the trained spatiotemporal incremental network to obtain the first target predicted delivery time, the non-spatial feature data of the target delivery order data is input into the non-spatial-temporal extension network to obtain the second target predicted delivery time, the first target predicted delivery time and the second target predicted delivery time are input into the time combination network to obtain the third target predicted delivery time, and the third target predicted delivery time is determined as the target predicted delivery time of the target delivery order data. By generating the predicted delivery time of the target delivery order data through the spatiotemporal incremental network and the non-spatial-temporal extension network, it is possible to combine multiple types of features to achieve a higher prediction accuracy for the predicted delivery time.
[0201] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.
[0202] The above disclosure is only the preferred embodiment of this specification, which certainly cannot be used to limit the scope of rights of this specification. Therefore, equivalent changes made according to the claims of this specification are still within the scope covered by this specification.
Claims
1. An incremental training method, characterized in that: include: Obtain incremental delivery sample data and the spatiotemporal prediction network trained with historical delivery data; The spatiotemporal prediction network is used to generate a predicted delivery time for a delivery order; The incremental delivery sample data includes sample spatiotemporal feature data of each incremental delivery order and the actual delivery time of the first sample; Generate a spatiotemporal incremental network based on the spatiotemporal prediction network, wherein initial incremental network parameters of the spatiotemporal incremental network are consistent with network parameters of the spatiotemporal prediction network; Inputting the sample spatiotemporal feature data into the spatiotemporal prediction network to obtain a historical predicted delivery time; Inputting the sample spatiotemporal feature data into the spatiotemporal incremental network to obtain a first sample predicted delivery time; Determine a first difference between the historical predicted delivery time and the first sample actual delivery time and a second difference between the first sample predicted delivery time and the first sample actual delivery time; Determine a reference delivery time from the first sample actual delivery time and the historical predicted delivery time based on the first difference and the second difference; The spatiotemporal incremental network is trained based on the incremental loss function, the predicted arrival time of the first sample and the reference delivery time to obtain a trained spatiotemporal incremental network.
2. The method according to claim 1, characterized in that The spatiotemporal incremental network includes an incremental feature extraction layer and a spatiotemporal prediction layer; The step of inputting the sample spatiotemporal feature data into the spatiotemporal incremental network to obtain a first sample predicted delivery time includes: Inputting the sample spatiotemporal feature data into the incremental feature extraction layer to obtain a spatiotemporal feature vector; The spatiotemporal feature vector is input into the spatiotemporal prediction layer to obtain a first sample predicted delivery time.
3. The method according to claim 2, characterized in that The spatiotemporal incremental network includes a feature combination layer; The step of inputting the spatiotemporal feature vector into the spatiotemporal prediction layer to obtain a first sample predicted delivery time includes: Inputting the spatiotemporal feature vector into the feature combination layer to obtain a combined spatiotemporal feature vector; The combined spatiotemporal feature vector is input into the spatiotemporal prediction layer to obtain a first sample predicted delivery time.
4. The method according to claim 1, characterized in that The determining of a reference delivery time from the first sample actual delivery time and the historical predicted delivery time based on the first difference and the second difference comprises: If the product of the first difference and the second difference is greater than zero and the absolute value of the first difference is less than the absolute value of the second difference, selecting the historical predicted delivery time as the reference delivery time; If the product of the first difference and the second difference is greater than zero and the absolute value of the first difference is greater than the absolute value of the second difference, selecting the actual delivery time of the first sample as the reference delivery time; If the product of the first difference and the second difference is less than or equal to zero, the actual delivery time of the first sample is selected as the reference delivery time.
5. The method according to claim 1, characterized in that The step of training the spatiotemporal incremental network based on the incremental loss function, the first sample predicted arrival time, and the reference delivery time to obtain a trained spatiotemporal incremental network includes: Calculate the incremental loss value between the predicted arrival time of the first sample and the reference delivery time based on the incremental loss function; Based on the incremental loss value, the initial incremental network parameters of the spatiotemporal incremental network are adjusted until the incremental loss value converges, and the step of inputting the sample spatiotemporal feature data into the spatiotemporal prediction network to obtain the historical predicted delivery time is executed to obtain the adjusted target incremental network parameters, and a trained spatiotemporal incremental network is obtained based on the target incremental network parameters.
6. The method according to claim 5, characterized in that The initial incremental network parameters of the spatiotemporal incremental network are adjusted based on the incremental loss value until the incremental loss value converges, and the step of inputting the sample spatiotemporal feature data into the spatiotemporal prediction network to obtain the historical predicted delivery time is performed to obtain the adjusted target incremental network parameters, and the trained spatiotemporal incremental network is obtained based on the target incremental network parameters, including: Calculate the regression loss value between the predicted arrival time of the first sample and the actual delivery time of the first sample based on the regression loss function; Based on the incremental loss value and the regression loss value, the initial incremental network parameters of the spatiotemporal incremental network are adjusted, and the step of inputting the sample spatiotemporal feature data into the spatiotemporal prediction network to obtain the historical predicted delivery time is executed until the sum of the incremental loss value and the regression loss value converges to obtain the adjusted target network parameters, and a trained spatiotemporal incremental network is obtained based on the target network parameters.
7. The method according to claim 1, characterized in that The method further comprises: Acquire target delivery order data; the target delivery order data includes target spatiotemporal feature data and non-spatial feature data; Inputting the target spatiotemporal feature data of the target delivery order data into the trained spatiotemporal incremental network to obtain a first target predicted delivery time; Inputting the non-temporal and spatial feature data of the target delivery order data into the non-temporal and spatial extension network to obtain a second target predicted delivery time; The first target predicted delivery time and the second target predicted delivery time are input into a time combination network to obtain a third target predicted delivery time, and the third target predicted delivery time is determined as the target predicted delivery time of the target delivery order data.
8. An incremental training device, characterized in that: The device comprises: An acquisition unit, used to acquire incremental delivery sample data and a spatiotemporal prediction network trained with historical delivery data; the spatiotemporal prediction network is used to generate a predicted delivery time of a delivery order; the incremental delivery sample data includes sample spatiotemporal feature data and sample actual delivery time of each incremental delivery order; A generating unit, configured to generate a spatiotemporal incremental network based on the spatiotemporal prediction network, wherein an initial incremental network parameter of the spatiotemporal incremental network is consistent with that of the spatiotemporal prediction network; A historical prediction unit, used for inputting the sample spatiotemporal feature data into the spatiotemporal prediction network to obtain a historical prediction delivery time; A sample prediction unit, used for inputting the sample spatiotemporal feature data into the spatiotemporal incremental network to obtain a first sample predicted delivery time; a difference calculation unit, configured to determine a first difference between the historical predicted delivery time and the actual delivery time of the first sample and a second difference between the predicted delivery time of the first sample and the actual delivery time of the first sample; A comparison unit, configured to determine a reference delivery time from the first sample actual delivery time and the historical predicted delivery time based on the first difference and the second difference; A training unit is used to train the spatiotemporal incremental network based on the incremental loss function, the predicted arrival time of the first sample and the reference delivery time to obtain a trained spatiotemporal incremental network.
9. An electronic device, characterized in that: include: Processor and memory; The memory stores a computer program, wherein the computer program is suitable for being loaded by the processor and executing the steps of the method according to any one of claims 1 to 7.
10. A storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.