Ship Detention Situation Prediction via Optimized Analytic Hierarchy Process and Naı̈ve Bayes Model

Ship detention serves as an obligatory but efficient manner in port state control (PSC) inspection, and accurate ship detention prediction provides early warning information for maritime traffic participants. Previous studies mainly focused on exploiting the relationship between ship factors (i.e., ship age and ship type) and PSC inspection reports. Less attention was paid to identify and predict the correlation between ship fatal deficiency and ship detention event. To address the issue, we propose a novel framework to identify crucial ship deficiency types with an optimized analytic hierarchy process (AHP)model./en, the Naı̈ve Bayes model is introduced to predict the ship detention probability considering weights of the identified crucial ship deficiency types. Finally, we evaluate our proposed model performance on the empirical PSC inspection dataset. /e research findings can help PSC officials easily determine main ship deficiencies, and thus, less time cost is required for implementing the PSC inspection procedure. In that manner, the PSC officials can quickly make ship detention decision and thus enhance maritime traffic safety.


Introduction
Port state control (PSC) inspection aims at identifying various potential maritime traffic safety risks, and thus, the ships with fatal deficiencies are detained to avoid potential maritime traffic accidents [1,2]. With the help of professional judgement, the PSC officials make ship detention decisions considering various observed ship technical deficiencies. Shipping company is forced to completely correct the deficiencies for the detained ship, which are identified in the PSC inspection reports. Both the PSC officials and shipping company hope to accurately determine ship deficiency, and thus, further measurements will be taken to improve maritime traffic safety and efficiency [3][4][5].
ough the PSC regime may vary in different countries, the PSC inspection regimes share the following points [6,7]: (1) PSC officials inspect ships at lower risk with a larger time interval (i.e., fatal deficiency to be found from the ships with lower probability), and vice versa; (2) the PSC inspection procedure focuses on various factors (e.g., deficiency types, flag state, ship classification society, and shipowner), which may impose a potential but significant threat to maritime traffic safety [8,9]. e ship detention decision is made after thoroughly inspecting the ship, which considers the weights of various observed deficiency factors. e empirical PSC inspection practice indicates that exploiting the close relationship between crucial deficiencies and ship detention can provide guidelines for quickly making ship detention decision. Our study aims to efficiently and accurately exploit the relationship, which can help maritime traffic participants (e.g., PSC officials and shipping owners) predict ship detention probability in real-world applications.
Many researchers focused on identifying the key factors, which impose important influences on ship detention decision [10][11][12][13][14][15]. More specifically, they attempted to exploit the correlation between the critical factors (i.e., ship age, ship type, and number of deficiencies) and ship detention rate from large-scale PSC inspection data, which were then used to estimate navigation risk level, probability of maritime incident, and ship detention rate. Hänninen and Kujala proposed two alternative Bayesian network algorithms as model construction, which indicated that ship type, number of deficiencies, and PSC inspection mechanism are the most important factors involving ship detention, maritime accident, etc. [16]. Yang et al. proposed a data-driven Bayesian networkbased approach to analyze risk factors (e.g., number of deficiency types, inspection type, recognized organization, and ship age) influencing PSC inspection results and predict the ship detention probability under different situations using bulk carrier dataset [4]. After that, Yang et al. introduced company performance factor into the Bayesian network model to generate the comprehensive detention rate function and then established the game model between the port authorities and ship owners [17]. Fan et al. established a Bayesian network model to investigate the factor impacts on ship navigation risk level and ship detention under different ship type dataset [18]. Şanlıer analyzed the observed deficiencies of ships from detention records and found the main factors (ship age, ship type, flag state, etc.) [19]. Xiao et al. applied a decision tree to conduct multifactor decision-making analysis and proposed a binary logistic regression to analyze detention decision under new inspection regime (NIR), and the results indicated that the ship age is the most important factor resulting in ship detention [20]. Similar results are obtained in [21][22][23][24][25][26].
A few studies tried to analyze the intrinsic correlation between ship deficiency and ship detention and established prediction mechanism of ship detention probability, which provide the basis for decision-maker of PSC inspection for the purpose of preventing maritime traffic incident. Knapp et al. proposed a logistic regression model to identify deficiency and ship factors influenced the inspection results and explore the differences in ship detention [27]. Chen et al. proposed a grey rational analysis model with improved entropy weight to identify key factors (i.e., deficiencies) from ship detention cases and put forward suggestions and countermeasures to reduce ship detention rate [28]. Knapp and Chen only considered deficiencies (the number of deficiencies is not large) as key factors of PSC inspection results and determined the influence degree of factors. But they failed to propose a prediction mechanism that can accurately predict ship detention situation. In sum, previous research studies mainly focused on exploring the correlation between ship factors and ship detention and established the ship detention rate prediction mechanism.
We tried to exploit intrinsic ship deficiency correlations by analyzing ship detention cases from PSC inspection data [29]. But it is important to predict ship detention incident for the purpose of enhancing maritime traffic safety and efficiency. To that aim, we proposed a novel framework to identify crucial ship deficiency types with an optimized AHP model and Naïve Bayes model, which was further employed to measure the occurrence probability of ship detention incident.
Our contributions can be summarized as follows: (1) we analyzed the weakness of the current PSC inspection methods in the real-world applications from the perspective of quantitative measurements; (2) to address the issue, we proposed a hybrid framework with Naïve Bayes model and an optimized AHP model to transform the empirical PSC knowledge into common rules (with the help of historical ship detention cases); (3) we verified the proposed framework performance via the empirical PSC inspection data, which were implemented in both qualitative and quantitative manners. e remainder of the paper is organized as follows. Section 2 introduces optimized AHP, Naïve Bayes model, and performance metrics in detail. Section 3 describes the data source and discusses the deficiency selection results and prediction results. Section 4 briefly concludes this study and provides potential future research directions.

