Economic freight calculation method based on large-scale airline data and random forest algorithm
By constructing a multi-level feature architecture and a random forest algorithm, the complexity of freight calculation for non-standard shipping routes in traditional shipping operations has been solved, achieving accuracy and interpretability in freight forecasting and enhancing the company's market responsiveness and competitiveness.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HUADIAN GROUP BEIJING FUEL LOGISTICS CO LTD
- Filing Date
- 2025-12-30
- Publication Date
- 2026-05-01
AI Technical Summary
In traditional shipping operations, freight calculations for non-standard routes suffer from problems such as overly strong linear assumptions, inability to quantify complex relationships, and difficulty in dynamically incorporating market factors. This results in complex calculations that rely on human experience and lack accuracy and consistency.
An economical freight calculation method based on large-scale route data and random forest algorithm is adopted. By acquiring historical freight rate data, a multi-level feature architecture is constructed, data cleaning and feature encoding are performed, a freight rate prediction model is constructed using random forest algorithm, and the model is continuously updated and trained through hyperparameter optimization and performance monitoring.
It improves the accuracy and reliability of freight forecasting, can capture complex nonlinear relationships and interaction effects, provides interpretable decision support, reduces maintenance costs and enhances enterprise competitiveness.
Smart Images

Figure CN121961672A_ABST
Abstract
Description
An Economical Freight Calculation Method Based on Large-Scale Route Data and Random Forest Algorithm Technical Field
[0001] This invention relates to the field of air route freight calculation technology, and more specifically, to an economical freight calculation method based on large-scale air route data and a random forest algorithm. Background Technology
[0002] In traditional shipping operations, if a route falls within an index range (such as routes designated by CBCFI), pricing and settlement are very simple and straightforward. However, when routes are "non-standard," the situation becomes more complex: First, there is a lack of direct market signals and a lack of publicly available, authoritative indices as a benchmark for negotiation, which can easily lead to disputes. Second, the influencing factors are complex and non-linear; for example, distance is not the only factor, and there are interaction effects between factors. Third, it relies heavily on human experience, traditionally depending on the experience of sales staff for estimations.
[0003] The most common approximation method in the industry is the combined route method. Many "non-standard" routes can be broken down into a combination of two or more "standard" routes. The following formula is used for calculation: target route freight rate ≈ route A freight rate ± route B freight rate.
[0004] The core method is to break down the route: the target route is decomposed into route segments contained in CBCFI. Different solutions exist depending on the specific business scenario.
[0005] Scenario 1: Different intermediate ports of call. For example, CBCFI offers routes "Qinhuangdao-Guangzhou" and "Qinhuangdao-Ningbo". This particular route is "Qinhuangdao-Ningbo-Guangzhou". The freight rate can be estimated as: "Qinhuangdao-Ningbo" freight rate + "Ningbo-Guangzhou" range freight rate. The "Ningbo-Guangzhou" freight rate may need to be estimated using other methods (such as the distance-based method, or by referring to price differences on other routes in the south).
[0006] Scenario 2: Different endpoint ports but overlapping routes. For example, the current business route is "Caofeidian-Shanghai," while CBCFI offers "Qinhuangdao-Shanghai." Since Caofeidian and Qinhuangdao both belong to the Tangshan port cluster and are very close, the freight rate for "Caofeidian-Shanghai" can be considered approximately equal to that for "Qinhuangdao-Shanghai." Minor adjustments will be made if port conditions differ (e.g., water depth, loading / unloading efficiency).
[0007] Scenario 3: Identifying Key Hubs. The current route is "Huanghua-Xiamen," which is not listed on CBCFI. However, CBCFI lists both "Huanghua-Ningbo" and "Qinhuangdao-Xiamen." By comparing the "Huanghua-Ningbo" and "Qinhuangdao-Xiamen" routes and considering the price difference between "Qinhuangdao-Ningbo," a reasonable freight rate for "Huanghua-Xiamen" can be indirectly estimated.
[0008] The combined route method is a good business logic tool, but it has inherent flaws from a technical perspective:
[0009] 1) The linear assumption is too strong, assuming that freight rates are strictly linearly related to distance, which is inconsistent with reality.
[0010] 2) It is impossible to quantify complex relationships. The combined route method relies on the business logic breakdown by experts, but it cannot accurately quantify the fixed price difference between "Caofeidian Port" and "Qinhuangdao Port", or whether this price difference will change with market sentiment.
[0011] 3) This method is difficult to dynamically incorporate and weight real-time changing market factors, such as instantaneous fluctuations in fuel prices or sudden congestion at a port.
[0012] No effective solutions have yet been proposed to address the problems in the relevant technologies. Summary of the Invention
[0013] To address the problems in related technologies, this invention proposes an economical freight calculation method based on large-scale route data and a random forest algorithm, in order to overcome the aforementioned technical problems existing in the existing related technologies.
[0014] Therefore, the specific technical solution adopted by the present invention is as follows:
[0015] In a first aspect, this invention provides an economical freight calculation method based on large-scale flight route data and a random forest algorithm, including:
[0016] Obtain historical fare data for the target route and construct a multi-layered feature architecture based on the historical fare data;
[0017] Based on a multi-level feature architecture, historical freight rate data is cleaned and feature-encoded to obtain processed historical freight rate data.
[0018] The processed historical freight rate data is partitioned using a dataset partitioning strategy to construct and train a freight rate prediction model;
[0019] The performance of the trained freight rate prediction model is measured by a performance evaluation index mechanism. If the performance of the trained freight rate prediction model is not up to standard, the hyperparameters of the trained freight rate prediction model are tuned again through a hyperparameter optimization mechanism to obtain a qualified freight rate prediction model, so as to realize the calculation of freight rates for the target route.
[0020] The qualified freight rate forecasting model is encapsulated as a standardized API service to establish a production-grade service framework; the performance of the qualified freight rate forecasting model is monitored in real time through a performance monitoring mechanism, and a continuous learning mechanism is triggered periodically based on time cycles to continuously update and retrain the qualified freight rate forecasting model.
[0021] Furthermore, the step of acquiring historical fare data for the target route and constructing a multi-level feature architecture based on the historical fare data includes:
[0022] Obtain route characteristic data, market environment data, and operating environment data of the target route in actual operation, and integrate the route characteristic data, market environment data, and operating environment data to obtain historical freight rate data;
[0023] Based on route feature data, market environment data, and operational environment data, a multi-level feature architecture is constructed, which includes: a basic feature layer, a derived feature layer, and time feature engineering.
[0024] Furthermore, based on route characteristic data, market environment data, and operational environment data, a multi-layered feature architecture is constructed. This multi-layered feature architecture includes: a basic feature layer, a derived feature layer, and time-based feature engineering.
[0025] Obtain numerical and categorical features from the route feature data and construct a basic feature layer;
[0026] Based on market environment data, a derivative feature layer is constructed through a deep integration of business knowledge and data transformation;
[0027] Time-cycle coding technology is used to periodically encode and trend-process time-series information in operational environment data to construct time feature engineering.
[0028] Furthermore, the historical fare data is cleaned and feature-encoded based on a multi-level feature architecture to obtain the processed historical fare data, which includes:
[0029] A differentiated processing strategy is used to perform data imputation and data missing processing on numerical features and categorical features in the basic feature layer, respectively;
[0030] Outlier detection is performed on the processed numerical and categorical features using statistical methods to identify outliers that deviate significantly from the preset route range, generating abnormal data. Based on professional knowledge in the shipping industry, the abnormal data is then validated a second time to distinguish between outlier data errors and market fluctuations, generating outlier values.
[0031] Outliers are handled through numerical adjustment or labeling mechanisms to ensure the accuracy and usability of the data;
[0032] The Z-score normalization algorithm is used to transform the processed numerical features to the same scale to ensure fair weight distribution.
[0033] By using one-hot encoding, the processed categorical features are converted into binary vectors, thus converting ship type classification into dummy variables, and transforming the dummy variables to the same scale;
[0034] By fusing numerical and categorical features at the same scale, the processed historical freight rate data is obtained.
[0035] Furthermore, the step of using a dataset partitioning strategy to partition the processed historical fare data and constructing and training a fare prediction model includes:
[0036] Using a dataset partitioning strategy, the processed historical freight rate data is partitioned sequentially along the time axis to obtain a training set, a validation set, and a test set.
[0037] Using the random forest algorithm as a framework, multiple decision trees are constructed by analyzing historical flight route records in the training set, and various factors affecting freight rates and their interrelationships are gradually identified in the training set to obtain a freight rate prediction model.
[0038] The prediction performance of the fare prediction model under different parameter configurations is evaluated using a validation set, and the prediction performance of the fare prediction model is optimized by a hyperparameter optimization mechanism. The prediction performance of the fare prediction model under different parameter configurations is objectively compared to avoid overfitting of the fare prediction model to the training set.
[0039] By using a test set to simulate a real deployment environment, the predictive performance of the freight rate forecasting model is estimated unbiasedly, and evaluation results are generated. This objectively assesses the actual predictive ability of the freight rate forecasting model on unknown future data, resulting in a well-trained freight rate forecasting model that provides a reliable basis for business decisions.
[0040] Furthermore, the performance evaluation index mechanism is used to measure the performance of the trained fare prediction model. If the performance of the trained fare prediction model is substandard, the hyperparameters of the trained fare prediction model are tuned again through a hyperparameter optimization mechanism to obtain a compliant fare prediction model, thereby enabling the calculation of freight rates for the target route. This includes:
[0041] The performance of a well-trained freight rate prediction model is comprehensively and objectively measured based on absolute error and relative performance metrics.
[0042] If the trained freight rate prediction model meets the performance requirements, then a qualified freight rate prediction model is obtained.
[0043] If the performance of the trained fare prediction model is not up to standard, a random search strategy is used to find the optimal parameter configuration of the trained fare prediction model and optimize the root mean square error in the trained fare prediction model to obtain a compliant fare prediction model.
[0044] Based on a multi-level interpretability analysis mechanism, the qualified freight rate forecasting model is transformed into a decision support tool, and the rationality of the qualified freight rate forecasting model is verified through interpretability analysis.
[0045] Furthermore, the comprehensive and objective evaluation of the performance of the trained freight rate prediction model based on absolute error and relative performance metrics includes:
[0046] The mean absolute error is obtained by calculating the average of the absolute values of the deviations between the evaluation results and the actual values output by the trained freight rate prediction model. The square root of the square of the deviation between the evaluation results and the actual values is then calculated, and the evaluation results that exceed the preset error are weighted and penalized to obtain the root mean square error. The mean absolute error and the root mean square error are combined to generate the absolute error index.
[0047] By analyzing the coefficient of determination, the proportion of the target variable variance explained by the trained freight rate forecasting model is measured, and the absolute error is transformed into a proportional relationship relative to the true value through the average relative error percentage, thus generating a relative performance index.
[0048] Furthermore, if the performance of the trained fare prediction model is substandard, a random search strategy is used to find the optimal parameter configuration of the trained fare prediction model, and the root mean square error in the trained fare prediction model is optimized to obtain a satisfactory fare prediction model, including:
[0049] By employing a random search strategy, we can find multiple combinations of parameters randomly sampled from a predefined parameter space for a well-trained freight rate prediction model. By leveraging the computational efficiency of the random search strategy, we can explore a wider range of configuration possibilities for the freight rate prediction model.
[0050] Based on the mathematical properties of root mean square error and its sensitivity to prediction bias, evaluation results that exceed the preset error are weighted and penalized to ensure that the trained freight rate prediction model avoids serious misestimation in actual business applications.
[0051] Using a time-series cross-validation algorithm, the training window and validation window are strictly divided according to the time sequence to prevent future information from being leaked into past time periods;
[0052] The test was conducted iteratively through multiple rounds of parameter combination testing. In each round of testing, a set of randomly sampled parameters was trained and validated through a training window and a validation window, respectively, and the performance of the trained freight rate prediction model was recorded.
[0053] Based on the performance of the trained freight rate prediction model, we gradually approach the optimal parameter configuration of the trained freight rate prediction model. By observing the relationship between parameters and performance of the trained freight rate prediction model in multiple rounds of testing, we understand the influence of different hyperparameters on the performance of the trained freight rate prediction model and obtain a qualified freight rate prediction model.
[0054] Furthermore, the process of transforming the qualified freight rate forecasting model into a decision support tool based on a multi-level interpretability analysis mechanism, and verifying the rationality of the qualified freight rate forecasting model through interpretability analysis, includes:
[0055] The feature importance analysis mechanism is used to calculate the frequency and purity improvement of each feature in the qualified freight rate prediction model in several decision trees, quantify the overall contribution of each feature to the prediction results, and generate a feature importance ranking chart to identify the key driving factors affecting coastal coal freight rates.
[0056] The SHAP value mechanism based on game theory quantifies the specific direction and magnitude of the influence of each feature on a prediction result, providing a fine-grained interpretation of individual prediction results.
[0057] By integrating feature importance ranking charts and fine-grained interpretations of forecast results, we can identify factors influencing freight rate fluctuations, analyze the market's sensitivity to various influencing factors, detect anomalies that deviate from conventional patterns, and verify the rationality of the compliant freight rate forecasting model and common business sense.
[0058] Furthermore, the process of encapsulating the qualified freight rate prediction model into a standardized API service and establishing a production-grade service framework; monitoring the performance of the qualified freight rate prediction model in real time through a performance monitoring mechanism, and periodically triggering a continuous learning mechanism based on a time cycle to continuously update and retrain the qualified freight rate prediction model includes:
[0059] The qualified freight rate forecasting model is packaged and encapsulated into a standardized API service through a unified data processing flow and forecasting logic. The data type, value range and processing logic of each feature are clearly defined through a standard feature input format. A structured forecasting result return format is established to provide full convenience for the integration and use of downstream businesses.
[0060] The performance monitoring mechanism tracks the mean absolute error and root mean square error, the stability of the prediction results, and the quality of the input data in real time to obtain diagnostic criteria, so as to achieve continuous evaluation of the performance of the qualified freight rate prediction model.
[0061] The compliant freight rate forecasting model is retrained periodically based on time cycles to ensure that it can learn the latest market patterns; a progressive update mechanism based on incremental learning ensures that the compliant freight rate forecasting model can quickly adapt to minor market changes; and a performance-triggered update mechanism automatically starts the retraining process when the performance monitoring mechanism detects that the performance degradation of the compliant freight rate forecasting model exceeds a preset threshold.
[0062] The beneficial effects of this invention are as follows:
[0063] 1) This invention employs a time-series-aware modeling process and business-oriented composite feature engineering, ensuring that the freight rate forecasting model learns market patterns that strictly follow time-based causal relationships, and that the input consists of high-value features carrying rich business semantics. This enables the freight rate forecasting model to capture complex nonlinear relationships and interaction effects that are difficult for humans to perceive, directly translating into a substantial improvement in forecast accuracy. Whether it's the trend changes in the regular market or the short-term fluctuations caused by unexpected events, the freight rate forecasting model can provide more accurate and reliable freight rate estimates than traditional empirical methods or simple linear freight rate forecasting models.
[0064] 2) The multi-level interpretability analysis integrated in this invention, particularly feature importance ranking and SHAP value analysis, transforms the complex freight rate forecasting model from a "black box" into a "glass box." This feature brings two key advantages: First, it greatly enhances the business team's confidence in the output of the freight rate forecasting model, as each forecast can be clearly interpreted and understood; second, it enables quantitative insights into freight rate drivers, accurately answering the core business question of "which factor and to what extent it affects current freight rates." This allows decision-makers to not only know the forecast results but also the basis for their decisions, thus enabling them to make more forward-looking strategic arrangements.
[0065] 3) This invention ensures that the freight rate forecasting model is not a one-off project, but an intelligent agent with self-evolution capabilities. Through continuous performance monitoring, early warning mechanisms, and multiple update strategies, the freight rate forecasting model can automatically adapt to changes in market structure and learn new pricing models, thereby effectively avoiding performance degradation over time. This allows the technology investment to generate long-term, stable returns, reduces maintenance costs, and significantly improves the return on investment.
[0066] 4) This invention integrates these technological advantages at the business level, deriving its ultimate value in operational efficiency and corporate competitiveness. This invention transforms the pricing process, which previously relied on the personal experience of senior experts and was time-consuming and prone to controversy, into a standardized, automated, and highly transparent scientific decision-making process. This not only significantly improves pricing efficiency and shortens the decision-making cycle, but also, through precise, consistent, and explainable pricing capabilities, enables companies to gain an informational advantage in complex market negotiations, respond more quickly to market changes, and manage operational risks more accurately, thereby building sustainable core competitiveness in fierce market competition.
[0067] 5) The Random Forest algorithm in machine learning used in this invention is highly suitable for this background. The core idea of machine learning is: instead of directly writing business logic rules, let the algorithm discover and summarize rules from historical data. Instead of telling the computer "the freight rate will increase by this much when the distance increases by this much", give it a large amount of historical data, including distance, freight rate, port, oil price, etc., and let it find the relationship between these variables and freight rate. Attached Figure Description
[0068] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0069] Figure 1 is one of the flowcharts of an economical freight calculation method based on large-scale route data and random forest algorithm according to an embodiment of the present invention;
[0070] Figure 2 is a second flowchart of the economical freight calculation method based on large-scale route data and random forest algorithm according to an embodiment of the present invention.
[0071] Figure 3 is a flowchart of step S3 in the economical freight calculation method based on large-scale route data and random forest algorithm according to an embodiment of the present invention.
[0072] Figure 4 is a flowchart of step S4 in the economical freight calculation method based on large-scale route data and random forest algorithm according to an embodiment of the present invention.
[0073] Figure 5 is a flowchart of step S5 in the economical freight calculation method based on large-scale route data and random forest algorithm according to an embodiment of the present invention. Detailed Implementation
[0074] To further illustrate the various embodiments, the present invention provides accompanying drawings, which are part of the disclosure of the present invention. These drawings are mainly used to illustrate the embodiments and can be used in conjunction with the relevant descriptions in the specification to explain the operating principles of the embodiments. With reference to these drawings, those skilled in the art should be able to understand other possible implementation methods and the advantages of the present invention.
[0075] According to an embodiment of the present invention, an economical freight calculation method based on large-scale route data and random forest algorithm is provided.
[0076] The present invention will now be further described with reference to the accompanying drawings and specific embodiments. As shown in Figures 1 and 2, the economical freight calculation method based on large-scale route data and random forest algorithm according to an embodiment of the present invention includes:
[0077] Step S1: Obtain historical fare data for the target route and construct a multi-level feature architecture based on the historical fare data;
[0078] Step S2: Based on the multi-level feature architecture, perform data cleaning and feature encoding on the historical freight rate data to obtain the processed historical freight rate data;
[0079] Step S3: Use a dataset partitioning strategy to partition the processed historical freight rate data, and build and train a freight rate prediction model;
[0080] Step S4: Use the performance evaluation index mechanism to measure the performance of the trained freight rate prediction model. If the performance of the trained freight rate prediction model is not up to standard, the hyperparameter optimization mechanism is used to re-adjust the hyperparameters of the trained freight rate prediction model to obtain a qualified freight rate prediction model so as to realize the calculation of freight for the target route.
[0081] Step S5: Encapsulate the qualified freight rate prediction model into a standardized API service and establish a production-grade service framework; monitor the performance of the qualified freight rate prediction model in real time through a performance monitoring mechanism, and trigger a continuous learning mechanism periodically based on a time cycle to continuously update and retrain the qualified freight rate prediction model.
[0082] In this optional embodiment, obtaining historical fare data for the target route and constructing a multi-layered feature architecture based on the historical fare data includes:
[0083] Obtain route characteristic data, market environment data, and operating environment data of the target route in actual operation, and integrate the route characteristic data, market environment data, and operating environment data to obtain historical freight rate data;
[0084] Based on route feature data, market environment data, and operational environment data, a multi-level feature architecture is constructed, which includes: a basic feature layer, a derived feature layer, and time feature engineering.
[0085] Specifically, the data collection process mainly includes the following data, as shown in Table 1.
[0086] Table 1 Historical Freight Rate Records
[0087] In constructing the feature engineering system, a multi-layered feature architecture was established, including a basic feature layer, a derived feature layer, and time feature engineering. This provides rich and effective input information for the freight rate prediction model.
[0088] In this optional embodiment, a multi-layered feature architecture is constructed based on route feature data, market environment data, and operational environment data. This multi-layered feature architecture includes: a basic feature layer, a derived feature layer, and time feature engineering.
[0089] Obtain numerical and categorical features from the route feature data and construct a basic feature layer;
[0090] Based on market environment data, a derivative feature layer is constructed through a deep integration of business knowledge and data transformation;
[0091] Time-cycle coding technology is used to periodically encode and trend-process time-series information in operational environment data to construct time feature engineering.
[0092] Specifically, the basic feature layer comes directly from the raw data and includes numerical features such as sailing distance, various index values and price data, as well as categorical features such as port codes, ship type classifications and quarterly labels. These features constitute the core elements for the model to identify basic patterns.
[0093] The derived feature layer, through a deep integration of business knowledge and data transformation, creates more predictive composite indicators. It constructs a market relative strength index, reflecting the relative premium level of a specific route by calculating the ratio of the route index to the composite index; designs economic indicators such as fuel cost per unit distance, directly reflecting the impact of operating costs on fares; establishes regional labels to identify important transportation patterns such as north-south routes; and introduces a seasonal adjustment factor based on monthly cycles, as well as discretizing continuous distances into short-haul, medium-haul, and long-haul segments. These derived features greatly enhance the model's ability to understand business patterns.
[0094] In terms of time feature engineering, advanced time cycle coding technology is employed to perform sine and cosine transformations on monthly and annual cycles, converting linear time information into waveform features that better reflect cyclical changes. Simultaneously, time trend features are introduced to capture long-term market evolution patterns. This complete feature engineering system, through multi-dimensional and multi-granular feature construction, provides machine learning models with comprehensive information input that reflects both immediate conditions and long-term patterns, laying a solid foundation for high-precision freight rate forecasting.
[0095] In this optional embodiment, the process of cleaning and feature encoding the historical fare data based on a multi-level feature architecture to obtain the processed historical fare data includes:
[0096] A differentiated processing strategy is used to perform data imputation and data missing processing on numerical features and categorical features in the basic feature layer, respectively;
[0097] Outlier detection is performed on the processed numerical and categorical features using statistical methods to identify outliers that deviate significantly from the preset range (normal range) of the route, generating abnormal data. Based on professional knowledge in the shipping industry, the abnormal data is then verified a second time to distinguish between errors in the abnormal data and market fluctuations, generating outlier values.
[0098] Outliers are handled through numerical adjustment or labeling mechanisms to ensure the accuracy and usability of the data;
[0099] The Z-score normalization algorithm is used to transform the processed numerical features to the same scale to ensure fair weight distribution.
[0100] By using one-hot encoding, the processed categorical features are converted into binary vectors, thus converting ship type classification into dummy variables, and transforming the dummy variables to the same scale;
[0101] By fusing numerical and categorical features at the same scale, the processed historical freight rate data is obtained.
[0102] Specifically, the data cleaning process is as follows: The data cleaning step first addresses the missing value problem. Based on the data type defined by different feature layers in feature engineering, a differentiated processing strategy is adopted: For numerical features, the median is used for filling. This method can effectively resist the influence of outliers and maintain the overall distribution characteristics of the data; For categorical features, a special "missing" label is used for filling, which not only preserves the information of missing data, but also avoids the sample loss caused by direct deletion.
[0103] In outlier detection, a comprehensive judgment system combining statistical methods and business logic is employed. After identifying extreme shipping values that significantly deviate from the normal range using statistical methods, these anomalous data are further verified using shipping industry expertise to distinguish between genuine data errors and reasonable market fluctuations. For confirmed outliers, the process avoids both simple deletion to prevent loss of important market information and indiscriminate retention to avoid interfering with model learning. Instead, reasonable numerical adjustments or labeling mechanisms are used to ensure the accuracy and usability of the data.
[0104] Feature Encoding and Standardization: The feature encoding and standardization phase involves processing different types of features separately. Numerical features are standardized using the Z-score method, transforming all numerical features to the same scale to eliminate the impact of dimensional differences on the model and ensure fair weight allocation for each feature during model training. For categorical features, nominal variables such as loading port and unloading port are converted into binary vectors through one-hot encoding, while ship type classification is converted into dummy variables. This process preserves the categorical information while transforming it into a mathematical form that can be processed by the random forest algorithm. Throughout the encoding process, special attention is paid to preserving the business relationship information inherent in the categorical features, ensuring that the transformed data accurately reflects the original business logic and domain knowledge.
[0105] In this optional embodiment, the step of partitioning the processed historical fare data using a dataset partitioning strategy to construct and train a fare prediction model includes:
[0106] Using a dataset partitioning strategy, the processed historical freight rate data is partitioned sequentially along the time axis to obtain a training set, a validation set, and a test set.
[0107] Using the random forest algorithm as a framework, multiple decision trees are constructed by analyzing historical flight route records in the training set, and various factors affecting freight rates and their interrelationships are gradually identified in the training set to obtain a freight rate prediction model.
[0108] The prediction performance of the fare prediction model under different parameter configurations is evaluated using a validation set, and the prediction performance of the fare prediction model is optimized by a hyperparameter optimization mechanism. The prediction performance of the fare prediction model under different parameter configurations is objectively compared to avoid overfitting of the fare prediction model to the training set.
[0109] By using a test set to simulate a real deployment environment, the predictive performance of the freight rate forecasting model is estimated unbiasedly, and evaluation results are generated. This objectively assesses the actual predictive ability of the freight rate forecasting model on unknown future data, resulting in a well-trained freight rate forecasting model that provides a reliable basis for business decisions.
[0110] Specifically, as shown in Figure 3, the dataset partitioning strategy is a crucial foundation for ensuring the effectiveness and reliability of the coastal coal freight rate forecasting model. Since shipping market price data exhibits significant time-series characteristics, traditional random partitioning methods are not applicable in this scenario. A strict time-series partitioning strategy is adopted, dividing the historical data sequentially into three independent parts: a training set, a validation set, and a test set.
[0111] The training set comprises approximately 70% of the total data and is located in the earliest stage of the time series. Its main function is to allow the coastal coal freight rate forecasting model to learn the basic patterns and regularities contained in historical data. In this stage, the random forest algorithm analyzes a large number of historical route records, constructs multiple decision trees, and gradually identifies various factors affecting freight rates and their interrelationships, forming a basic understanding of the pricing mechanism of the shipping market.
[0112] The validation set comprises approximately 15% of the total data, occurring immediately after the training set. Its primary function is to fine-tune hyperparameters and select the appropriate freight rate prediction model during training. By evaluating the predictive performance of the freight rate prediction model under different parameter configurations on the validation set, the effectiveness of various settings can be objectively compared, preventing overfitting of the model to the training data and ensuring good generalization ability.
[0113] The test set, comprising approximately 15% of the data, represents the most recent phase of the time series and reflects the most recent market data. This dataset was completely isolated during the development and optimization of the coastal coal freight rate forecasting model, and was not involved in any form of training or parameter adjustment. Its sole purpose was to simulate the model's performance in a real-world deployment environment after the model was finalized, providing an unbiased estimate of its predictive performance. The evaluation results on the test set allow for an objective assessment of the coastal coal freight rate forecasting model's actual predictive capability on future unknown data, providing a reliable basis for business decisions.
[0114] In the configuration of the random forest algorithm, a prediction system capable of capturing complex patterns and exhibiting good generalization ability is constructed through carefully designed basic parameters and advanced features. Regarding the basic parameter settings, the number of trees is controlled within the range of 100-500. This number ensures that the fare prediction model obtains stable output through collective decision-making while avoiding excessive consumption of computational resources. The maximum depth of each tree is limited to 5-30 layers, ensuring that the fare prediction model can learn meaningful decision paths without overfitting due to excessive detail. Simultaneously, the minimum number of samples for node splits is set to 2-20, and the minimum number of samples for leaf nodes is set to 1-10. These constraints ensure that each decision node is statistically significant and prevent the fare prediction model from becoming sensitive to noisy data.
[0115] At the advanced feature configuration level, a feature sampling strategy is employed, randomly selecting feature subsets according to the square root or logarithmic ratio. This mechanism effectively promotes diversity among trees, allowing each tree to examine the data from different perspectives. The use of bootstrap sampling enables each decision tree to use different data subsets generated through sampling with replacement during training, further enhancing the diversity of the freight rate prediction model. Of particular note is the out-of-bag evaluation function, which automatically utilizes samples not involved in the training of each tree for internal validation. This not only provides an efficient method for evaluating freight rate prediction models without additional data splitting but also provides a reliable basis for real-time monitoring of the model's performance.
[0116] Random forests, by constructing multiple decision trees and identifying factors influencing freight rates, employ a sophisticated mechanism that blends collective intelligence with randomness. The construction process begins with bootstrapping, randomly sampling multiple subsets of data with replacement to provide each tree with a slightly different training perspective. During the growth of each tree, the algorithm searches for the optimal split point at each node from a randomly selected subset of features to maximize the differentiation of freight rate differences. For example, one tree might first split based on sailing distance, while another might prioritize port congestion; this randomness ensures that each tree develops a unique decision path.
[0117] Through the collaborative work of these diverse decision trees, the fare forecasting model can progressively identify complex fare-influencing factors and their interrelationships. Once all trees have completed training, they form a powerful forecasting committee. For new route data, each tree makes an independent prediction based on its learned rules, and a consensus result is ultimately generated through collective voting. More importantly, by analyzing the frequency with which features are used as split nodes across all trees and the resulting increase in purity, the importance of each feature can be quantified, identifying key drivers influencing fare rates. Simultaneously, by observing the patterns of different feature combinations in the decision path, the fare forecasting model can reveal the interactions between factors; for example, it discovers that when fuel prices are high, the sensitivity of flight distance to fare rates is significantly enhanced. This multi-layered, multi-faceted analytical capability makes random forests not only a forecasting tool but also an insightful engine for understanding the fare formation mechanism.
[0118] In this optional embodiment, the step of using a performance evaluation index mechanism to measure the performance of the trained fare prediction model, and if the performance of the trained fare prediction model is substandard, then through a hyperparameter optimization mechanism, the hyperparameters of the trained fare prediction model are tuned again to obtain a compliant fare prediction model, so as to realize the calculation of freight for the target route, includes:
[0119] The performance of a well-trained freight rate prediction model is comprehensively and objectively measured based on absolute error and relative performance metrics.
[0120] If the trained freight rate prediction model meets the performance requirements, then a qualified freight rate prediction model is obtained.
[0121] If the performance of the trained fare prediction model is not up to standard, a random search strategy is used to find the optimal parameter configuration of the trained fare prediction model and optimize the root mean square error in the trained fare prediction model to obtain a compliant fare prediction model.
[0122] Based on a multi-level interpretability analysis mechanism, the qualified freight rate forecasting model is transformed into a decision support tool, and the rationality of the qualified freight rate forecasting model is verified through interpretability analysis.
[0123] Specifically, as shown in Figure 4, a performance evaluation index system was established for the performance evaluation of the freight rate forecasting model. This system comprehensively and objectively measures the performance of the freight rate forecasting model. The system includes two main categories: absolute error indicators and relative performance indicators, providing a panoramic view of the accuracy of the freight rate forecasting model from different perspectives.
[0124] Hyperparameter optimization process: During the evaluation of the freight rate prediction model, if the performance is unsatisfactory, hyperparameter optimization is performed, and the freight rate prediction model is retrained and evaluated again to achieve the expected results. The design of the hyperparameter optimization process employs a systematic and rigorous method to find the optimal parameter configuration for the random forest algorithm.
[0125] Model interpretability analysis: At the interpretability analysis level of the freight rate forecasting model, a multi-layered and in-depth interpretive framework was constructed, transforming the freight rate forecasting model from a "black box" into a business-understandable and trustworthy decision support tool. Through systematic interpretability analysis, not only is the rationality of the freight rate forecasting model verified, but more importantly, deep insights driving business decisions are extracted from it.
[0126] In this optional embodiment, the comprehensive and objective measurement of the performance of the trained freight rate prediction model based on absolute error metrics and relative performance metrics includes:
[0127] The mean absolute error (MAE) is obtained by calculating the average of the absolute values of the deviations between the evaluation results and the actual values output by the trained freight rate prediction model. The square root of the square of the deviation between the evaluation results and the actual values is then calculated, and evaluation results that exceed the preset error (large error) are penalized by weight to obtain the root mean square error (RMSE). The mean absolute error and the root mean square error are combined to generate the absolute error index.
[0128] By analyzing the coefficient of determination (R²), the proportion of the target variable variance explained by the trained freight rate forecasting model is measured, and the absolute error is transformed into a proportional relationship relative to the true value through the average relative error percentage, thus generating a relative performance index.
[0129] Specifically, regarding absolute error metrics, two core indicators are used: MAE and RMSE. MAE provides an intuitive measure of the magnitude of the prediction error of the freight rate forecasting model by calculating the average of the absolute values of the deviations between the predicted and actual values. Its advantage is that it treats the error of each sample equally, providing a typical performance of the freight rate forecasting model under normal circumstances. Here, the predicted value is the result calculated by the freight rate forecasting model during the evaluation process, and the actual value is the historical freight rate data that has occurred and been accurately recorded. RMSE, on the other hand, assigns a higher penalty weight to larger errors by squaring and then taking the square root of the error. This makes it more sensitive to serious deviations in the prediction results and can effectively identify abnormal prediction situations that, although infrequent, may pose significant business risks.
[0130] Relative performance metrics assess the effectiveness of freight rate forecasting models from another perspective, primarily including R² and mean relative error percentage (MRP). R² measures the proportion of the target variable variance that the freight rate forecasting model can explain, reflecting its ability to capture the patterns of freight rate fluctuations. The closer its value is to 1, the stronger the explanatory power of the freight rate forecasting model. The MRP percentage transforms the absolute error into a proportional relationship relative to the true value, providing business personnel with a more intuitive and understandable concept of accuracy. This facilitates cross-scenario performance comparisons of freight rate forecasting models across different routes and freight rate levels. The combined use of these two types of metrics ensures both the technical rigor of the freight rate forecasting model evaluation and enhances the connection between the evaluation results and business decisions.
[0131] In this optional embodiment, if the performance of the trained fare prediction model is substandard, a random search strategy is used to find the optimal parameter configuration of the trained fare prediction model, and the root mean square error in the trained fare prediction model is optimized to obtain a satisfactory fare prediction model, including:
[0132] By employing a random search strategy, we can find multiple combinations of parameters randomly sampled from a predefined parameter space for a well-trained freight rate prediction model. By leveraging the computational efficiency of the random search strategy, we can explore a wider range of configuration possibilities for the freight rate prediction model.
[0133] Based on the mathematical properties of root mean square error and its sensitivity to prediction bias, evaluation results that exceed the preset error are weighted and penalized to ensure that the trained freight rate prediction model avoids serious misestimation in actual business applications.
[0134] Using a time-series cross-validation algorithm, the training window and validation window are strictly divided according to the time sequence to prevent future information from being leaked into past time periods;
[0135] The test was conducted iteratively through multiple rounds of parameter combination testing. In each round of testing, a set of randomly sampled parameters was trained and validated through a training window and a validation window, respectively, and the performance of the trained freight rate prediction model was recorded.
[0136] Based on the performance of the trained freight rate prediction model, we gradually approach the optimal parameter configuration of the trained freight rate prediction model. By observing the relationship between parameters and performance of the trained freight rate prediction model in multiple rounds of testing, we understand the influence of different hyperparameters on the performance of the trained freight rate prediction model and obtain a qualified freight rate prediction model.
[0137] Specifically, in terms of search methods, a random search strategy was chosen. This method explores a wider range of configuration possibilities with high computational efficiency by randomly sampling multiple parameter combinations in a predefined parameter space. Compared with traditional grid search methods, it is more likely to discover parameter regions with excellent performance under the same computational cost.
[0138] Regarding evaluation metrics, mean squared error was chosen as the core optimization objective. This choice is based on its favorable mathematical properties and sensitivity to prediction errors, enabling it to impose stronger penalties on larger prediction deviations, thereby ensuring that the freight rate forecasting model avoids serious misestimations in practical business applications. To maintain the inherent characteristics of time series data, a time series cross-validation method was specifically adopted, strictly dividing the training and validation windows according to chronological order. This effectively prevents future information from being leaked into past time periods, ensuring the authenticity and reliability of the freight rate forecasting model's evaluation results.
[0139] The entire optimization process involves multiple rounds of parameter combination testing and iteration. In each round, a randomly sampled set of parameters is fully trained and validated, and its performance is recorded. This iterative optimization mechanism allows for a gradual approximation of the optimal parameter configuration. Furthermore, by observing the relationship between parameters and performance across multiple rounds of testing, a deeper understanding of the impact of different hyperparameters on the freight rate prediction model's performance is gained, providing ample data support for ultimately determining the best freight rate prediction model configuration.
[0140] In this optional embodiment, the step of transforming the qualified freight rate forecasting model into a decision support tool based on a multi-level interpretability analysis mechanism, and verifying the rationality of the qualified freight rate forecasting model through interpretability analysis, includes:
[0141] The feature importance analysis mechanism is used to calculate the frequency and purity improvement of each feature in the qualified freight rate prediction model in several decision trees, quantify the overall contribution of each feature to the prediction results, and generate a feature importance ranking chart to identify the key driving factors affecting coastal coal freight rates.
[0142] The SHAP value mechanism based on game theory quantifies the specific direction and magnitude of the influence of each feature on a prediction result, providing a fine-grained interpretation of individual prediction results.
[0143] By integrating feature importance ranking charts and fine-grained interpretations of forecast results, we can identify factors influencing freight rate fluctuations, analyze the market's sensitivity to various influencing factors, detect anomalies that deviate from conventional patterns, and verify the rationality of the compliant freight rate forecasting model and common business sense.
[0144] Specifically, feature importance analysis forms the foundational layer of the freight rate forecasting model interpretation. By calculating the frequency and purity of each feature's use in splitting nodes across numerous decision trees, it precisely quantifies their overall contribution to the forecast results. This analysis generates intuitive feature importance ranking charts, enabling data scientists and business personnel to readily identify key drivers influencing coastal coal freight rates. For example, it might reveal that the CBCFI composite index contributes as much as 30%, while the impact of sailing distance is only 15%. This quantitative understanding has significant guiding implications for business strategy development.
[0145] At the advanced explanatory level, the advanced technique of SHAP (SHapley Additive ex Planations) value analysis is introduced. Based on the concept of Shapley values in game theory, it can provide a refined explanation for individual prediction samples. SHAP values can not only quantify the specific direction and magnitude of each feature's impact on a particular prediction—for example, explaining why the predicted freight rate for a certain route is 5 yuan / ton higher than the average, with oil price increases contributing 3 yuan and port congestion contributing 2 yuan—but also reveal the interactions between features, discovering complex patterns such as the "cumulative effect when high oil prices and low inventory occur simultaneously." This fine-grained explanatory power greatly enhances the transparency and credibility of freight rate prediction models in critical business decisions.
[0146] All technical analysis serves the extraction of business insights. By integrating the results of feature importance analysis and SHAP value analysis, the main influencing factors of freight rate fluctuations can be systematically identified, the market's sensitivity to various factors can be analyzed, and anomalies deviating from conventional patterns can be detected. These insights not only verify the consistency between freight rate forecasting models and common business sense, but also often reveal some market patterns that have not been fully recognized. This provides solid data support for route optimization, freight rate negotiation, and risk management, truly achieving a transformation from freight rate forecasting models to decision intelligence.
[0147] In this optional embodiment, the step of encapsulating the qualified freight rate prediction model into a standardized API service and establishing a production-grade service framework; monitoring the performance of the qualified freight rate prediction model in real time through a performance monitoring mechanism, and periodically triggering a continuous learning mechanism based on a time cycle to continuously update and retrain the qualified freight rate prediction model includes:
[0148] The qualified freight rate forecasting model is packaged and encapsulated into a standardized API service through a unified data processing flow and forecasting logic. The data type, value range and processing logic of each feature are clearly defined through a standard feature input format. A structured forecasting result return format is established to provide full convenience for the integration and use of downstream businesses.
[0149] The performance monitoring mechanism tracks the mean absolute error and root mean square error, the stability of the prediction results, and the quality of the input data in real time to obtain diagnostic criteria, so as to achieve continuous evaluation of the performance of the qualified freight rate prediction model.
[0150] The compliant freight rate forecasting model is retrained periodically based on time cycles to ensure that it can learn the latest market patterns; a progressive update mechanism based on incremental learning ensures that the compliant freight rate forecasting model can quickly adapt to minor market changes; and a performance-triggered update mechanism automatically starts the retraining process when the performance monitoring mechanism detects that the performance degradation of the compliant freight rate forecasting model exceeds a preset threshold.
[0151] Specifically, as shown in Figure 5, the deployment architecture design involved constructing a complete production-grade service framework. By unifying and encapsulating the data preprocessing process and prediction logic, end-to-end consistency from raw data to prediction results was ensured. Standardized API interfaces were designed to provide a unified and efficient access point for prediction services to various business systems. At the input level, a strict feature input standard format was established, clearly defining the data type, value range, and processing logic for each feature. At the output level, a structured prediction result return format was defined, including core predicted values, confidence intervals, and related metadata, providing significant convenience for the integration and use of downstream business systems.
[0152] Performance Monitoring System: After the Random Forest algorithm was implemented in this invention, a comprehensive performance monitoring system was established. This system continuously evaluates the performance of the compliant freight rate prediction model by tracking key indicators in real time, including prediction error metrics such as MAE and RMSE, the stability of prediction results, and the quality of input data. The monitoring system not only focuses on the absolute accuracy of the compliant freight rate prediction model but also pays special attention to the stability of prediction performance. It also monitors changes in the distribution of input data to ensure that the compliant freight rate prediction model operates in a data environment that meets expectations. This multi-layered monitoring provides a comprehensive diagnostic basis for the health status of the compliant freight rate prediction model.
[0153] Continuous Learning Process: To address the dynamic nature of the shipping market, a continuous learning mechanism was designed. This mechanism includes three complementary strategies for updating the compliant freight rate forecasting model: periodic retraining based on time cycles to ensure the model learns the latest market patterns; a gradual update mechanism based on incremental learning to enable the model to quickly adapt to minor market changes; and performance-triggered updates, which automatically initiate a retraining process when the monitoring system detects that the model's performance has degraded beyond a predetermined threshold. These three strategies together constitute an intelligent system capable of self-evolution and continuously maintaining forecast accuracy, ensuring that the compliant freight rate forecasting model meets business needs throughout its entire lifecycle.
[0154] According to another embodiment of the present invention, an economical freight calculation system based on large-scale route data and a random forest algorithm is also provided, the system comprising:
[0155] The data acquisition and architecture building module is used to acquire historical fare data for the target route and build a multi-level feature architecture based on the historical fare data.
[0156] The data processing module is used to perform data cleaning and feature encoding on historical freight rate data based on a multi-level feature architecture to obtain processed historical freight rate data.
[0157] The model building and training module is used to partition the processed historical freight rate data using a dataset partitioning strategy, and to build and train a freight rate prediction model.
[0158] The model performance evaluation and tuning module is used to measure the performance of the trained fare prediction model using a performance evaluation index mechanism. If the performance of the trained fare prediction model is not up to standard, the hyperparameter optimization mechanism is used to tune the hyperparameters of the trained fare prediction model again to obtain a compliant fare prediction model, so as to realize the calculation of freight for the target route.
[0159] The model performance monitoring and update module is used to encapsulate the qualified freight rate prediction model into a standardized API service and establish a production-grade service framework. It monitors the performance of the qualified freight rate prediction model in real time through a performance monitoring mechanism and triggers a continuous learning mechanism periodically based on time cycles to continuously update and retrain the qualified freight rate prediction model.
[0160] To verify the performance of this invention, a fare prediction model was established for the non-standard route "Caofeidian-Zhanjiang" which is not covered by the CBCFI index, based on historical operating data from a certain year. The prediction results output by the fare prediction model were then compared with the actual data.
[0161] Historical freight rate data is shown in Table 2.
[0162] Table 2 Historical Freight Rate Data
[0163] Current market environment data are shown in Table 3.
[0164] Table 3 Current Market Environment Data
[0165] Feature engineering is shown in Table 4.
[0166] Table 4 Feature Engineering Table
[0167] Training and validation process of freight rate prediction model: Dataset partitioning:
[0168] 1) Training set: January 2022 - June 2023 (18 months, approximately 75% of the data);
[0169] 2) Validation set: July 2023 - September 2023 (3 months, approximately 12.5% of the data);
[0170] 3) Test set: October 2023 - December 2023 (3 months, approximately 12.5% of the data).
[0171] Random forest configuration:
[0172] 1) Number of trees: 350;
[0173] 2) Maximum depth: 18 floors;
[0174] 3) Minimum number of samples for node splitting: 5;
[0175] 4) Minimum number of samples per leaf node: 3;
[0176] 5) Feature sampling strategy: sqrt (using the square root of the total number of features);
[0177] 6) Enable self-service sampling and out-of-bag assessment.
[0178] The results of the freight rate forecasting model are shown in Table 5.
[0179] Table 5. Validation Table of Freight Rate Forecasting Model Prediction Results
[0180] Freight rate forecasting model performance metrics:
[0181] 1) MAE (Mean Absolute Error): 0.50 yuan / ton;
[0182] 2) RMSE (Root Mean Square Error): 0.58 yuan / ton;
[0183] 3) R² (coefficient of determination): 0.94;
[0184] 4) Average relative error: 1.2%.
[0185] Feature importance analysis results: Through random forest algorithm analysis, the key factors affecting the freight rate of the "Caofeidian-Zhanjiang" route were identified:
[0186] 1) CBCFI Composite Index (Importance weight: 28.5%)
[0187] 2) Fuel prices (importance weight: 22.1%)
[0188] 3) Inventory levels at southern ports (importance weight: 18.7%).
[0189] 4) Sailing distance (importance weight: 15.3%)
[0190] 5) Seasonal factors (importance weight: 9.2%)
[0191] 6) Ship type differences (importance weight: 6.2%).
[0192] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. An economical freight calculation method based on large-scale flight route data and random forest algorithm, characterized in that, include: Obtain historical fare data for the target route and construct a multi-layered feature architecture based on the historical fare data; Based on a multi-layered feature architecture, historical fare data is cleaned and feature-encoded to obtain processed historical fare data. The processed historical fare data is then partitioned using a dataset partitioning strategy to construct and train a fare prediction model. A performance evaluation metric mechanism is used to measure the performance of the trained fare prediction model. If the performance of the trained fare prediction model is substandard, a hyperparameter optimization mechanism is used to fine-tune the hyperparameters again to obtain a satisfactory fare prediction model, enabling the calculation of freight rates for target routes. The satisfactory fare prediction model is encapsulated as a standardized API service, establishing a production-grade service framework. A performance monitoring mechanism monitors the performance of the satisfactory fare prediction model in real time, and a continuous learning mechanism is periodically triggered based on time periods to continuously update and retrain the satisfactory fare prediction model.
2. The economical freight calculation method based on large-scale route data and random forest algorithm according to claim 1, characterized in that, The process of acquiring historical fare data for the target route and constructing a multi-level feature architecture based on the historical fare data includes: acquiring actual route feature data, market environment data, and operating environment data for the target route, and integrating the route feature data, market environment data, and operating environment data to obtain historical fare data; and constructing a multi-level feature architecture based on the route feature data, market environment data, and operating environment data, wherein the multi-level feature architecture includes: a basic feature layer, a derived feature layer, and time feature engineering.
3. The economical freight calculation method based on large-scale route data and random forest algorithm according to claim 2, characterized in that, The method involves constructing a multi-layered feature architecture based on route feature data, market environment data, and operational environment data. This multi-layered feature architecture includes: a basic feature layer, a derived feature layer, and a time feature engineering layer. The method involves: acquiring numerical and categorical features from the route feature data to construct the basic feature layer; constructing the derived feature layer based on market environment data through a deep integration of business knowledge and data transformation; and constructing the time feature engineering layer by periodically encoding and trend-following the time series information in the operational environment data using time periodic encoding technology.
4. The economical freight calculation method based on large-scale route data and random forest algorithm according to claim 3, characterized in that, The process, based on a multi-level feature architecture, involves data cleaning and feature encoding of historical freight rate data. The resulting processed historical freight rate data includes: using a differentiated processing strategy to perform data imputation and missing data handling on numerical and categorical features in the basic feature layer; using statistical methods to detect outliers in the processed numerical and categorical features, identifying significant deviations from the preset route range, generating outlier data, and performing secondary verification based on shipping expertise to distinguish between errors and market fluctuations, generating outliers; processing outliers through numerical adjustment or labeling mechanisms to ensure data accuracy and usability; using the Z-score normalization algorithm to transform the processed numerical features to the same scale to ensure fair weight distribution; converting the processed categorical features into binary vectors through one-hot encoding, converting ship type classification into dummy variables, and transforming the dummy variables to the same scale; and fusing the numerical and categorical features at the same scale to obtain the processed historical freight rate data.
5. The method for calculating economical freight costs based on large-scale flight route data and random forest algorithm according to claim 1, characterized in that, The process of partitioning processed historical fare data using a dataset partitioning strategy to construct and train a fare prediction model includes: partitioning the processed historical fare data sequentially along the time axis using a dataset partitioning strategy to obtain a training set, a validation set, and a test set; using a random forest algorithm as a framework, constructing multiple decision trees by analyzing historical flight records in the training set, and gradually identifying various factors affecting fares and their interrelationships in the training set to obtain a fare prediction model; using the validation set to evaluate the predictive performance of the fare prediction model under different parameter configurations, and using a hyperparameter optimization mechanism to fine-tune the predictive performance of the fare prediction model, objectively comparing the predictive performance of the fare prediction model under different parameter configurations to avoid overfitting the fare prediction model to the training set; using the test set to simulate a real deployment environment, performing an unbiased estimation of the predictive performance of the fare prediction model, generating evaluation results, objectively judging the actual predictive ability of the fare prediction model on future unknown data, and obtaining a trained fare prediction model to provide a reliable basis for business decisions.
6. The method for calculating economical freight rates based on large-scale flight route data and random forest algorithm according to claim 5, characterized in that, The process of using performance evaluation metrics to measure the performance of the trained fare forecasting model, and if the performance of the trained fare forecasting model is substandard, then using a hyperparameter optimization mechanism to re-tune the hyperparameters of the trained fare forecasting model to obtain a satisfactory fare forecasting model, in order to calculate the freight rates for the target route, includes: comprehensively and objectively measuring the performance of the trained fare forecasting model based on absolute error and relative performance metrics; if the performance of the trained fare forecasting model is satisfactory, then a satisfactory fare forecasting model is obtained; if the performance of the trained fare forecasting model is substandard, then using a random search strategy to find the optimal parameter configuration of the trained fare forecasting model, and optimizing the root mean square error in the trained fare forecasting model to obtain a satisfactory fare forecasting model; based on a multi-level interpretability analysis mechanism, the satisfactory fare forecasting model is transformed into a decision support tool, and the rationality of the satisfactory fare forecasting model is verified through interpretability analysis.
7. The method for calculating economical freight costs based on large-scale flight route data and random forest algorithm according to claim 6, characterized in that, The method of comprehensively and objectively measuring the performance of a trained freight rate forecasting model based on absolute error and relative performance indices includes: calculating the average absolute error by taking the square root of the square of the deviation between the evaluation results and the actual values output by the trained freight rate forecasting model; penalizing evaluation results that exceed a preset error by applying weights to obtain the root mean square error; combining the average absolute error and the root mean square error to generate an absolute error index; analyzing the coefficient of determination to measure the proportion of the variance of the target variable explained by the trained freight rate forecasting model; and converting the absolute error into a proportional relationship relative to the actual value through the average relative error percentage to generate a relative performance index.
8. The method for calculating economical freight rates based on large-scale flight route data and random forest algorithm according to claim 7, characterized in that, If the performance of the trained fare prediction model is substandard, a random search strategy is used to find the optimal parameter configuration for the trained fare prediction model and optimize the root mean square error in the trained fare prediction model to obtain a satisfactory fare prediction model. This includes: using a random search strategy to find multiple parameter combinations randomly sampled in a predefined parameter space for the trained fare prediction model; exploring a wider range of configuration possibilities for the fare prediction model by leveraging the computational efficiency of the random search strategy; and, based on the mathematical characteristics of the root mean square error and its sensitivity to prediction deviation, applying weighted penalties to evaluation results that exceed a preset error to ensure that the trained fare prediction model avoids serious errors in actual business applications. Error estimation is addressed through a time-series cross-validation algorithm that strictly divides the training and validation windows according to chronological order to prevent future information from being leaked into past time periods. The process involves multiple rounds of parameter combination testing and iteration. In each round, a randomly sampled set of parameters is trained and validated separately through the training and validation windows, and the performance of the trained fare prediction model is recorded. Based on the performance of the trained fare prediction model, the optimal parameter configuration is gradually approximated. By observing the relationship between parameters and performance in multiple rounds of testing, the influence of different hyperparameters on the performance of the trained fare prediction model is understood, resulting in a satisfactory fare prediction model.
9. The method for calculating economical freight costs based on large-scale flight route data and random forest algorithm according to claim 6, characterized in that, The multi-level interpretability analysis mechanism transforms the qualified freight rate forecasting model into a decision support tool. Through interpretability analysis, the rationality of the qualified freight rate forecasting model is verified. This includes: calculating the frequency and purity improvement of each feature in the qualified freight rate forecasting model across several decision trees using a feature importance analysis mechanism; quantifying the overall contribution of each feature to the forecasting results; generating a feature importance ranking chart to identify key drivers affecting coastal coal freight rates; quantifying the specific direction and magnitude of each feature's impact on a given forecasting result using a game theory-based SHAP value mechanism; providing fine-grained explanations for individual forecasting results; and integrating the feature importance ranking chart and the fine-grained interpreted forecasting results to identify factors influencing freight rate fluctuations, analyze the market's sensitivity to various influencing factors, and detect anomalies deviating from conventional patterns, thus verifying the rationality of the qualified freight rate forecasting model in relation to common business sense.
10. The method for calculating economical freight rates based on large-scale flight route data and random forest algorithm according to claim 1, characterized in that, The process of encapsulating the qualified freight rate prediction model into a standardized API service and establishing a production-level service framework includes: real-time monitoring of the performance of the qualified freight rate prediction model through a performance monitoring mechanism, and periodic triggering of a continuous learning mechanism based on time cycles to continuously update and retrain the qualified freight rate prediction model. This includes: unifying the data processing flow and prediction logic of the qualified freight rate prediction model into a standardized API service, and clearly defining the data type, value range, and processing logic of each feature through a standard feature input format; establishing a structured prediction result return format to facilitate integration and use by downstream businesses; and through... The performance monitoring mechanism tracks the mean absolute error and root mean square error, the stability of prediction results, and the quality of input data in real time to obtain diagnostic criteria, enabling continuous evaluation of the performance of the qualified freight rate prediction model. Based on time periods, the qualified freight rate prediction model is periodically retrained to ensure it can learn the latest market patterns. An incremental learning-based progressive update mechanism ensures the qualified freight rate prediction model can quickly adapt to minor market changes. Based on performance-triggered updates, when the performance monitoring mechanism detects that the performance degradation of the qualified freight rate prediction model exceeds a preset threshold, the retraining process is automatically initiated.