*Article* **Ship Traffic Flow Prediction in Wind Farms Water Area Based on Spatiotemporal Dependence**

**Tian Xu \* and Qingnian Zhang**

School of Transportation and Logistics Engineering, Wuhan University of Technology, Wuhan 430063, China; 258553@whut.edu.cn

**\*** Correspondence: yingying1520@whut.edu.cn

**Abstract:** To analyze the changing characteristics of ship traffic flow in wind farms water area, and to improve the accuracy of ship traffic flow prediction, a Gated Recurrent Unit (GRU) of a Recurrent Neural Network (RNN) was established to analyze multiple traffic flow sections in complex waters based on their traffic flow structure. Herein, we construct a spatiotemporal dependence feature matrix to predict ship traffic flow instead of the traditional ship traffic flow time series as the input of the neural network. The model was used to predict the ship traffic flow in the water area of wind farms in Yancheng city, Jiangsu Province. Autoregressive Integrated Moving Average (ARIMA), Support-Vector Machine (SVM) and Long Short-Term Memory (LSTM) were chosen as the control tests. The GRU method based on the spatiotemporal dependence is more accurate than the current mainstream ship traffic flow prediction methods. The results verify the reliability and validity of the GRU method.

**Keywords:** complex waters; ship traffic flow; spatiotemporal dependence; gate recurrent unit

#### **1. Introduction**

Marine wind energy is a green renewable resource that has the advantages of cleanliness, low development cost, and abundant reserves [1,2]. The development of marine wind energy under the background of encouraging sustainable economic development is conducive to alleviating the energy crisis and preventing climate change. With the development of offshore wind power technology, offshore wind farm construction has gradually become a key development field [3]. However, the offshore wind farm needs to occupy a large area of water in the process of construction, and some ship traffic inevitably flows through the wind farm. With the increasing frequency of offshore wind power construction, the risk assessment of ship navigation in wind farms water area has also attracted the attention of scholars at home and abroad [4].

In the water area of the wind farm, ships need to be in close contact with the wind turbine, and the working frequency is very high. Compared with ships in other water areas, the collision probability of ships in the water area of a wind farm is greater [5,6]. Especially in severe weather—such as strong winds, large waves, and dense fog—the maneuverability of the ship is limited, the visibility in the water area is reduced, and the risk of collision between the ships and the wind turbines is further exacerbated [7]. With the increase in offshore wind power construction, the safety of ship navigation in the waters of offshore wind farms has gradually attracted the extensive attention of relevant scholars. At present, the research on ship navigation safety in the water area of wind farms mainly focuses on exploring the variation law of collision risk between ships and offshore wind turbines [8,9].

However, the impact of wind farm characteristics and ship traffic flow characteristics is not fully considered, and the established collision risk model often cannot reflect the actual situation of ship/wind turbine collisions. Therefore, it is necessary to analyze the ship traffic flow in the wind farms water area as the basis of ship navigation risk assessment [10,11]. By analyzing the variation in characteristics of ship traffic flow, mining

**Citation:** Xu, T.; Zhang, Q. Ship Traffic Flow Prediction in Wind Farms Water Area Based on Spatiotemporal Dependence. *J. Mar. Sci. Eng.* **2022**, *10*, 295. https:// doi.org/10.3390/jmse10020295

Academic Editor: Claudio Ferrari

Received: 7 January 2022 Accepted: 15 February 2022 Published: 21 February 2022

**Publisher's Note:** MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

**Copyright:** © 2022 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https:// creativecommons.org/licenses/by/ 4.0/).

the potential regularity of traffic flow data, and predicting the traffic flow state in the future, we can provide a theoretical basis for the formulation of traffic control measures in the wind farms water area.

Therefore, we propose a method to predict the traffic volume in wind farm areas based on spatiotemporal dependence. A feature matrix is constructed to represent the spatial relationship of traffic flow based on Pearson's Correlation Coefficient (PCC), and then GRU is established to predict the ship traffic flow. The construction in this paper has two folders: Firstly, the spatial effects of traffic flow on different routes are considered. Secondly, the matrix is used as the input of the neural network instead of a single value. The method proposed in this paper can support the construction of safety supervision in wind farms water area.

The remainder of this paper is organized as follows: Section 2 reviews research related to the research and safety of wind farm water and traffic flow prediction. Section 3 elaborates on the framework construction and methodological development, followed by case studies in Section 4. Finally, Section 5 discusses the major findings and potential research improvements, and conclusions are summarized in Section 5

#### **2. Literature Review**

Traffic flow prediction is an important topic in maritime traffic research. Recently, the study of ship traffic flow prediction can be divided into statistical methods and data-driven methods.