Methodology
In this study, an optimized AHP method is proposed to implement the target of selecting thirty deficiencies, and two types of Naïve Bayes model are further employed to accomplish the prediction of ship detention situation based on selection deficiencies dataset at different ship types. e workflow for the proposed framework is shown in Figure 1.

Optimized Analytic Hierarchy Process.
e analytic hierarchy process (AHP) is a popular model in tackling multiobjective decision-making task, which is implemented with matrix operations and fuzzy quantification of qualitative indicators to determine the weight of elements. AHP has been widely used in the field of decision-making [30,31], risk assessment [32,33], etc. e AHP model selects crucial deficiency subcategories which are explained in detail as follows.

Establishment of Hierarchical Structure.
e hierarchical structure of AHP consists of three hierarchies which are target hierarchy, criterion hierarchy, and project hierarchy (as shown in Figure 2). We aim to select deficiency subcategories, which play the most important role leading to ship detention. e parent ship deficiency category and deficiency subcategory (except the other deficiencies) can be set as criterion hierarchy and project hierarchy, respectively. In criterion hierarchy, the number with two digits is the code of parent deficiency category and the number with five digits is the code of deficiency subcategory in project hierarchy.

Constructing Judgement Matrix.
Constructing judgement matrix is the key procedure of the AHP model, and the process is entrusting a number to every element by comparing the influence of factors at the same hierarchy and previous hierarchy. e judgement matrix can be expressed as follows: · · · a n a 1 · · · a n a 2 ⋮ ⋮ a 1 a n a 2 a n ⋱ ⋮ · · · a n a n where a i , i � 1, 2, · · · , n; 1 ≤ a i ≤ 9 is the assigned number. Note that the smaller the value, the greater the influence of this factor. Parameter A is a reciprocal judgement matrix. Generally speaking, the number of factors at the same hierarchy and previous hierarchy is equal to or smaller than 9, and the comparing process is affected by human subjective factors. It may cause difficulty in determining ship deficiency level due to superfluous factors and excessive perceptual factors. To this end, we quantify the parameter a i and then generate the judgement matrix A based on the probability of deficiency from the experimental dataset. e formula for calculating the probability of element is presented as follows: where f(d) represents the probability of element, N i (d) is the number of times deficiency appears in the PSC inspection dataset, and T d represents the number of PSC inspected ships. e pseudocode for the proposed quantification method is shown in Algorithm 1.

