Channel water level prediction method based on online echo state network algorithm
By using the online echo state network (SW-OSESN) model selected by self-attention mechanism weight in water level prediction in waterways, the problem of poor medium- and long-term water level prediction in the prior art is solved, and a higher accuracy and stable water level prediction is achieved.
Patent Information
- Application Number
- CN202410746888.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-11
- Publication Date
- 2025-03-28
- Estimated Expiration
- 2044-06-11
AI Technical Summary
The existing medium- and long-term water level prediction algorithms have problems such as poor prediction results, unstable predictions, and inability to update models based on real-time data.
Using the waterway water level prediction method based on the online echo state network algorithm, an online echo state network (SW-OSESN) model with self-attention mechanism weight selection is proposed. The input weight and internal weight are selected using the scaling method and self-attention weight selection method, and an online learning network with a priori knowledge base that can autonomously update the model is designed.
It improves the accuracy of medium- and long-term water level prediction, overcomes the problem of prediction instability, and can automatically update the model based on new data, so that the prediction model has the ability to update the water level change trends and characteristics in real time.
Smart Images

Figure CN118586557B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of water level prediction, and in particular to a waterway water level prediction method based on an online echo state network algorithm. Background Art
[0002] In the field of transportation, water transportation has become one of the most important modes of transportation in commodity exchange due to its high carrying capacity and low freight. China has abundant river resources, including natural rivers such as the Yangtze River, Pearl River, and Yellow River, as well as artificial waterways such as the Beijing-Hangzhou Grand Canal. These rivers not only provide water for life and agriculture, but also have important functions in water transportation, flood control and drought relief, aquaculture, and tourism. The Yangtze River is the longest river in China. Among its main streams and tributaries, it is conducive to the passage of ships and has natural conditions for the development of water transportation. At present, with the development and application of technologies such as electronic navigation charts, navigation mark telemetry and remote control, and water level telemetry and remote control, the ability to collect waterway status information and provide navigation information services has been significantly improved.
[0003] At the same time, water level prediction is crucial for the safe passage of ships through waterways, and it also affects the navigability of waterways. Accurate waterway water level data ensures that ships can safely and efficiently cross rivers, lakes, ports and various waters in coastal areas. Providing accurate and timely water level prediction is crucial to enhancing the safety of maritime navigation. Therefore, real-time observation and accurate prediction of water level status are of great reference significance for the safety of ships sailing in waterways, flood prevention work during flood season, and ecological governance work. In addition, waterway water level prediction is crucial for inland waterway traffic, and plays a key role in cargo loading, navigation efficiency and navigation safety. Scientific and reasonable inland water level prediction can improve waterway navigation efficiency and ensure the safety of ship navigation. Recording the water level of inland waterways is an important task, which plays a vital role in guiding navigation safety and flood prevention. High-precision water level prediction helps to improve waterway shipping safety and arrange maintenance of waterways. However, in today's medium- and long-term prediction algorithms, there are problems such as poor medium- and long-term prediction results, unstable predictions, and inability to update models based on real-time data.
[0004] With the advancement of telemetry and remote control technology, a large amount of water level data can be obtained by setting up water level observation stations. The theories and technologies in the field of artificial intelligence provide new ideas for learning and building prediction models from big data. However, current research still has some limitations, such as low long-term prediction accuracy, the inability of the model to update autonomously based on newly generated data, and the existence of prediction uncertainty.
[0005] Existing technologies, such as the long short-term memory (LSTM) and gated recurrent unit (GRU) used in the Dongting Lake water level prediction research based on recurrent neural network, have constructed a prediction model for the water level change of Dongting Lake. The memory unit in the LSTM model processes the water level time series data by using the characteristics of the memory unit, which transmits the feature information in the time series from one unit to the next unit like a conveyor belt. However, when faced with massive data, the computational complexity of LSTM in each layer of the network will increase layer by layer, and LSTM uses the gradient descent method to back-propagate the loss function to iterate the weight of the network, which also leads to a great impact on the training efficiency of LSTM; although GRU is more efficient than LSTM in computational complexity, it also needs to find the optimal parameters during the training process, and the number of its parameters is also large, which makes the model also have the problem of parameter dependence; the model LSTM or GRU cannot add new data features to the training model after the model is trained. For example, in the study of water level prediction of Panjiakou Reservoir based on PCA-ESN model, an algorithm is proposed to pre-process the data using PCA algorithm and then predict the reservoir water level through echo network. Although the main factors affecting the water level are discovered through PCA data processing, and the ESN model is used for efficient water level prediction, the model prediction is uncertain due to the random selection of model weights. It is also an offline model. If the data is not retrained, new features cannot be added to the trained model. Summary of the invention
[0006] In view of this, the present invention discloses a waterway water level prediction method based on an online echo state network algorithm. The present invention proposes a new network model structure, called a self-attention weighted online sequential echo state network (SW-OSESN) for medium- and long-term water level prediction. It utilizes the advantages of reservoir computing (RC), improves the accuracy of medium- and long-term water level prediction, overcomes the problem of unstable prediction, and solves the problem of needing to retrain the model when new data is added, so that it can be better applied to real scenarios.
[0007] To this end, the present invention adopts the following technical solutions:
[0008] The present invention discloses a method for predicting water level of a waterway based on an online echo state network algorithm, the method comprising:
[0009] S1. Obtain water level data of the channel recorded by multiple water tunnel stations;
[0010] S2. Construct and train an online sequential echo state network with self-attention weight selection as a medium- and long-term waterway water level prediction model; in the waterway water level prediction model, the input weights and internal weights are selected by using a scaling method and a self-attention weight selection method, and an online learning network with a prior knowledge base that can independently update the model is used for online learning, so that the kernel storage state is automatically updated with the input of new data;
[0011] S3. Based on the acquired water level data, the waterway water level prediction model is used to predict the waterway water level.
[0012] Furthermore, the input weights and internal weights are selected using the scaling method and the self-attention weight selection method, including:
[0013] Calculate the initial weight ω: Where O is a matrix of dimension [D,Q] randomly selected based on uniform distribution, D is the size of the training window, Q is the number of hidden neurons, and provides decentralized input weights in the neural network;
[0014] Scale the initial weights to calculate the input weights W: Among them, Φ is the maximum value in the initial weight matrix;
[0015] Calculate initial internal weights
[0016] Where O is a matrix of dimension [Q,Q] randomly selected based on a normalized distribution, and μ is the maximum value of the matrix O;
[0017] Calculate the relationship weight A between hidden neurons:
[0018] Where softmax is the softmax normalization method; d k is the size of the similarity matrix; K is the linear transformation of the similarity matrix;
[0019] Apply the calculated relationship weight A to find the connection relationship R between the reservoir states, and then standardize R to a value between 0 and 1: R = max_min (Aξ); where max_min is the maximum-minimum standardization function; ξ is the similarity matrix between the initial storage states;
[0020] Generate internal weight W based on connection relationship R based on filtering method in .
[0021] Furthermore, internal weights are generated according to the connection relationship R based on a filtering method, including: setting all elements in R that are smaller than the maximum value of each row to zero.
[0022] Furthermore, online learning is performed using an online learning network with a prior knowledge base that can autonomously update the model, including: an initial learning stage and a sequential learning stage;
[0023] The initial learning phase builds a priori knowledge base based on the initial training data;
[0024] The sequential learning stage learns features from samples arriving in real time, updates the interval coefficient using the error coefficient and scaling coefficient, and adds the newly entered water level features to the prior knowledge base, so that the prediction model has the latest water level features and change trends without retraining.
[0025] Furthermore, the initial learning phase builds a priori knowledge base based on the initial training data, including:
[0026] Calculate the first initial reserve pool state S1 according to the first sample x1 in the initial training data: S1 = [x1, F(Wx1)];
[0027] Based on the remaining samples in the initial training data, calculate the i-th initial reserve pool state S i :
[0028] S i =(1-α)S i-1 +αF(Wx i +W in S i-1 );
[0029] The reservoir state and the initial training data are combined as the initial reservoir state S0;
[0030] where α is the leakage rate; F(·) is the hyperbolic tangent function; x i is the i-th initial training sample;
[0031] Calculate the initial interval coefficient K0 based on the initialization reservoir state S0: K0 = S0S0 T ;
[0032] Calculate the initial output weight β0 based on the initial reservoir state S0 and the initial interval coefficient K0:
[0033] Furthermore, the sequential learning stage learns features from samples arriving in real time, updates the interval coefficients using the error coefficient and scaling coefficient, and adds the newly entered water level features to the prior knowledge base, so that the prediction model has the latest water level features and change trends without retraining, including:
[0034] Assume that there are K samples in the sequential learning stage to continue updating the model and calculate the corresponding reservoir state S j :S j =(1-α)Sj-1 +αF(Wx j +W in S j-1 );
[0035] Where S j is the jth training sample in the continuous part;
[0036] The updated pool state is combined with the training sample: S j =[x j ,S j ];
[0037] According to the error parameter τ=||S j β j-1 -T j ||Update the inverse of the interval coefficient K -1 j:
[0038]
[0039] Where j is the number of training data in the sequential stage, j = [1, 2, ..., N]; K represents the transposed matrix of the j-th reservoir state; j-1 represents the j-1th interval coefficient; η is the scaling factor;
[0040] Output weight β based on previous state j-1 , the inverse of the current interval coefficient and the current reserve pool state S j , update the output weight β j :
[0041] Where T j Represents the true value of the jth state.
[0042] The above technical solution has the following beneficial effects:
[0043] The present invention constructs a brand-new online prediction network structure, in which the learning part of SW-OSESN includes an initial learning stage and a sequential learning stage. The initial learning stage constructs a priori knowledge base based on the initial training data. The sequential learning stage focuses on learning features from samples arriving in real time, and updates the interval coefficient using the error coefficient and the scaling coefficient. It can add the newly entered water level features to the priori knowledge base, so that the prediction model can have the latest water level features and change trends without retraining. The kernel storage state can be automatically updated with the input of new data, and has the ability to update the water level change trend and water level features in real time. It not only solves the problem of inefficient information transmission of storage states in traditional neural networks, but also can efficiently update the prediction model according to new data.
[0044] In this paper, a self-attention weight selection method is designed to replace the randomly selected weights. Appropriate input weights and internal weights are selected by a weight selection method based on scaling and self-attention to replace the randomly selected weight connections in the online prediction algorithm. This not only overcomes the uncertainty of the prediction, but also enhances the interpretability of the weight selection in the proposed online learning algorithm. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0046] Figure 1 It is a flow chart of a waterway water level prediction method based on an online echo state network algorithm in an embodiment of the present invention;
[0047] Figure 2 The comparison between the predicted value and the true value of the 18th step of SW-OSESN in the artificial data in the embodiment of the present invention;
[0048] Figure 3 This is the comparison between the predicted value and the true value of the eighteenth step of the water level prediction data of SW-OSESN in the embodiment of the present invention. DETAILED DESCRIPTION
[0049] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0050] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0051] The basic idea of the present invention is: first, the present invention proposes an online learning algorithm called online sequential echo state network (OS-ESN) for multi-step time series prediction. Its training samples can update the model in sequence. The learning part of OS-ESN includes an initial learning stage and a sequential learning stage. Prior knowledge is learned from the initial learning stage, and the sequential learning stage focuses on learning features from upcoming samples and updating the online learning model. Compared with other random-based online and offline learning models, the network has superior multi-step prediction capabilities in waterway water level data. Secondly, the present invention designs a weight selection method based on a self-attention mechanism, which uses a weight selection method based on scaling and self-attention to replace the randomly selected input weights and internal weights in OS-ESN, which helps to reduce instability and enhance the interpretability of the weight selection strategy. Through these two methods, the present invention proposes an online sequential echo state network called self-attention weighted online sequential echo state network (SW-OSESN) for medium- and long-term water level prediction. It uses scaling and self-attention weight selection methods to select input weights and internal weights, and designs an online learning network with a prior knowledge base that can autonomously update the model, which can obtain accurate prediction results in medium- and long-term water level forecasts.
[0052] like Figure 1 As shown, the waterway water level prediction method based on the online echo state network algorithm in the embodiment of the present invention specifically includes the following steps:
[0053] S1. Obtain water level data of the channel recorded by multiple water tunnel stations;
[0054] Among them, the waterway water level data is a time series collected at multiple moments;
[0055] S2. Build and train the online sequential echo state network SW-OSESN with self-attention weight selection;
[0056] S3. Based on the acquired water level data, the waterway water level is predicted using SW-OSESN.
[0057] SW-OSESN mainly includes three stages: weight selection stage, initial learning stage and sequential learning stage.
[0058] (I) Weight selection stage:
[0059] The input weights are selected by the scaled Xavier method. The initial weights (ω) can be calculated by formula (1):
[0060]
[0061] Where O is a matrix of dimension [D,Q] randomly selected based on uniform distribution, D is the size of the training window, and Q is the number of hidden neurons. It provides decentralized input weights in the neural network. Next, the initial weights are scaled to calculate the appropriate range W of the input weights. The mathematical representation after scaling is shown in formula (2).
[0062]
[0063] Where Φ is the maximum value of in the initial weight matrix. On the other hand, the internal weights of OS-ESN represent the connections between hidden neurons. Here, a self-attention weight selection method is introduced to find suitable connections to represent the distribution of internal weights in OS-ESN. In order to extract the relationship between the reservoir states, the initial training data is used in the present invention to calculate the corresponding initial reservoir state (v). Its mathematical representation is shown in the following formula:
[0064]
[0065] where F(·) is the hyperbolic tangent function; x n is the nth initial training sample; v n is the nth initial reservoir state; the first reservoir state can be calculated by v1 = F(Wx1); represents the initial internal weight, which is selected by formula (4):
[0066]
[0067] Where O is a matrix of dimension [Q,Q] randomly selected based on a normalized distribution, and μ is the maximum value of the matrix O. Based on the initial reservoir state v = [v1,v2,…,v L0], each row of initial storage state represents the characteristics of each hidden neuron. The similarity between the initial reservoir states can be calculated by the product of v and vT. Then, the similarity matrix ξ is readjusted within the range of 0 and 1 using the max-min normalization method. In order to extract the connection relationship between these hidden neurons, the present invention designs a self-attention mechanism to calculate the relationship between these hidden neurons based on the similarity matrix. The relationship weight A between these hidden neurons can be calculated by formula (5).
[0068]
[0069] Where softmax is the softmax normalization method; d k is the size of the similarity matrix; K is the linear transformation of the similarity matrix. Further, the calculated weight A is applied to find the connection relationship R between the reservoir states, and then R is standardized to a value between 0 and 1, and its mathematical expression is as shown in formula (6):
[0070] R=max_min(Aξ) (6)
[0071] Where max_min is the maximum-minimum normalization function. The matrix R represents the connection relationship between hidden neurons. However, in order to simplify the connection relationship and avoid the overfitting problem, the present invention sets all elements in the matrix R that are less than the maximum value of each row to zero. This method not only discards the less influential elements in the matrix R, but also retains the highest closed connection between hidden neurons. Therefore, based on this filtering method, the matrix R can be transformed into a matrix with zeros (W in ), which can be used to replace the randomly selected OS-ESN internal weights.
[0072] (II) Initial learning stage:
[0073] The initial training data is used to calculate the initial reservoir state S0 and the initial output weight β0. The present invention sets 20% of the training data as the initial training data. The first reservoir state S1 can be calculated as S1 = [x1, F (Wx1)], where x1 is the first sample feature. In order to enrich the representation of the features, the reservoir state and the original features are grouped together as the initial reservoir state. Then, based on the remaining initial training data, the mathematical representation of the initial reservoir state S0 can be expressed by formula (7):
[0074]
[0075] Where L0 is the size of the initial training sample, x L0 is the L0th initial training sample, S L0 is the L0th initial reservoir state. Each initial reservoir state can be calculated by formula (8).
[0076] S i =(1-α)S i-1 +αF(Wx i +W in S i-1 ) (8)
[0077] where α is the leakage rate and i is the number of initial reservoir states (i = [2, 3, ..., L0]). Next, the initial interval coefficient K0 is defined as K0 = S0S0 T .
[0078] The initial output weight (β0) can be calculated using formula (9):
[0079]
[0080] (III) Sequential learning stage:
[0081] The main goal is to update the output weights according to the interval coefficients and the upcoming training samples. Assume that there are K samples to continue updating the model in the sequential learning stage. First, the corresponding reservoir state S is calculated by formula (10): j :
[0082] S j =(1-α)S j-1 +αF(Wx j +W in S j-1 ) (10)
[0083] Where S j is the jth training sample in the continuous part. Then, the updated reservoir state can be combined with the training sample, and its mathematical expression is shown in formula (11):
[0084] S j = x j ,S j ] (11)
[0085] Next, according to the error parameter (τ = || S j β j-1 -T j ||) Update the inverse of the interval coefficient (K -1 j). Its mathematical expression can be expressed by formula (12):
[0086]
[0087] Where j is the number of training data in the sequential stage (j = [1, 2, ..., N]); K represents the transposed matrix of the j-th reservoir state; j-1represents the (j-1)th interval coefficient; η is the scaling factor, which is defined as 1e-20 in the present invention. Then, based on the output weight β of the previous state j-1 , the inverse of the current interval coefficient and the current reserve pool state S j , the output weight β can be updated by formula (13) j .
[0088]
[0089] Where T j represents the true value in the jth state. Finally, the updated output weight and test data set (X t ) to perform prediction work. Test the state of the reserve pool S t (i) is based on the input weight (W) and the first test feature (X t (1)) calculated, can be displayed as S t (1) = F) WX t (1)). Then, the test reservoir state can be calculated by equation (14):
[0090] S t (p) = (1-α)S t (p-1)+αF(WX t (p)+W in S t (p-1)) (14)
[0091] Where p is the number of test samples, i = [2, 3, ..., P]. The final test pool state is the same as the way the reserve pool state is processed in the training phase. The conversion can be performed using formula (15):
[0092]
[0093] Use calculation to get the test reservoir status The updated output weight β can be used to predict the test data set. Its mathematical expression can be seen in formula (16):
[0094]
[0095] in, Represents the predicted value. The simple training and prediction process is also shown in Table 1.
[0096] Table 1
[0097]
[0098]
[0099] The above embodiments have the following beneficial effects:
[0100] 1) Water level prediction is one of the key technologies for intelligent perception of intelligent navigation systems. The present invention proposes a novel online sequential echo state network, which can use newly collected data to update the model in real time, so that the model has the latest water level characteristics and changing trends.
[0101] 2) The weight selection method based on the self-attention mechanism proposed in the present invention also replaces the original randomly selected input weights and internal weights, which also solves the prediction uncertainty problem existing in the prediction of the OS-ESN model and improves the prediction accuracy of the water level to a certain extent.
[0102] 3) The water level prediction model of the present invention can be deployed as a service interface to provide convenient water level data for waterway bureaus or crew members, thereby improving the level of waterway information services and the safety of ship navigation.
[0103] In order to verify the prediction ability of the prediction algorithm proposed in the present invention for water level, the present invention uses artificial data and water level data to verify and compare the model and method. The artificial data includes two data: Mack-Glass and Lorenz. Among them, Mack-Glass (MG) is used as a benchmark model in the literature due to its chaotic characteristics, which is created by the following equation:
[0104]
[0105] The delay parameter τ determines the characteristics of the equation. For example, τ>16.8 means that the generated time series is chaotic. In the above formula, constants b=0.1, c=0.2, τ=30, and x(t) represents the value of the variable at time t (t=1, 2, ..., T). Generate a Mack-Glass time series sample set with a length of 1036.
[0106] Secondly, the Lorenz time series dataset is a weather example of a chaotic system, which is a simplified version of the Navier-Stokes equation used in fluid mechanics. The Lorenz equation is written as follows:
[0107]
[0108]
[0109]
[0110] Among them, σ = 10, b = 8 / 3, r = 28. Consider the x-coordinate of the Lorenz time series for prediction and generate a time series of length 2536. In this artificial data, the prediction horizon (P) is set to eighteen steps and the size of the prediction time window (D) is eighteen.
[0111] In the water level data, water level data of four hydropower stations in the Nanjing section of the Yangtze River are collected, including: Banqiao, Dadaokou, Longtankou, and Sanjiangkou. These water level data are the average of the water level conditions recorded every hour at each hydropower station. During the training process, the size of the prediction range (P) is set to one hundred and twenty, and the size of the time window (D) is set to twenty-four. Based on the above settings and through the data conversion method, a data matrix for model training can be generated. The detailed information of the artificial data and water level data is shown in Table 2.
[0112] Table 2
[0113] Data Name Abbreviation Time Data length Data Dimensions Mack-Glass MG - 1036 [1000,36] Lorenz BM - 2536 [2500,36] Banqiao BQ 2017 / 01 / 05-2023 / 06 / 14 41516 [41372,144] Dadaokou DD 2017 / 07 / 05-2023 / 06 / 14 48724 [48580,144] Longtan River Estuary LT 2017 / 01 / 23-2020 / 07 / 11 30329 [30185,144] Sanjiangkou SJ 2017 / 01 / 09-2023 / 06 / 13 56254 [56110,144]
[0114] On the other hand, in order to reflect the superiority of the prediction performance of the present invention and solve the limitations of the original prediction model, the prediction performance of SW-OSESN is compared with that of random online learning algorithms (Online Sequential Extreme Learning Machine (OS-ELM) and Online Sequential Echo State Network (OS-ESN)). In addition, all data are divided into 70% and 30% in different models to generate training data sets and test data sets.
[0115] Before model training, in order to enable all comparison models to achieve the best prediction results, the parameter selection of each model is also an important consideration for model training. In all comparison model training, the optimal number of hidden neurons is searched with a grid search method in the range of [10, 1000] and an interval of 10. In OS-ESN and SW-OSESN, the value of the spectral radius needs to be determined. The value of the optimal spectral radius is determined by searching in the range of [0.05, 0.95] and an interval of 0.05. In addition, in the random algorithm, in order to unify the prediction ability of the random algorithm, the random initialization seed is set to 1000 in the experiment.
[0116] Finally, in order to evaluate the prediction performance of the method and prediction model proposed in the present invention in different orders of magnitude in each time period. In the comparison experiment of artificial data, the historical data of eighteen steps are used to predict the numerical trend of the next eighteen steps. When comparing the prediction effects, this experiment divides the prediction results into four time periods, including: 1-6 steps, 7-12 steps, 13-18 steps, and the average prediction results of 1-24 steps. At the same time, in the water level data comparison experiment, one hundred and twenty hours of historical data are used to predict the water level conditions in the next twenty-four hours. When comparing the prediction effects, this experiment divides the prediction results into five time periods, including 1-6 steps, 7-12 steps, 13-18 steps, 19-24 steps, and the average prediction results of 1-24 steps, which can better understand the prediction performance of the model under different periods.
[0117] In the comparative experiment of artificial data and water level data, the mean square error (MSE) and symmetric mean absolute percentage (SMAPE) are used to measure their prediction levels, and the formula is expressed as follows:
[0118]
[0119]
[0120] Among them, Y i represents the i-th real data value; is the i-th predicted data value; n represents the total number of data.
[0121] The artificial data comparison experiment shows the performance comparison between the traditional online sequence extreme learning machine and the online echo algorithm and its variant model, SW-OSESN. Table 3 shows the performance of these three prediction models in multiple period average predictions.
[0122] Table 3
[0123]
[0124] In the MG dataset, the MSE and SMAPE of SW-OSESN are the lowest in all four time periods, which shows that SW-OSESN has excellent prediction capabilities in different time prediction periods. In addition, by comparing the prediction performance of OS-ESN and OS-ELM, it is found that the average values of MSE and SMAPE of OS-ESN in these four prediction periods are smaller than those of OS-ELM, which directly proves that the online sequence learning model based on the echo algorithm designed by the present invention is better than the online prediction model based on the extreme learning machine. Compared with the value of SMAPE, SW-OSESN is 32.67% lower than OS-ELM. For the Lorenz dataset, the MSE and SMAPE values of the three prediction models are compared. Except for the performance of SMAPE in the prediction period 13-18, SW-OSESN has achieved the best performance. Using the SMAPE standard to measure the performance of the prediction period 13-18, OS-ELM achieves the best prediction effect, but it is only reduced by 0.02% compared with SW-OSESN. Compared with the prediction results of the overall 1-18 long periods, whether compared by MSE or SMAPE, SW-OSESN has achieved better prediction results than the other two prediction models. In addition, from the prediction results of the prediction model SW-OSESN in three different periods, it can be seen that the prediction accuracy of the short-term (1-6) time series is higher than that of the medium-term (7-12) and long-term (13-18), and its prediction accuracy also decreases with the increase of the number of prediction steps. In order to more intuitively show the prediction performance of the SW-OSESN prediction model, Figure 2 The comparison between the predicted value (blue curve) and the true value (red curve) of SW-OSESN at the 18th step in the artificial test data set is shown. It can be seen that the predicted curve at the 18th step can basically fit the curve of the true value, and their time series trends are basically consistent.
[0125] In summary, SW-OSESN shows more stable and excellent performance in processing these two datasets, especially in long-term prediction. OS-ESN has certain advantages in short-term prediction, but its performance in long-term prediction is not as good as SW-OSESN. Although OS-ELM performs well in some short-term predictions, its performance in long-term predictions is more obvious.
[0126] In the comparative experiment of water level data, the twenty-four-step prediction range is divided into five prediction periods, including short-term (1-6), short-term and medium-term (7-12), medium-term and long-term (13-18), long-term (19-24), and average period (1-24). Table 4 shows the performance of the OS-ELM, OS-ESN, and SW-OSESN prediction models in the above prediction periods. In the BQ data, the MSE is the lowest in the range of 1-6, and the SMAPE is also relatively low. However, as the time range increases, the MSE and SMAPE increase, but they still remain at a low level overall. For the model SW-OSESN, the values of MSE and SMAPE are similar to those of OS-ESN in the range of 1-6, but the SMAPE of SW-OSESN decreases slightly as the time range increases. Comparing the three prediction models, except that the MSE obtains the minimum value in OS-ESN, the minimum values of other prediction periods appear in the SW-OSESN prediction model. In the DD data, the MSE and SMAPE values of SW-OSESN are the lowest in all prediction periods, which shows the best water level prediction ability of SW-OSESN in DD hydropower stations. In the LT data, except for OS-ESN obtaining the lowest MSE value in the 1-6 prediction periods, SW-OSESN achieved the smallest MSE and SMAPE values in other prediction periods. In the LT data, SW-OSESN obtained the smallest MSE and SMAPE values in five different prediction periods, which directly proves that the SW-OSESN prediction model shows better prediction results than the other two prediction models in any prediction period. In order to more intuitively show the prediction performance of the SW-OSESN prediction model, Figure 3 The comparison between the predicted value (blue curve) and the true value (red curve) of SW-OSESN in the water level test dataset at the 24th step is shown. It can be seen that the predicted curve at the 24th step can basically fit the curve of the true value. Their time series trends are basically consistent.
[0127] Table 4
[0128]
[0129]
[0130] In summary, SW-OSESN generally shows more stable and excellent performance when processing these water level datasets, especially on the DD and SJ datasets. OS-ESN has certain advantages in short-term prediction, but its performance in long-term prediction is not as good as SW-OSESN. Although OS-ELM performs well in some short-term predictions, its performance in long-term predictions is more obvious.
[0131] Through the above comparative experiments, it can be concluded that the prediction performance of SW-OSESN is better than that of OS-ELM and OS-ESN, and the prediction performance of OS-ESN is better than that of OS-ELM, which shows that the network model structure proposed in the present invention not only improves the water level prediction accuracy, but also can stably update the prediction model by adding new data. In addition, the weight selection method based on the self-attention mechanism also replaces the original randomly selected input weights and internal weights, which also solves the prediction uncertainty problem of the OS-ESN model in prediction. Based on the performance of different types of artificial data and real water level data, SW-OSESN shows excellent prediction ability and prediction stability. It not only achieves accurate prediction results in different prediction states in all water level data, but also can obtain excellent performance in small-scale artificial data. Therefore, the prediction model proposed in the present invention is helpful to monitor and predict the water level of water stations, and the prediction model can be updated in real time by adding new data, so that the model can learn updated water level characteristics and change trends. The prediction data obtained by the model proposed in the present invention can provide data support for maintaining navigation safety.
[0132] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for predicting water level in a waterway based on an online echo state network algorithm, characterized in that: include: Obtain channel water level data recorded by multiple water tunnel stations; An online sequential echo state network with self-attention weight selection is constructed and trained as a medium- and long-term waterway water level prediction model. The waterway water level prediction model uses a scaling method and a self-attention weight selection method to select input weights and internal weights, and uses an online learning network with a prior knowledge base that can update the model autonomously to perform online learning, so that the kernel storage state is automatically updated with the input of new data. Based on the acquired water level data, the waterway water level prediction model is used to predict the waterway water level; The input weights and internal weights are selected using the scaling method and the self-attention weight selection method, including: Calculate the initial weight ω: Where O is a matrix of dimension [D,Q] randomly selected based on uniform distribution, D is the size of the training window, Q is the number of hidden neurons, and provides decentralized input weights in the neural network; Scale the initial weights to calculate the input weights W: Among them, Φ is the maximum value in the initial weight matrix; Calculate initial internal weights Where O is a matrix of dimension [Q,Q] randomly selected based on a normalized distribution, and μ is the maximum value of the matrix O; Calculate the relationship weight A between hidden neurons: Where softmax is the softmax normalization method; d k is the size of the similarity matrix; K is the linear transformation of the similarity matrix; Apply the calculated relationship weight A to find the connection relationship R between the reservoir states, and then standardize R to a value between 0 and 1: R = max_min (Aξ); where max_min is the maximum-minimum standardization function; ξ is the similarity matrix between the initial storage states; Generate internal weight W based on connection relationship R based on filtering method in ; Online learning is performed using an online learning network with a priori knowledge base that can autonomously update the model, including: an initial learning phase and a sequential learning phase; The initial learning phase builds a priori knowledge base based on the initial training data; The sequential learning stage learns features from samples arriving in real time, updates the interval coefficient using the error coefficient and scaling coefficient, and adds the newly entered water level features to the prior knowledge base, so that the prediction model has the latest water level features and change trends without retraining.
2. A method for predicting water level in a waterway based on an online echo state network algorithm according to claim 1, characterized in that: Generate internal weights according to the connection relationship R based on the filtering method, including: setting all elements in R that are smaller than the maximum value of each row to zero.
3. A method for predicting water level in a waterway based on an online echo state network algorithm according to claim 1, characterized in that: The initial learning phase builds a priori knowledge base based on the initial training data, including: Calculate the first initial reserve pool state S1 according to the first sample X1 in the initial training data: S1 = [x1, F(Wx1)]; Based on the remaining samples in the initial training data, calculate the i-th initial reserve pool state S i : S i =(1-α)S i-1 +αF(Wx i +W in S i-1 ); The reservoir state and the initial training data are combined as the initial reservoir state S0; where α is the leakage rate; F(·) is the hyperbolic tangent function; x i is the i-th initial training sample; Calculate the initial interval coefficient K0 based on the initialization reservoir state S0: K0 = S0S0 T ; Calculate the initial output weight β0 based on the initial reservoir state S0 and the initial interval coefficient K0:
4. A method for predicting water level in a waterway based on an online echo state network algorithm according to claim 3, characterized in that: The sequential learning stage learns features from samples arriving in real time, updates the interval coefficients using the error coefficient and scaling coefficient, and adds the newly entered water level features to the prior knowledge base, so that the prediction model has the latest water level features and change trends without retraining, including: Assume that there are K samples in the sequential learning stage to continue updating the model and calculate the corresponding reservoir state S j :S j =(1-α)S j-1 +αF(Wx j +W in S j-1 ); Where S j is the jth training sample in the continuous part; The updated pool state is combined with the training sample: S j =[x j ,S j ]; According to the error parameter τ=∥S j β j-1 -T j ∥Update the inverse of the interval coefficient K -1 j: Where j is the number of training data in the sequential stage, j = [1, 2, ..., N]; K represents the transposed matrix of the j-th reservoir state; j-1 represents the j-1th interval coefficient; η is the scaling factor; Output weight β based on previous state j-1 , the inverse of the current interval coefficient and the current reserve pool state S j , update the output weight β j : Where T j represents the true value in the jth state.
Citation Information
Patent Citations
Water level prediction method based on whale optimization algorithm and long-short term memory network
CN114912673A
Air temperature prediction method and system based on self-attention echo state network
CN117194918A