Several statistical models have been applied extensively in traffic flow prediction, including linear regression, ARIMA, Kalman filtering, Bayesian networks, Markov models, etc. Sun et al. (2003) introduced local linear regression into traffic flow prediction research [12]. Williams and Hoel (2003) adopted the seasonal ARIMA process to forecast vehicular traffic flow [13]. Getahun (2021) modeled a time series of road traffic accidents based on ARIMA [14]. Guo et al. (2014) developed an adaptive Kalman filter method for stochastic traffic flow rate prediction [15], while Xie et al. (2007) researched traffic flow prediction using a Kalman filter with discrete wavelet decomposition [16]. Saeedmanesh et al. (2021) developed an extended Kalman filter approach for real-time state estimation in multiregion MFD urban networks [17]. Smith et al. (1997, 2002) proposed a nonparametric method for traffic flow forecasting, and compared parametric and nonparametric models [18,19]. Zheng and Su (2014) researched traffic flow forecasting using a constrained linearly sewing principal component algorithm [20]. Wang et al. (2021) proposed a non-parametric model with an optimized training strategy for vehicle traffic flow prediction [21]. Castillo et al. (2008) introduced a Bayesian network for traffic flow prediction [22]. Wang et al. (2014) designed an architecture for traffic flow prediction using a new Bayesian combination method [23]. Afrin et al. (2021) estimated traffic congestion based on a Bayesian network [24]. Qi and Ishak (2014) developed a hidden Markov model for the prediction of traffic flow on freeways [25]. Rajawat et al. (2021) developed a comprehensive framework for the prediction of human mobility patterns based on a hidden Markov model [26].

In recent years, data-driven methods have been widely used in traffic flow prediction. The advantage of these methods is their ability to predict future traffic flow directly from the given big data without modeling the traffic flow phenomenon. Many researchers have applied SVM regression models to traffic flow prediction and achieved good results [27–29]. Some improved SVM methods are also widely used [30,31]. Yao et al. (2014) developed a framework in multistep-ahead prediction for rock displacement surrounding a tunnel, using an improved SVM [32]. Toan et al. (2021) applied an SVM for short-term traffic flow prediction [33].

Another widely used method is the K-nearest neighbor model, which is easy to implement because the processes of training data and estimating parameters are simple. Hong et al. (2015) developed a hybrid multimetric K-nearest neighbor regression model for traffic flow prediction [34]. Akbari et al. (2011) applied the K-nearest neighbor algorithm for daily inflow forecasting [35]. Yu et al. (2016) designed a prediction model for multipletimestep prediction of traffic conditions [36]. Another very important method is machine learning. Many kinds of research for traffic prediction based on machine learning have been published [37–42]. Li (2016) applied dynamic fuzzy neural networks for traffic flow prediction [43]. Huang et al. (2014) proposed a Deep Belief Network (DBN) for traffic flow prediction, which is a deep architecture [44]. Yang et al. (2016) designed a type of unsupervised learning architecture of the neural network approach for traffic flow prediction using the Taguchi method [45]. Lu et al. (2021) proposed a combined method for short-term traffic flow prediction based on a recurrent neural network [46]. machine learning. Many kinds of research for traffic prediction based on machine learning have been published [37–42]. Li (2016) applied dynamic fuzzy neural networks for traffic flow prediction [43]. Huang et al. (2014) proposed a Deep Belief Network (DBN) for traffic flow prediction, which is a deep architecture [44]. Yang et al. (2016) designed a type of unsupervised learning architecture of the neural network approach for traffic flow prediction using the Taguchi method [45]. Lu et al. (2021) proposed a combined method for short-term traffic flow prediction based on a recurrent neural network [46]. In summary, many researchers have made great progress in the research of traffic

Hong et al. (2015) developed a hybrid multimetric K-nearest neighbor regression model for traffic flow prediction [34]. Akbari et al. (2011) applied the K-nearest neighbor algorithm for daily inflow forecasting [35]. Yu et al. (2016) designed a prediction model for multiple-timestep prediction of traffic conditions [36]. Another very important method is

*J. Mar. Sci. Eng.* **2022**, *10*, x FOR PEER REVIEW 3 of 18

In summary, many researchers have made great progress in the research of traffic flow prediction, but the assumption that the model parameterization performs relatively badly in variable traffic conditions affects the majority of statistical models. On the other hand, data-driven models such as deep learning techniques are often used to make predictions. Although the accuracy of the deep learning method is higher than that of other algorithms, the training time is much longer than that of other algorithms. The GRU has fewer parameters than other models, reducing the risk of overfitting, and has a shorter training time. Additionally, the GRU can simultaneously consider the influence of features and historical time series. At present, GRU networks are mainly used in classification, regression, and time-series prediction problems. Therefore, a GRU was established to predict the ship traffic flow in this research. flow prediction, but the assumption that the model parameterization performs relatively badly in variable traffic conditions affects the majority of statistical models. On the other hand, data-driven models such as deep learning techniques are often used to make predictions. Although the accuracy of the deep learning method is higher than that of other algorithms, the training time is much longer than that of other algorithms. The GRU has fewer parameters than other models, reducing the risk of overfitting, and has a shorter training time. Additionally, the GRU can simultaneously consider the influence of features and historical time series. At present, GRU networks are mainly used in classification, regression, and time-series prediction problems. Therefore, a GRU was established to predict the ship traffic flow in this research. Several studies have emerged over recent years covering many aspects of wind

Several studies have emerged over recent years covering many aspects of wind farms, such as site selection [47,48], operation and maintenance [49–51], and wildlife impact [52,53], among others. However, research on traffic flow prediction in the water area of wind farms is rare at present, and most such studies take a single port or channel section as their research object, not considering the spatiotemporal dependence of ship traffic flow. Therefore, taking the supervision of maritime traffic safety in complex waters as the starting point, the water area of Yancheng wind farms was selected as the research object to predict ship traffic flow in different routes in the water area of the wind farms. farms, such as site selection [47,48], operation and maintenance [49–51], and wildlife impact [52,53], among others. However, research on traffic flow prediction in the water area of wind farms is rare at present, and most such studies take a single port or channel section as their research object, not considering the spatiotemporal dependence of ship traffic flow. Therefore, taking the supervision of maritime traffic safety in complex waters as the starting point, the water area of Yancheng wind farms was selected as the research object to predict ship traffic flow in different routes in the water area of the wind farms.

