A water level prediction method based on an integrated intelligent model
Patent Information
- Application Number
- CN202610816956.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-08
- Publication Date
- 2026-08-28
AI Technical Summary
[0011]本申请提供一种基于集成智能模型的水位预测方法,要解决的技术问题包括:如何有效捕捉洪水流量时间序列中的长短期依赖性和复杂非线性特征,如何提升预测模型的精度、鲁棒性和计算效率,如何增强模型对预测结果的解释能力,以及如何克服单一模型在处理非平稳、非线性水文时序数据时的局限性
1)本申请通过构建基于Stacking集成学习的洪水水位预测方法,将长短期记忆网络-序列到序列模型、支持向量回归模型以及基于多头注意力机制的Transformer模型作为基础学习器,并采用Stacking方法训练元学习器进行最终预测。该集成框架能够综合发挥长短期记忆网络-序列到序列模型在时间依赖建模方面的优势、支持向量回归模型在非线性拟合方面的优势以及Transformer模型在多尺度特征提取方面的优势,从而全面捕捉洪水流量时间序列中的长短期依赖性和复杂非线性特征,显著提升预测精度和鲁棒性,有效克服单一模型在处理非平稳、非线性水文时序数据时的局限性。
Smart Images

Figure CN122654792A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of hydrological prediction technology, and in particular to a water level prediction method based on an integrated intelligent model. Background Technology
[0002] Floods are among the most common and destructive natural disasters globally. Against the backdrop of global climate change, extreme precipitation events are becoming more frequent, river levels are rising rapidly, and the risk of flooding is significantly increasing. Currently, flood level prediction methods mainly include physical model-based prediction methods, hydrodynamic model prediction methods, regression analysis methods, time series analysis methods, wavelet analysis methods, and machine learning and deep learning methods.
[0003] Physical model-based prediction methods forecast water levels by simulating watershed hydrological processes, such as the Stanford model, Sacramento model, and Xin'anjiang model. These methods offer good physical interpretability and can realistically reflect changes in hydrological processes. However, the versatility of physical models is limited, and their applicability depends on the specific physical context and environmental conditions. In areas with complex topography, the computational accuracy of physical models is insufficient for practical needs, and obtaining model parameters requires a large amount of high-quality data, resulting in high data collection costs and difficulties in model optimization and adjustment.
[0004] Hydrodynamic models are flow prediction models rigorously based on physical mechanisms, such as the MIKE series models, which have high accuracy in short-term predictions. However, the parameter tuning of hydrodynamic models is complex, the physical experiments are costly, and the hydrological processes have strong nonlinear characteristics, making it difficult for these models to achieve accurate long-term simulations. In addition, the establishment of hydrodynamic models requires a large amount of accurate river cross-sectional data, which is difficult to obtain, limiting their widespread application in data-scarce areas.
[0005] Regression analysis methods utilize historical water level data and related influencing factors to establish regression models for water level prediction. Commonly used methods include multiple regression models and stepwise regression models. These methods are simple and easy to implement, but lack physical meaning and cannot effectively handle complex nonlinear relationships in hydrological systems. When the terrain is complex, the generalization ability of the regression model is significantly weakened, and the prediction accuracy is difficult to meet practical needs.
[0006] Time series analysis methods predict future trends by analyzing the temporal and regular characteristics of time series. Commonly used methods include autoregressive moving average models and differential covariant moving average autoregressive models. Time series analysis reveals the dependence of a series only in the time domain and requires a high degree of stationarity of the data. However, hydrological time series typically exhibit significant seasonal fluctuations and nonlinear characteristics. Time series models perform poorly when handling nonlinear series, resulting in limited predictive accuracy.
[0007] Wavelet analysis, by decomposing signals at multiple scales using basis functions, can reveal the changing patterns of hydrological time series. However, the selection of basis functions in wavelet analysis is quite sensitive; different basis functions can lead to different analytical results. Furthermore, wavelet analysis is primarily used to reveal changing patterns; to achieve water level prediction, it often needs to be combined with other methods, increasing the complexity and uncertainty of the model.
[0008] Machine learning methods can process large amounts of data and automatically extract features, addressing the nonlinear and high-dimensional characteristics of hydrological systems, making them a crucial method for water level prediction. Among these methods, Support Vector Regression (SVR) has attracted attention due to its principle of minimizing structural risk. SVR can reliably obtain the global optimum by mapping low-dimensional data to a high-dimensional space through kernel functions, handling nonlinear relationships. However, SVR requires significant time investment in practical applications, and its predictive performance may decline as the amount of data increases. Furthermore, SVR requires specialized skills in feature selection of the input data to avoid interference from redundant information.
[0009] Deep learning methods have evolved from artificial neural networks. Among them, Long Short-Term Memory (LSTM) networks, due to their unique memory units and gating mechanisms, are able to effectively capture long-term dependencies in time series and have attracted widespread attention in the field of water level prediction. However, LSM-based models still face difficulties in handling highly nonlinear time series, and traditional LSM networks require consistent input and output time steps, making it difficult to flexibly handle water level prediction tasks where the input and output sequence lengths are inconsistent. Temporal convolutional neural networks (CNNs) based on convolutional neural networks (CNNs) improve the problem of insufficient spatial information utilization through dilated convolutions and residual connections, but still face the risk of gradient explosion. Overall, the application of deep learning in water level prediction remains an important but still largely unexplored area.
[0010] In summary, how to comprehensively capture the long-term and short-term dependencies and complex nonlinear characteristics in flood flow time series, while improving prediction accuracy, robustness, and computational efficiency, and enhancing the model's ability to interpret prediction results, is a technical problem that urgently needs to be solved. Summary of the Invention
[0011] This application provides a water level prediction method based on an integrated intelligent model. The technical problems to be solved include: how to effectively capture the long-term and short-term dependencies and complex nonlinear characteristics in flood flow time series, how to improve the accuracy, robustness and computational efficiency of the prediction model, how to enhance the model's ability to interpret the prediction results, and how to overcome the limitations of a single model in processing non-stationary and nonlinear hydrological time series data.
[0012] To achieve the above objectives, this application adopts the following technical solution: This application provides a water level prediction method based on an integrated intelligent model, the method comprising: Obtain historical hydrological data for the target water area, including at least average water level, suspended sediment transport rate, sediment concentration, average flow rate, and water temperature. The historical hydrological data is preprocessed to obtain preprocessed data; Multiple basic learners are constructed, including a first learner based on a long short-term memory network-sequence to sequence model, a second learner based on a support vector regression model, and a third learner based on a Transformer model with a multi-head attention mechanism. The first learner, the second learner, and the third learner are trained using the preprocessed data, and the prediction results of each learner are generated. The prediction results of the first learner, the second learner, and the third learner are used as inputs to train a meta-learner, forming a Stacking ensemble model. The trained Stacking ensemble model is used to predict flood levels in the target water area.
[0013] Preferably, the historical hydrological data is preprocessed to obtain the preprocessed data, and the calculation method is as follows: in, For raw data The mean, For raw data standard deviation This is the preprocessed data.
[0014] Preferably, the data processing flow of the first learner includes: Multidimensional hydrological feature sequences of multiple consecutive historical time steps As input, where Indicates at time step t Preprocessed hydrological feature vectors This includes standardized average water level, suspended sediment transport rate, sediment concentration, average flow rate, and water temperature; The long short-term memory network in the encoder reads the input sequence step by step, and at each time step... t Based on the hidden state of the previous moment and unit state and the current input The cell state and hidden state are updated through the following gating mechanism: Forgotten Gate: ,in Output for the forget gate. It is the sigmoid activation function. Here is the weight matrix for the forget gate. This represents vector concatenation. For the bias term of the forget gate; Input Gate: ,in For input gate output, Here is the weight matrix of the input gate. This is the bias term for the input gate; Candidate state: ,in The candidate cell state is... The hyperbolic tangent activation function is used. Here is the weight matrix for the candidate states. The bias term for the candidate state; Cell status: ,in This represents the current state of the cell. Output gate: ,in For output gate output, This is the weight matrix of the output gate. This is the bias term for the output gate; Hidden state: ,in The current hidden state; The encoder reads the last input. Then, the final state vector is obtained. h T and C T This is passed to the decoder as a context vector; The decoder is based on a long short-term memory network structure, using the context vector as the initial state to progressively generate predicted output sequences for multiple future time steps. ,in This represents the prediction result of the first learner. It should include at least the predicted average water level.
[0015] Preferably, when training the first learner, a sliding window is used to construct input sequence and corresponding output sequence sample pairs, and minimizing the mean squared error is used as the optimization objective; the mean squared error loss function is: in This represents the value of the loss function. For the sample size, The output sequence predicted by the model. For the actual output sequence, This represents the Euclidean norm.
[0016] Preferably, the data processing flow of the second learner includes: The hydrological feature vector of a single historical time step is used as the input vector, and the hydrological feature vector includes at least the standardized average water level, suspended sediment transport rate, sediment concentration, average flow rate, and water temperature. Through kernel function Mapping the input vector to a high-dimensional feature space yields high-dimensional feature vectors. ; Constructing the objective function in high-dimensional space ,in For the weight vector, For bias terms; Solving by minimizing the structural risk function. and The structural risk function is: in For regularization parameters, The number of training samples. and Let be slack variables, representing the th , respectively i The bias of a sample's predicted value being higher than the true value and the bias of a sample's predicted value being lower than the true value; Substituting the obtained w and b into the regression function, the output is the predicted average water level value for the input vector. .
[0017] Preferably, the kernel function is a radial basis function, expressed as follows: ,in Represents the kernel function. Given two input vectors, For kernel function parameters, It is a normalized exponential function; Alternatively, the kernel function may be a linear kernel, expressed as follows: ; Alternatively, the kernel function may employ a polynomial kernel, expressed as follows: ,in For constant terms, Let the degree be the polynomial. Alternatively, the kernel function can use a sigmoid kernel, expressed as follows: .
[0018] Preferably, the data processing flow of the third learner is as follows: The multidimensional hydrological time series with multiple consecutive historical time steps is used as the input sequence, wherein the multidimensional hydrological time series includes a standardized hydrological feature vector. For each time step l Input feature vector x l A linear transformation is performed through a fully connected embedding layer to obtain a dimension of d model input embedding vector ,in To embed the weight matrix, For embedding bias terms; For each position of the input sequence and index of each dimension The position encoding vector is calculated according to the following formula: in This indicates that the position encoding vector is at the th position. Values on the dimension, Indicates the first Values on the dimension; Each position pos input embedding vector With the corresponding position encoding vector The input vector of the encoder is obtained by element-wise addition. This forms the input sequence of the encoder. Z ; In the self-attention layer of the encoder, based on the input sequence Z Generate query matrix Q Key matrix K Sum matrix V And the attention output is calculated using a scaled dot product attention mechanism: in Represents the attention function. For activation function, For the dimensions of the query and key vectors, This indicates that the query matrix is multiplied by the transpose of the key matrix; A multi-head attention mechanism is employed, where the results from multiple independent attention heads are concatenated and then linearly transformed. The computation process is represented as follows: in This represents a multi-head attention function. and For the outputs of the first and h-th attention heads, For the number of attention heads, To output the weight matrix, Indicates a splicing operation; Multi-head attention output With the input sequence Z Residual connections are performed, and then layer normalization is applied to obtain the first intermediate result. The first intermediate result is input into the feedforward neural network for nonlinear transformation, and then residual connections are performed with the first intermediate result and layer normalization is applied to obtain the output features of the encoder. The decoder takes the output features of the encoder and the historical predictions generated as input, and uses the same multi-head self-attention mechanism as the encoder to gradually generate water level prediction sequences for multiple future time steps.
[0019] Preferably, the predictive performance of the first learner, the second learner, or the third learner is evaluated using mean squared error, mean absolute error, and coefficient of determination. The formulas for calculating the mean square error, mean absolute error, and coefficient of determination are as follows: in Indicates mean square error. To assess sample size, For the first i The true value of each sample For the first i Predicted values for each sample; Indicates the mean absolute error; The coefficient of determination is represented by the coefficient of determination. This is the average of the true values.
[0020] Preferably, the prediction results of the first, second, and third learners are used as inputs to train a meta-learner, forming a Stacking ensemble model, specifically including: The dataset used for training is divided into a training set and a test set; The training set is divided into K subsets using the K-fold cross-validation method; Repeat the training and validation process K times until each subset is used as a validation set once, thereby generating a new training set in which each sample contains the prediction results generated by the first learner, the second learner and the third learner, respectively. A meta-learner is trained using the new training set; During the final prediction, the predicted values output by the first, second, and third learners for the same input sample are combined into a three-dimensional feature vector. ,in The predicted average water level is the output of the first learner. The predicted average water level is the output of the second learner. The superscript represents the predicted average water level output by the third learner. This indicates transposition; the three-dimensional feature vector is input into the trained meta-learner, which then uses its internal regression function... Output the final water level prediction value .
[0021] Preferably, the formula for calculating the predicted water level is as follows: in, Let be the weight coefficients obtained from training the meta-learner, and satisfy . .
[0022] The water level prediction method based on an integrated intelligent model provided in this application has at least the following beneficial effects: 1) This application constructs a flood level prediction method based on Stacking ensemble learning. It uses a Long Short-Term Memory (LSTM) network-sequence-to-sequence model, a Support Vector Regression (SVR) model, and a Transformer model based on multi-head attention as base learners, and employs the Stacking method to train a meta-learner for final prediction. This ensemble framework comprehensively leverages the advantages of the LTM-sequence-to-sequence model in time dependency modeling, the SVR model in nonlinear fitting, and the Transformer model in multi-scale feature extraction. This allows for the comprehensive capture of both short-term and long-term dependencies and complex nonlinear features in flood flow time series, significantly improving prediction accuracy and robustness, and effectively overcoming the limitations of single models in processing non-stationary and nonlinear hydrological time series data.
[0023] 2) In the data preprocessing stage, this application employs an improved Z-score standardization method, which maps the original data to a distribution interval with a mean of 0.5 and a variance of 0.5 using a formula. This standardization method eliminates the differences in the dimensions of various hydrological indicators while preserving the distribution characteristics of the original data, avoiding data distortion caused by traditional standardization methods. It provides high-quality input data for subsequent model training, which is beneficial to improving the convergence speed and prediction performance of the model.
[0024] 3) In the Long Short-Term Memory Network-Sequence to Sequence Model, this application achieves effective capture of long-term dependencies in the input sequence through a complete gating mechanism update formula in the encoder, including forget gate, input gate, candidate state, unit state, output gate, and hidden state. The encoder compresses the input sequence into a context vector and passes it to the decoder. The decoder gradually generates predicted output sequences for multiple future time steps, thus flexibly handling water situation prediction tasks where the length of the input sequence is inconsistent with the length of the output sequence, and realizing multi-step advance prediction functionality.
[0025] 4) In this application, the support vector regression model maps the input vector to a high-dimensional feature space through a kernel function and constructs a linear regression function using the principle of minimizing structural risk. Slack variables and regularization parameters are then used to control model complexity. This approach effectively handles nonlinear relationships in hydrological data while suppressing overfitting and improving the model's generalization ability. The choice of radial basis functions, linear kernels, multinomial kernels, and sigmoid kernels allows the model to adapt to the prediction needs of different hydrological scenarios.
[0026] 5) In this application, the Transformer model injects temporal sequence information into the input sequence through a positional encoding formula, and utilizes scaled dot product attention and multi-head attention mechanisms to extract complex interaction relationships between different time steps and different feature dimensions. The output of the self-attention layer is input into the feedforward neural network after residual connections and layer normalization, effectively alleviating the gradient vanishing problem in deep network training. The efficient parallel computing capability of the multi-head attention mechanism significantly improves the model's processing efficiency for long sequence data, while also enhancing the model's interpretability of prediction results.
[0027] 6) In this application, within the Stacking ensemble framework, a new training set is generated using the K-fold cross-validation method. The prediction results of the three base learners are combined into a feature vector, which is then input into a meta-learner. The meta-learner learns a nonlinear mapping function or linear weighted fusion coefficients to output the final prediction value. This ensemble strategy fully leverages the complementary advantages of each base model, reduces the prediction bias and variance of a single model, and makes the overall prediction results more stable and accurate, providing scientific and reliable technical support for flood early warning and disaster prevention and mitigation decision-making. Attached Figure Description
[0028] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0029] Figure 1 A flowchart illustrating a water level prediction method based on an integrated intelligent model, provided in this application embodiment; Figure 2The average water level time series diagram provided for the embodiments of this application; Figure 3 This is a time series diagram of suspended sediment transport rate provided in an embodiment of this application; Figure 4 The average flow rate time series diagram provided for the embodiments of this application; Figure 5 A time series diagram of sediment content provided for an embodiment of this application; Figure 6 The average water temperature time series diagram provided for the embodiments of this application; Figure 7 The three-dimensional thermogram of flow rate-water level-sediment concentration provided in the embodiments of this application; Figure 8 Thermographic diagram of sand content provided for embodiments of this application; Figure 9 Radar images of sediment concentration, flow rate, average water level, suspended sediment transport, and water temperature provided for embodiments of this application; Figure 10 The monthly cumulative contribution analysis chart of annual sediment transport volume provided for the embodiments of this application; Figure 11 This is a schematic diagram of the structure of the LSTM-Seq2Seq model provided in the embodiments of this application; Figure 12 This is a schematic diagram of the input sequence and corresponding output sequence sample pairs provided in the embodiments of this application; Figure 13 The encoder-decoder structure diagram of the Transformer model provided in the embodiments of this application; Figure 14 The training loss diagram of the LSTM-Seq2Seq model provided in the embodiments of this application; Figure 15 A schematic diagram illustrating the fitting of the LSTM-Seq2Seq model provided in this application embodiment; Figure 16 The image shows the 60-day prediction results of the LSTM-Seq2Seq model provided in this application embodiment. Figure 17 This is a diagram showing the fitting of the SVM model provided in the embodiments of this application; Figure 18 This is a graph showing the 60-day prediction results of the SVM model provided in this application embodiment; Figure 19 This is a training loss diagram of the transformer model provided in the embodiments of this application; Figure 20 A diagram showing the fitting of the transformer model provided in the embodiments of this application; Figure 21The following is a graph showing the 60-day prediction results of the transformer model provided in this application embodiment; Figure 22 A graph showing the fitting of the Stacking ensemble model provided in the embodiments of this application; Figure 23 The Stacking ensemble model provided in this application provides a 60-day prediction result diagram; Figure 24 This is a graph showing the predicted results of the Stacking ensemble model for the next three years, as provided in an embodiment of this application. Figure 25 A graph showing the change in the first predicted loss value provided in an embodiment of this application; Figure 26 A graph showing the change in the second predicted loss value provided in an embodiment of this application; Figure 27 This is a training set / test set fit diagram provided in the embodiments of this application; Figure 28 A graph showing the first flood forecast results for the next three years, provided as an embodiment of this application; Figure 29 The second flood forecast result diagram for the next three years is provided for an embodiment of this application.
[0030] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concepts of this application to those skilled in the art through reference to specific embodiments. Detailed Implementation
[0031] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0032] The collection, storage, use, processing, transmission, provision, and disclosure of relevant data and information in the technical solution of this application all comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0033] The technical solution of this application and how it solves the above-mentioned technical problems will be described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will be described below with reference to the accompanying drawings.
[0034] This application provides a water level prediction method based on an integrated intelligent model, aiming to address the problems of low accuracy and weak stability in existing flood flow prediction methods. It uses an ensemble learning approach to predict the water situation of the Lishui River, employing a multi-model ensemble approach to fully utilize the unique advantages of each model and reduce the limitations of a single model, thereby providing more comprehensive and accurate predictions. In general, this method integrates an LSTM-seq2seq model (first learner), an SVR model (second learner), and a Transformer model (third learner), using a stacking method to construct a comprehensive deep learning framework to fully capture the long-term and short-term dependencies and complex nonlinear features in flood flow time series. First, the combination of the time dependency modeling capability of LSTM-seq2seq, the multi-head attention mechanism of Transformer, and the nonlinear fitting capability of SVR ensures the efficient extraction and representation of time series features. Second, the stacking method integrates different models, not only improving prediction accuracy and robustness but also reducing the limitations of a single model, providing more stable and accurate water level prediction results. Furthermore, combining the efficient parallel processing capabilities of the Transformer with the sequential processing capabilities of LSTM-seq2seq significantly improves the model's computational efficiency and its ability to handle long-sequence data, enabling it to adapt to the prediction needs of large-scale data. Finally, through multi-head attention mechanisms and the interpretability of SVR, the model's interpretability of prediction results is enhanced, providing a more transparent prediction process and contributing to a deeper understanding of the key influencing factors of flood flow changes. This integrated approach not only optimizes prediction performance but also improves the practicality and scientific rigor of water level prediction.
[0035] like Figure 1 As shown, the water level prediction method based on the integrated intelligent model includes the following steps S10-S60.
[0036] S10: Obtain historical hydrological data for the target water area. The historical hydrological data should include at least the average water level, suspended sediment transport rate, sediment concentration, average flow rate, and water temperature.
[0037] In this embodiment, the target water area includes regions where water level prediction is needed for flood warning. Historical hydrological data for the target water area can come from the hydrological monitoring station network in the region. These monitoring stations are distributed across key hydrological nodes in the area and conduct long-term, systematic observation and recording of various hydrological elements of the river, thereby providing relevant basic data.
[0038] This embodiment selects data from 2013 to 2023 as the core research object from long-term observation data from 1992 to 2023. To ensure data quality, incomplete time series data were discarded. After screening, seven core data files were finally determined as the main data sources. From these files, five key hydrological indicators were extracted: average water level, suspended sediment transport rate, sediment concentration, average flow rate, and water temperature.
[0039] S20: Perform data preprocessing on historical hydrological data to obtain preprocessed data.
[0040] In this embodiment, due to the significant differences in the dimensions of each indicator (such as sand content), ) and average flow ( Furthermore, the data distribution is uneven, so an improved Z-score standardization is adopted: in, For raw data The mean, For raw data standard deviation For the preprocessed data, a linear transformation is used to map the data to a distribution interval with a mean of 0.5 and a variance of 0.5, preserving the original data distribution characteristics while eliminating the influence of dimensions.
[0041] The data obtained through steps S10 and S20 in this embodiment are as follows: Figures 2 to 10 As shown.
[0042] Figure 2 This is a time series plot of the average water level. Figure 2 This chart shows the daily average water level changes in the target area over the past decade (2013-2023), with the horizontal axis representing the number of days (1-3652 days) and the vertical axis representing the standardized average water level. The chart marks flood-initiated times in red, with water levels significantly higher than the average. Water level changes exhibit clear seasonal fluctuations, with significantly higher levels during the flood season (summer) and lower levels during the dry season (winter). The concentration of flood-initiated events during the flood season demonstrates a strong correlation between flood events and high water levels.
[0043] Figure 3 This is a time series plot of suspended sediment transport rate. Figure 3 The chart shows the trend of suspended sediment transport rate, with the vertical axis representing the standardized suspended sediment transport rate and the horizontal axis representing the number of days (1-3652 days). The trend of suspended sediment transport rate is similar to that of the average water level, exhibiting multiple peaks and troughs. The suspended sediment transport rate values corresponding to flood outbreak points are significantly higher than the average level.
[0044] Figure 4This is a time series plot of average flow rate. Figure 4 The chart shows the daily sediment concentration trend, with the vertical axis representing standardized sediment concentration and the horizontal axis representing the number of days (1-3652 days). The sediment concentration trend is similar to the previous two indicators. The sediment concentration values corresponding to flood outburst points are significantly higher than the average level, indicating that sediment concentration, suspended sediment transport rate, and water level changes are positively correlated, and the sediment concentration during the flood season is significantly higher than that during the dry season.
[0045] Figure 5 This is a time series plot of sediment concentration. It shows the trend of daily average flow rate, with the vertical axis representing standardized flow values. The flow values at the flood inrush point are significantly higher than the average level. Flow rate changes are highly consistent with changes in water level and sediment concentration, with a significant increase in flow rate during the flood season and lower flow rate during the dry season. The prominent flow peaks during floods illustrate the significant correlation between floods and river flow.
[0046] Figure 6 This is a time series plot of average water temperature. Figure 6 This shows the daily average water volume trend, with the vertical axis standardized. The average water temperature trend differs from the previous four indicators, exhibiting more pronounced periodic fluctuations. This indicates that water temperature changes are more stable compared to other hydrological indicators.
[0047] Figure 7 A three-dimensional thermogram of flow rate, water level, and sediment concentration. Figure 7 The graph clearly illustrates the relationship between flow rate, water level, and sediment concentration. As can be seen, sediment concentration increases with both flow rate and water level, particularly in areas with high flow rates and high water levels, where sediment concentration rises significantly. The red-marked hotspots of high sediment concentration further confirm this, indicating that under specific flow rate and water level conditions, the sediment concentration of a river can increase dramatically.
[0048] Figure 8 A heat map of sediment concentration further reveals the impact of flow rate and water level on sediment concentration. The color in the graph, from dark blue to yellow, represents a gradual increase in sediment concentration, and the density of the contour lines reflects the drastic changes in sediment concentration. The graph shows that at a flow rate of approximately 200-250 m³ / h... 3 In areas with a water level of approximately 80-90m, the sediment content reaches its highest value, which is consistent with the results of the three-dimensional surface plot.
[0049] Figure 9Five radar charts were generated for sediment concentration, flow rate, average water level, suspended sediment transport, and water temperature in the target area for each month of 2015, 2017, 2019, 2021, and 2023. The seasonal and annual trends of these data were analyzed. Flow rate, water level, sediment concentration, and sediment transport all exhibit a pattern of higher values in summer and lower values in winter, closely related to the regional precipitation cycle. No significant interannual fluctuations were observed, reflecting relatively stable regional climate conditions.
[0050] Figure 10 This chart shows the monthly cumulative contribution of annual sediment transport. Sediment transport from July to September generally accounts for over 50% of the annual total (colored as an orange-yellow gradient), coinciding with the concentrated rainfall characteristics of the main flood season (mid-June to mid-July) in the target region. Heavy rains lead to a surge in runoff (Q↑), while simultaneously enhancing scouring (sediment content↑), resulting in an exponential increase in sediment transport (Q×C). For example, the extreme precipitation event in July 2018 (year not specified in the data) may correspond to the peak sediment transport. Differences between flood seasons: Although April to June falls within the broader flood season, its contribution to sediment transport is lower than that from July to September, possibly due to weaker rainfall intensity during the plum rain season and higher soil moisture content in the early stages. Overall volatility: There are significant interannual differences in total annual sediment transport (variations in stacking height). For example, the total volume surged in 2016 and 2020 due to heavy precipitation events (requires verification with specific meteorological data). Sediment transport decreased in some years after 2018, possibly related to soil and water conservation projects or reservoir regulation (requires further verification). Wavelet analysis can reveal multi-timescale oscillations in sediment transport, such as a quasi-3-5 year cycle that may correspond to climate drivers such as ENSO.
[0051] S30: Construct multiple basic learners, including a first learner based on a long short-term memory network-sequence to sequence model, a second learner based on a support vector regression model, and a third learner based on a Transformer model with a multi-head attention mechanism.
[0052] S40: Train the first learner, the second learner, and the third learner using the preprocessed data, and generate the prediction results for each learner.
[0053] S30 and S40 jointly completed the construction and independent training of multiple basic learners. Specifically, S30 established a first learner based on a long short-term memory network-sequence to sequence model, a second learner based on a support vector regression model, and a third learner based on a Transformer model with a multi-head attention mechanism. S40 used preprocessed hydrological data to train the above three learners respectively and output their respective prediction results, providing basic input for subsequent integration and fusion.
[0054] In one specific implementation, the first learner is an LSTM-seq2seq model. The core idea of the Seq2Seq (Sequence-to-Sequence) model is to encode the input sequence into a fixed-length context vector, and then decode this context vector into an output sequence. The Seq2Seq model does not restrict the input type or dimension, and can flexibly handle multi-dimensional hydrological data such as flow rate, water level, and sediment concentration, making it suitable for the time series analysis and forecasting needs of this project. The model's structure mainly consists of two parts: an encoder and a decoder. The encoder encodes the input sequence... The decoder then converts the context vector into an output sequence. .
[0055] LSTM (Long Short-Term Memory) is a special type of recurrent neural network (RNN) that effectively solves the vanishing and exploding gradient problems that traditional RNNs may encounter when processing long sequences. LSTM uses gating mechanisms (including input gate, forget gate, and output gate) to control the flow of information, thereby better capturing long-term dependencies in the sequence. LSTM contains a specific state called the "cell state" to store long-term information at each time step. The state update formula for an LSTM cell is as follows: Forgotten Gate: ,in Output for the forget gate. It is the sigmoid activation function. Here is the weight matrix for the forget gate. This represents vector concatenation. For the bias term of the forget gate; Input Gate: ,in For input gate output, Here is the weight matrix of the input gate. This is the bias term for the input gate; Candidate state: ,in The candidate cell state is... The hyperbolic tangent activation function is used. Here is the weight matrix for the candidate states. The bias term for the candidate state; Cell status: ,in This represents the current state of the cell. Output gate: ,in For output gate output, This is the weight matrix of the output gate. This is the bias term for the output gate; Hidden state: ,in The current hidden state; The encoder reads the last input. Then, the final state vector is obtained. h T and C T This is passed to the decoder as a context vector; The decoder is based on a long short-term memory network structure, using the context vector as the initial state to progressively generate predicted output sequences for multiple future time steps. ,in This represents the prediction result of the first learner. It should include at least the predicted average water level.
[0056] Figure 11 This is a schematic diagram of the LSTM-Seq2Seq model. In the water level prediction task, the encoder receives an input water level sequence containing a time step N. Each of them This represents the multidimensional hydrological information at time n. The encoder encodes the input sequence using LSTM, compressing it into a state vector. This vector contains all the key information of the input hydrological sequence. The decoder, based on an LSTM structure, receives the state vector output by the encoder. It gradually generates a predicted hydrological sequence with a time step of M. Each of them This represents the predicted multidimensional hydrological information at time m. Since the encoder and decoder can have different time steps, the LSTM-Seq2Seq model can flexibly handle the problem of inconsistent input and output sequence lengths.
[0057] For training the first model, a sliding window method is used to design the dataset samples. First, the input and output datasets are generated from the hydrological data, represented as follows: and Enter water information The dimension is Outputting water information The dimension is In the application of sliding windows, the input time step N and output time step M are set, and training samples are extracted using a sliding window. Specifically, using... As an input sample sequence, use As output samples. In this way, the entire training dataset is divided into a series of input sequences and corresponding output sequence sample pairs, such as... Figure 12 As shown.
[0058] During model training, the generated sample set needs to be appropriately partitioned. To ensure the model's generalization ability and avoid overfitting, we divide it into three portions: 70% for training, 15% for validation, and 15% for testing. The model training optimization objective is to minimize the mean squared error (MSE), and its loss function is as follows: in This represents the value of the loss function. For the sample size, The output sequence predicted by the model. For the actual output sequence, This represents the Euclidean norm.
[0059] During optimization, the Adam optimizer is employed, which effectively handles sparse gradients and non-stationary objectives, helping to accelerate model convergence. During training, an early stopping strategy is used to prevent overfitting; that is, the loss on the validation set is monitored, and training is stopped if there is no improvement within a certain number of epochs. During training, hyperparameters such as batch size and learning rate are selected through experimental tuning, typically with an initial learning rate of 0.001, and dynamically adjusted based on training convergence.
[0060] After each training round, the model is evaluated on the validation set. The evaluation metrics include mean squared error (MSE), root mean squared error (RMSE), and coefficient of determination (CQD). These metrics reflect the model's prediction error and goodness of fit, helping us assess its performance. For hyperparameter optimization, we might use methods such as grid search or Bayesian optimization to automatically find the optimal model configuration. Finally, after training, we use a test set to test the model's generalization ability, ensuring its reliable performance in real-world applications.
[0061] During training, training data is input into the model, and the predicted values are calculated through forward propagation. Then, the error between the predicted and true values is calculated based on the loss function, and the model parameters are updated through backpropagation. After each round of training, the model performance is evaluated using a validation set, and the training parameters (such as the learning rate) are adjusted based on the changes in loss on the validation set to prevent overfitting.
[0062] Use a variety of evaluation metrics to comprehensively evaluate model performance. In addition to the commonly used MSE and MAE, you can also use the root mean square error (RMSE) and coefficient of determination (CQD). Indicators such as RMSE reflect the average magnitude of the deviation between predicted and actual values. It can measure the model's goodness of fit to the data. The prediction results can be visualized and analyzed, with curves comparing predicted and actual values to visually demonstrate the model's predictive performance. Furthermore, by plotting error distribution histograms and other methods, the distribution characteristics of model errors can be further analyzed, providing a basis for model improvement. Based on the model evaluation results, the model's hyperparameters can be further adjusted.
[0063] In one specific implementation, the second learner is a Support Vector Regression (SVR) model. Support Vector Regression (SVR) is an application of SVM to regression problems. Its goal is to find a function... This ensures that the deviation between the predicted and actual values is within the allowable error range. The objective function of SVR is: in, w It is a weight vector. It is a kernel function that maps input data to a high-dimensional space. b This is a bias term. The objective function of SVR is solved by minimizing the following structural risk function: in, It is a regularization parameter that controls the trade-off between model complexity and error; and These are slack variables, used to allow data points to deviate from the fitted function. The kernel function is the core of SVR (Simultaneous Dynamic Range), used to map input data to a high-dimensional space to find a linear segmentation in nonlinear problems. Commonly used kernel functions include: Linear kernel: ; Polynomial kernel: ; Radial basis function (RBF) kernel: ,in Represents the kernel function. Given two input vectors, For kernel function parameters, It is a normalized exponential function; sigmoid core: .
[0064] For water level prediction, due to the complex nonlinear characteristics of hydrological data, radial basis function is usually chosen, which can map low-dimensional data to a high-dimensional space and better handle nonlinear relationships.
[0065] The main parameters of the SVR model include the penalty factor, i.e., the regularization parameter. C and kernel function parameters γ Punishment factor C The tolerance of the control model to errors,C The larger the value, the heavier the penalty for error by the model, and the higher the model complexity. γ The value determines the width of the radial basis kernel function. γ The larger the value, the stronger the locality of the function, and the stronger the model's ability to fit the data, but it is also more prone to overfitting. Methods such as cross-validation can be used to... C and γ Parameter optimization is performed to determine the optimal combination of model parameters.
[0066] For training the second learner, the preprocessed data is divided into training, validation, and test sets, typically in a 70%, 15%, and 15% ratio, respectively. The training set is used to learn the model parameters, the validation set is used to adjust the parameters during model training to prevent overfitting, and the test set is used to evaluate the performance of the final model. The SVR model is trained using the training set data, and the model parameters are determined by minimizing the structural risk function. During training, the kernel function parameter γ and the penalty factor are continuously adjusted. The performance of the model under different parameter combinations is evaluated using the validation set, and the parameters that minimize the validation set error are selected as the final model parameters.
[0067] The preprocessed data is divided into training, validation, and test sets, typically in a 70%, 15%, and 15% ratio, respectively. The training set is used to learn the model parameters, the validation set is used to adjust parameters during model training to prevent overfitting, and the test set is used to evaluate the performance of the final model. The SVR model is trained using the training set data, and the model parameters are determined by minimizing the structural risk function. During training, the kernel function parameter γ and the penalty factor are continuously adjusted. The performance of the model under different parameter combinations is evaluated using the validation set, and the parameters that minimize the validation set error are selected as the final model parameters.
[0068] Model evaluation metrics: Root mean square error (RMSE), mean absolute error (MAE), and coefficient of determination (R²). 2 The predictive performance of the model is evaluated using indicators such as ( ).
[0069] Root Mean Square Error (RMSE): in For the true value, denoted as , where n is the sample size. RMSE reflects the average error between the predicted and actual values; a smaller value indicates a more accurate model prediction.
[0070] Mean Absolute Error (MAE): MAE measures the average absolute error between predicted and actual values; similarly, a smaller value indicates better model performance.
[0071] Coefficient of determination : ,in This is the average of the true values. The closer the value is to 1, the better the model fits the data and the stronger its predictive ability.
[0072] In one specific implementation, the third learner is a Transformer model based on the Multi-head attention mechanism.
[0073] The Transformer is an advanced encoder-decoder model that leverages attention mechanisms to address the slow training of Recurrent Neural Networks (RNNs) and efficiently handle time-series data. It consists of multiple stacked encoder and decoder layers, each containing a multi-head self-attention mechanism for extracting time-series features, and a feedforward network layer, collectively forming sub-layers of the encoder and decoder. Each sub-layer employs residual connections to facilitate training and accelerate convergence. Figure 13 This demonstrates the encoder-decoder architecture of the Transformer. In the encoder, the input data first passes through an embedding layer, which consists of a single-layer fully connected network. The network uses positional encoding to calculate the relative position of the data within the sequence, thereby obtaining the temporal correlation information of the data.
[0074] Specifically, for each time step l Input feature vector x l A linear transformation is performed through a fully connected embedding layer to obtain a dimension of d model input embedding vector ,in To embed the weight matrix, For embedding bias terms; For each position of the input sequence and index of each dimension The position encoding vector is calculated according to the following formula: in This indicates that the position encoding vector is at the th position. Values on the dimension, Indicates the first Values on the dimension; Each position pos input embedding vector With the corresponding position encoding vector The input vector of the encoder is obtained by element-wise addition. This forms the input sequence of the encoder.Z .
[0075] Next, the correlation between data points is determined using a self-attention mechanism. As a core component of the Transformer architecture, self-attention is a weighted aggregation mechanism that assigns different weights to different positions. It uses three matrix forms—key-value pairs (K,V) and queries (Q)—to calculate the similarity between the query and the key. The similarity is represented as a weight and multiplied by the value. At the end of the encoder layer, the output of the attention mechanism undergoes a non-linear transformation through a feedforward network and is added to the residual.
[0076] Specifically, in the self-attention layer of the encoder, based on the input sequence Z Generate query matrix Q Key matrix K Sum matrix V And the attention output is calculated using a scaled dot product attention mechanism: in Represents the attention function. For activation function, For the dimensions of the query and key vectors, This indicates that the query matrix is multiplied by the transpose of the key matrix; A multi-head attention mechanism is employed, where the results from multiple independent attention heads are concatenated and then linearly transformed. The computation process is represented as follows: in This represents a multi-head attention function. and For the outputs of the first and h-th attention heads, For the number of attention heads, To output the weight matrix, Indicates a splicing operation; Multi-head attention output With the input sequence Z Residual connections are performed, and then layer normalization is applied to obtain the first intermediate result. The first intermediate result is input into the feedforward neural network for nonlinear transformation, and then residual connections are performed with the first intermediate result and layer normalization is applied to obtain the output features of the encoder.
[0077] Finally, the decoder takes the encoder's output features and the generated historical predictions as input, employing the same multi-head self-attention mechanism as the encoder to progressively generate water level prediction sequences for multiple future time steps. For example, the decoder reads the encoder's feature vector information and generates the output sequence. At each time step, the sequence is generated based on the output of the previous time step and the encoded vector generated at time step t-1. In the decoder, preventing future information from flowing forward is crucial; therefore, a masking operation is applied before the softmax operation of the attention mechanism to mask data from future time periods.
[0078] During the training of the source model, both the input and output of the Transformer are hydrological and meteorological data with time attributes. Since the formation of floods in the basin is affected by a variety of complex factors, which will influence the characteristics of future water levels, such as previous precipitation, temperature, and underlying surface conditions, these will serve as the input to the encoder, and the predicted target water level value at future time will be used as the output.
[0079] During the training process of the third learner, key parameters of the Transformer model are determined, such as the dimension of the embedding layer. The number of heads (h) in a multi-head attention mechanism and the number of neurons in the hidden layer of a feedforward neural network. These parameters are typically determined through experimental comparison of the model's performance on the validation set under different values. For example, they can be set separately. The parameters were set to 64, 128, and 256. The root mean square error (RMSE) and mean absolute error (MAE) of the model were compared under different values, and the optimal parameter combination was selected.
[0080] Use a suitable optimizer to update model parameters, such as the Adam optimizer. The Adam optimizer combines the advantages of Adagrad and RMSProp, and can adaptively adjust the learning rate. Set an initial learning rate, such as 0.001, and dynamically adjust it during training based on performance on the validation set. For example, if the loss function on the validation set no longer decreases within a few epochs, reduce the learning rate to 0.1 times its original value.
[0081] Based on the above model parameter settings and optimizations, the model training process is as follows: Dataset partitioning: The collected historical data is divided into training, validation, and test sets in chronological order. Typically, the training set comprises 60%-80%, the validation set 10%-20%, and the test set 10%-20%. For example, the first 80% of the data is used as the training set for learning model parameters, the middle 10% as the validation set for monitoring model performance and adjusting hyperparameters during training, and the last 10% as the test set for evaluating the model's final generalization ability.
[0082] Training process: During training, the training set data is input into the Transformer model, and the loss function (such as the mean squared error loss function) between the model's predicted values and the true values is calculated. Where n is the number of samples, It is the actual value. (This refers to the predicted value). The gradient of the loss function with respect to the model parameters is calculated using the backpropagation algorithm, and the model parameters are updated using the optimizer to continuously reduce the loss function. After each epoch, the model performance is evaluated on the validation set, and metrics such as loss value, RMSE, and MAE are recorded. When the performance on the validation set no longer improves (e.g., the loss value on the validation set does not decrease significantly after 5 consecutive epochs), training is stopped, and the model is considered to have converged.
[0083] This embodiment uses multiple evaluation metrics to comprehensively assess model performance. In addition to RMSE and MAE, Mean Absolute Percentage Error (MAPE) can also be used. The coefficient of determination is used to measure the relative error between predicted and actual values. , in It is the mean of the true values. The closer to 1, the better the model fit.
[0084] Model tuning: Optimize the model based on the evaluation results. If the model performs well on the training set but poorly on the validation and test sets, it may be overfitting. This can be improved by increasing regularization terms (such as L1 or L2 regularization), reducing model complexity (such as reducing the number of neurons in the hidden layers or the number of heads in the multi-head attention mechanism), or increasing the amount of training data. If the model performs poorly on both the training and validation sets, it may be underfitting. In this case, try increasing model complexity, adjusting the learning rate, or using more complex features to improve model performance.
[0085] S50: Using the prediction results of the first, second, and third learners as input, train a meta-learner to form a Stacking ensemble model.
[0086] Stacking (also known as stacked generalization) is an ensemble learning technique that uses the predictions of multiple learners as input to train a meta-learner to achieve better prediction performance. Prior to this, three learners had been trained: an LSTM-Seq2seq model, an SVR model, and a Transformer model based on Multi-HeadAttention.
[0087] In one specific implementation, the Stacking integration model is constructed through the following steps.
[0088] S501: Divide the dataset into a training set and a test set. This is to use different data when training and evaluating the model.
[0089] S502: Use K-fold cross-validation to divide the training data into K subsets.
[0090] S503: Repeat step S502 until each subset has been used as a validation set once. This will produce a new training set where each sample contains predictions from the three weak learners.
[0091] S504: Train a meta-learner using the new training set. The goal of the meta-learner is to learn how to make more accurate predictions based on the predictions of the weak learners.
[0092] In the final prediction, the predicted values output by the first learner (LSTM-Seq2seq model), the second learner (SVR model), and the third learner (Transformer model) for the same input sample are combined into a three-dimensional feature vector: .in, The predicted average water level is the output of the first learner. The predicted average water level is the output of the second learner. The superscript represents the predicted average water level output by the third learner. This indicates transpose. The three-dimensional feature vector is input into the trained meta-learner, which outputs the final flood level prediction value through its internal regression function. The calculation method is as follows: in, This is the final flood level forecast. This means that the meta-learner, through training, learns a nonlinear mapping function that can combine the predictive advantages of three basic models and correct the prediction bias of a single model.
[0093] In this embodiment, the meta-learner can use a linear weighted fusion method to complete the prediction output, and the final prediction value is calculated using the following formula: in, These are the weight coefficients for the LSTM-Seq2seq model, SVR model, and Transformer model, respectively, obtained through iterative optimization during meta-learner training, and the weight coefficients satisfy the normalization constraint. By using a controllable linear weighted fusion method, the prediction weights of each individual model can be reasonably allocated, preserving the prediction advantages of each model and further improving the stability and accuracy of flood level prediction results.
[0094] S60: Predict flood levels in the target water area using a trained Stacking ensemble model.
[0095] The feasibility and advancement of the method proposed in this application will be demonstrated through specific experiments below. The data used in the experiments can be found in the following reference. Figures 2-10 The data shown.
[0096] The experimental computing platform used a 12th Gen Intel(R) Core(TM) i5-12500H (2.50GHz) processor and Python version 3.9.5, and the training was performed using the CPU.
[0097] LSTM-Seq2Seq model hyperparameter configuration: The experiment used PyTorch as the runtime framework and the Adam optimizer for training and optimization. The hyperparameter configuration included a historical input step size of 60 and a future prediction step size of 1; network structure parameters were: hidden_size=64 neurons, num_layers=2 LSTM layers, dropout=0.1; training parameters were: epochs=50, batch_size=128, and learn_rate=0.001.
[0098] SVM model hyperparameter configuration: The experiment uses scikit-learn's SVR for regression prediction and MultiOutputRegressor for multi-output prediction. The hyperparameter configuration includes a historical input step size of 60 and a future prediction step size of 1; the SVR kernel function is `kernel="rbf"`, the penalty coefficient `C=10.0`, the loss tolerance interval `epsilon=0.1`, and the kernel parameter `gamma="scale"`. This model is a non-neural network method and does not require setting epochs, batch size, or optimizer parameters.
[0099] Transformer model hyperparameter configuration: The experiment used PyTorch as the runtime framework and the AdamW optimizer for training and optimization. The hyperparameter configuration included a historical input step size of 60 and a future prediction step size of 1; embedding / hidden layer dimension d_model=64, feedforward layer dimension ff_dim=128, multi-head attention head count num_heads=4, encoder layer count num_layers=3, and dropout=0.1; training parameters were: epochs=60, batch size=128, learning rate=0.001, weight decay=0.0001, and gradient clipping threshold clip_grad=1.0.
[0100] Hyperparameter configuration of the Stacking model: The experiment uses the Stacking framework for two-layer fusion. The first-level base learner consists of the prediction results of three models: LSTM, SVM, and Transformer. The second-level meta-learner uses the XGBoost regression model (XGBRegressor) to achieve non-linear weighted fusion. In the hyperparameter configuration, the input feature dimension of the base learner is 3 (corresponding to the prediction values of the three models); the number of weak learners in XGBoost is n_estimators=500, the maximum tree depth is max_depth=3, the learning rate is learning_rate=0.05, the sample subsampling ratio is subsample=0.8, the feature subsampling ratio is colsample_bytree=0.8, the L1 regularization coefficient is reg_alpha=0.0, the L2 regularization coefficient is reg_lambda=1.0, the objective function is the regression squared error objective="reg:squarederror", the random seed is random_state=42, and the number of parallel threads is n_jobs=-1. This two-layer model achieves optimal fusion by minimizing the mean squared error on the validation set.
[0101] To verify the actual effectiveness of the hydrological prediction model, this experiment focused on water level and water level prediction. By analyzing the changes in losses during training and validation, the degree of fit to historical data, and the prediction results of future trends, the model's adaptability to normal and extreme hydrological scenarios, as well as the reliability of short-term and long-term predictions, were evaluated. The aim was to clarify the model's strengths and weaknesses and provide empirical evidence for subsequent model optimization and the development of hydrological prediction technology.
[0102] Experiment 1: Water Level Prediction Using LSTM-Seq2Seq Model like Figure 14The graph shows the curves of training loss and validation loss as a function of training epochs. The training loss is initially high, gradually decreasing from 0.9 at the initial epoch to below 0.25 at epoch 100, with some fluctuation, showing an overall decreasing trend. The validation loss starts low, decreases synchronously, then stabilizes at around 0.02, with minimal fluctuation. This indicates that the model continuously learns and optimizes during training, and the validation loss remains stable at a low level, showing no significant overfitting and good generalization ability. Figure 15 The diagram shows the changes in actual and predicted water levels over time. The actual and predicted water levels largely overlapped in the last 60 days, with only minor deviations at certain local points. For most of the period, both values were low, with the actual value fluctuating at some points. The predicted values showed significant spikes around days 23 and 52, deviating significantly from the actual values, but the overall fluctuation trend was consistent with the actual values. Overall, the model has some predictive ability for water levels during normal periods, but its performance is poor at special or extreme time points. It has a strong ability to fit historical data, but its ability to capture and handle outliers is insufficient, requiring further optimization to improve its adaptability to complex situations. Figure 16 The data shown represents the predicted water level for the next 60 days. The predicted values show a stable trend within 0-60 days, remaining between 60 and 80, reflecting the model's conservative estimate of long-term water level changes. This may be limited by the lack of significant trend changes in historical data.
[0103] Experiment 2: Water Level Prediction Using SVM Model like Figure 17 The model displays the changes in actual and predicted water levels over time. The actual and predicted water levels largely overlap within the first 0-60 days, with only minor deviations at certain local points in time. For most of the period, both values are low, with the actual value fluctuating at some points. The predicted values show significant spikes around days 23 and 52, deviating significantly from the actual values, but the overall fluctuation trend is consistent with the actual values. Overall, the model has some predictive ability for water levels during normal periods, but its performance is poor at special or extreme time points. It has a strong ability to fit historical data, but its ability to capture and handle outliers is insufficient, requiring further optimization to improve its adaptability to complex situations. Figure 18 The data shown represents the predicted water level for the next 60 days. The predicted values show a stable trend, remaining around 60, reflecting the model's conservative estimate of long-term water level changes. This may be limited by the lack of significant trend changes in historical data.
[0104] Experiment 3: Water Level Prediction Using Transformer Model like Figure 19The graph shows the curves of training loss and validation loss as a function of training epochs. The training loss is initially high, gradually decreasing from 0.8 at the initial epoch to below 0.25 at epoch 200, with some fluctuation, showing an overall decreasing trend. The validation loss starts low, decreases synchronously, then stabilizes at around 0.02, with minimal fluctuation. This indicates that the model continuously learns and optimizes during training, and the validation loss remains stable at a low level, showing no significant overfitting and good generalization ability. Figure 20 The diagram shows the changes in actual and predicted water levels over time. The actual and predicted water levels largely overlap within the first 0-60 days. The predicted values show significant spikes around days 23 and 52, with relatively small deviations from the actual values, and the overall fluctuations are consistent with the trend of the actual values. Overall, the model has a strong predictive ability for water levels during normal periods, performs well at special or extreme time points, and has a strong ability to fit historical data, but its ability to capture and handle outliers is relatively good. Figure 21 The figure shows the predicted water level for the next 60 days. The predicted value shows a significant increase on the 25th day, rising to around 80, reflecting the model's prediction of flooding based on long-term water level changes.
[0105] Experiment 4: Stacking ensemble model for water level prediction like Figure 22 The diagram shows the changes in actual and predicted water levels over time. The actual and predicted water levels largely overlap over the 60-day period, with only minor deviations at certain local points. For most of the time, both values are low, with the actual value fluctuating at some points. The predicted values show significant spikes around days 23 and 52, deviating significantly from the actual values, but the overall fluctuation trend is consistent with the actual values. Overall, the model has a very accurate predictive ability for water levels during normal periods and performs exceptionally well at special or extreme times. It has a strong ability to fit historical data and is very good at capturing and handling outliers. Figure 23 The figure shows the predicted water level for the next 60 days. The predicted values fluctuate greatly at 20 and 50 days, and remain between 60 and 80 for the rest of the time, reflecting the model's accurate estimation of water level changes over long and specific periods.
[0106] like Figure 24 The data shows the predicted water level for the next three years. The predicted values fluctuate significantly in a periodic manner, while remaining between 60 and 80 for the rest of the time, indicating that the Stacking ensemble model has a good predictive effect on the periodic changes in water level.
[0107] To comprehensively and deeply evaluate the performance of the Stacking ensemble model, this experiment conducted two prediction tests. The first prediction, based on the initially constructed model and feature engineering, aimed to obtain the model's performance under basic settings, providing baseline data for subsequent optimization. Analysis of the first prediction results revealed shortcomings in the model's ability to capture flood level and flow variation patterns, such as prediction bias in extreme cases. Based on the analysis of the first prediction results, the second prediction targeted optimizations to the model parameters and feature engineering. Parameter tuning included fine-tuning the Stacking ensemble model's hyperparameters to improve the model's feature extraction and learning capabilities.
[0108] Changes from the first predicted loss value ( Figure 25 As the number of training epochs increases, both the training set loss and the validation set loss show a decreasing trend. In the early stages of training, the loss value decreases significantly, indicating that the model can quickly learn the features in the data; as training progresses, the rate of decrease in the loss value gradually slows down, stabilizing after approximately 30 training epochs. This means that the model gradually converges, and its fit to the data continuously improves. The change in the loss value of the second prediction (…) Figure 26 The model also exhibited a similar trend, but during training, the validation set loss fluctuated slightly between 0 and 10 epochs. This may be due to overfitting or underfitting of certain data features during the learning process. However, the overall loss value remained at a low level and eventually converged, indicating that the model training was effective and could adapt well to the training data.
[0109] The Stacking ensemble model was applied to flood prediction in the target area, and the results were compared with the actual values. The training set and test set fit (...) Figure 27 The results show that the predicted values and the actual values have a high degree of consistency in overall trend. During periods when the flood level and flow rate are relatively stable, the predicted values can track the changes in the actual values well; however, in extreme cases where the water level rises or falls rapidly, there is a certain deviation between the predicted values and the actual values, but they can still roughly reflect the trend of change.
[0110] The trained model is used to predict flood conditions for the next three years. The first prediction of flood conditions for the next three years is as follows: Figure 28 The forecast indicates that the target area may experience multiple flood events in the near future, with water levels and flows exhibiting periodic fluctuations. During certain specific periods, water levels and flows are expected to reach higher levels, posing a certain risk of flooding. The second flood forecast for the next three years (…) Figure 29The trend is similar to the first prediction, but there are differences in specific values. This may be due to adjustments in model parameters and different levels of learning of data features during the two predictions. By comparing the two prediction results, it can be found that the model has a certain degree of stability in grasping the future flood trend, but some uncertainties still exist in the details, requiring further optimization of the model and enrichment of data to improve the accuracy of the prediction.
[0111] In the second prediction, model parameters and feature engineering were further optimized, which improved the prediction accuracy for extreme cases to some extent. The two prediction results were quantitatively evaluated by calculating RMSE, MAE, and R². The first prediction had an RMSE of 0.15, an MAE of 0.06, and an R² score of... 2 The second forecast showed an RMSE of 0.41; the second forecast showed an RMSE of 0.13 and a MAE of 0.04. 2 Increased to 0.45. RMSE is quite sensitive to error fluctuations; a decrease in its value means that the average error between the optimized model's predicted values and the true values is reduced, indicating that error fluctuations in the prediction process are effectively controlled, and the prediction results are more stable and reliable. MAE intuitively reflects the average magnitude of the error between the predicted and true values. A decrease in MAE indicates that the model's average error is decreasing during prediction, and it can more accurately approximate the true values. R 2 R is used to evaluate the goodness of fit of a model to the data. 2 The increase in the value indicates that the optimized model fits the data better and can explain more variation in the data. This means that the model has a more accurate grasp of the patterns of flood level and flow changes and can better uncover the potential information in the data.
[0112] These changes in indicators demonstrate that the optimized model has significantly improved in both prediction accuracy and fit, enabling it to more accurately predict flood levels and flows in the target area. However, it should also be noted that R... 2 The values have not yet reached the ideal level, indicating that there is room for improvement in the model's ability to interpret data. There may be some factors that the model has not yet fully captured, influencing the occurrence and development of floods. Future research could consider introducing more data sources, such as soil moisture and vegetation dynamics, or employing more complex model structures to further explore the relationships between data features, thereby improving the model's predictive performance and better serving flood prevention and disaster reduction efforts in the target area.
[0113] In summary, based on a clear understanding of the experimental hardware platform, software environment, and training strategy, this experiment constructed and trained LSTM-Seq2Seq, Support Vector Regression (SVR), Multi-Head Attention Transformer, and Stacking ensemble models for multivariate prediction of sediment concentration, flow rate, and water level, focusing on multi-year daily hydrological sequences in the target region. Through a unified data preprocessing workflow (missing value removal, standardization, and sliding window construction) and a consistent validation partitioning method (reserving the last 60 days as the validation set), the comparability of results from different models was ensured, enabling an objective evaluation of the models' time-series modeling capabilities and generalization performance.
[0114] From the perspective of single-model performance, LSTM-Seq2Seq can effectively learn the temporal dependencies in historical sequences using a recurrent structure. The predicted curve generally matches the actual changes during the validation period, indicating good fitting and short-term extrapolation capabilities for routine hydrological processes. However, near individual sudden fluctuations or extreme-scale changes, there is still a certain degree of deviation, reflecting that its response to anomalous patterns is still limited by the coverage of the training samples. SVM / SVR models have a stable advantage in small-sample and nonlinear regression tasks, providing smooth and reasonable predictions for most time periods. However, they lack sensitivity to rapid jumps or sharp peaks, leading to relatively prominent errors near extreme values. Transformer models, relying on a multi-head attention mechanism, can capture dependencies at different time scales in parallel. They perform well in short-term fitting accuracy, local trend tracking, and periodic feature extraction, especially in predicting continuously changing segments. However, as the future prediction step size increases, the error gradually accumulates with recursive rolling, introducing some uncertainty into long-term extrapolation.
[0115] Comprehensive comparison results show that the three types of single models are significantly complementary in terms of modeling mechanism and error distribution: LSTM is better at learning local continuous dependencies, Transformer is better at capturing long-range correlations and multi-scale information, and SVM excels in nonlinear fitting stability and noise resistance. Based on this complementary feature, the method in this application further introduces a Stacking ensemble strategy, using the outputs of multiple base learners as inputs to a secondary learner to achieve a weighted fusion of the advantages of different models. Experiments show that the Stacking model has the smallest overall error and the highest degree of overlap between the fitted curve and the real sequence during the validation phase. It also suppresses the deviation of most abnormal fluctuation points to a certain extent, demonstrating the value of ensemble learning in improving robustness and generalization ability.
[0116] Finally, the Stacking ensemble model predicted the flood situation, showing that a major flood would occur around June 2025, which is consistent with the actual situation. This demonstrates that the Stacking model has excellent flood prediction capabilities, improves the model's ability to predict extreme situations and enhances its stability, and provides more reliable technical support for flood prevention and control in the target area.
[0117] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.
Claims
1. A water level prediction method based on an integrated intelligent model, characterized in that, The method includes: Obtain historical hydrological data for the target water area, including at least average water level, suspended sediment transport rate, sediment concentration, average flow rate, and water temperature. The historical hydrological data is preprocessed to obtain preprocessed data; Multiple basic learners are constructed, including a first learner based on a long short-term memory network-sequence to sequence model, a second learner based on a support vector regression model, and a third learner based on a Transformer model with a multi-head attention mechanism. The first learner, the second learner, and the third learner are trained using the preprocessed data, and the prediction results of each learner are generated. The prediction results of the first learner, the second learner, and the third learner are used as inputs to train a meta-learner, forming a Stacking ensemble model. The trained Stacking ensemble model is used to predict flood levels in the target water area.
2. The water level prediction method based on an integrated intelligent model according to claim 1, characterized in that, The historical hydrological data is preprocessed, and the calculation method for the preprocessed data is as follows: in, For raw data The mean, For raw data standard deviation This is the preprocessed data.
3. The water level prediction method based on an integrated intelligent model according to claim 1, characterized in that, The data processing flow of the first learner includes: Multidimensional hydrological feature sequences of multiple consecutive historical time steps As input, where Indicates at time step t Preprocessed hydrological feature vectors This includes standardized average water level, suspended sediment transport rate, sediment concentration, average flow rate, and water temperature; The long short-term memory network in the encoder reads the input sequence step by step, and at each time step... t Based on the hidden state of the previous moment and unit state and the current input The cell state and hidden state are updated through the following gating mechanism: Forgotten Gate: ,in Output for the forget gate. It is the sigmoid activation function. Here is the weight matrix for the forget gate. This represents vector concatenation. For the bias term of the forget gate; Input Gate: ,in For input gate output, Here is the weight matrix of the input gate. This is the bias term for the input gate; Candidate state: ,in The candidate cell state is... The hyperbolic tangent activation function is used. Here is the weight matrix for the candidate states. The bias term for the candidate state; Cell status: ,in This represents the current state of the cell. Output gate: ,in For output gate output, This is the weight matrix of the output gate. This is the bias term for the output gate; Hidden state: ,in The current hidden state; The encoder reads the last input. Then, the final state vector is obtained. h T and C T This is passed to the decoder as a context vector; The decoder is based on a long short-term memory network structure, using the context vector as the initial state to progressively generate predicted output sequences for multiple future time steps. ,in This represents the prediction result of the first learner. It should include at least the predicted average water level.
4. The water level prediction method based on an integrated intelligent model according to claim 3, characterized in that, When training the first learner, a sliding window is used to construct input sequence and corresponding output sequence sample pairs, and minimizing the mean squared error is used as the optimization objective; the mean squared error loss function is: in This represents the value of the loss function. For the sample size, The output sequence predicted by the model. For the actual output sequence, This represents the Euclidean norm.
5. The water level prediction method based on an integrated intelligent model according to claim 1, characterized in that, The data processing flow of the second learner includes: The hydrological feature vector of a single historical time step is used as the input vector, and the hydrological feature vector includes at least the standardized average water level, suspended sediment transport rate, sediment concentration, average flow rate, and water temperature. Through kernel function Mapping the input vector to a high-dimensional feature space yields high-dimensional feature vectors. ; Constructing the objective function in high-dimensional space ,in For the weight vector, For bias terms; Solving by minimizing the structural risk function. and The structural risk function is: in For regularization parameters, The number of training samples. and Let be slack variables, representing the th , respectively i The bias of a sample's predicted value being higher than the true value and the bias of a sample's predicted value being lower than the true value; Substituting the obtained w and b into the regression function, the output is the predicted average water level value for the input vector. .
6. The water level prediction method based on an integrated intelligent model according to claim 5, characterized in that, The kernel function uses radial basis functions, and its expression is: ,in Represents the kernel function. Given two input vectors, For kernel function parameters, It is a normalized exponential function; Alternatively, the kernel function may be a linear kernel, expressed as follows: ; Alternatively, the kernel function may employ a polynomial kernel, expressed as follows: ,in For constant terms, Let the degree be the polynomial. Alternatively, the kernel function can use a sigmoid kernel, expressed as follows: .
7. The water level prediction method based on an integrated intelligent model according to claim 1, characterized in that, The data processing flow of the third learner is as follows: The multidimensional hydrological time series with multiple consecutive historical time steps is used as the input sequence, wherein the multidimensional hydrological time series includes a standardized hydrological feature vector. For each time step l Input feature vector x l A linear transformation is performed through a fully connected embedding layer to obtain a dimension of d model input embedding vector ,in To embed the weight matrix, For embedding bias terms; For each position of the input sequence and index of each dimension The position encoding vector is calculated according to the following formula: in This indicates that the position encoding vector is at the th position. Values on the dimension, Indicates the first Values on the dimension; Each position pos input embedding vector With the corresponding position encoding vector The input vector of the encoder is obtained by element-wise addition. This forms the input sequence of the encoder. Z ; In the self-attention layer of the encoder, based on the input sequence Z Generate query matrix Q Key matrix K Sum matrix V And the attention output is calculated using a scaled dot product attention mechanism: in Represents the attention function. For activation function, For the dimensions of the query and key vectors, This indicates that the query matrix is multiplied by the transpose of the key matrix; A multi-head attention mechanism is employed, where the results from multiple independent attention heads are concatenated and then linearly transformed. The computation process is represented as follows: in This represents a multi-head attention function. and For the outputs of the first and h-th attention heads, For the number of attention heads, To output the weight matrix, Indicates a splicing operation; Multi-head attention output With the input sequence Z Residual connections are performed, and then layer normalization is applied to obtain the first intermediate result. The first intermediate result is input into the feedforward neural network for nonlinear transformation, and then residual connections are performed with the first intermediate result and layer normalization is applied to obtain the output features of the encoder. The decoder takes the output features of the encoder and the historical predictions generated as input, and uses the same multi-head self-attention mechanism as the encoder to gradually generate water level prediction sequences for multiple future time steps.
8. The water level prediction method based on an integrated intelligent model according to claim 3, 5, or 7, characterized in that, The predictive performance of the first learner, the second learner, or the third learner is evaluated using mean squared error, mean absolute error, and coefficient of determination. The formulas for calculating the mean square error, mean absolute error, and coefficient of determination are as follows: in Indicates mean square error. To assess sample size, For the first i The true value of each sample For the first i Predicted values for each sample; Indicates the mean absolute error; The coefficient of determination is represented by the coefficient of determination. This is the average of the true values.
9. The water level prediction method based on an integrated intelligent model according to claim 1, characterized in that, Using the prediction results of the first, second, and third learners as input, a meta-learner is trained to form a Stacking ensemble model, which specifically includes: The dataset used for training is divided into a training set and a test set; The training set is divided into K subsets using the K-fold cross-validation method; Repeat the training and validation process K times until each subset is used as a validation set once, thereby generating a new training set in which each sample contains the prediction results generated by the first learner, the second learner and the third learner, respectively. A meta-learner is trained using the new training set; During the final prediction, the predicted values output by the first, second, and third learners for the same input sample are combined into a three-dimensional feature vector. ,in The predicted average water level is the output of the first learner. The predicted average water level is the output of the second learner. The superscript represents the predicted average water level output by the third learner. This indicates transposition; the three-dimensional feature vector is input into the trained meta-learner, which then uses its internal regression function... Output the final water level prediction value .
10. The water level prediction method based on an integrated intelligent model according to claim 9, characterized in that, The formula for calculating the predicted water level is as follows: in, Let be the weight coefficients obtained from training the meta-learner, and satisfy . .