Weight Calculation.
e weight calculation procedure is to obtain the judgement matrix, where the eigenvector W (corresponding to the maximum eigenvalue λ max ) is the weight. It indicates the importance of this hierarchy of elements to the previous hierarchy of element. e expression for weight calculation can be shown as follows: where W � (w 1 , w 2 , · · · , w n ) represents the weight of criterion hierarchy for target hierarchy, W � (w i1 , w i2 , · · · , w im ) is the weight of project hierarchy for element i in criterion hierarchy. For the final element selection, the combined weight C j demands to calculate, which represents the importance of project hierarchy elements for target hierarchy, and the calculation formula can be expressed as follows: e performance of the model needs to be verified after model establishment, and consistency check is required for the AHP model. e consistency index (CI) and consistency ratio (CR) are used to verify whether the judgement matrix meets consistency criterion. e formulas of CI and CR are shown as follows: when CR < 0.10, the consistency of the judgement matrix is acceptable; otherwise, the judgement matrix should be modified appropriately. RI represents the mean random consistency index, and the value can be generated by randomly constructing 10000 sample matrices: construct the positive reciprocal matrix by randomly extracting numbers from 1 to 9 and its reciprocal, obtain the average value of maximum eigenvalue λ max ′ , and define where N means the order of the matrix. e python code for calculating different orders of RI is available at https:// github.com/shubowu/RI-of-AHP, and the result of different orders of RI is shown in Table 1. However, for the target of selecting thirty deficiency categories based on the combined weight, the random consistency check for combined weight should be verified as follows:

Naïve Bayes Model.
Naïve Bayes is a classification method based on Bayes' theorem and feature condition assumptions and it is widely used in different applications such as data prediction [34,35], classification [36,37], and data mining [38,39]. Naïve Bayes model assumes that all attributes are independent of each other. More specifically, each attribute independently affects the classification results.

Bayesian Inference.
For a given training dataset, X � (x 1 , x 2 , · · · , x s ) represents attributes and contains s-dimensional features (i.e., thirty deficiency subcategories), Y � (c 1 , c 2 , · · · , c k ) is the collection of class tags and contains k categories (i.e., detention result). e expression for Bayes' theorem can be represented as follows: where P(X) � s i�1 P(x i | c)P(c), in which P(c) is the prior probability and can be calculated based on the dataset. For the attribute conditional independence assumption of Naïve Bayes, conditional probability P(x | y) can be transformed as equation (10). And then, we substitute equation (9) into equation (10), and thus, equation (11) is obtained. e Naïve Bayes model is expressed in equation (12):

Estimation of P(y) and P(x i | y).
e training process of the Naïve Bayes model is to estimate a priori probability P(y) and condition probability P(x i |y) for each category based on the given training dataset. Considering the characteristic of independent identical distribution of sample data, the estimation of a priori probability P(y) can be expressed as follows: where |D y | means the number of samples of category y in the given training dataset and |D t | is the number of training data samples. e discrete attribute is assigned with discrete values, which are 0 and 1, respectively. Moreover, the value 0 indicates that the deficiency does not exist in the ship (or PSC officer does not observe such deficiency during the inspection procedure). e value 1 indicates that the deficiency is found in the ship by the PSC officer. e estimation of condition probability P(x i |y) can be represented as follows: where |D y,x i | is the number of values in x i of ith attribute in the collection D y . However, the information carried by other attributes may be lost by attributes that are not present in the training dataset due to insufficient data. To this end, Laplacian correction is utilized to smooth a priori probability and condition probability during the estimation process and the correction formulas are shown as follows: 4 Mathematical Problems in Engineering where M is the number of categories in the training dataset and M i represents the number of values of the ith attribute.