#### **3. Methodology 3. Methodology**

The logical framework for the prediction of ship traffic flow in wind farm waters is depicted in Figure 1; it consists of three components: data preparation, spatial relationship analysis, and time-series prediction model. The logical framework for the prediction of ship traffic flow in wind farm waters is depicted in Figure 1; it consists of three components: data preparation, spatial relationship analysis, and time-series prediction model.

**Figure 1.** Logical framework in this study. **Figure 1.** Logical framework in this study.

#### *3.1. Data Preparation*

As of December 2004, the International Maritime Organization (IMO) required all vessels over 299 GT to install an Automatic Identification System (AIS) transponder on board [54]. The increasing number of ships equipped with AISs provides a lot of basic data for traffic flow prediction research. AIS data are received as a series of messages following a nonstandard pattern of irregular time intervals. Since there is a lot of noise in the raw AIS data, it is necessary to preprocess the data. Firstly, the data of ship position abnormality, speed abnormality, and course abnormality in the experimental dataset are removed based on the algorithm proposed by [55]. Then, the linear interpolation method should be used to interpolate the ship's AIS data per 10 s.

#### *3.2. Analysis of Spatial Dependence of Ship Traffic Flow*

For complex waters, such as wind farms water areas, the ship traffic flow may be affected by the traffic conditions of adjacent routes. Therefore, considering the spatial ship traffic flow dependence, Pearson's Correlation Coefficient (PCC) method was used to calculate the correlation coefficient between the traffic flows of adjacent routes [56,57]. PCC is the covariance of the two variables divided by the product of their standard deviations.

Adding the route information with high correlation to the prediction model improves the accuracy of the marine traffic flow prediction model. If the traffic flow sequence of section *x* and section *y* is as follows:

$$q\_{\mathbf{x}} = (q\_{\mathbf{x},\mathbf{1}}, q\_{\mathbf{x},\mathbf{2}}, \dots, q\_{\mathbf{x},\mathbf{T}})\_{\prime} \tag{1}$$

$$q\_y = (q\_{y,1}, q\_{y,2}, \dots, q\_{y,T}),\tag{2}$$

then the correlation coefficient of the two sections is given by:

$$\rho\_{\mathbf{x},\mathbf{y}} = \frac{\sum\_{i=1}^{T} (q\_{\mathbf{x},i} - \overline{q\_{\mathbf{x}}})(q\_{\mathbf{y},i} - \overline{q\_{\mathbf{y}}})}{\sqrt{\sum\_{i=1}^{T} (q\_{\mathbf{y},i} - \overline{q\_{\mathbf{y}}})^2} \sqrt{\sum\_{i=1}^{T} (q\_{\mathbf{y},i} - \overline{q\_{\mathbf{y}}})^2}},\tag{3}$$

where *ρx,y* is the degree of correction between *x* and *y,* referred to as the correlation coefficient, while *T* represents the length of the time series. The closer *ρx,y* is to 1, the greater the correlation between the target section and the adjacent section. When *ρx,y* = 0, there is no correlation between the target section and adjacent sections. When 0 < *ρx,y* < 0.5, this indicates that the correlation between the target section and adjacent sections is low. To ensure the prediction accuracy of the model, 0.5 ≤ *ρx,y* < 1 was set as the spatial threshold range.

#### *3.3. Time-Series Prediction Model Based on an Improved Recurrent Neural Network*

A GRU can be used to mine the time characteristics of traffic flow and capture the time dependence of ship traffic flow [58–60]. Cho et al. introduced a GRU as a gating mechanism in recurrent neural networks [61]. The GRU's functions are similar to those of a Long Short-Term Memory (LSTM) network with a forget gate, but with fewer parameters. The GRU outperformed LSTM on certain tasks, such as polyphonic music modeling, speech signal modeling, and natural language processing. The GRU also uses only two parameters, which can help to reduce the risk of overfitting. The basic structure of the GRU is shown in Figure 2. *J. Mar. Sci. Eng.* **2022**, *10*, x FOR PEER REVIEW 5 of 18

**Figure 2.** Diagram of the model structure used in this research: (**a**) Whole structure of the model. (**b**) Basic structure of the GRU. **Figure 2.** Diagram of the model structure used in this research: (**a**) Whole structure of the model. (**b**) Basic structure of the GRU.

*x*(*t*) represents the input signal vector of the current node; *h*(*t <sup>−</sup>* 1) represents the hidden

( )*<sup>t</sup> h* is

state vector passed down from the previous node, *h*(*t*) is the output vector, and '

to obtain two gating states; the functions of the reset gate and update gate are as follows:

where *Wr* is the weight matrix of reset gate, while *Wz* is the weight matrix of the update

( 1) *<sup>t</sup> h* <sup>−</sup> and *x*(*t*). The activation function tanh is used to standardize the data to ob-

( ) ' ( ) '

where the operator denotes the Hadamard product, ' *Wh* is the weight matrix of

( )*<sup>t</sup> h* to the current hidden state and effectively remembers the current state. In the last memory update stage, forgetting and memorizing steps are both used, as

