A port multi-category ship berth demand prediction and recommendation method and system based on an XGBoost model
By using a multi-category ship berth demand prediction method based on the XGBoost model, the problems of low efficiency and low prediction accuracy in traditional berth allocation are solved, and high-precision berth demand prediction and resource scheduling optimization are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- COSCO SHIPPING TECH CO LTD
- Filing Date
- 2026-03-04
- Publication Date
- 2026-06-05
AI Technical Summary
Traditional berth allocation methods rely on a first-come, first-served principle, which is difficult to cope with the diversity of ship types and port operating environments, resulting in low berth utilization efficiency and low prediction accuracy.
A multi-category vessel berth demand prediction method based on the XGBoost model is adopted. By collecting and cleaning historical data, constructing multi-dimensional feature engineering, combining data fusion with external port factors, and using the XGBoost model for training and optimization, the method can predict and recommend the berth with the highest matching probability in real time.
It improved the accuracy and timeliness of berth forecasting, optimized port resource allocation, reduced time costs, and increased decision-making space and resource utilization efficiency.
Smart Images

Figure CN122155253A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of port management and intelligent technology, specifically relating to a method and system for predicting and recommending the demand for multiple types of ship berths in ports based on the XGBoost model. Background Technology
[0002] In recent years, with the advancement of digitalization and informatization in port management, forecasting ship berth demand has gradually become one of the key technologies in port optimization management. Traditional berth allocation methods mostly rely on the first-come, first-served principle, that is, allocating berths based on ship arrival times. This method is difficult to cope with the increasingly complex port operation demands, especially given the increasing diversity of ship types, deadweight tonnage, and other factors. Berth utilization efficiency is low, and it is difficult to accurately predict ship berthing demand. Therefore, traditional methods cannot effectively consider the dynamic changes of ships and the actual port operating environment.
[0003] Currently, berth demand forecasting methods based on historical data have been applied both domestically and internationally, typically relying on time series analysis or empirical estimation. However, these methods fail to fully leverage multi-dimensional information such as vessel type, navigation characteristics, port facilities, and vessel tonnage, resulting in low forecast accuracy and wasted port resources. With the diversification of vessel types and port operating environments, the applicability and accuracy of existing forecasting methods are significantly limited. Therefore, there is an urgent need for a high-precision forecasting model that combines historical dynamic data of vessels with port and berth characteristics to improve the scientific rigor and accuracy of port berth demand forecasting, optimize resource allocation, and enhance port operational efficiency. Summary of the Invention
[0004] This invention addresses the problems of low efficiency in port berth resource allocation and low prediction accuracy in existing technologies by proposing a method and system for predicting and recommending port berth demand for multiple types of vessels based on the XGBoost model.
[0005] The technical solution claimed by this invention is as follows:
[0006] A method for predicting and recommending berth demand for multiple types of vessels in ports based on the XGBoost model includes the following steps:
[0007] S1: Data Collection and Preprocessing: Collect historical data on ship port calls, clean the collected data, and fill in missing values;
[0008] S2: Feature Engineering and Data Fusion: Based on the data obtained in S1, feature engineering is constructed. At the same time, combined with external port factors, multi-dimensional data fusion is performed to construct a feature set for predicting ship berth demand. The feature engineering includes ship characteristics, historical berthing characteristics, and port characteristics. The external port environment includes the port operation environment and ship navigation patterns.
[0009] S3: Model Training and Optimization: Based on the feature engineering and ship berth demand prediction feature set constructed in S2, the XGBoost model is used for model training and optimization;
[0010] S4: Real-time data input and prediction update: Collect real-time data of ships calling at ports and execute steps S1-S2; use the XGBoost model obtained in step S3 to make real-time predictions, and recommend the berths with the highest matching probability based on the prediction results, and further evaluate the recommendation results to provide decision support for port berth scheduling.
[0011] S5: Feedback and Model Update: During port operations, real-time feedback is provided based on the actual berth usage, and the XGBoost model is continuously updated based on the actual results.
[0012] Preferably, the historical port call data of the vessel includes: basic vessel attributes, port loading and unloading task type, and port berth label; the basic vessel attributes include: vessel type, deadweight tonnage, and length.
[0013] Preferably, the vessel characteristics include: vessel primary ship type, vessel secondary ship type, length, beam, draft, deadweight tonnage, and shipowner; the historical berthing characteristics include: berth number, number of berths, and frequency of berthing at each berth; the port characteristics include: port code, berth characteristics, and cargo loading / unloading tasks.
[0014] Preferably, the goal of the XGBoost model is to minimize the loss function and to gradually optimize the model parameters through a gradient boosting algorithm. The loss function of the XGBoost model is shown in equation (1):
[0015] (1)
[0016] in: The loss function is typically expressed using cross-entropy or mean squared error; This represents the regularization term, which controls the model complexity.
[0017] Preferably, step S4 is as follows: Based on the XGBoost model trained in S3, combined with the characteristics of the ship and the real-time port berth information, the XGBoost model recommends the top 3 berths with the highest matching probability. For each ship, the XGBoost model predicts its most likely berth and its corresponding probability, and further evaluates the recommendation results, thereby providing decision support for port berth scheduling. Specifically, the output of the XGBoost model is the ranking of the berth number and the corresponding predicted probability as shown in equation (2):
[0018] (2)
[0019] Among them, "features" refers to the characteristics of the ship. It is the predicted berth number. Let be the predicted probability of berth i.
[0020] Preferably, the evaluation of the recommendation results in S4 specifically includes:
[0021] After training the XGBoost model, predictions are made on the test set and the accuracy is calculated, as shown in equation (3):
[0022] (3)
[0023] in: Represents an indicator function, when When the value is 1, it is 1; otherwise, it is 0. Considering that there may be some randomness or multiple berthing preferences when ships berth at ports, the XGBoost model will output the top 3 berths with the highest matching probability for port operators to choose from, and evaluate the accuracy of the model.
[0024] Preferably, the accuracy of the evaluation model is specifically defined as follows: the accuracy of the first three matching probabilities refers to the proportion of the predicted value that contains the true value in the first three predicted values, and the evaluation method is as shown in equation (4):
[0025] (4)
[0026] in: These are the top three berths in terms of predicted probability for the i-th sample; It is an indicator function, when the true value The value is 1 if it is among the first 3 berths of the predicted value, and 0 otherwise.
[0027] Preferably, the actual berth usage includes: berthing time and berth occupancy rate; when training the XGBoost model, it is trained separately for each port and for multiple ship types.
[0028] This invention also provides a port multi-category vessel berth demand prediction and recommendation system based on the XGBoost model, comprising: a data source module for collecting historical data on vessel berthing at ports; a preprocessing module for preprocessing the data collected by the data source module and collecting and processing information on vessels about to arrive at the port; a feature engineering and fusion module for constructing a vessel berth demand prediction feature set based on the data processed by the preprocessing module and simultaneously combining external port factors to perform multi-dimensional data fusion; a model training and tuning module for training and optimizing the feature engineering and vessel berth demand prediction feature set constructed by the feature engineering and fusion module using the XGBoost model; a prediction and recommendation berth module for real-time prediction using the XGBoost model obtained by the model training and tuning module and recommending the berths with the highest matching probability based on the prediction results, thereby providing decision support for port berth scheduling; and a result visualization and evaluation module for providing real-time feedback based on actual berth usage during port operations, continuously updating the XGBoost model based on actual results, and displaying the actual results.
[0029] In the aforementioned system, the historical port call data for vessels includes: basic vessel attributes, port loading / unloading task type, and port berth label; the basic vessel attributes include: vessel type, deadweight tonnage, and length; the feature engineering includes: primary vessel type, secondary vessel type, length, beam, draft, deadweight tonnage, shipowner, berth number, frequency of berthing at each berth, port code, number of berths, and port loading / unloading tasks.
[0030] Beneficial effects
[0031] This invention provides a method and system for predicting and recommending multi-category vessel berth demand in ports based on the XGBoost model. The method includes: collecting historical data on vessel calls at ports, cleaning and removing outliers from the collected data, and filling in missing values to ensure data integrity and consistency; constructing feature engineering based on the collected data, and simultaneously combining external port factors to perform multi-dimensional data fusion to construct a vessel berth demand prediction feature set; predicting subsequent vessel berth demand based on multiple dimensional features to improve the accuracy of subsequent model predictions; training and optimizing the model using the XGBoost model, which, as an efficient gradient boosting tree (GBDT) model, can handle complex nonlinear relationships, and further improves prediction accuracy through multiple rounds of iterative training; collecting vessel call data; and collecting historical data on vessel calls at ports. The invention utilizes real-time port call data and employs the XGBoost model for real-time prediction. Based on the prediction results, it recommends the berths with the highest matching probability, providing decision support for port berth scheduling and thus achieving efficient utilization of port resources. During port operations, real-time feedback is provided based on actual berth usage, and the XGBoost model is continuously updated based on the actual results to further improve prediction accuracy and recommendation precision. In summary, the prediction method provided by this invention, through multi-dimensional data analysis, feature extraction, model training, and berth allocation, can provide accurate berth demand prediction for port management. The application of machine learning algorithms significantly improves the accuracy and timeliness of berth prediction, possessing high application value in the shipping industry and solving the problems of low efficiency and low prediction accuracy in existing port berth resource allocation technologies.
[0032] The method and system provided by this invention optimize the allocation and operation scheduling of port berth resources by comprehensively analyzing historical dynamic data of ships and combining real-time data input with intelligent prediction models, thereby providing more accurate decision support for port berth resource scheduling.
[0033] Furthermore, the method and system provided by this invention have the following advantages: 1. Potential Feature Mining: By applying the XGBoost machine learning algorithm to train historical ship berthing data, potential influencing factors can be systematically mined, such as ship berthing preferences and the cooperative relationship between ship owners and berth operators. These features not only enrich the input dimensions of the model but also significantly improve the accuracy and reliability of the prediction results. 2. Berth Prediction Based on Historical Data: The berth prediction method based on real historical data has strong empirical evidence, which helps to provide port management departments with scientific berth allocation decision support in advance. It can effectively reduce unnecessary time costs during operations and optimize the allocation and utilization efficiency of port resources. 3. Berth Resource Scheduling Basis: Providing multiple recommended berths, the model offers port managers more flexible and diverse berth resource scheduling schemes. This mechanism not only increases the decision-making space but also supports more efficient berth resource allocation. 4. Ship Berthing Preference Analysis and Model Optimization Potential: By learning from historical ship berthing data at different ports, ship berth selection preferences can be indirectly analyzed. The model has great optimization potential in the future.
[0034] This invention employs the XGBoost classification algorithm to accurately predict ship berth demand and adaptively adjusts to different ship types and port berth characteristics. By considering multiple factors (such as ship draft, deadweight tonnage, and ship type) and combining port berth distribution and historical berthing data, this invention provides efficient and accurate berth prediction in dynamic environments. Compared with traditional methods based on experience or simple statistical analysis, this invention has the following advantages: High-precision prediction: Based on machine learning algorithms, it can effectively capture the nonlinear relationship of ship berth allocation, improving prediction accuracy. Real-time performance: It can dynamically adjust the prediction model according to real-time data, meeting the timeliness requirements of port management. Flexibility: It supports berth prediction for various ship types and ports, exhibiting good adaptability and scalability. Optimized port management: By optimizing berth allocation, it improves the utilization rate of port berths, reduces ship waiting time, and thus improves the overall operational efficiency of the port. Attached Figure Description
[0035] Figure 1 This is a flowchart of a port multi-category vessel berth demand prediction and recommendation method based on the XGBoost model in an embodiment of the present invention.
[0036] Figure 2 This is a flowchart of a port multi-category vessel berth demand prediction and recommendation system based on the XGBoost model in an embodiment of the present invention.
[0037] Figure 3 This is a schematic diagram illustrating the accuracy distribution density of the global port liquid bulk carrier berth prediction model in an embodiment of the present invention. Detailed Implementation
[0039] To make the objectives, technical solutions, and advantages of the present invention clearer, the technical solutions will be further described clearly and completely below with reference to the accompanying drawings.
[0040] Example 1: A Port Multi-Category Vessel Berth Demand Prediction and Recommendation Method Based on XGBoost Model
[0041] This set of embodiments provides a method for predicting and recommending berth demand for multiple types of vessels in ports based on the XGBoost model, including the following steps:
[0042] S1: Data Collection and Preprocessing: Collect historical data on ship port calls, clean the collected data, and fill in missing values. In a specific embodiment of the invention, historical data on ship port calls is extracted from the database. Basic ship attributes (ship type, deadweight tonnage (dwt), length, etc.), port berth labels (berth_uuid), and ship berthing / loading / unloading task types are extracted from the database using SQL statements. To ensure data integrity and accuracy, missing values are filled, and data cleaning is performed.
[0043] Historical ship port call records were extracted and sorted from data sources. Table 1 shows some of the historical ship port call data for Jiangyin Port. The data was first cleaned and preprocessed.
[0044] Table 1. Historical data on some ports of call for vessels (Data source: ShipVision)
[0045]
[0046] S2: Feature Engineering and Data Fusion: Based on the data obtained in S1, feature engineering is constructed. Simultaneously, multi-dimensional data fusion is performed, combined with external port factors, to construct a feature set for predicting ship berth demand. The feature engineering includes ship characteristics, historical berth characteristics, and port characteristics. The external port environment includes the port operating environment and ship navigation patterns. In a specific embodiment of this invention, the historical port berthing data includes: basic ship attributes, berthing and loading / unloading task type, and berth label. The basic ship attributes include: ship type, deadweight tonnage, and length. The ship characteristics include: primary ship type, secondary ship type, length, beam, draft, deadweight tonnage, and shipowner. The historical berthing characteristics include: berth number, number of berths, and frequency of berthing at each berth. The port characteristics include: port code, number of berths, and berthing and loading / unloading tasks.
[0047] S3: Model Training and Optimization: Based on the feature engineering and ship berth demand prediction feature set constructed in S2, the XGBoost model is used for model training and optimization; the goal of the XGBoost model is to minimize the loss function, and the parameters of the model are gradually optimized through the gradient boosting algorithm. The loss function of the XGBoost model is shown in Equation (1):
[0048] (1)
[0049] in: The loss function is typically expressed using cross-entropy or mean squared error; This represents the regularization term, which controls the model complexity.
[0050] In a specific embodiment of the present invention, the XGBoost model is trained separately for each port and for multiple ship types.
[0051] S4: Real-time data input and prediction update: Collect real-time data of ships calling at ports and execute steps S1-S2; use the XGBoost model obtained in step S3 for real-time prediction, and recommend the berths with the highest matching probability based on the prediction results, and further evaluate the recommendation results to provide decision support for port berth scheduling; In a specific embodiment of the present invention, based on the XGBoost model trained in S3, combined with the characteristics of ships and real-time port berth information, the XGBoost model recommends the top 3 berths with the highest matching probability. For each ship, the XGBoost model predicts its most likely berth and its corresponding probability, and further evaluates the recommendation results to provide decision support for port berth scheduling; Specifically, the output of the XGBoost model is the ranking of the berth number and the corresponding predicted probability as shown in equation (2):
[0052] (2)
[0053] Among them, "features" refers to the characteristics of the ship. It is the predicted berth number. Let be the predicted probability of berth i.
[0054] The evaluation of the recommendation results specifically involves:
[0055] After training the XGBoost model, predictions are made on the test set and the accuracy is calculated, as shown in equation (3):
[0056] (3)
[0057] in: Represents an indicator function, when When the value is 1, it is 1; otherwise, it is 0. Considering that there may be some randomness or multiple berthing preferences when ships berth at ports, the XGBoost model will output the top 3 berths with the highest matching probability for port operators to choose from, and evaluate the accuracy of the model.
[0058] The accuracy of the evaluation model is specifically defined as follows: the accuracy of the first three matching probabilities refers to the proportion of the predicted value that contains the true value in the first three predicted values, and the evaluation method is shown in Equation (4):
[0059] (4)
[0060] in: These are the top three berths in terms of predicted probability for the i-th sample; It is an indicator function, when the true value The value is 1 if it is among the first 3 berths of the predicted value, and 0 otherwise.
[0061] For example, the image used to evaluate the accuracy of berth prediction through this model is as follows: Figure 2 As shown, Figure 2 The model accuracy for berth prediction of liquid bulk carriers in all ports is included. The distribution density image of the berth prediction model accuracy can effectively show the performance of the model for this type of ship.
[0062] In a specific embodiment of the present invention, some data on the predicted berths for ships arriving at Jiangyin Port in the next seven days are shown in Table 2. Each arriving ship includes the top three recommended berths with the highest matching probability.
[0063] Table 2. Forecast berths of vessels arriving at Jiangyin Port in the next seven days
[0064]
[0065] S5: Feedback and Model Update: During port operations, real-time feedback is provided based on actual berth usage, and the XGBoost model is continuously updated based on the actual results; the actual berth usage includes: berthing time and berth occupancy rate.
[0066] Example 2: Port Multi-Category Vessel Berth Demand Prediction and Recommendation System Based on XGBoost Model
[0067] This set of embodiments provides a port multi-category vessel berth demand prediction and recommendation system based on the XGBoost model. It includes a data source module that collects historical data on vessel berthing at ports, connected in sequence; a preprocessing module that preprocesses the data collected by the data source module and collects and processes information on vessels about to arrive at the port; a feature engineering and fusion module that constructs a vessel berth demand prediction feature set based on the data processed by the preprocessing module and simultaneously integrates multi-dimensional data fusion with external port factors; a model training and tuning module that uses the XGBoost model to train and optimize the feature engineering and vessel berth demand prediction feature set constructed by the feature engineering and fusion module; a prediction and recommendation berth module that uses the XGBoost model obtained from the model training and tuning module to make real-time predictions and recommend the berths with the highest matching probability based on the prediction results, thereby providing decision support for port berth scheduling; and a result visualization and evaluation module that provides real-time feedback based on actual berth usage during port operations, continuously updates the XGBoost model based on actual results, and displays the actual results.
[0068] In a specific embodiment of the present invention, the historical port call data of the vessel includes: basic vessel attributes, port loading and unloading task type, and port berth label; the basic vessel attributes include: vessel type, deadweight tonnage, and length; the feature engineering includes: primary vessel type, secondary vessel type, length, beam, draft, deadweight tonnage, shipowner, berth number, frequency of berthing at each berth, port code, number of berths, and port loading and unloading task.
[0069] The above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail through the above preferred embodiments, those skilled in the art should understand that various changes can be made to it in form and detail without departing from the scope defined by the claims of the present invention.
Claims
1. A method for predicting and recommending berth demand for multiple types of vessels in ports based on the XGBoost model, characterized in that, Includes the following steps: S1: Data Collection and Preprocessing: Collect historical data on ship port calls, clean the collected data, and fill in missing values; S2: Feature Engineering and Data Fusion: Based on the data obtained in S1, feature engineering is constructed. At the same time, combined with external port factors, multi-dimensional data fusion is performed to construct a feature set for predicting ship berth demand. The feature engineering includes ship characteristics, historical berthing characteristics, and port characteristics. The external port environment includes the port operation environment and ship navigation patterns. S3: Model Training and Optimization: Based on the feature engineering and ship berth demand prediction feature set constructed in S2, the XGBoost model is used for model training and optimization; S4: Real-time data input and prediction update: Collect real-time data of ships calling at ports and execute steps S1-S2; use the XGBoost model obtained in step S3 to make real-time predictions, and recommend the berths with the highest matching probability based on the prediction results, and further evaluate the recommendation results to provide decision support for port berth scheduling. S5: Feedback and Model Update: During port operations, real-time feedback is provided based on the actual berth usage, and the XGBoost model is continuously updated based on the actual results.
2. The method for predicting and recommending port berth demand for multiple types of vessels based on the XGBoost model according to claim 1, characterized in that, The historical port call data of the vessel includes: basic vessel attributes, type of cargo loading and unloading task, and port berth label; the basic vessel attributes include: vessel type, deadweight tonnage, and length.
3. The method for predicting and recommending port berth demand for multiple types of vessels based on the XGBoost model according to claim 2, characterized in that, The vessel characteristics include: vessel type 1, vessel type 2, length, beam, draft, deadweight tonnage, and owner; the historical berthing characteristics include: berth number, number of berths, and frequency of berthing at each berth; the port characteristics include: port code, berth characteristics, and cargo loading / unloading tasks.
4. The method for predicting and recommending port berth demand for multiple types of vessels based on the XGBoost model according to claim 3, characterized in that, The goal of the XGBoost model is to minimize the loss function and gradually optimize the model parameters through the gradient boosting algorithm. The loss function of the XGBoost model is shown in equation (1): (1) in: The loss function is typically expressed using cross-entropy or mean squared error; This represents the regularization term, which controls the model complexity.
5. The method for predicting and recommending port berth demand for multiple types of vessels based on the XGBoost model according to claim 4, characterized in that, Step S4 is as follows: Based on the XGBoost model trained in S3, combined with the characteristics of the ship and the real-time port berth information, the XGBoost model recommends the top 3 berths with the highest matching probability. For each ship, the XGBoost model predicts its most likely berth and its corresponding probability, and further evaluates the recommendation results, thereby providing decision support for port berth scheduling. Specifically, the output of the XGBoost model is the ranking of the berth number and the corresponding predicted probability as shown in Equation (2): (2) Among them, "features" refers to the characteristics of the ship. It is the predicted berth number. Let be the predicted probability of berth i.
6. The method for predicting and recommending port berth demand for multiple types of vessels based on the XGBoost model according to claim 5, characterized in that, The evaluation of the recommendation results described in S4 specifically includes: After training the XGBoost model, predictions are made on the test set and the accuracy is calculated, as shown in equation (3): (3) in: Represents an indicator function, when When the value is 1, it is 1; otherwise, it is 0. Considering that there may be some randomness or multiple berthing preferences when ships berth at ports, the XGBoost model will output the top 3 berths with the highest matching probability for port operators to choose from, and evaluate the accuracy of the model.
7. The method for predicting and recommending port berth demand for multiple types of vessels based on the XGBoost model according to claim 6, characterized in that, The accuracy of the evaluation model is specifically defined as follows: the accuracy of the first three matching probabilities refers to the proportion of the predicted value that contains the true value in the first three predicted values, and the evaluation method is shown in Equation (4): (4) in: These are the top three berths in terms of predicted probability for the i-th sample; It is an indicator function, when the true value The value is 1 if it is among the first 3 berths of the predicted value, and 0 otherwise.
8. The method for predicting and recommending port berth demand for multiple types of vessels based on the XGBoost model according to any one of claims 1-7, characterized in that, The actual berth usage includes: berthing time and berth occupancy rate; when training the XGBoost model, it is trained separately for each port and multiple ship types.
9. A port multi-category vessel berth demand prediction and recommendation system based on the XGBoost model, characterized in that, The system includes a data source module that collects historical data on ship port calls, connected in sequence; a preprocessing module that preprocesses the data collected by the data source module and collects and processes information on ships about to arrive at the port; a feature engineering and fusion module that constructs a feature set for predicting ship berth demand based on the data processed by the preprocessing module and simultaneously integrates multi-dimensional data fusion with external port factors; a model training and tuning module that uses the XGBoost model to train and optimize the feature engineering and ship berth demand prediction feature set constructed by the feature engineering and fusion module; a prediction and recommendation berth module that uses the XGBoost model obtained by the model training and tuning module to make real-time predictions and recommend the berths with the highest matching probability based on the prediction results, thereby providing decision support for port berth scheduling; and a result visualization and evaluation module that provides real-time feedback based on the actual berth usage during port operations, continuously updates the XGBoost model based on the actual results, and displays the actual results.
10. The port multi-category vessel berth demand prediction and recommendation system based on the XGBoost model as described in claim 9, characterized in that, The historical port call data includes: basic ship attributes, port loading / unloading task type, and port berth label; the basic ship attributes include: ship type, deadweight tonnage, and length; the feature engineering includes: ship type 1, ship type 2, length, beam, draft, deadweight tonnage, ship owner, berth number, frequency of berthing at each berth, port code, number of berths, and port loading / unloading task.