Performance Metrics.
e detention prediction process using the Naïve Bayes model can be regarded as binary classification, and three evaluation metrics including accuracy (Acc), precision (P), and recall (R) are adopted to evaluate the model prediction performance. e statistical indicators of Acc, P, and R are shown as follows: where d is the number of validation datasets, II(·) is the indicator function, y i and f(x i ) are the actual value of the element and its estimator, is true negative and TP + FP + FN + TN � d. For comprehensively considering the performance of precision and recall and evaluating the performance of models, many times (t � 50) of experiment were implemented and macroscopic harmonic mean (MacF) and microscopic harmonic mean (MicF) are utilized to substitute for precision and recall to evaluate the model prediction performance, respectively. e formulas can be expressed as follows: where parameter β > 0 measures the relative importance of recall to precision, and β � 1.2 was set in this study. MacP, MacR, MicP, and MicR can be calculated using the following equations:

Experiments
In this section, we aim to predict the detention situation based on the deficiency of ships in the PSC inspection process. Since there are many ship deficiency subcategories (i.e., 568 types of deficiency subcategories in the raw PSC inspection data), it is possible to obtain unsatisfied prediction accuracy due to trivial deficiency Input: PSC inspection dataset Output: judgement matrix A n is the number of elements at the same hierarchy and previous hierarchy. I j , j � 1, · · · 9, represents the rank of intervals from large to small. Calculate the probability of elements (deficiencies) using equation (2 Mathematical Problems in Engineering interference. To address the issue, we employed an optimized AHP model to select crucial deficiency subcategories, which are supposed to play important roles in making detention decisions of ships. For the purpose of model performance evaluation, multinomial Naïve Bayes (MNB) and Bernoulli Naïve Bayes (BNB) are adopted to predict the detention situation based on the selection deficiency subcategories.

Dataset.
We collected PSC data samples from the empirical Asia-Pacific PSC inspection data within five years (i.e., from January 2014 to December 2018). We have collected 10322 PSC inspection samples, and each data sample includes both fundamental ship information and ship deficiency types. More specifically, the fundamental ship information contains ship name, ship type, flag, detention state, number of deficiencies, etc. We have collected 568 types of ship deficiencies, and each ship deficiency is denoted as 0 or 1. More specifically, the ship deficiency is observed in the PSC inspection sample when the attribute value is assigned to 1, and vice versa.

Deficiency Subcategory Selection Analysis.
e judgement matrices for the target hierarchy and criterion hierarchy were provided to further unveil the AHP modeling results. More specifically, Table 2 shows the judgement matrix for the target hierarchy. Table 3 shows the judgement matrix for the criterion hierarchy with cargo operations including equipment deficiency (code ID is 06), and Table 4 represents the judgement matrix for the criterion hierarchy with ISPS deficiency (code ID is 16). e parent ship deficiency types were classified as the basic elements for the criterion hierarchy elements, and the corresponding weights are shown in Table 5. It is noted that the deficiency item of certificate and documentation was assigned with a significantly larger weight (i.e., 0.3215) compared to other ship deficiency types. Such statistics indicated that ship crew without qualified certificates can directly result in ship detention, which is consistent with the real-world PSC inspection experience. Moreover, ships loading with dangerous goods may be detained, and the factor is assigned with weight 0.0357. Table 6 shows the results with λ max , CI, RI, CR, and check result of single hierarchy consistency check for each hierarchy. e result of hierarchy consistency check for the overall consistency check is acceptable (combined with the result (CR T � 0 < 0.1) of total hierarchy consistency check). From the perspective of CR indicator, the judgement matrices have satisfied consistency check criterion considering that each CR is smaller than 0.1. Additionally, each CR is smaller than 0.1, which confirmed the above analysis. e RI indicator ranges from 1.2241 to 1.7056, which indicated that the mean random consistency varied in a small interval. Table 7 presents specific ship deficiencies which are supposed to be carefully inspected by PSC officials in practice (i.e., such deficiency can obviously result in ship detention case). It is noted that both seafarers' employment agreement (code ID is 01220) and endorsement by flag state (code ID is 01214) are assigned with larger weights in the optimized AHP model, which are both 0.0829. More specifically, PSC officer is likely to make a ship detention decision when they observe such deficiencies. e lifebuoy relevant issues are considered as another type of critical ship deficiency which affects ship detention decision. By interviewing with many experienced captains and PSC officer, the determined ship type deficiency and the assigned weights are consistent with the real world, and thus, the results can facilitate the PSC inspection procedure.

Performance of Ship Detention Prediction.
After the deficiency subcategory selection (i.e., influence factor reduction) with the optimized AHP model, the Naïve Bayes models (i.e., MNB and BNB) and hybrid Naïve Bayes model (i.e., MNB and BNB combined with optimized AHP, respectively) were employed to predict the detention situation of ships by using different ship types (i.e., general cargo/multipurpose ship with 3849 samples and bulk carrier with 2260 samples) data collected from the PSC inspection dataset. Note that 70% of samples were selected randomly as the training dataset, and the remaining 30% were used as the validation dataset. We implement the experiment in fifty times and three performance metrics (i.e., Acc, MacroF, and MicroF) are adopted to measure the model prediction performance and stability.
From the perspective of accuracy (see Figure 3), the distribution curves showed ups and downs with poor fluctuation. In general, reasonable prediction results were obtained and the results of a hybrid model combining Naïve Bayes model and optimized AHP showed better than the Naïve Bayes model without deficiency selection scheme. e main reason is that the deficiency selection procedure removed most of the inconsequential deficiency subcategories which will decrease the prediction accuracy. Comparing the prediction performance of two types of Naïve Bayes model, the results of the MNB model are significantly better than those of the BNB model (the mean of accuracy is 0.8946 and 0.8784 in general cargo/multipurpose ship, and 0.9290 and 0.9189 in bulk carrier, respectively).
It indicated that the distribution tendency of PSC inspection data is more similar to the MNB model and obtains satisfactory training performance. Additionally, we found that the model performance of bulk carrier outperforms that of general cargo/multipurpose ship. As shown in Table 8

Conclusion
In this paper, we aimed at predicting the detention situation of ships by combining deficiency selection procedure and Naïve Bayes model using dataset from Asia-Pacific PSC inspection. Considering that trivial ship deficiency imposes an insignificant effect on the ship detention decision, we introduced an optimized AHP model to select thirty deficiency subcategories from 568 types of deficiency categories, which are input as the attributes of Naïve Bayes model. e experimental results provided the following conclusions: (1) the hybrid model combining Naïve Bayes and optimized AHP model can accurately predict ship detention results, which can help shipowners to take timely actions to repair ship deficiency in advance; (2) the MNB model (a type of Naïve Byes model) obtained better ship detention prediction accuracy compared to the counterparts of the BNB model; (3) additional PSC inspection samples can provide more intrinsic relations between ship deficiency and detention events and thus can further improve model prediction performance.
ough the proposed hybrid model combining Naïve Bayes model and optimized AHP model obtained satisfied ship detention prediction results, the following researches can be done to expand our work. First, it is found that deficiency categories determined by the proposed AHP model were not perfectly matched with the real world (i.e., slightly different from PSC inspection records). We can develop additional knowledge discovery models to explore more intrinsic ship detention patterns from the ship deficiency. Second, we can establish a correlation network between various ship deficiency types and integrate Bayesian network models to discover ship detention knowledge for the purpose of obtaining higher ship detention prediction  Data Availability e data used to support the findings of this study are available from the corresponding author upon request.

Conflicts of Interest
e authors declare no conflicts of interest.