where ( )*<sup>t</sup> h* represents the output of the network at the moment *t* and ( ) ( ) 0,1 *<sup>t</sup> z* ∈ . The input of each layer of the GRU considers the output of the previous layer of the GRU, so as to capture the timing relationship of ship traffic flow. After constructing a GRU, it is used as the basic unit from sequence to sequence as a model to generate the final predic-

The ship traffic flow in an area is related not only to the actual traffic flow in the given moments, but also to the spatially related route. Therefore, compared with the traditional ship traffic flow prediction method, a PCC algorithm can be introduced to calculate the correlation of traffic flow between different routes. This method can screen the areas with high correlation and reconstruct the spatiotemporal dependence matrix, in order to improve the input of the GRU model and to predict the ship traffic flow in

is the previously obtained update gate *z*; the update expression is as follows:

complex waters more accurately. The algorithm flow is as follows:

( ) ( 1) ( ) Sigmoid\_ 1( ( , )) *t rt t r Wh x* = <sup>−</sup> , (4)

( ) ( 1) ( ) Sigmoid\_ 2( ( , )) *t zt t z Wh x* = <sup>−</sup> , (5)

( ) ( 1) ( ) ( ) tan h , *t t tt <sup>h</sup> h Wh rx* = <sup>−</sup> , (6)

( )*<sup>t</sup> h* mainly contains the current input *x*(*t*), which

'

( ) ( ) ( 1) ( ) ( ) (1 ) *ttt t t hz h z h* = +− <sup>−</sup> , (7)

( 1) ( ) ( 1) *t tt h rh* − − = to reset the data, then

gate. After obtaining the gating signal, use '

candidate activation in the GRU, and '

( )*<sup>t</sup> h* ; the calculation formula is as follows:

σ

splice '

tain '

adds '

tion result.

*x*(*t*) represents the input signal vector of the current node; *<sup>h</sup>*(*<sup>t</sup>* <sup>−</sup> 1) represents the hidden state vector passed down from the previous node, *h*(*t*) is the output vector, and *h* 0 (*t*) is candidate activation vector; *r*(*t*) is the reset gate vector, *z*(*t*) is the update gate vector, while *σ* represents the original function, and is a sigmoid function. The GRU uses *<sup>x</sup>*(*t*) and *<sup>h</sup>*(*<sup>t</sup>* <sup>−</sup> 1) to obtain two gating states; the functions of the reset gate and update gate are as follows:

$$r\_{(t)} = \text{Signpoint\\_1}(\mathcal{W}\_r(h\_{(t-1)}, \mathbf{x}\_{(t)})),\tag{4}$$

$$z\_{(t)} = \text{Sigmoid}\_{-} \mathcal{Z}(\mathcal{W}\_{z}(h\_{(t-1)}, x\_{(t)})),\tag{5}$$

where *W<sup>r</sup>* is the weight matrix of reset gate, while *W<sup>z</sup>* is the weight matrix of the update gate. After obtaining the gating signal, use *h* 0 (*t*−1) <sup>=</sup> *<sup>r</sup>*(*t*)  *<sup>h</sup>*(*t*−1) to reset the data, then splice *h* 0 (*t*−1) and *x*(*t*) . The activation function tanh is used to standardize the data to obtain *h* 0 (*t*) ; the calculation formula is as follows:

