1. Introduction
To load and discharge a ship moored at a terminal, the following procedure is primarily used [
1]. First, the ship enters the port and approaches the terminal at a safe approaching speed. Second, when the ship is approaching the terminal facility, parallel to the facility, the hull comes into contact with part of the facility, such as a fender. Berthing energy is generated when the ship first makes contact with the terminal facility; it is then absorbed by the fender so that the ship can safely berth [
2]. However, if the ship exceeds the permissible berthing energy of the pier or jetty, accidents might occur, such as damage to the terminal facility and damage to the hull; thus, safety managers, such as the port manager and the ship operator, must pay close attention as the ship berths.
Design guidelines such as PIANC (the world association for waterborne transport infrastructure), British standards, EAU, and Spanish ROM propose designing the berthing energy of a terminal by applying safety margins [
3,
4,
5,
6,
7]. However, as the increasingly large-scale development of ships rapidly progresses, berthing that exceeds the berthing ability of the terminal facility frequently occurs. According to the Republic of Korea’s Ministry of Oceans and Fisheries survey, an analysis of 14 trade ports reveals that, on average, approximately 30% of ships entering and exiting ports exceed the pier design standards of said ports. In addition, the average excess rate of the ship scale was approximately 200% [
8]. For example, in October 2017, a terminal facility at the Jebel Ali Port in Dubai was destroyed as a ship exceeding the berthing ability berthed at a velocity that exceeded the port’s limitations [
9].
Ueda et al.’s study mentions that berthing velocity is the most important factor in estimating berthing energy [
10]. Therefore, the control of berthing velocity, rather than the size of ship, which has already been determined before berthing, has become more important as the berthing of large ships has increased. Because the importance of berthing velocity has been recognized, relevant research is actively being conducted. In Cho et al.’s study, a basic statistical analysis of berthing velocity was conducted that confirmed that several cases exceeding the design criteria occurred [
2]. Lee et al. confirms that the berthing velocity data follows a lognormal distribution [
1]. Robous et al. analyze the correlation between the measured values and influential factors of berthing velocity [
11]. Lee et al. analyzed the importance of the influence factor of the ship’s berth velocity using machine learning techniques [
12]. However, they focused on the design and maintenance of the terminal facilities. Little research has been conducted regarding the berthing velocity with respect to port managers and ship operators.
To prevent potential berthing accidents, it is necessary to conduct an analysis of the risk range of the ship’s berthing velocity from the perspective of the port managers and ship operators. In particular, accidents can be prevented if the risk range of the berthing velocity can be predicted in advance before the ship approaches the port. The risk range of the berthing velocity that can cause an accident includes velocities that exceed the allowable berthing velocity established in the design of the port. Ozturk et al. note that, in terms of maritime transport, risk analyses consist mainly of experts’ judgments, and that risk should be analyzed using quantitative indicators [
13]. In particular, Paltrinieri et al. present machine learning methods to quantitatively assess risk in safety-critical industries [
14]; Shenping et al. also conducted risk assessment studies using machine learning in relation to the maritime field [
15].
Therefore, this study develops a machine learning strategy for predicting the risk range of an unsafe berthing velocity when a ship approaches a port. The algorithm uses nine methods of supervised machine learning classification. To construct models, the input parameters were based on the factors affecting the berthing velocity in PIANC WG (Working Group) 145 [
16]. Berthing velocity corresponding to the output parameter was measured at a tanker terminal in the Republic of Korea. The machine learning algorithm, which has good performance in all evaluation models, was adopted to predict and classify the risk range of the berthing velocity.
2. Materials and Methods
The methodology of this study is illustrated in
Figure 1. First, the ship’s berthing velocity and risk range were defined and measured. Data was collected based on factors affecting the berthing velocity mentioned by PIANC WG145 [
16]. Using the collected data, a basic statistical analysis was performed, and the data was preprocessed so it could be applied to machine learning algorithms. We applied machine learning classification algorithms and compared and evaluated them to enable the selection of models with good performance.
2.1. Berthing Velocity
2.1.1. Definition of Berthing Velocity
Figure 2 illustrates a ship’s berthing process. When the ship comes into contact with the terminal facility, berthing energy is generated. Equation (1), which is based on kinetic energy, can be used to calculate berthing energy. The parameters of berthing energy
consist of the ship mass
(tonnes), the berthing velocity
(cm / s), the eccentricity coefficient
, the mass coefficient
, the softness factor
, and the berth configuration factor
[
1,
2,
3].
The most important factor of the parameters for calculating
is the squared value of berthing velocity, which is defined as the velocity when the ship first comes into contact with the terminal facility. In particular, because the berthing velocity is a factor that can be adjusted, it can be considered the most important factor in preventing berthing accidents. Berthing velocity is determined by numerous factors [
2]; those pertaining to PIANC WG145 are shown in
Table 1 [
16].
2.1.2. Measured Data
The berthing velocity measurement used in the analysis was obtained in a tanker terminal in the Republic of Korea composed of three jetties. The designed berthing velocity for each jetty was 12, 15, and 15 cm/s. According to the terminal’s operating regulations, critical velocity is set. If a tanker violates the regulations, it will be blacklisted and held accountable when damage is applied to the terminal facility [
17]. A photograph and particulars of tanker terminal is shown in
Figure 3 and
Table 2, respectively.
The device used to measure the berthing velocity was a fixed laser-type docking aid system (DAS). A laser DAS measures the distance as time changed from the wharf to the ship’s hull, as shown in
Figure 4 [
18], and then calculates the berthing velocity. In this study, 426 berthing velocities were measured using a DAS from March 2017 to November 2019. Especially in the Republic of Korea, the ”Act on the arrival, departure, etc. of ships,” emphasizes the safe berthing of ships by establishing the provision that safety equipment such as DAS should be installed on docks that are used to handle dangerous cargo [
19].
2.1.3. Safety Management of Berthing Velocity
Before analyzing the berthing velocity, it is necessary to understand Brolsma’s curve, which provides guidance with respect to the berthing velocity [
20]. It is a graph that depicts the appropriate berthing velocity according to ship size by dividing berthing velocity into five nautical conditions. The terminal measuring the berthing velocity in this study is a representative Korean port that is sheltered from the open sea, and it has difficult docking conditions; thus, it corresponds to the “difficult, sheltered” segment of Brolsma’s curve. An evaluation of the data obtained from 426 ships confirms that several cases exceeded the applicable criteria. This data is demonstrated in the graph shown in
Figure 5.
In particular, according to
Table 2, in this terminal, the berthing velocity is defined as the operated velocity and the designed velocity, is also mentioned. However, even when the terminal’s regulation was applied, it was confirmed that many ships berth with an excessive berthing velocity. In the operated velocity, 166 ships which docked at critical velocity were identified. Moreover, 11 ships exceeded the designated velocity of the jetties (10 Jetty No. 1, 10 No. 2, and 3 No. 3). This indicates that a significant number of ships are in danger of causing accidents, and it can be seen that ship operators and port managers need safety management measures to prevent accidents. In this study, the berthing velocity as the output parameter was classified as either “Safety”, “Warning,” and “Critical” according to the regulations enforced at this terminal, and the risk range is defined as “Critical”.
2.2. Data Acquisition and Statistics
The factors affecting the berthing velocity mentioned in PIANC WG145 were set as the input parameters, and data was collected as shown in
Table 1 [
21,
22,
23,
24]. In the case of the “closed/open quay/jetty” variable, the jetty that measures the berthing velocity is set as the closed jetty, so Jetty 1, Jetty 2, and Jetty 3 representing the jetty of the berthing have been replaced. In the case of the “human” variable, they were classified as a class representing the pilot’s experience. Regarding “ship type,” the terminal is a tanker terminal, and the type of ship is fixed. State and DWT data indicating the cargo loading conditions and the sizes of the ships were collected. “Berthing maneuver” is an element indicating whether the ship was affected by berthing as a result of external force or as a result of bringing the ship alongside the dock using only tugs and an engine. In this study, the MaxAngle data was collected using the maximum berthing angle. “Equipment/tugs” is the sum of the horse powers of the tugs used. The wind speed and significant wave height were investigated to obtain the “Effect wind” and “Effect wave” data, respectively. In the case of “Current,” this pier was a closed jetty, so it was excluded because the current itself had little effect. Also, according to terminal regulation, the allowable maximum tidal current speed is 0.5 knots or less when the ship is berthing [
17]. Therefore, the ship in this terminal is allowed to berth under the negligible current influence. Lastly, “Berthing aids” was used to measure the maximum berthing angle value and the dependent parameter berthing velocity.
Table 3 shows a summary of the variables.
Thus, the data about Jetty No. and MaxAngle could be collected through DAS, which measured the berthing velocity. State and DWT were obtained using Port-MIS (Port Management Information System) operated by the Ministry of Oceans and Fisheries in the Republic of Korea [
22]. Pilot and Tug H.P. are referred to the harbor pilot’s associations in the port [
23]. Finally, for the Wind and Wave variables, the data from the nearest sea buoy to the jetty was referenced [
24].
Based on the collected data, data object and attribute type, basic statistical descriptions of data, data visualization, and correlation analysis were performed. Through this process, it was possible to grasp the basic properties of the data necessary to classify berthing velocity; the process was also useful for data preprocessing [
25]. Furthermore, by analyzing the correlation between the input and output parameters, we attempted to improve the performance of the final model by excluding certain variables. In this way, selected variables and basic statistics can be used to check characteristics of variables to be used before building a machine learning model.
2.3. Data Preprocessing
Data preprocessing is the process of transforming data into a form suitable for analysis so that it can be applied to machine learning models. This is a necessary process of data analysis; specifically, the initial data must be processed to improve the performance of the machine learning models [
26]. In this study, to improve the performance of predicting the risk range of berthing velocity, data was processed using missing value processing, scaling, sampling, and one-hot encoding.
2.3.1. Missing Values
When collecting data, missing values occur due to inevitable circumstances such as mechanical error. Primarily, a measure of central tendency is used for the substitute (e.g., the mean or median) to determine the missing value [
27]. For normal (symmetric) data distributions, the mean can be used, while the median should be employed for skewed data distributions.
2.3.2. Scaling
Scaling is the process of standardizing data units. Multi-dimensional data should be standardized and analyzed so that, in the analysis results, there are no errors that might have occurred due to differences in data units [
28]. When the data shows normality, standardization by variance and standard deviation is used, and when a non-normal distribution is used, min–max normalization and robust normalization are used.
In this study, continuous data was preprocessed through robust normalization. The robust method is presented in Equation (2) and uses an interquartile range (IQR,
and median (
). This method is advantageous in that, compared with other techniques, it minimizes the influence of outliers.
2.3.3. Sampling
Sampling is used to reduce errors and improve the performance of classification algorithms using unbalanced datasets. If an unbalanced dataset is used, the original abnormal value may be incorrectly classified as a normal value. Therefore, in this study, the synthetic minority over-sampling technique (SMOTE), which is a general method of over-sampling the minority (abnormal) class, was used [
29].
SMOTE is based on the theory that the feature spaces of minority class instances are similar to one another. For each instance
in a minority class, SMOTE searches its
-nearest neighbors (KNNs), and one neighbor is randomly selected as
(instances
and
are referred to as seed samples). Then, a random number between [0, 1]
is generated. The new artificial sample
is calculated as [
29]:
2.3.4. One-Hot Encoding
One-hot encoding, referred to as a temporary variable, is a method of displaying categorical variables as binary vectors, as shown in
Figure 6. In other words, the categorical variable is marked as 0 for all items that do not correspond to the enumeration; for corresponding items, the variable is marked as 1 [
30]. This is to prevent the categorical variable from being recognized as a continuous variable when applying the algorithm. In this study, this method was applied to Jetty No., State, and Pilot corresponding to categorical variables.
2.4. Cross Validation
In this study, the k-fold method was used as a cross-validation method in which all of the data is randomly divided into k pieces, as shown in
Figure 7. One sample was used as validation data, and the remaining k-1 samples were used as training data [
31]. This method was used in this study because it improves the accuracy of datasets with a small number of data samples.
2.5. Machine Learning Algorithms
All modeling methodologies presented below are methodologies related to classification analysis. The models used in this study correspond to multiclass classification [
32]; nine algorithms were used.
2.5.1. Decision Tree Classifier
Decision tree classifier (DTC) is an algorithm that uses node segmentation and pruning to predict and classify the input values [
33]. There are various algorithms that employ node division criteria, one of the most common techniques being a classification and regression tree (CART) [
34]. This is a method of binary splitting when dividing from a node. The tree splitting method used in this algorithm is the Gini index [
35]. The Gini index is measure of how often data are misclassified. When the total data (
is separated based on an arbitrary
region, it is the multiplication of the ratio
of the class belonging to the category ‘
’ and the ratio
that does not belong to the aforementioned category. The equation is as follows:
2.5.2. Ensemble Methods using Random Forest, Bagging, Extra Trees and Boosting Classifier
The basic concept of ensemble methods is to derive a predictive model by combining several simple models based on boosting and bagging. Four classification models related to ensemble methods were used in this study: a random forest classifier (RFC), bagging, an extra trees classifier (ETC), and a gradient boosting classifier (GBC).
Random forest is a method of learning a model in the form of a forest by many decision trees [
36]. The method of constructing the forest is based on bagging (bootstrap aggregating), in which several different train datasets are created, trained, and combined through bootstrapping. A random forest randomly generates each decision tree (
) divided into b
such as
. The ensemble learning that classifies the most voted class among
, which is the predicted value of several trees generated by bagging, is expressed as Equation (5). Extra (i.e., extremely randomized) trees are algorithms that are added in a randomized step as an extended algorithm in the random forest method [
37]. However, the difference from random forest (
is that each tree uses the entire train dataset, not the bootstrap sample.
Boosting is a method in which multiple weak classifiers are gathered to create a strong classifier. That is, weak classifiers are supplemented step by step, and weight is applied to transform them into one strong classifier. In particular, gradient boosting (GBC) generalizes the model by optimizing arbitrary differentiable loss functions as a weight [
38].
2.5.3. Gaussian Naive Bayes Classifier
Gaussian naive Bayes (GNB) is based on Bayesian estimation, which is a method of inferring posterior probability through the subject’s prior probability and additional information. It is especially appropriate when the dimension
of the feature space is large. In this study, The naive Bayes model
assumes that given a class
, the features
(k point nearest to X) are independent [
39]:
2.5.4. K-Nearest Neighbors Classifier
K-nearest neighbors (KNN) is a method wherein the data of KNNs is grouped into a single major category. The constant k is defined by the user, and when the training sample is
, let
be a reordering of {1,…,m}; for
, it is defined by Equation (7) [
40]:
2.5.5. Support Vector Machine
A support vector machine (SVM) is a non-stochastic linear and nonlinear classification model that, based on the given data, determines to which category new data belongs [
41]. In other words, by learning the distance between each piece of data in two groups and finding the center point, SVM learns how to divide the group by obtaining the optimal hyperplane from the center. Here, if data can be divided into a straight line, a linear classification model is applied; if it cannot be divided into a straight line, a nonlinear classification model is used.
2.5.6. Multi-Layer Perceptron Classifier
A multi-layer perceptron (MLP), also known as a neural network, is a computational model inspired by the neural network structure of the brain [
42]. It has the advantage of being able to conclude complex and unrelated datasets. The structure of the MLP consists of an input layer for receiving data, an output layer for classifying and predicting data, and a hidden layer that calculates the data. The MLP of this study uses a feedforward method, where the value transmitted from the input layer is transferred to the hidden layer, and the calculated value is transferred to the output layer and then classified into three output values.
2.6. Evaluation Methods
The machine learning classification algorithm is evaluated based on the confusion matrix [
35]. The evaluation measures used in this study—accuracy, recall, and precision—are shown in
Figure 8. The evaluation method that can be used considering both recall and precision is the F1 score, which is calculated as follows:
The receiver operating characteristic (ROC) curve consists of a true positive rate (TPR) that corresponds to recall and a false positive rate (FPR), calculated as 1-specificity [
43]. The area under the ROC curve is referred to as the area under the curve (AUC), and it is as demonstrated in Equation (9) when TPR (T):
and FPR (T):
:
In this study, multiclass evaluation is performed because the output parameters are classified into three categories: “Safety”, “Warning”, and “Critical”. In multiclass evaluation, two types of means are used to extract a single number. The first is macro averaging, i.e., computing the metric independently for each class and then computing the average. The second calculates the measure based on the sum of the numerator and denominator, i.e., micro averaging, and is useful to create a bias toward a large number of classes.
3. Results
3.1. Data Statistics and Preprocessing
After the data acquisition is complete, a basic statistical analysis of the collected data is conducted. According to the analysis results, data preprocessing was performed on meaningful variables.
3.1.1. Categorical Variables
Figure 9 and
Table 4 show the analysis results of variables corresponding to berthing velocity and categorical variables, respectively. According to the results, 19.5% of the ships that docked had a berthing velocity that was classified as “Critical”. In addition, it can be seen that 11.7%, 29.9%, and 16.8% of the ships docking in Jetty 1, Jetty 2, and Jetty 3, respectively, have “Critical” velocities. In case of State, the ratio of critical velocity was 31.3% (Ballast), 15.3% (Half), and 10.9% (Laden), respectively. Pilots exhibited critical velocity ratios of 17.9% (1st), 23.1% (2nd), 27.8% (3rd), and 26.5% (4th). Therefore, Jetty 2, Ballast, and 3rd class Pilot have the highest critical velocity ratio among the three categorical variables.
Table 5 shows the correlation between the dependent and categorical independent variables; the Pilot variable has a p-value of 0.748, which is not significant. It judged that the propensity and competence of the pilot rather than the pilot’s experience have a greater effect on the berthing velocity. Therefore, to improve the performance of machine learning algorithms, the Pilot variable was excluded, and the Jetty No. and State variables were preprocessed using one-hot encoding.
3.1.2. Continuous Variables
Table 6 shows the descriptive statistics of the continuous variables, and the results of the normality test are given in
Table 7; none of the variables were normal. Therefore, if there is a missing value, such as Tug H.P., Wind, or Wave, it is processed as a median value. Robust normalization of all continuous variables is applied to data scaling.
Figure 10 is a visualization of the continuous dataset.
Table 8 shows the correlation between continuous variables. In particular, according to
Table 8, the correlation coefficient between the dependent variable Berthing Velocity and the independent variable are −0.11 (DWT), 0.13 (MaxAngle), −0.12 (Tug H.P.), −0.01 (Wind), and −0.01 (Wave), respectively. Accordingly, Wind and Wave variables with low correlation indices and dependent variables were excluded from the construction of the machine learning model. This increases or decreases the tug pushing force depending on the weather, or the ship operator performs berthing more carefully when the weather worsens. Therefore, it seems that the weather parameters and berthing velocity are not related in this terminal.
3.2. Sampling and Cross Validation
To improve the performance of machine learning classification, the analysis excluded Pilot, Wind, and Wave. However, the data divided into Safety (110), Warning (233), and Critical (83) of this study have a problem of imbalance. Due to this, the original abnormal value may be incorrectly classified as a normal value. Therefore, sampling was performed using the SMOTE technique as shown in
Table 9. The sampled dataset using the SMOTE technique was divided into a train dataset and test dataset by 8:2 (559:140). To obtain consistent results for model performance, the results were averaged after 10-fold cross validation was performed on the train dataset. The 10-fold train dataset consists of 9 folds with 59 data and the other 1 fold with 58 data.
Therefore, the dataset that has completed all preprocessing is applied to the machine learning model through 10-fold method cross validation.
3.3. Application of Machine Learning Algorithms
Each machine learning classification model was trained using Scikit-learn [
44] hyperparameters. The results are shown in
Figure 11 and
Table 10.
Most models had an accuracy greater than 50%. The extra trees classifier showed the highest accuracy value at 0.6495, and the random forest, bagging, and gradient boosting classifier, in turn, gave good results of over 60%. The F1-score value that considers both recall and precision values was the best performance model with ETC (macro: 0.6349, micro: 0.6495), RFC (0.6245, 0.6351), bagging (0.6050, 0.6153), and GBC (0.5960, 0.6079). Therefore, ensemble methods corresponding to ETC, RFC, bagging, and GBC best classify into three ranges of berthing velocity: “Safety”, “Warning’ and “Critical”.
4. Discussion
This study proposed an algorithm to predict the risk range of a ship’s unsafe berthing velocity. This study does not focus on the safe berthing velocity as it relates to the design of the pier [
1,
2,
3,
11]; rather, it centers on ship operators and port managers. In addition, it is more advantageous to use the machine learning technique, which is a quantitative evaluation method, rather than factors such as the opinions of experts as a safety management method [
14,
15].
The risk classification algorithm of berthing velocity showed accuracy and F1 scores greater than 60% when using ETC, RFC, bagging, and GBC along with ensemble methods. The average AUC value corresponding to velocity classified as “Critical” was 0.6744, and the risk associated with “Critical” berthing velocity was better classified than velocities classified as “Safety” or “Warning.” In particular, despite the lowest accuracy value, macro F1 score, and micro F1 score of 0.6077, 0.5960, and 0.6079, respectively, that were obtained with GBC, the classification performance of “Critical” velocity was high at 0.7578. Therefore, regarding safety management, if ensemble methods are used to construct a classification algorithm used to determine the risk range associated with berthing velocity, the ship operator and port manager can predict the risk of berthing velocity prior to docking and thus prevent accidents.
To prevent accidents from the viewpoint of the purpose of this study, namely risk management of berthing velocity, it is necessary to accurately classify and predict “Critical” velocity. In the previous section, a model was selected for classifying measured berthing velocity into three risk ranges, and predicting said velocity. Moreover, AUC was calculated by entering a test dataset using ensemble methods to examine the classification performance of “Critical” velocity. According to
Table 11 and
Figure 12, it was found that the performance of classifying “Critical” velocity (class 2) was higher than that of “Safety” and “Warning” in AUC of four models (0.6742, 0.6190, 0.6465, and 0.7578), respectively. Therefore, it can be said that the ensemble methods selected in this study are suitable for classifying and predicting the risk associated with berthing velocity.
As described above, the results of this study can classify and predict critical velocity, which is a dangerous range when ship berthing, through the ensemble method. Through this, the practical aspect of the paper is as follows. First, it is possible to provide a program for classifying and predicting berthing velocities based on ensemble methods, to assist ship operators such as navigators and pilots. It is a method to help to adjust the berthing velocity in advance by providing the range of expected berthing velocities based on the data corresponding to the input parameters used in the study: Jetty No., State, DWT, MaxAngle, and Tug H.P. For example, if the range of berthing velocity output through the input data held at the time the ship enters the port indicates the "Critical" category, berthing can be done with more care. Second, it can be used in the port to manage the berthing of the ship, to predict and classify the danger range of berthing velocity through input parameters provided by the ship. This allows the port manager to warn the vessel when berthing into a critical range category while monitoring the velocity in real-time using the DAS. Third, this result is only for the terminal used in this study, but it can be changed and applied in the same way as this analysis method through data measured in other ports.
This study does have limitations, however. One is that the performance of the risk classification algorithm is not as high as 60%. This means that the rate of error is approximately 40%. To build a more accurate algorithm, data must be accumulated from more than 426 samples. In addition, the data analyzed in this study is limited to a terminal in Korea, and tankers were the only type of ship from which the data was collected. Therefore, it is necessary to collect berthing velocity data of various types of ship from various terminals.