A Modular Tide Level Prediction Method Based On NARX Neural Network

This paper proposed a modular tide level prediction model based on nonlinear autoregressive exogenous model (NARX) neural network in order to improve the accuracy of tide prediction. The model divides tide data into two parts: the astronomical tide data affected by celestial tide generating force, and non-astronomical tide data affected by various environmental factors. NARX neural network and harmonic analysis are used to simulate and predict the non-astronomical and astronomical part of tide respectively, and then the nal result is obtained by combining the two parts. In this paper, the tide data from Yorktown, USA, are used to simulate the prediction of tide level, and the results are compared with the traditional harmonic analysis (HA) method and Genetic Algorithm-Back Propagation (GA-BP) neural network. The results show that as a dynamic neural network, NARX neural network modular prediction model is more suitable for the analysis and prediction of time series data and has better stability and accuracy. the prediction output by analyzing the dynamic data. The results show that NARX modular prediction model has stable prediction error and high prediction accuracy. Even with the advance of forecast time, it can still give accurate prediction results, and has a good tting degree for tide level data. This model can be used not only in tide prediction, but also in other time series problems.


Introduction
The tides are periodic uctuations of sea water caused by the gravity of the moon and the sun [1]. The generation of tide is due to the sum of the gravitational force of the moon and the sun and the inertial centrifugal force required for the relative motion of the earth. With the development of science and technology, the in uence of tide on navigation is gradually increasing [2].
The harmonic analysis method is the most traditional technique in tide prediction [3][4][5]. It decomposes the complex tide into several parts with periodic changes. By analyzing the observed tide level data, the constants in the tide harmonic model can be obtained. Then, according to the harmonic constants obtained, the composition of tide waves can be calculated, and used to calculate tides. The main drawback of this method is that in order to obtain a relatively accurate harmonic analysis model, a large number of long-term observation data are needed [6]. Therefore, the traditional static structure harmonic analysis model is di cult to carry out high-precision tide prediction.
In recent years, the arti cial intelligence technology is rapidly developed, intelligent computation techniques have been widely employed in areas of ocean engineering/ marine science [7][8][9][10], such as support vector machines (SVM) [11], BP neural network [4,12], Long Short-Term Memory (LSTM) neural network [5,13], etc., which has been widely used in coastal and marine engineering due to their strong search, reasoning, planning and self-learning ability [14][15]. Qiu et al. (2009) proposed an operational evaluation method for tide forecasting based on dynamic weight allocation [16], which realized synchronous forecasting by multiple forecasters. Although this method reduces the unstable factors in the prediction results and improves the accuracy and rationality of the prediction, it is more laborintensive. Yin et al. (2013) proposed a variable structure RBF network based on sliding data window to predict the real-time tide level. The prediction accuracy is improved compared with the traditional harmonic analysis [17], but the room for improvement is relatively large. Nitsure et al. (2014) proposed a method for indirect prediction of sea level data by GP-ANN (generic programming arti cial neural network) and wind eld information [18], but the prediction accuracy is easily affected by the changes of surrounding environment. Yin (2017) proposed an online sequential extreme learning machine (OS-ELM) by introducing the hidden element pruning strategy for online tide prediction [19], which has the characteristics of high prediction accuracy and calculation speed, but the lack of neurons in the hidden layer is easy to affect the stability of the network, In the last decade, more and more scholars began to use combination method to predict tides. El-Diasty and Al-Harbia (2015) proposed a high-precision sea-level prediction model combining harmonic analysis and wavelet neural network (WNN) [20]. Compared with traditional methods, the results show that the prediction accuracy has been improved, but the data dispersion is relatively large. Zhang et al. (2017) used harmonic analysis and adaptive network-based fuzzy inference system (ANFIS) to establish a comprehensive and accurate tide level prediction system network [21]. The modular method is used to provide stable and reliable prediction results for tide level prediction, and the prediction accuracy is improved. Liu et al. (2019) proposed a combined tide forecasting model based on harmonic analysis and autoregressive integrated moving average-support vector regression (ARIMA-SVR), which improves the low accuracy of single prediction model [22]. Kumar et al. (2020) proposed a model based on the strong coupling between the fully nonlinear potential ow theory (FNPT) at the far-eld and Navier-Stokes (NS) equations in the nearshore to estimate the run-up of tsunami-like waves [23].
The tide level data can be regarded as time series in forecasting tide level. The structural characteristics of NARX neural network make it have better learning e ciency and higher prediction accuracy for time series [24]. In order to further improve the prediction accuracy of tide data, a modular tide prediction model based on NARX neural network is proposed. The model divides tide data into two parts: astronomical tide affected by celestial tide generating force and non-astronomical tide affected by various environmental factors.
NARX neural network and harmonic analysis method are used to simulate and predict the nonastronomical tide part and astronomical tide part respectively. Then, the nal result is generated by combining the two parts, and the results are compared with traditional harmonic analysis method and the GA-BP neural network.

