Logistics transportation cost estimation method based on shuttle task classification and multi-model combination
By classifying shuttle task data and jointly estimating multiple models, the problem of low estimated accuracy of shuttle transportation costs in the prior art is solved, and higher estimate accuracy and lower prediction deviation are achieved.
Patent Information
- Application Number
- CN202210863956.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-20
- Publication Date
- 2025-02-21
- Estimated Expiration
- 2042-07-20
AI Technical Summary
The prior art has low accuracy when estimating the transportation costs of shuttle bus tasks, especially since the cost cannot be filled without the shuttle bus tasks in history, and the cost estimate method for a single ton-kilometer is too simple. The linear regression model is based on the category type. The linear correlation between features and costs is weak, resulting in a large deviation in prediction accuracy.
The logistics and transportation cost estimate method based on shuttle task classification and multi-model combination is adopted. By dividing historical shuttle task data into sample sets according to task type, the estimated shuttle task is estimated using XGBOOST model and sliding average model, and Combining multiple prediction results through fusion models to improve accuracy.
The accuracy of transportation cost estimates for shuttle tasks is improved and prediction bias is reduced. Especially when dealing with different types of shuttle tasks, the use of the fusion model further improves the accuracy of cost estimates.
Smart Images

Figure CN115081993B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of logistics transportation cost estimation, and particularly relates to a logistics transportation cost estimation method based on shuttle task classification and multi-model combination. Background Art
[0002] The logistics trunk line transportation cost, that is, the cost generated by the operation of trunk line shuttles in the logistics network, is generally settled in units of shuttle tasks. A shuttle task means that a shuttle runs a specific route and performs the task of transporting goods. The cost of each shuttle task mainly consists of fixed costs and variable costs. The fixed costs mainly include the financial costs of the shuttle (such as the purchase cost of the shuttle), driver's salary, etc. These costs are fixed in total, and for a shuttle task, these costs are usually allocated on a monthly basis. The variable costs mainly include fuel costs, road and bridge tolls, etc. The amount of these costs has a great relationship with the route of the shuttle task operation.
[0003] In the trunk line network, there are different types of shuttle tasks, mainly including planned shuttle tasks, temporary shuttle tasks, and replacement shuttle tasks, etc. Among them, a planned shuttle task refers to a shuttle task with goods that operates in cooperation for a relatively long time in the network. A temporary shuttle task refers to a shuttle task that operates temporarily. A replacement shuttle task refers to a task in which another shuttle task replaces a shuttle task with goods that operates in cooperation for a relatively long time in the network. For example, the shuttle task of a shuttle originally performing the goods transportation from Hangzhou to Shanghai is cancelled, and a shuttle originally performing the goods transportation from Shaoxing to Shanghai comes to Hangzhou for transfer to replace the shuttle task originally performing the Hangzhou - Shanghai shuttle task.
[0004] For the above different types of shuttle tasks, currently, the future shuttle costs are mainly estimated through the following 3 methods:
[0005] 1. Using the historical transportation costs of the same type of shuttle tasks for filling, that is, calculating the historical average transportation cost of this task number to estimate the transportation cost of the shuttle task of this vehicle on a certain future day according to the specific number of the shuttle task (formulated according to the shuttle license plate and the shuttle driving route. For example, the shuttle task number of the shuttle with the license plate number Zhe A12345 performing the transportation route from Hangzhou to Shanghai is encoded as HZ - SH Zhe A12345). For example, if the average cost of HZ - SH Zhe A12345 performing the Hangzhou - Shanghai transportation task in the past 30 consecutive days on the current day when the cost estimation is to be carried out is 2000 yuan, then the estimated cost for the current day is 2000 yuan. However, the estimation method of cost filling has the situation that it cannot be filled due to the absence of such a shuttle task in history, and there are relatively large defects.
[0006] 2. Using the cost per ton per kilometer for estimation, its essence is to assume that the shuttle bus cost is linearly related to its rated load and driving distance. First, calculate the average per ton per kilometer transportation cost of the entire network based on historical data, and then use this value and the input shuttle bus rated load and driving distance to estimate the shuttle bus cost. For example, the total load of all shuttle bus tasks within a certain trunk transportation network within the past 30 days is 10,000 tons, the total mileage is 10,000 kilometers, and the total transportation cost is 1,000,000 yuan. The transportation cost per ton per kilometer is 0.01 yuan. Assuming that the cargo load of a shuttle bus task is 100 tons and the estimated mileage is 100 kilometers, the estimated transportation cost is 0.01×100×100=100 yuan. However, this method is too simple and rough, considering fewer variables, the estimation accuracy is not high, and it deviates greatly from the actual transportation costs.
[0007] 3. Use a unified linear regression model to estimate the transportation costs of future shuttle bus tasks using the task type, driving distance, task bus model, whether it is round trip, task origin province, task destination province, and bus ownership of all shuttle bus tasks as input features of the linear retrospective model. However, since all the features except the driving distance are categorical features, the linear correlation between these categorical features and the shuttle bus costs is weak. Experimental summary shows that there is still an accuracy deviation of about 10%. Summary of the invention
[0008] The present invention aims to improve the estimation accuracy of shuttle bus task transportation cost and provides a logistics transportation cost estimation method based on shuttle bus task classification and multi-model combination.
[0009] To achieve this object, the present invention adopts the following technical solutions:
[0010] A method for estimating logistics transportation costs based on shuttle task classification and multi-model combination is provided, and the steps include:
[0011] S1, dividing the first feature data generated by each shuttle bus task of the historical logistics trunk line transportation into a sample set corresponding to each task type according to the task type, wherein the sample set includes a training set and a test set;
[0012] S2, obtaining the third characteristic data of the shuttle bus task for which cost estimation is to be performed, including the task type, task route, task bus model, and whether it is a round trip;
[0013] S3, obtaining each of the first feature data in the sample set having the same task type as the third feature data, and using the first XGBOOST model pre-trained based on the sample set to perform transportation cost estimation on all of the first feature data for the shuttle task to be estimated, and outputting the cost estimation result;
[0014] Then, the first feature data having the same data feature as the third feature data is obtained from the sample set,
[0015] If the acquisition is successful, then for each piece of the first characteristic data acquired, a moving average model is used to estimate the transportation cost of the shuttle bus task to be estimated, and the cost estimation result is output;
[0016] If the acquisition fails, the transportation cost of the shuttle task to be estimated is filled using the single kilometer cost filling method;
[0017] S4, using the cost estimation results output by the sliding average model and the first XGBOOST model for each shuttle task to be estimated and having the same task type, whether the sliding average model adopts single-kilometer filling, a sample set formed by each of the first feature data sets having the same task type, and the actual transportation cost incurred by each shuttle task in the sample set as model training samples to obtain a fusion model for estimating the transportation cost of shuttle tasks of the same task type;
[0018] S5, using the second characteristic data of the future shuttle bus task as the input of the fusion model, and the model outputs the estimated result of the transportation cost of the future shuttle bus task.
[0019] Preferably, the first characteristic data includes the mission number performed by the shuttle bus, the mission start time, the mission type, the model of the shuttle bus performing the mission, the mission route, the distance of the mission route, whether it is round trip, the origin of the shuttle bus, the settlement type, the bargaining type, the ownership of the shuttle bus, and the costs incurred by the shuttle bus in performing the mission.
[0020] Preferably, the method of dividing each of the first characteristic data into data sets comprises the steps of:
[0021] S11, converting or splitting the first characteristic data associated with each shuttle bus task to obtain second characteristic data corresponding to each of the first characteristic data, wherein the second characteristic data includes task type, shuttle bus model to perform the task, task bus capacity, task route distance, whether round trip, task origin province, task destination province, number of nodes passed by the task, whether it is an inter-provincial task, shuttle bus ownership, task month, fee settlement type, bargaining type, shuttle bus origin, and fees incurred by the shuttle bus in performing the task;
[0022] S12, for the categorical features in the second feature data, use one-hot encoding to convert them to obtain corresponding feature data, and then divide the second feature data set composed of each piece of the second feature data into a training data set and a test data set according to the task start time;
[0023] S13, according to the task type, further dividing the training data set into a first training data set with the task type of "planning", a second training data set with the task type of "temporary", and a third training data set with the task type of "replacement", and further dividing the test data set into a first test data set with the task type of "planning", a second test data set with the task type of "temporary", and a third test data set with the task type of "replacement", the first training data set and the first test data set form a first sample set corresponding to the "planning" task type, the second training data set and the second test data set form a second sample set corresponding to the "temporary" task type, and the third training data set and the third test data set form a third sample set corresponding to the "replacement" task type.
[0024] Preferably, in step S3, the method for cost estimation using the sliding average model comprises the steps of:
[0025] A1, obtaining a sample set having the same task type as the third feature data from each of the sample sets divided in step S1, and then performing feature matching on the third feature data and each of the first feature data generated within a specified historical continuous date in the obtained sample set,
[0026] If all matches are successful, the transportation fee incurred by executing the corresponding shuttle mission recorded in the first feature data involved in the matching is obtained, and then the process goes to step A2;
[0027] If any one or more features are not matched successfully, the transportation costs and task route distances corresponding to all shuttle tasks within the specified continuous dates participating in the matching are obtained, and then the process proceeds to step A3;
[0028] A2, estimate the transportation costs of future shuttle missions using the following formula (1):
[0029]
[0030] In formula (1), Y i represents the estimated transportation cost for the shuttle task of task type i;
[0031] y ij It represents the actual transportation cost incurred by the j-th historical shuttle task with task type i that participates in feature matching;
[0032] N i Indicates the number of historical shuttle tasks with task type i that participate in feature matching;
[0033] A3, estimate the transportation costs incurred by future shuttle missions using the following formula (2):
[0034]
[0035] In formula (2), Y i represents the estimated transportation cost for the shuttle task of task type i;
[0036] y j represents the actual transportation cost incurred by the j-th historical shuttle task participating in feature matching;
[0037] m j represents the route mileage of the jth historical shuttle mission;
[0038] N represents the number of historical shuttle tasks involved in feature matching;
[0039] KM represents the route mileage of the shuttle mission for which cost estimation is to be performed.
[0040] Preferably, in step S4, the method for training the fusion model comprises the steps of:
[0041] B1, determine the initial second XGBOOST objective function:
[0042] B2, using the Grid Search method to adjust the parameters of the initial second XGBOOST model;
[0043] B3, using the cost estimation results output by the sliding average model and the first XGBOOST model for each shuttle task to be cost estimated and having the same task type, whether the sliding average model adopts single-kilometer filling, a sample set of the first feature data sets with the same task type, and the actual transportation costs generated by each shuttle task in the sample set as samples to train the second XGBOOST model, and finally obtaining the fusion model that integrates the prediction data features of the sliding average model and the first XGBOOST model.
[0044] Preferably, the objective function of the fusion model is expressed by the following formula (3):
[0045]
[0046] In formula (3), y i represents the target value of sample i;
[0047] Represents the prediction result of the t-1th tree in the second XGBOOST model for sample i;
[0048] f t (x i ) represents the model prediction result of the t-th tree in the second XGBOOST model;
[0049] x i represents the eigenvalue of sample i;
[0050] n represents the number of samples input into the second XGBOOST model;
[0051] γ represents the regularization parameter of the weight value L1 that controls the complexity of the model;
[0052] T represents the number of leaf nodes in the second XGBOOST model;
[0053] λ represents the L2 regularization parameter of the weight value that controls the complexity of the model;
[0054] w j Represents a vector consisting of the scores on the j-th leaf node in the second XGBOOST model;
[0055] constant represents a constant term.
[0056] The present invention has the following beneficial effects:
[0057] 1. The first characteristic data of each historical shuttle bus task is converted or split into second characteristic data including task type, shuttle bus model, task bus capacity, task route distance, whether it is round trip, task departure province, task destination province, number of nodes passed by the task, whether it is an inter-provincial task, shuttle bus ownership, task month, payment type, bargaining type, shuttle bus origin, and the cost incurred by the shuttle bus to perform the task. This increases the number of continuous features and improves the linear correlation between task characteristic data and transportation costs, which is beneficial to improving the cost estimation accuracy of the model.
[0058] 2. The XGBOOST tree model is used to replace the linear regression model for transportation cost estimation, which weakens the impact of the weak linear correlation between task feature data and transportation costs on the accuracy of model cost estimation, and the cost estimation accuracy is higher.
[0059] 3. When training the fusion model, the sliding average model and the first XGBOOST model were added to output the cost estimation results for each shuttle task to be estimated and with the same task type, and whether the sliding average model used single-kilometer filling. The advantages of the three cost estimation methods, namely the sliding average model, the first XGBOOST model and single-kilometer filling, were combined. The trained fusion model has higher transportation cost estimation accuracy. Compared with the existing unified linear regression model, it further reduces the remaining 10% prediction accuracy deviation. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments of the present invention. Obviously, the drawings described below are only some embodiments of the present invention, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0061] Figure 1 It is a logic block diagram for realizing a method for estimating logistics transportation costs based on shuttle task classification and multi-model combination provided by an embodiment of the present invention;
[0062] Figure 2 It is a diagram of implementation steps of a method for estimating logistics transportation costs based on shuttle task classification and multi-model combination provided by an embodiment of the present invention;
[0063] Figure 3 It is a schematic diagram of the XGBOOST model containing two regression trees;
[0064] Figure 4 It is a comparison curve of the estimation accuracy of transportation costs of different task types by the moving average model and the XGBOOST model;
[0065] Figure 5 It is a box plot comparing the absolute value errors of the transportation costs of different task types between the moving average model and the XGBOOST model;
[0066] Figure 6 It is a bar chart comparing the estimation accuracy of the moving average model, XGBOOST model and fusion model for transportation costs of different task types. DETAILED DESCRIPTION
[0067] The technical solution of the present invention is further described below with reference to the accompanying drawings and through specific implementation methods.
[0068] Among them, the drawings are only used for illustrative explanations, and they only represent schematic diagrams rather than actual pictures, and should not be understood as limitations on this patent; in order to better illustrate the embodiments of the present invention, some parts of the drawings may be omitted, enlarged or reduced, and do not represent the size of the actual product; for those skilled in the art, it is understandable that some well-known structures and their descriptions in the drawings may be omitted.
[0069] The same or similar numbers in the drawings of the embodiments of the present invention correspond to the same or similar parts; in the description of the present invention, it should be understood that if the terms "upper", "lower", "left", "right", "inner", "outer", etc. appear, the orientation or position relationship indicated is based on the orientation or position relationship shown in the drawings, which is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation. Therefore, the terms describing the position relationship in the drawings are only used for illustrative purposes and cannot be understood as a limitation on this patent. For ordinary technicians in this field, the specific meanings of the above terms can be understood according to specific circumstances.
[0070] In the description of the present invention, unless otherwise clearly specified and limited, if the term "connection" or the like appears to indicate the connection relationship between components, the term should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, it can be the internal connection of two components or the interaction relationship between two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0071] The logistics transportation cost estimation method based on shuttle task classification and multi-model combination provided by the embodiment of the present invention is as follows: Figure 1 and Figure 2 As shown, including:
[0072] Step S1, dividing the first feature data generated by each shuttle bus task of the historical logistics trunk line transportation into a sample set corresponding to each task type according to the task type, and the sample set includes a training set and a test set;
[0073] For example, the shuttle bus task data settled from 2021-01-01 to 2021-09-30 is obtained from the Best Express database as a training set, recorded as train_data, and the shuttle bus task data settled from 2021-10-01 to 2021-10-10 is obtained as a test data set, recorded as test_data. The data sample is shown in Table a below:
[0074]
[0075]
[0076] Table a
[0077] As can be seen from Table a above, the first characteristic data includes the task number performed by the shuttle bus, the task start time, the task type, the task route, the task route distance, the type of shuttle bus used to perform the task, whether it is round trip, the origin of the shuttle bus, the payment type, the bargaining type, the ownership of the shuttle bus, and the costs incurred by the shuttle bus in performing the task.
[0078] Among the first characteristic data, only the task route distance is a continuous feature, and the linear correlation between other category-type characteristics and the cost is weak. In order to improve the linear correlation between the task characteristic data and the cost, the present application first converts or splits the first characteristic data associated with each shuttle task to obtain the second characteristic data corresponding to each first characteristic data. The second characteristic data is shown in Table b below, including the task type, the type of shuttle bus used to perform the task, the capacity of the task shuttle, the task route distance, whether it is round trip, the province of origin of the task, the province of destination of the task, the number of nodes passed by the task, whether it is an inter-provincial task, the shuttle bus affiliation, the task month, the settlement type, the bargaining type, the origin of the shuttle bus, and the cost incurred by the shuttle bus to perform the task. As can be seen from Table b below, after conversion or splitting, compared with the first feature data, the second feature data adds the continuity feature of "task shuttle volume", which improves the linear correlation between the task feature data and the cost, which is beneficial to improving the cost estimation accuracy of the subsequent model. In addition, "whether it is a cross-provincial task", "task month", "number of nodes passed by the task", "task origin province" and "task destination province" are included as input features of the fusion model with XGBOOST as the initial model. The model input features are richer, which is conducive to further improving the model's estimation accuracy of transportation costs.
[0079]
[0080]
[0081] Table b
[0082] In order to facilitate model training, for the categorical features in the second feature data, this application uses one-hot encoding to convert them to obtain the corresponding feature data, and then divides the data according to the task start time to obtain the training feature data Xtrain and the test feature data Xtest. Similarly, according to the cost column as the target value, the data is divided according to the task start time to obtain the training target data Ytrain and the test target data Ytest. The data sample of Xtrain or Xtest is shown in Table b above, and the data sample of Ytrain or Ytest is shown in Table c below:
[0083]
[0084] Table c
[0085] After obtaining Xtrain, Xtest, Ytrain, and Ytest, it was found through the selection of feature data and analysis that the distribution of task feature data corresponding to different task types is quite different. The cost estimation model trained with mixed task feature data of different task types has different estimation accuracy when predicting the transportation costs of different types of shuttle tasks. Therefore, this application further divides Xtrain, Xtest, Ytrain, and Ytest according to the task type, and obtains the training data set and test data set belonging to the task types of "planning", "temporary", and "replacement" as shown in Table d below, where the training data set includes a training feature data set and a training target data set, and the test data set includes a test feature data set and a test target data set.
[0086]
[0087] Table d The data composition example of Xtrain is shown in Table M below:
[0088]
[0089]
[0090]
[0091] Table M
[0092] After obtaining the sample set corresponding to each task type, such as Figure 2 As shown, the logistics transportation cost estimation method based on shuttle task classification and multi-model combination provided in this embodiment is transferred into:
[0093] Step S2, obtaining third characteristic data of the shuttle bus task for which cost estimation is to be performed, including task type, task route, task bus model, and whether it is round trip;
[0094] Step S3, obtaining each first feature data having the same data feature in the sample set having the same task type as the third feature data, and then using the sliding average model and the pre-trained first XGBOOST model to estimate the transportation cost of the shuttle task to be estimated for each first feature data, and outputting the cost estimation results respectively;
[0095] For example, if the task type recorded in the third characteristic data is "planning", then a sample set of first characteristic data with the task type of "planning" is obtained, and then each first characteristic data in the sample set with the same data feature as the third characteristic data is further obtained. The same here means that the features of all data are the same. For example, if the task route recorded in the third characteristic data is "Hangzhou-Shanghai", the shuttle bus model for performing the task is "model number 1111", and whether it is round trip is "yes", then the task route recorded in each first characteristic data obtained from the sample set with the same task type of "planning" must also be "Hangzhou-Shanghai", the shuttle bus model for performing the task must also be "model number 1111", and whether it is round trip must also be "yes".
[0096] After obtaining the first feature data with the same data features, the sliding average model and the pre-trained first XGBOOST model are used to estimate the transportation cost of the shuttle task for which the cost estimation is to be performed.
[0097] Sliding average is a sliding window average, which is a calculation method that directly takes the average of the shuttle task costs with the same characteristics within a certain period of history as the estimated value. In this application, it is preferred to select the data in the acquired sample set with the task start time 30 days before the required prediction day, select the task type, task shuttle bus model, whether it is round trip, and the average transportation cost of the shuttle tasks corresponding to the same first characteristic data of task route, and then assign the average cost to the shuttle tasks with the same data characteristics on the prediction day as the predicted transportation cost. Taking the estimated cost of 2021-10-01 as an example, the specific implementation steps are as follows:
[0098] The actual transportation costs recorded in all the first characteristic data with the same data characteristics as the shuttle bus tasks to be estimated and whose task start time is greater than or equal to 2021-09-01 and less than or equal to 2021-09-30 in the sample set are taken, and then the average is taken by the following formula (1):
[0099]
[0100] In formula (1), Y i represents the estimated transportation cost for the shuttle task of task type i;
[0101] y ij represents the actual transportation cost incurred by the j-th historical shuttle task with task type i obtained from the sample set;
[0102] N i represents the number of historical shuttle tasks with task type i obtained from the sample set (preferably 30 days);
[0103] Compared with the existing method of directly using the historical average cost according to the specific number, the above sliding window average cost estimation method has a wider matching surface and a lower probability of not matching, but it still happens. Therefore, when the first feature data with the same data feature is not matched, this application uses the task route distance × the average per-kilometer cost within 30 days (ave_pre_km) to estimate the cost. Ave_pre_km is calculated by the following formula (2):
[0104]
[0105] The cost estimate is calculated using the following formula (3):
[0106]
[0107] In formula (3), Y i represents the estimated transportation cost for the shuttle task of task type i;
[0108] y j Indicates participation in Y i Calculate the actual transportation cost incurred by the j-th historical shuttle task;
[0109] m j represents the route mileage of the jth historical shuttle mission;
[0110] N means participation in Y i The number of historical shuttle missions calculated;
[0111] KM represents the route mileage of the shuttle mission for which cost estimation is to be performed.
[0112] The accuracy of cost estimation for shuttle bus tasks of different task types using the sliding average model is shown in Table e below:
[0113]
[0114]
[0115] Table E
[0116] The accuracy calculation method is expressed by the following formula (4):
[0117]
[0118] In formula (4), Y i It represents the estimated cost of the shuttle task with task type i by the moving average model;
[0119] y i It represents the actual transportation cost incurred by the shuttle task of task type i;
[0120] n represents the number of shuttle tasks of task type i participating in the accuracy calculation.
[0121] XGBOOST is the abbreviation of "Exterme Gradient Boosting", which is a type of Boosting algorithm. It integrates many tree models together and is a boosting tree model used to solve supervised learning problems, that is, using the feature data in the above data to predict the predicted value in the above data. It has performed well in some prediction projects in recent years. Therefore, this application selects this model to estimate the cost.
[0122] After deciding to use the model, first determine the objective function used to train the XGBOOST model. The objective function of Xgboost consists of the training error, i.e., the loss function, and the regularization term. The general expression is as follows:
[0123]
[0124] The first term is the loss function, y i is the target value of sample i, is the prediction result of the t-th tree for sample i, is the prediction result of the t-1th tree for sample i, f t (x i ) is the model prediction result of the tth tree, and l is the loss function to be selected. The second term is the regularization term, including L1 regularization and L2 regularization. The regularization term is mainly used to measure the complexity of the model, and this application uses the following formula to express it:
[0125]
[0126] In the above formula, w j It represents the vector composed of the scores on the jth leaf node in the XGBOOST model, T represents the number of leaf nodes in the XGBOOST model, λ represents the L2 regularization parameter of the weight value that controls the complexity of the model, which will be adjusted later to determine its final value, and γ represents the L1 regularization parameter of the weight value that controls the complexity of the model, which will be adjusted later to determine its final value. The third term constant is a constant term.
[0127] w j Calculated by the following formula:
[0128]
[0129] represents the first-order gradient of the i-th sample falling on the j-th leaf node,
[0130] represents the second-order gradient of the i-th sample falling on the j-th leaf node,
[0131] I j Represents the sample set that falls on the jth leaf node;
[0132] λ represents the L2 regularization parameter of the weight value that controls the complexity of the model.
[0133] After testing the commonly used loss functions and making preliminary comparisons, this application chooses to use MSE as the loss function for XGBOOST model training. At this time, its objective function expression can be written as:
[0134]
[0135] After determining the model and objective function, this application uses Grid Search to adjust the model parameters. First, initialize some parameters as shown in the following table f:
[0136] parameter value max_depth 5 min_child_weight 1 gamma 0 subsample 0.8 colsample_bytree 0.8 learning_rate 0.1 n_estimators 500 reg_alpha 0 reg_lambda 1
[0137] Table f
[0138] Then filter different parameters one by one. First, filter n_estimators and set the values of n_estimators to 400, 500, 600, 700, 800, 900, 1000, and 1100 respectively. The remaining parameters are initial parameters. Use the GridSearchCV function in the pythonsklearn machine learning library and filter with "neg_mean_squared_error" as the accuracy evaluation method (neg_mean_squared_error is the value of the parameter scoring of the GridSearchCV function). Finally, determine its selected value as 1000. After determining the value of n_estimators, set the parameter value to 1000, and then filter min_child_weight and max_depth. The subsequent parameter screening steps are the same and will not be repeated here. The specific parameter screening order and the candidate values during screening are shown in Table g below.
[0139]
[0140]
[0141] Table g
[0142] After the previous parameter value is screened and determined, the initial value is replaced and no longer changed, and only the following parameters are screened. Finally, the model parameters determined by this application are as follows Table h (parameters that have not been screened by grids are determined by manual experience):
[0143]
[0144] Table h
[0145] Then, the XGBOOST model is trained using the model parameters and objective function determined above with the training data sets GXtrain, GYtrain, LXtrain, LYtrain, DXtrain, and DYtrain (data from 2021-09-01 to 2021-09-31) recorded in Table d. The specific training process is briefly described as follows:
[0146] First, according to the input feature data, the model continuously splits it. When splitting, a greedy algorithm that enumerates all different tree structures is used, and the current optimal structure tree is found by minimizing the loss function to add to the model. Each time a tree is split, an independent regression tree model is generated. Figure 3 An xgboost model with two regression trees is shown. For example, if the value of the model parameter n_estimators is 1000, 1000 tree models need to be generated.
[0147] Each generated tree model will train a new function separately, corresponding to f in the objective function above t (x i ), and the target value of each new tree model training is the residual between the prediction result of the previous tree model and the true value.
[0148] The value corresponding to the leaf node in each tree is the predicted value of the tree for the sample falling into the leaf node.
[0149] Finally, the test feature data sets GYtest, LYtest, and DYtest are used to make predictions in the prediction period from 2021-10-01 to 2021-10-10. That is, according to the features in the test feature data set, the corresponding leaf nodes are found in each tree, and the scores of each leaf node are added. The added value is the predicted value of the sample. The accuracy of estimating shuttle bus fares using the XGBOOST model is shown in Table i below:
[0150] date Planning task type accuracy Temporary task type accuracy Replacement task type accuracy 2021 / 10 / 1 95.26% 94.14% 89.09% 2021 / 10 / 2 94.85% 94.12% 92.79% 2021 / 10 / 3 94.89% 94.72% 95.32% 2021 / 10 / 4 94.73% 95.09% 93.18% 2021 / 10 / 5 94.48% 94.98% 94.52% 2021 / 10 / 6 95.22% 95.43% 92.14% 2021 / 10 / 7 95.16% 94.58% 93.73% 2021 / 10 / 8 95.20% 94.05% 93.15% 2021 / 10 / 9 94.97% 95.11% 91.64% 2021 / 10 / 10 94.95% 93.71% 93.04%
[0151] Table i
[0152] Figure 4 A comparative curve chart showing the accuracy of transportation cost estimation for different task types using the moving average model and the XGBOOST model. Figure 5 The figure shows the comparison curve of the absolute value error of the moving average model and the XGBOOST model for the transportation costs of different task types. Figure 4 and Figure 5 It can be seen that the moving average model and the XGBOOST model have their own advantages and disadvantages in the accuracy of cost estimation for shuttle tasks of different task types. Figure 5 The absolute error box plot (absolute error is the absolute value of the difference between the estimated and actual costs) of the cost estimation results of the moving average model and the XGBOOST model for shuttle tasks with different shuttle task types between 2021.10.1 and 2021.10.10 shows that different models perform differently for different estimation individuals. For example, for planning task types, the average absolute error using the moving average model is smaller than the average absolute error using XGBOOST, but the absolute errors of several points are greater than the absolute errors of all points using XGBOOST. Therefore, this application considers fusing these two models to further improve the accuracy of cost estimation by fusing the model.
[0153] This application uses the blending method to fuse the models. The specific steps are as follows:
[0154] First, the features used in the fusion model are determined, which are the predicted value of the sliding average model, the predicted value of the XGBOOST model, whether the sliding average model uses single-kilometer filling (if single-kilometer filling is used, the feature is assigned a value of "1", otherwise it is assigned a value of "0"), the sample set of each first feature data set with the same task type, and the actual transportation cost generated by each shuttle task in the sample set. The sample feature data used in the fusion model is shown in the following table j:
[0155]
[0156] Table J
[0157] Then, the determined features are used as training samples, and the fusion model is obtained by the same method of training a separate XGBOOST model. The transportation cost of future shuttle missions is predicted through the fusion model.
[0158] That is Figure 2 In step S4 shown, the cost estimation results outputted by the sliding average model and the first XGBOOST model for each shuttle task to be estimated and having the same task type, whether the sliding average model adopts single-kilometer filling, a sample set formed by each first feature data set having the same task type, and the actual transportation cost generated by each shuttle task in the sample set are used as model training samples to obtain a fusion model for estimating the transportation cost of shuttle tasks of the same task type;
[0159] After training the fusion model, transfer it to:
[0160] Step S5, using the second characteristic data (excluding the cost) of the future shuttle bus mission as the input of the fusion model, the model outputs the estimated result of the transportation cost of the future shuttle bus mission.
[0161] This application uses the fusion model to predict the cost of the shuttle bus task data from 2021-10-01 to 2021-10-10, and the average accuracy of the entire network is shown in the following table k:
[0162]
[0163]
[0164] Table k
[0165] Compare Table K, Table I, Table E and Figure 6 It can be seen that the fusion model has significantly improved the accuracy of transportation cost estimation for shuttle tasks of different task types, proving the effectiveness of the fusion model in improving the accuracy of cost estimation.
[0166] It should be noted that the above specific implementations are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art should understand that various modifications, equivalent substitutions, changes, etc. can be made to the present invention. However, as long as these changes do not deviate from the spirit of the present invention, they should be within the scope of protection of the present invention. In addition, some terms used in the specification and claims of this application are not restrictive, but are only for the convenience of description.
Claims
1. A method for estimating logistics transportation costs based on shuttle task classification and multi-model combination, characterized in that the steps include: S1, dividing the first feature data generated by each shuttle bus task of the historical logistics trunk line transportation into a sample set corresponding to each task type according to the task type, wherein the sample set includes a training set and a test set; S2, obtaining third characteristic data of the shuttle bus task for which cost estimation is to be performed, including task type, task route, task bus model, and whether it is round trip; S3, obtaining each of the first feature data in the sample set having the same task type as the third feature data, and using the first XGBOOST model pre-trained based on the sample set to perform transportation cost estimation on all of the first feature data for the shuttle task to be estimated, and outputting the cost estimation result; Then, the first feature data having the same data feature as the third feature data is obtained from the sample set, If the acquisition is successful, then for each piece of the first characteristic data acquired, a moving average model is used to estimate the transportation cost of the shuttle bus task to be estimated, and the cost estimation result is output; If the acquisition fails, the transportation cost of the shuttle task to be estimated is filled using the single kilometer cost filling method; S4, using the cost estimation results output by the sliding average model and the first XGBOOST model for each shuttle task to be estimated and having the same task type, whether the sliding average model adopts single-kilometer filling, a sample set formed by each of the first feature data sets having the same task type, and the actual transportation cost incurred by each shuttle task in the sample set as model training samples to obtain a fusion model for estimating the transportation cost of shuttle tasks of the same task type; S5, using the second characteristic data of the future shuttle bus task as the input of the fusion model, and the model outputs the estimated result of the transportation cost of the future shuttle bus task; The first characteristic data includes the task number, task start time, task type, bus model, task route, task route distance, whether round trip, bus origin, payment type, bargaining type, bus ownership, and fees incurred by the bus in performing the task; The method of dividing each of the first characteristic data into data sets comprises the steps of: S11, converting or splitting the first characteristic data associated with each shuttle bus task to obtain second characteristic data corresponding to each of the first characteristic data, wherein the second characteristic data includes task type, shuttle bus model to perform the task, task bus capacity, task route distance, whether round trip, task origin province, task destination province, number of nodes passed by the task, whether it is an inter-provincial task, shuttle bus ownership, task month, fee settlement type, bargaining type, shuttle bus origin, and fees incurred by the shuttle bus in performing the task; S12, for the categorical features in the second feature data, use one-hot encoding to convert them to obtain corresponding feature data, and then divide the second feature data set composed of each piece of the second feature data into a training data set and a test data set according to the task start time; S13, according to the task type, further dividing the training data set into a first training data set with the task type of "planning", a second training data set with the task type of "temporary", and a third training data set with the task type of "replacement", and further dividing the test data set into a first test data set with the task type of "planning", a second test data set with the task type of "temporary", and a third test data set with the task type of "replacement", the first training data set and the first test data set forming a first sample set corresponding to the "planning" task type, the second training data set and the second test data set forming a second sample set corresponding to the "temporary" task type, and the third training data set and the third test data set forming a third sample set corresponding to the "replacement" task type; In step S3, the method for estimating costs using the sliding average model includes the following steps: A1, obtaining a sample set having the same task type as the third feature data from each of the sample sets divided in step S1, and then performing feature matching on the third feature data and each of the first feature data generated within a specified historical continuous date in the obtained sample set, If all matches are successful, the transportation fee incurred by executing the corresponding shuttle mission recorded in the first feature data involved in the matching is obtained, and then the process goes to step A2; If any one or more features are not matched successfully, the transportation costs and task route distances corresponding to all shuttle tasks within the specified continuous dates participating in the matching are obtained, and then the process proceeds to step A3; A2, estimate the transportation costs of future shuttle missions using the following formula (1): In formula (1), Y i represents the estimated transportation cost for the shuttle task of task type i; y ij It represents the actual transportation cost incurred by the j-th historical shuttle task with task type i that participates in feature matching; N i Indicates the number of historical shuttle tasks with task type i that participate in feature matching; A3, estimate the transportation costs incurred by future shuttle missions using the following formula (2): In formula (2), Y i represents the estimated transportation cost for the shuttle task of task type i; y j represents the actual transportation cost incurred by the j-th historical shuttle task participating in feature matching; m j represents the route mileage of the jth historical shuttle mission; N represents the number of historical shuttle tasks involved in feature matching; KM represents the route mileage of the shuttle bus mission for which cost estimation is to be performed; In step S4, the method for training the fusion model comprises the steps of: B1, determine the objective function of the initial second XGBOOST model: B2, using the Grid Search method to adjust the parameters of the initial second XGBOOST model; B3, using the cost estimation results output by the sliding average model and the first XGBOOST model for each shuttle bus task to be estimated and having the same task type, whether the sliding average model adopts single-kilometer filling, a sample set of each first feature data set having the same task type, and the actual transportation cost generated by each shuttle bus task in the sample set as samples to train the second XGBOOST model, and finally obtaining the fusion model that integrates the prediction data features of the sliding average model and the first XGBOOST model; The objective function of the fusion model is expressed by the following formula (3): In formula (3), y i represents the target value of sample i; Y i (t-1) represents the prediction result of the t-1th tree in the second XGBOOST model for sample i; f t (x i ) represents the model prediction result of the t-th tree in the second XGBOOST model; x i represents the eigenvalue of sample i; n represents the number of samples input into the second XGBOOST model; γ represents the regularization parameter of the weight value L1 that controls the complexity of the model; T represents the number of leaf nodes in the second XGBOOST model; λ represents the L2 regularization parameter of the weight value that controls the complexity of the model; w j Represents a vector consisting of the scores on the j-th leaf node in the second XGBOOST model; constant represents a constant term.
Citation Information
Patent Citations
Logistics system and method for intra-city and urban-rural material transportation
CN107590636A
Transnational logistics expense trial method and system based on inference engine
CN111369288A