$$h\_{(t)}' = \tan \mathbf{h} \Big( \mathcal{W}\_{\mathbb{H}'} \Big( h\_{(t-1)} \odot r\_{(t)'} x\_{(t)} \Big) \Big),\tag{6}$$

where the operator  denotes the Hadamard product, *W<sup>h</sup>* <sup>0</sup> is the weight matrix of candidate activation in the GRU, and *h* 0 (*t*) mainly contains the current input *x*(*t*) , which adds *h* 0 (*t*) to the current hidden state and effectively remembers the current state.

In the last memory update stage, forgetting and memorizing steps are both used, as is the previously obtained update gate *z*; the update expression is as follows:

$$h\_{(t)} = z\_{(t)} \odot h\_{(t-1)} + (1 - z\_{(t)}) \odot h'\_{(t)'} \tag{7}$$

where *h* (*t*) represents the output of the network at the moment *t* and *z*(*t*) ∈ (0, 1). The input of each layer of the GRU considers the output of the previous layer of the GRU, so as to capture the timing relationship of ship traffic flow. After constructing a GRU, it is used as the basic unit from sequence to sequence as a model to generate the final prediction result.

The ship traffic flow in an area is related not only to the actual traffic flow in the given moments, but also to the spatially related route. Therefore, compared with the traditional ship traffic flow prediction method, a PCC algorithm can be introduced to calculate the correlation of traffic flow between different routes. This method can screen the areas with high correlation and reconstruct the spatiotemporal dependence matrix, in order to improve the input of the GRU model and to predict the ship traffic flow in complex waters more accurately. The algorithm flow is as follows:

(1) According to the characteristics of traffic flow structure in complex waters, the temporal and spatial characteristic matrix of multiple observation sections is defined as *Q*.

$$\mathbf{Q} = \begin{pmatrix} q\_1 \\ q\_2 \\ \vdots \\ q\_m \end{pmatrix} = \begin{pmatrix} q\_{1,1} & q\_{1,2} & \cdots & q\_{1,T} \\ q\_{2,1} & q\_{2,2} & \cdots & q\_{2,T} \\ \vdots & \vdots & \cdots & \vdots \\ q\_{m,1} & q\_{m,2} & \cdots & q\_{m,T} \end{pmatrix} \tag{8}$$

where *q<sup>m</sup>* is the time series of the observation section, and *qm*,*<sup>T</sup>* is the traffic volume of observation section *m* at the moment *T*;

(2) Calculate the correlation coefficient between the traffic flow at the observation section of two routes, constructing a spatial correlation matrix as follows:

$$
\rho\_{xy} = \begin{pmatrix}
\rho\_{1,1} & \rho\_{1,2} & \cdots & \rho\_{1,m} \\
\rho\_{2,1} & \rho\_{2,2} & \cdots & \rho\_{2,m} \\
\vdots & \vdots & \cdots & \vdots \\
\rho\_{m,1} & \rho\_{m,2} & \cdots & \rho\_{m,m}
\end{pmatrix};
\tag{9}
$$

(3) Rank traffic flow correlation between sections. Select the sections to be predicted and sort the other sections by correlation;

(4) Set the correlation threshold *δ*. The sections with a correlation greater than *δ* are reconstructed into a new spatiotemporally dependent characteristic matrix;

(5) Build the GRU model. The input of the GRU model is improved by using the reconstructed spatiotemporal dependence characteristic matrix, and the improved GRU is used to predict ship traffic flow;

(6) Calculate the Mean Absolute Percentage Error (MAPE); taking the minimum MAPE as the final optimization goal of the model, the optimal spatial threshold is determined;

(7) Results and analysis: To quantitatively analyze the prediction results and the performance of the model, the Mean Absolute Error (MAE), Root-Mean-Square Error (RMSE), Mean Absolute Percentage Error (MAPE), and R<sup>2</sup> are used as prediction and evaluation indicators. The calculation method is as follows:

$$\text{MAE} = \frac{1}{n} \sum\_{i}^{n} |p\_i - x\_i|\_{\prime} \tag{10}$$

$$\text{RMSE} = \sqrt{\frac{1}{n} \sum\_{i}^{n} \left(p\_i - x\_i\right)^2} \tag{11}$$

$$\text{MAPE} = \frac{1}{n} \sum\_{i}^{n} \frac{|p\_i - \mathbf{x}\_i|}{\mathbf{x}\_i} \times 100,\tag{12}$$

$$\mathbf{R}^2 = 1 - \frac{\sum\_{1}^{n} \left(p\_i - \mathbf{x}\_i\right)^2}{\sum\_{1}^{n} \left(\overline{\mathbf{x}\_i} - \mathbf{x}\_i\right)^2} \tag{13}$$

where *p<sup>i</sup>* is the predicted value obtained by PCC–GRU and by SVM, LSTM, and ARIMA in the control experiment; *x<sup>i</sup>* is the actual value; *x<sup>i</sup>* is the average of the actual flow section values.

#### **4. Case Study**

#### *4.1. Research Area and Data*

Due to the influence of meteorological and hydrological conditions, construction conditions, and water area location, the water area traffic environment of wind farms presents complex temporal and spatial characteristics. Based on AIS data, real-time prediction of ship traffic flow changes in different stages of wind farm groups can provide an effective means for daily maintenance of wind farms and safety monitoring in the process of construction.

To verify the effectiveness and feasibility of the model, the wind farm water area in Jiangsu Province was selected as the research object, as shown in Figure 3. The cross-section flow statistics of complex routes in the region were evaluated. The routes observed in this research were routes recommended in nautical charts, and the observation section was set in these routes. If a ship passes through the observation section, the traffic volume increases by 1.

**4. Case Study** 

*4.1. Research Area and Data* 

process of construction.

traffic volume increases by 1.

Due to the influence of meteorological and hydrological conditions, construction conditions, and water area location, the water area traffic environment of wind farms presents complex temporal and spatial characteristics. Based on AIS data, real-time prediction of ship traffic flow changes in different stages of wind farm groups can provide an effective means for daily maintenance of wind farms and safety monitoring in the

To verify the effectiveness and feasibility of the model, the wind farm water area in Jiangsu Province was selected as the research object, as shown in Figure 3. The cross-section flow statistics of complex routes in the region were evaluated. The routes observed in this research were routes recommended in nautical charts, and the observation section was set in these routes. If a ship passes through the observation section, the

**Figure 3.** Schematic diagram of the observation section in the Yancheng wind farm area. **Figure 3.** Schematic diagram of the observation section in the Yancheng wind farm area.

The cross-sectional diagram is shown in Figure 3. The location information of the section is shown in Table 1. The traffic flow time series from 1 to 29 March 2021 was selected as the training data, and the traffic flow data on 30 March were used as the verification set. The ship traffic flow data of sections H1–H11 were collected in hours, and the ship traffic flow data for one day were obtained, as shown in Table 2. *q*1–*q*11 represent the traffic volume through sections H1–H11, respectively. Traffic volume is measured as the number of ships in the section during the given time. The cross-sectional diagram is shown in Figure 3. The location information of the section is shown in Table 1. The traffic flow time series from 1 to 29 March 2021 was selected as the training data, and the traffic flow data on 30 March were used as the verification set. The ship traffic flow data of sections H1–H11 were collected in hours, and the ship traffic flow data for one day were obtained, as shown in Table 2. *q*1–*q*<sup>11</sup> represent the traffic volume through sections H1–H11, respectively. Traffic volume is measured as the number of ships in the section during the given time.

**Table 1.** Coordinates of the observation section. **Sections P1 P2** H1 120.06495° E 34.75165° N 120.13086° E 34.96235° N H2 120.02375° E 34.69723° N 119.96195° E 34.42275° N H3 120.35502° E 34.76512° N 120.27413° E 34.64402° N H4 120.26468° E 34.49281° N 120.20728° E 34.42028° N H5 120.57021° E 34.48273° N 120.47371° E 34.43313° N H6 120.47302° E 34.35673° N 120.57023° E 34.30368° N H7 121.30618° E 34.65731° N 121.08612° E 34.45872° N H8 121.04723° E 34.20372° N 120.93305° E 34.15846° N Taking section H5 as an example, the model proposed in this paper was used to predict ship traffic flow. Spatial state variables and temporal state variables were the two input parameters of the model. The spatial state variable is a matrix formed by the correlation coefficients between sections, while the time state variable refers to the time interval adopted by the spatial matrix. When the neural network model was built, the recurrent neural network of each layer of encoder and decoder had several GRUs. The number of GRUs is always a multiple of 2—generally between 16 and 128; if it is too large, it will increase the computational complexity and make the training time too long; if it is too small, it will also affect the performance of the model. Figure 4 provides the MEA and RMSE of the experiments using different numbers of GRUs. The GRU number of 64 obtained the lowest error. Therefore, we set the number of GRUs to 64 in our experiments. The validation set loss of the experiment using different batch sizes is shown in Figure 5. The batch size of 8 yielded the lowest error. As a result, the batch size of our model was set to 8. When a complete dataset passes through the neural network and returns, the process is called an epoch; we set the number of epochs to 100. Table 3 shows the hyperparameters used by PCC–GRU in the experiment. All experiments were conducted in Keras on a laptop with an NVIDIA 2080ti GPU, an Intel Core i9-9900KF CPU (3.6 GHz), 16 GB RAM, and the Windows 10 operating system.


**Table 1.** Coordinates of the observation section.

**Table 2.** Ship traffic flow per hour on 30 March 2021.


**Table 3.** Hyperparameters used in PCC–GRU.


**Figure 4.** MAE and RMSE with the same number of GRUs: (**a**) MAE of the experiment. (**b**) RMSE of the experiment. **Figure 4.** MAE and RMSE with the same number of GRUs: (**a**) MAE of the experiment. (**b**) RMSE of the experiment. **Figure 4.** MAE and RMSE with the same number of GRUs: (**a**) MAE of the experiment. (**b**) RMSE of the experiment.

**Figure 5.** The loss of different batch sizes. **Figure 5.** The loss of different batch sizes. **Figure 5.** The loss of different batch sizes.

#### **Table 3.** Hyperparameters used in PCC–GRU. **Table 3.** Hyperparameters used in PCC–GRU. *4.2. Results and Analysis*

**Hyperparameter Value**  Epochs 100 Dropout Rate Rate Learning Rate 0.0005 Batch Size 8 **Hyperparameter Value**  Epochs 100 Dropout Rate Rate Learning Rate 0.0005 Batch Size 8 The data of four sections (H3, H5, H9, and H11) were selected to verify the method proposed in this research. In order to set the optimal threshold of PCC and time steps in the GRUs, many experiments were carried out in this research. Indicators for evaluating the experimental results can be calculated using Equations (10)–(13). In these equations, *xi* is the temporary ship traffic volume value measured on 30 March 2021, while *p<sup>i</sup>* is the predicted value by PCC–GRU, calculated with different parameters.

Hidden Unit 64 *4.2. Results and Analysis*  The data of four sections (H3, H5, H9, and H11) were selected to verify the method proposed in this research. In order to set the optimal threshold of PCC and time steps in the GRUs, many experiments were carried out in this research. Indicators for evaluating the experimental results can be calculated using Equations (10)–(13). In these equations, *xi* is the temporary ship traffic volume value measured on 30 March 2021, while *pi* is the predicted value by PCC–GRU, calculated with different parameters. Hidden Unit 64 *4.2. Results and Analysis*  The data of four sections (H3, H5, H9, and H11) were selected to verify the method proposed in this research. In order to set the optimal threshold of PCC and time steps in the GRUs, many experiments were carried out in this research. Indicators for evaluating the experimental results can be calculated using Equations (10)–(13). In these equations, *xi* is the temporary ship traffic volume value measured on 30 March 2021, while *pi* is the predicted value by PCC–GRU, calculated with different parameters. To study the influence of spatiotemporal state variables on prediction accuracy and determine the optimal parameters, the thresholds of PCC were set as 0.8, 0.7, 0.6, and 0.5, because when the threshold is greater than or equal to 0.8, there is no section related to H3, H5, H9, or H11 in space. To improve the prediction accuracy, the PCC algorithm was used to select spatial characteristic variables. From the position of each observation section, it can be seen that the sections with a large correlation and with the target section are located in the water area around the target, indicating that the traffic flow of the surrounding water area has a great impact on the target section. According to the actual situation, the effectiveness of the PCC algorithm in spatial feature variable selection was verified.

Timesteps are an import parameter in neural networks. If the number of timesteps is *n*, that means that we think that each value is related to *n* values in front of it. If the timestep used in prediction is too large, it will lead to time information redundancy and affect the accuracy of the prediction results. If the timestep is too small, it will lead to overfitting of the model. The performance of the model can be seen in Tables 4–7, where the timestep of 7 obtains the lowest error. Therefore, we set the timestep to 7 in our experiments.


**Table 4.** Prediction performance of different thresholds in H3.

**Table 5.** Prediction performance of different thresholds in H5.



**Table 6.** Prediction performance of different thresholds in H9.

**Table 7.** Prediction performance of different thresholds in H11.


Further analysis of the impact of timestep on prediction accuracy shows that the selection of different parameter combinations will change the prediction accuracy of the model. Within a certain range, the prediction accuracy is positively correlated with the timestep. In a certain range, with the decrease in the spatial threshold, the spatial correlation between observation sections is lower. In the case of a high threshold, too little information on other sections leads to a poor prediction effect. In the case of a low threshold, too much irrelevant information is added to interfere with the prediction effect. Based on the prediction performance of different thresholds in Tables 4–7, the threshold was set to 0.5, 0.5, 0.6, and 0.6, respectively. The predicted and true values of observation sections H3, H5, H9, and H11 in the training dataset are shown in Figure 6; the predicted results are in good agreement with the actual values, indicating that the PCC–GRU model is feasible in the actual traffic scenario. Based on the prediction performance of different thresholds in Tables 4–7, the threshold was set to 0.5, 0.5, 0.6, and 0.6, respectively. The predicted and true values of observation sections H3, H5, H9, and H11 in the training dataset are shown in Figure 6; the predicted results are in good agreement with the actual values, indicating that the PCC–GRU model is feasible in the actual traffic scenario.

Further analysis of the impact of timestep on prediction accuracy shows that the selection of different parameter combinations will change the prediction accuracy of the model. Within a certain range, the prediction accuracy is positively correlated with the timestep. In a certain range, with the decrease in the spatial threshold, the spatial correlation between observation sections is lower. In the case of a high threshold, too little information on other sections leads to a poor prediction effect. In the case of a low threshold, too much irrelevant information is added to interfere with the prediction effect.

7 0.61225 0.75934 8.57453 0.83634

3 1.48741 1.74551 20.91039 0.48333 4 1.12575 1.33582 15.97794 0.67957 5 0.65062 0.80676 10.17630 0.79775 6 0.62077 0.79132 8.80699 0.83894 7 0.60225 0.76385 8.53494 0.85846

3 1.42989 1.76357 18.58104 0.56642 4 1.06954 1.31858 13.15588 0.69508 5 0.61793 0.76473 9.267573 0.85563 6 0.58345 0.72785 8.238327 0.89162 7 0.52425 0.68346 7.33485 0.92125

*J. Mar. Sci. Eng.* **2022**, *10*, x FOR PEER REVIEW 12 of 18

0.6 H8

0.5

H9

H5 H8 H9

**Figure 6.** Prediction results of the PCC–GRU model: (**a**) Training data in H3. (**b**) Training data in H5. (**c**) Training data in H9. (**d**) Training data in H11. **Figure 6.** Prediction results of the PCC–GRU model: (**a**) Training data in H3. (**b**) Training data in H5. (**c**) Training data in H9. (**d**) Training data in H11.

To verify the prediction performance of the PCC–GRU model, comparative experiments were set up in this study. LSTM, SVM, and ARIMA were used to predict the traffic To verify the prediction performance of the PCC–GRU model, comparative experiments were set up in this study. LSTM, SVM, and ARIMA were used to predict the traffic flow of H3, H5, H9, and H11. These methods are commonly used in maritime traffic flow prediction [62–64]; therefore, these methods were used as benchmarking methods. After many experiments, the parameters of each model in the experiment were determined, as shown in Table 8. The prediction results of the ship traffic flow of each model are shown in Figure 7.

> Moving average Terms 6 Difference Items 1


**Table 8.** Parameter setting of models.

ARIMA

in Figure 7.

LSTM

SVM

ARIMA

**Table 8.** Parameter setting of models.

**Figure 7.** Comparison of prediction results of different models: (**a**) Prediction results in H3. (**b**) Prediction results in H5. (**c**) Prediction results in H9. (**d**) Prediction results in H11. **Figure 7.** Comparison of prediction results of different models: (**a**) Prediction results in H3. (**b**) Prediction results in H5. (**c**) Prediction results in H9. (**d**) Prediction results in H11.

flow of H3, H5, H9, and H11. These methods are commonly used in maritime traffic flow prediction [62–64]; therefore, these methods were used as benchmarking methods. After many experiments, the parameters of each model in the experiment were determined, as shown in Table 8. The prediction results of the ship traffic flow of each model are shown

> Neuron 12 Timesteps 5 Number of Iterations 300

> Penalty Factor 0.8 Number of Iterations 500

Autoregressive Terms 2 Moving average Terms 6 Difference Items 1

Kernel Function Radial Basis Function

**Model Parameter** 

It can be seen from Table 9 that different models have different results in the traffic flow prediction experiment in the wind farms water area. In our case study, the LSTM model did not take into account the spatial information in the data, so its prediction accuracy was lower than that of the PCC–GRU model, and the time taken to train the LSTM model was too long for real-time prediction of maritime traffic flow. The machine learning algorithm SVM is suitable for short-term traffic forecasting, but the output of the SVM model will oscillate as the training data and the forecasting time increase. Mean-It can be seen from Table 9 that different models have different results in the traffic flow prediction experiment in the wind farms water area. In our case study, the LSTM model did not take into account the spatial information in the data, so its prediction accuracy was lower than that of the PCC–GRU model, and the time taken to train the LSTM model was too long for real-time prediction of maritime traffic flow. The machine learning algorithm SVM is suitable for short-term traffic forecasting, but the output of the SVM model will oscillate as the training data and the forecasting time increase. Meanwhile, the linear model ARIMA is unable to identify the randomness and nonlinearity in the data, making it difficult to make accurate predictions of random changes in traffic. The MAE of the PCC–GRU model in the prediction experiments of the four sections (H3, H5, H9, and H11) was 0.3333, 0.3750, 0.3333, and 0.3333, respectively; the RMSE of the PCC–GRU model of the four sections was 0.5774, 0.6124, 0.5774, and 5774, respectively, while the MAPE was 8.1597, 7.0006, 10.7639, and 5.1403, respectively, which is the smallest in the comparative analysis of the models. R<sup>2</sup> is usually used to describe the fitting degree of the data; the closer it is to 1, the better the fitting degree, and the smaller the deviation between the fitted curve and the original data points. The R<sup>2</sup> of the PCC–GRU model was 0.8799, 0.9116, 0.9063, and 0.9521, respectively, which was greater than that of other models. The bar chart of the error analysis indicators can be seen in Figure 8. In conclusion, the prediction results of the PCC–GRU model are closer to the observed values, and the performance of its algorithm is better than that of other traditional traffic flow prediction methods. The analysis of vessel traffic flow is the basis for evaluating the safety of vessel navigation in a given area of water. By predicting the ship traffic flow in the wind farms water area and maintaining real-time monitoring, it is possible to predict the business of vessel navigation and to control the traffic flow to avoid close-quarters situations.


**Table 9.** Performance comparison of different models.

*J. Mar. Sci. Eng.* **2022**, *10*, x FOR PEER REVIEW 14 of 18

**Figure 8.** Bar chart of the error analysis indicators: (**a**) MAE of five prediction results. (**b**) RMSE of five prediction results. (**c**) R2 of five prediction results. (**d**) MASE of five prediction results. **Figure 8.** Bar chart of the error analysis indicators: (**a**) MAE of five prediction results. (**b**) RMSE of five prediction results. (**c**) R<sup>2</sup> of five prediction results. (**d**) MASE of five prediction results.

#### **5. Conclusions**

According to the needs of traffic characteristic analysis and traffic supervision in complex waters, this study introduced the spatial correlation of ship traffic flow structure into machine learning based on the variant GRU of the recurrent neural network, constructing a spatiotemporal dependence characteristic matrix of ship traffic flow, and improving the prediction accuracy of the ship traffic flow by the neural network. The PCC algorithm is simple to implement and fast to compute, taking into account the degree of correlation of time series at different times, and it is suitable for determining correlation between random variables. The GRU uses a unique memory module instead of implicit nodes, which increases the robustness of the model and can effectively compensate for the shortcomings of traditional neural networks that cannot effectively process long time series. Taking the water area of the wind farm in the Yancheng sea area of Jiangsu Province as an example, the traffic flow in this area was predicted. Compared to results of the commonly used ship traffic flow prediction models ARIMA, SVM, and LSTM, the GRU method's prediction was proven to be effective. The machine learning algorithm SVM is suitable for short-term prediction of traffic flows, but as the prediction time increases, the output of the SVM model will oscillate. The linear model ARIMA cannot identify the randomness and nonlinearity in the data, making it difficult to accurately predict the random changes in traffic. The LSTM model does not take into account the spatial information in the data, and therefore has a lower prediction accuracy than the PCC–GRU model.

By predicting the ship traffic flow and analyzing the temporal and spatial characteristics of traffic flow in complex waters, the marine traffic situation can be evaluated in real time, providing a theoretical basis for the risk evaluation and navigation safety guarantee of complex waters—especially the waters in wind farms with multi-route intersection—and reduces the risks of navigation and operation in the waters. Modelling the spatiotemporal dependence of ship traffic flow is a key area of future research. There are many factors affecting traffic flow prediction that have not been fully considered in this paper. The model proposed in this paper learns static spatial dependencies; however, the dependencies between locations may change over time. In subsequent research, dynamic structures should be considered in order to further improve the prediction performance.

**Author Contributions:** Conceptualization, T.X. and Q.Z.; methodology, T.X. and Q.Z.; software, T.X.; validation, T.X. and Q.Z.; formal analysis, T.X.; investigation, T.X.; resources, Q.Z.; data curation, T.X.; writing—original draft preparation, T.X.; writing—review and editing, T.X. and Q.Z.; visualization, T.X.; supervision, Q.Z.; project administration, Q.Z.; funding acquisition, Q.Z. All authors have read and agreed to the published version of the manuscript.

**Funding:** This research was funded by National Natural Science Foundation of China grant number 51879211. And The APC was funded by 51879211.

**Institutional Review Board Statement:** Not applicable.

**Informed Consent Statement:** Not applicable.

**Data Availability Statement:** Not applicable.

**Acknowledgments:** The authors would like to thank the anonymous reviewers and editors for their constructive comments, which were very helpful in improving this paper. This work was supported by the National Natural Science Foundation of China (NSFC) through Grant No.51879211.

**Conflicts of Interest:** The authors declare no conflict of interest.

#### **References**