Harmonic Analysis Method
The studies on tides have started very early. According to the long-term observation, the tide is composed of a series of harmonic vibrations (tide components). The period of tide components corresponds to the The BP neural network is a multilayer feedforward neural network trained according to the error reverse propagation algorithm, and is the most widely used neural network at present [28][29].
The network mainly includes two aspects --signal forward transmission and error back-propagation. In forward transmission, the input signal is processed layer by layer from the input layer to the output layer through the hidden layer. If the output layer cannot get the actual output, it will turn into back propagation, adjust the weight and threshold of the whole network according to the prediction error, so that the predicted output of BP neural network will gradually approach the actual output.
Since the steepest descent method of nonlinear programming is adopted in the application of BP neural network, it usually has some disadvantages such as easy to fall into local minimum state, slow convergence speed and low learning e ciency. There is still much room for improvement in the forecast results.
In order to improve the prediction accuracy of BP neural network on the original basis, this paper adopts genetic algorithm (GA) to optimize it. The genetic algorithm was originally proposed by Professor Holland of Michigan University [30], which is a method to simulate the biological evolution mechanism of nature, that is, useful retention and useless removal in the optimization process. When solving complex combinatorial optimization problems, compared with some conventional optimization algorithms, it usually can quickly get better optimization results.
The basic operation of genetic algorithm is divided into three steps.
(1) Selection operation: in this paper, roulette selection method is used to calculate the probability of each individual appearing in the offspring according to the individual tness value, and the individuals are randomly selected to form the offspring population according to the probability.
(2) Cross operation: because the sample is encoded by real number, this paper takes fusion crossover method as the cross-operation method.
(3) Mutation operation: all individuals in the population are judged whether to mutate according to the pre-set mutation probability, and then the mutated individuals are randomly selected to mutate. The genetic algorithm has local random search ability and maintains population diversity to prevent premature convergence phenomenon [31]. Figure 1 shows the ow chart of BP neural network improved by genetic algorithm.

NARX Neural Network
This section may be divided by subheadings. It should provide a concise and precise description of the experimental results, their interpretation, as well as the experimental conclusions that can be drawn. NARX neural network is a nonlinear autoregressive model for describing nonlinear discrete systems [32].
It is the most widely used neural network in nonlinear dynamic systems. It is suitable for time series prediction and has been applied to solve the problems of nonlinear sequence prediction in many elds.
NARX neural network's memory effect on historical data enhances its processing ability for dynamic data, improves its prediction performance for complex series, has stronger mirroring capability for nonlinear tting, and is more suitable for analysis and prediction of time series data such as tide [32][33][34].
A typical NARX neural network consists of output layer, input layer, hidden layer and output and input delay. However, the parameters of each part of the corresponding neural network should be determined before application. Its basic structure is shown in Fig. 2.
In Fig. 2, x(t) means the external input of the neural network; for the two y(t) in the structure, the right one means the output of the neural network at the next time, and the left one means the output of the neural network at the previous (t-n) time; W means the connection weight; b means the threshold; 1:2 means the delay order, that is, the analog number of the next output layer refers to the number of the rst two input layers, and the mathematical expression is y(t) = f(x(t)-1),x(t-2)). The model of NARX neural network can be expressed in the following Equation [24,35]: In Eq. (3), u is an externally determined variable. According to the formula, the value of y(t) at the next moment depends on the input value x(t) and the previous output y(t).

Modular Tide Prediction
Theoretically, tides are periodic uctuations of sea water caused by the gravity of the moon and the sun, but in fact there are other factors affecting the tide data, such as air temperature, air pressure, wind, etc.
Therefore, the tide data can be divided into astronomical tides and non-astronomical tides in the tide forecast. The astronomical tides are mainly caused by the tide force of celestial bodies and have obvious change rules. The non-astronomical tide is affected by environmental factors, and its change has no obvious regularity, showing a strong randomness. Therefore, there is a big difference between the two parts. Only using a single method may not re ect the complete law of tide [36], which contains relatively large errors.
Based on the above situation, the modular/ensemble tide prediction method is added to the NARX model [37][38]. In this model, the astronomical tide part of harmonic analysis method is used to obtain the overall variation law of tide, and then NARX neural network is used to predict the non-astronomical tide part, and modify the prediction result, so as to improve the accuracy of tide prediction. The speci c steps are shown in Fig. 3.
The measured tide level data y(t) is set as the prediction input of the model, which is used for the modular prediction model. Because the harmonic analysis prediction model can be used for long-term tide prediction, y 0 (t) is the tide prediction value obtained by harmonic analysis module, and y 1 (t) is the difference between y and y 0 . Since the harmonic analysis method considers the in uence of celestial bodies on tides, the difference y 1 (t) between the veri ed data and the predicted data by harmonic analysis method can be regarded as the non-astronomical part of tide level data affected by various uncertainties and nonlinear factors such as hydrometeorology. In NARX model part, according to the model structure diagram (Fig. 2), if the model outputs the prediction data y 2 (t + 1) at the next moment, the input terminal actually measured ve kinds of meteorological data y 3 (t), y 3 (t-1) … y 3 (t-N + 1) and the outputted prediction y 1 (t) at last step. Finally, the nal prediction result y(t + N) can be obtained by adding the output data of NARX model and harmonic analysis module.

Simulation
In this paper, the tide level data from Yorktown, US (37 ° 13.6'N, 76 ° 28.7' W), are selected as the samples to verify the performance of the prediction model. Yorktown is a small town in southeast Virginia, USA, and now is a part of the National Historical Park. The satellite image is shown in Figure 4 below.
In the process of model simulation, the tide observation data of GMT0000 to GMT2300 from June 1, 2020 to July 30, 2020 in Yorktown is selected, and the observation interval is 1 hour. A total of 1440 groups of tide level data are listed, and the tide level time series of this period can be obtained by listing the data. Tide and meteorological data used in this paper are from the website https://tidesandcurrents.noaa.gov/. The observed tide level data is shown in Figure 5.

Prediction Analysis of Harmonic Analysis Method
In order to facilitate comparison, this paper directly intercepted the last 240 sets of harmonic analysis data and compared them with the actual observed tide level. The results are shown in Figure 6.
It can be seen from Figure 6 (a) and (b) that the prediction error range of harmonic analysis model is [0,0.25] meters. The larger error is mainly concentrated in the rst 150 groups of data, and the later prediction error is gradually stable. The stable prediction error is about 0.1 meters. This result obviously cannot satisfy the accuracy requirements.

Prediction and Analysis of GA-BP Neural Network
In order to complete the tide level prediction, it is necessary to set the initial input parameters of GA-BP neural network. The main contents include the layers' number of BP neural network, the number of nodes in the input layer, the hidden layer and the output layer, and the initial parameters of genetic optimization algorithm. Firstly, the topological structure of neural network model should be determined.
In this paper, the classic three-layer BP neural network is used, and the topological structure is in Figure 7.
The number of nodes in the input layer is determined by the number of input parameters. In this paper, BP neural network is used to train the data obtained by harmonic analysis method to predict tide, so the number of nodes in the input layer is taken as 1.
The number of nodes in the hidden layer mainly affects the performance of BP neural network. If the selected number of hidden layer nodes is not appropriate, the accuracy of prediction output data of trained network is often di cult to achieve the expected. To solve this problem, this paper adopts Equation (4).
In Equation (4), M means the number of hidden layer nodes, m means the number of input layer nodes, n means the number of output layer nodes, and a means a random natural number between 0 and 10.
Through the calculation of empirical formula combined with multiple test prediction method, the number of hidden layer nodes is nally determined to be 10.
For the GA-BP neural network model used in this paper, the output data is the predicted tide level at a certain time, so the number of nodes in the output layer is set as 1.
For the introduced genetic algorithm, four parameters need to be set in advance.
(1) The size of the population is generally 20 ~ 100 If the population size is too small, the population evolution cannot produce the expected number according to the pattern theorem; if the population size is too large, the results are di cult to converge and waste resources, and the robustness is reduced.
(2) The mutation probability is generally 0.0001 ~ 0.1 If the mutation probability is too small, the diversity of population will decrease too quickly, which will lead to the rapid loss of effective genes and is not easy to repair. If the mutation probability is too large, although the population diversity can be guaranteed, the probability of high-order patterns being destroyed increases with the increase of mutation probability.
(3) The crossover probability is generally 0.4 ~ 0.99 If the crossover probability is too large, it is easy to destroy the existing favorable pattern, increase the randomness, and easily miss the optimal individual. If the crossover probability is too small, it cannot effectively update the population.
(4) Evolutionary algebra, usually 100 ~ 500 If the evolutionary algebra is too small, the algorithm is not easy to converge, and the population is not mature; if the evolutionary algebra is too large, the algorithm is already skilled or the population is too early to converge again, it is meaningless to continue evolution, which will only increase time expenditure and resources waste.
Through repeated attempts and experiments, the population size is set as 50, the number of iterations is set as 100, the crossover probability is 0.5, and the mutation probability is 0.005. 1200 groups of data were trained before the prediction, and the last 240 groups of data were used as prediction output. The comparison between the predicted tide level and the actual tide level and the correlation between the predicted output and the actual output data are shown in Figure 8 and Figure 9.
As shown from the above gures, the prediction data of GA-BP neural network is basically consistent with the actual value, but the error of a small part of output data is still very large. the overall prediction error range of GA-BP neural network is reduced to less than 0.2 meters, which is lower than that of harmonic analysis method. However, the prediction error increases signi cantly before and after the peak tide level.
This phenomenon is more obvious in the last 100 sets of data.

NARX Modular Neural Network Prediction Analysis
As GA-BP model, in order to complete the tide level prediction, it is also necessary to set the initial input parameters of NARX neural network, including the number of nodes in the input layer, the hidden layer and the output layer, the delay order of input and output.

Comparison And Analysis
As shown from Fig. 13, most of the prediction output errors of GA-BP model are smaller than that of harmonic analysis model, and NARX modular model error is better than the other two methods in both uctuation range and stability. In addition, the mean absolute error (MAE), mean square error (MSE) and root mean square error (RMSE) of the three models are calculated and compared as follows: In Table 1, MAE is used to represent the average difference between the predicted value and the real value; MSE can re ect the degree of difference between the predicted value and the real value; RMSE can well re ect the measurement precision; the smaller the above three indicators, the better the prediction effect. It can be seen that NARX modular model has signi cantly higher prediction accuracy than GA-BP model and harmonic analysis model, and its prediction output is better than the other two models in the degree of prediction difference and error uctuation.
In this paper, aiming at many nonlinear factors that affect the tide level data, ve input parameters including wind speed, wind direction, gust speed, air temperature and air pressure are selected to predict tide level. Therefore, the number of input nodes is 5; the number of output nodes is 1; the number of neurons in hidden layer is determined as 10 according to the empirical equation (4); and the default delay order of input and output is 1: 2. This means that the simulation data of the next output layer refers to the data of the rst two input layers; the greater the delay order is, the more data are referenced in the prediction process, and the better the prediction effect is. In this paper, the delay order is set as 1:20.
After setting, its structure is shown in Figure 10.
The comparison and correlation between the predicted tide level and the observed tide level after training are shown in Figure 11 and Figure 12.
As shown from the gures, the prediction results are in good agreement with the actual observed tide level change trend, and the correlation between the predicted output data and the actual output data reaches 0.988. Only when the tide level is about to turn, the prediction error is relatively large, but it has little impact on the overall accuracy of the data. Compared with the rst two prediction methods, NARX modular model has a better prediction effect. According to the speci c error data, the error is basically stable within 0.05 meters.
To compared with the harmonic analysis model, both GA-BP neural network and NARX modular model have improved the accuracy of tide level prediction (Fig. 14). However, GA-BP neural network prediction model cannot adjust the prediction results in time, so that the prediction output at these time points continues to increase, forming a sharp curve on the output image. For NARX modular prediction model, the prediction output can be adjusted accurately and timely to make the output data conform to the reality as much as possible; in the period before and after the peak tide level, the output error is only slightly increased compared with other time periods, and has little impact on the overall prediction results.
Since long-term accurate prediction plays a more important role in the actual tide prediction, this paper conducts an extended experiment on the basis of single-step prediction. The following table lists and analyzes the RMSE of the prediction error of the three methods in the case of multi-step prediction. It can be seen from Table 2 that NARX has higher prediction accuracy than GA-BP. With the advance of prediction time, the prediction accuracy of both methods decreases, but GA-BP is more affected than NARX. The prediction accuracy of GA-BP in multi-step prediction is lower than that of traditional harmonic analysis model, while the prediction error of NARX modular model is relatively stable.

Conclusions
In this paper, a modular tide level prediction model based on NARX neural network is proposed. The tide level data of Yorktown in the United States is used for simulation prediction, and the prediction results are compared with those of HA and GA-BP models. Compared with the other two methods, a model is not required before the prediction, the NARX modular prediction model can be tted to give the prediction output by analyzing the dynamic data. The results show that NARX modular prediction model has stable prediction error and high prediction accuracy. Even with the advance of forecast time, it can still give accurate prediction results, and has a good tting degree for tide level data. This model can be used not only in tide prediction, but also in other time series problems. The structure diagram of GA-BP model.

Figure 2
The structure of NARX neural network.

Figure 3
The block diagram of modular tide prediction model.

Figure 4
The satellite images of Yorktown (source: http://maps.google.com/ ). Note: The designations employed and the presentation of the material on this map do not imply the expression of any opinion whatsoever on the part of Research Square concerning the legal status of any country, territory, city or area or of its authorities, or concerning the delimitation of its frontiers or boundaries. This map has been provided by the authors.

Figure 5
Page 16/21 The tide level observation data.  The topological structure of BP neural network.  The correlation between predicted value and actual value of GA-BP model.

Figure 10
The structure of NARX neural network.   The error comparison.