LSTM-CAM-Transform flood forecasting model for long and short dependence feature fusion
By adopting the LSTM-CAM-Transformer model in the flood forecast model, combining the cross attention mechanism and integrating long-term and short-term dependence characteristics, the problem of low forecast accuracy of the existing model is solved, and higher flood forecast accuracy and reliability are achieved.
Patent Information
- Application Number
- CN202510408814.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-02
- Publication Date
- 2025-05-02
- Estimated Expiration
- 2045-04-02
AI Technical Summary
The existing flood forecasting model is difficult to effectively integrate long-term and short-term dependence characteristics, resulting in low forecast accuracy and difficult to adapt to variable hydrological and meteorological conditions.
Using the LSTM-CAM-Transformer model, LSTM and Transformer are coupled through the cross-attention mechanism, integrating short-term and long-term characteristics, and building a hierarchical long-term and short-term feature collaborative learning framework.
The joint identification of long and short-term characteristics of floods is realized, the accuracy and reliability of flood forecasts are improved, and the information of multiple time scales in hydrological changes can be more effectively captured.
Smart Images

Figure CN119917822A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of flood forecasting, and in particular to an LSTM-CAM-Transformer flood forecasting model for long- and short-term dependency feature fusion. Background Art
[0002] Floods are one of the major natural disasters that seriously threaten human life and property safety and socio-economic development. Accurate flood forecasting is crucial for flood prevention and disaster reduction. In the process of flood formation, there are both long-term characteristics affected by the regulation and storage of river basins and short-term changing characteristics affected by sudden changes in rainfall intensity in a short period of time. Traditional flood forecasting models, such as empirical models, conceptual models, and distributed models, have problems such as low forecast accuracy and difficulty in adapting to changing environments when facing complex hydrological and meteorological conditions.
[0003] With the development of deep learning technology, data-driven flood forecasting models have made some progress, but existing models are still insufficient in capturing the long-term and short-term dependency characteristics of flood processes. A single model structure is difficult to fully capture the various time scale information involved in the formation and development of floods. For example, although the long short-term memory network (LSTM) can handle short-term dependencies well, it has limited ability to capture long-term climate trends and basin hydrological characteristics; although the Transformer architecture is good at capturing long-term dependency information, it is not sensitive enough to short-term local feature changes. In addition, when integrating features of different time scales, traditional models often use simple weighting or splicing methods, which cannot fully explore the intrinsic connections between features, resulting in limited forecast accuracy.
[0004] Existing flood forecasting models often fail to make full use of data information of different time scales and multiple modes, resulting in insufficient forecast accuracy and timeliness, making it difficult to meet the needs of actual flood prevention and disaster reduction. Therefore, it is of great practical significance to develop a flood forecasting model that can effectively integrate long-term and short-term dependency characteristics. Summary of the invention
[0005] The purpose of the present invention is to provide an LSTM-CAM-Transformer flood forecasting model for the fusion of long- and short-term dependency features. The LSTM and Transformer are coupled through the Cross Attention Mechanism (CAM), and the short-term feature extraction capability of the LSTM is integrated with the long-term dependency modeling capability of the Transformer to realize the joint recognition of the long-term and short-term features of the flood, thereby improving the accuracy and reliability of the flood forecast.
[0006] In order to solve the above technical problems, the present invention provides the following technical solutions: An LSTM-CAM-Transformer flood forecasting model for long- and short-term dependency feature fusion, the steps of which include: Obtain flood runoff data and flood prediction factor data, and use the mutual information method to screen flood prediction factors; The normalized and screened flood prediction factors and flood data are divided into rate period data and validation period data; Constructing an LSTM-CAM-Transformer flood forecasting model, wherein the LSTM-CAM-Transformer flood forecasting model structure includes a long-short dependency feature extraction module and a flood prediction module; Among them, the long-short dependency feature extraction module is used to extract the long-short dependency fusion feature vector in the hydrological dynamic characteristics of the flood prediction factor, and the long-short dependency feature extraction module includes: three independent LSTM subnets, a multi-scale feature fusion module, a first Transformer encoder, a feature alignment module and a cross-attention mechanism feature fusion module; A flood prediction module, used for performing flood forecasting based on long-short dependency fusion feature vectors and flood data, the flood prediction module comprising: a second Transformer decoder and a multi-layer perceptron (MLP); The LSTM-CAM-Transformer flood forecasting model is trained using the root mean square propagation method (RMSprop) based on rate-periodic data. The root mean square propagation method (RMSprop) can adaptively adjust the learning rate for different parameters to accelerate convergence by performing exponentially weighted moving average on the square of the gradient, and reduce the interference of noise on model convergence and forecast accuracy. The accuracy of the LSTM-CAM-Transformer flood forecasting model was verified using the determination coefficient based on the validation period data, and flood prediction was performed using the trained LSTM-CAM-Transformer flood forecasting model.
[0007] Among them, for the time series of given flood data, the Hurst index (H) is calculated using the rescaled range analysis method (R / S analysis method), and its function expression is: ; Where: t=1,2,…; R(t) is the range of the flood time series, S(t) is the standard deviation S of the time series, and R / S is the rescaled range.
[0008] The Hurst index (H) is obtained by calculating the rescaled range R / S for different time intervals t and plotting the slope of log(R / S) and log(t). The H of many runoff series is significantly greater than 0.5, indicating that flood series have long memory. Therefore, it is necessary to combine long-term and short-term characteristics when constructing the LSTM-CAM-Transformer flood forecasting model.
[0009] According to the above technical solution, the three independent LSTM subnetworks are hour-level LSTM subnetwork, day-level LSTM subnetwork and week-level LSTM subnetwork; The hourly LSTM subnet is used to capture the hydrological dynamic characteristics at the hourly time scale; The daily LSTM subnet is used to capture the hydrological dynamic characteristics at the daily time scale; The weekly LSTM subnetwork is used to capture the hydrological dynamic characteristics at the weekly time scale.
[0010] Among them, each LSTM subnet can effectively capture the dynamic changes of hydrology at different time scales through the synergy of its unique input gate, forget gate and output gate. The hourly LSTM subnet focuses on capturing short-term characteristics such as the sharp change of rainfall intensity and the rapid response of runoff in a short period of time; the daily LSTM subnet is used to analyze the impact of the overall changes of rainfall and runoff within a day on the water storage capacity of the basin; the weekly LSTM subnet focuses on the comprehensive hydrological dynamic changes of the basin within a week, integrating the accumulated information such as rainfall over a longer period of time.
[0011] According to the above technical solution, the LSTM-CAM-Transformer flood forecasting model execution steps include: The screened flood prediction factors are input into three independent LSTM subnetworks to obtain the hourly time scale hydrological dynamic characteristics h (1) , hydrological dynamic characteristics on daily time scale (2) and hydrological dynamic characteristics at weekly time scales (3) ; The multi-scale feature fusion module is used to transform the hourly time scale hydrological dynamic features h (1) , hydrological dynamic characteristics on daily time scale (2) and hydrological dynamic characteristics at weekly time scales (3) Perform dynamic weighted fusion to obtain a comprehensive short-term feature vector ; The downsampled flood prediction factor is mapped to a low-dimensional vector space and the comprehensive short-term feature vector through the embedding layer of the first Transformer encoder After fusion, the long-term feature vector is obtained by self-attention mechanism, normalization layer, feedforward network layer, and normalization layer. ; The comprehensive short-term feature vector is aligned by the feature alignment module and the long-term eigenvector Mapped to the same dimension; The cross-attention mechanism feature fusion module is used to combine the comprehensive short-term feature vectors of the same dimension and the long-term eigenvector Fusion is performed to obtain the long-short dependency fusion feature vector ; The masked self-attention mechanism of the second Transformer decoder is used to process the predicted output of the previous moment to obtain the flood feature vector and the long-short dependency fusion feature vector After the cross-attention mechanism fusion, it passes through the normalization layer, feedforward network layer and multi-layer perceptron of the second Transformer decoder in turn to obtain the flood forecast result.
[0012] According to the above technical solution, the influence of characteristics of different time scales on flood changes changes dynamically with time and specific conditions, so the feature vectors output by each LSTM subnet are dynamically weighted and fused. According to the importance of characteristics of different time scales, the scale feature fusion module uses the softmax function to assign different weights to the output of each LSTM subnet for weighted summation to obtain the comprehensive short-term feature vector h s ; The comprehensive short-term eigenvector Calculation formula: ; ; ; In the formula, is the input feature of the kth scale at time t, represents the hidden state output by the kth scale at time t-1, represents the hidden state of the kth scale at time t, represents the feature vector of the kth scale, represents the hidden state output by the kth scale at time 1, represents the hidden state output by the kth scale at time 2, represents the hidden state output by the kth scale at time T, represents the weight matrix of the kth scale in the softmax function, represents the weight matrix of the j-th scale in the softmax function, represents the feature vector of the jth scale, represents the bias vector of the jth scale in the softmax function, Represents the bias vector of the kth scale in the softmax function.
[0013] Among them, k and j can be 1, 2, and 3, respectively representing the hydrological dynamic characteristics of the hourly time scale, the hydrological dynamic characteristics of the daily time scale, and the hydrological dynamic characteristics of the weekly time scale.
[0014] According to the above technical solution, the downsampled flood prediction factor is mapped to the low-dimensional vector space and the comprehensive short-term feature vector through the embedding layer of the first Transformer encoder. After merging, we get the fused vector sequence , and fused vector sequence Perform position encoding; The downsampled flood prediction factor is mapped to a low-dimensional vector space and the comprehensive short-term feature vector through the embedding layer of the first Transformer encoder Fusion enables Transformer to combine these short-term features while capturing long-term dependencies, better understand the changing patterns of floods at different time scales, and further explore the potential complex patterns and features in the data. At the same time, in order to enable Transformer to better process time series data, the fusion vector sequence Perform positional encoding to enable the model to distinguish data from different time points.
[0015] The position encoding formula includes: ; ; Where: Fusion vector sequence The position index of the element in, i represents the dimension index, The model dimension is set to 128 dimensions. Represents a fused vector sequence The positional encoding value of the elements in the even-numbered dimensions, Represents the fusion vector sequence The positional encoding value of the elements in the odd dimensions.
[0016] According to the above technical solution, the LSTM-CAM-Transformer flood forecasting model is characterized in that the long-term feature vector Calculation formula: ; ; ; Where x is the fusion vector sequence , represents the weight matrix of the query, represents the weight matrix of the key, A weight matrix representing the values, represents the query vector, represents the key vector, The indicator vector, represents the dimension of the key vector, T represents the transpose operation of the key vector, represents the activation function, represents the multi-head attention concatenation function, Represents a single-head attention calculation function.
[0017] According to the above technical solution, due to the comprehensive short-term feature vector and the long-term eigenvector may have different time steps or dimensions, so the feature alignment module uses line interpolation to integrate the short-term feature vector and the long-term eigenvector Refine to the same time step and use a fully connected layer to integrate the short-term feature vector and the long-term eigenvector Mapped to the same dimension.
[0018] According to the above technical solution, the cross-attention mechanism feature fusion module uses the cross-attention mechanism CAM to combine the comprehensive short-term feature vectors of the same dimension and the long-term eigenvector Perform long-short dependency feature fusion to obtain the long-short dependency fusion feature vector .
[0019] Compared with the prior art, the beneficial effects achieved by the present invention are as follows: the present invention couples LSTM and Transformer through the Cross Attention Mechanism (CAM), constructs a hierarchical long- and short-term feature collaborative learning framework, integrates the short-term feature extraction capability of LSTM with the long-term dependency modeling capability of Transformer, realizes the joint identification of long- and short-term flood features, effectively solves the problem of feature separation between local mutation response and global trend evolution in hydrological forecasting, avoids the limitations of a single model in computational efficiency and feature coverage, and provides a new solution for accurate hydrological forecasting that is both scientific and practical in engineering. The coupling architecture exhibits more reliable multi-scale feature decoupling analysis and dynamic decision support, can efficiently identify the coupling effects of heterogeneous hydrological elements, enhance the robustness of the system to realistic constraints such as data loss and basin heterogeneity, adaptively adjusts the interaction weights of long- and short-term features, and simultaneously captures the subtle signs of sudden flood peaks and the macroscopic evolution laws of slow-onset floods in complex hydrological scenarios, significantly improving the accuracy of flood forecasting. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings: Figure 1 This is an overall architecture diagram of an LSTM-CAM-Transformer flood forecasting model for long- and short-term dependent feature fusion according to the present invention; Figure 2 This is the schematic diagram of the cross attention mechanism. DETAILED DESCRIPTION
[0021] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0022] The present invention provides a technical solution: An LSTM-CAM-Transformer flood forecasting model for long- and short-term dependency feature fusion is constructed as follows: S1. Obtain flood runoff data and flood prediction factor data, and use the mutual information method to screen flood prediction factors. Take the example of flood prediction factors screened by mutual information method. The specific steps include: A large amount of data related to flood prediction factors in the basin should be widely collected, such as historical rainfall data R from meteorological stations, previous water level data Wpre and previous flood flow data Qpre from hydrological monitoring stations, etc. The time resolution of the data should cover hourly, daily and weekly scales to meet the needs of multi-scale modeling.
[0023] The mutual information method is used to calculate various flood prediction factors and the required variable flood flow. After calculating the mutual information value, it was found that rainfall data R, previous water level Wpre, previous flood flow Qpre, and underlying surface indicators such as watershed soil texture, vegetation coverage, elevation, slope, and slope aspect were all related to flood flow. The correlation is high and it can be used as a predictor of floods.
[0024] The mutual information value formula is as follows: ; Where: is the flood prediction factor, is the variable flood flow, N is the total number of samples of flood prediction factors, Flood prediction factor In the kth level and flood flow The number of samples in the mth bin, Expressed as flood prediction factor The number of samples in the kth bin; Expressed as flood flow The number of samples in the mth bin.
[0025] S2. Normalize the screened flood prediction factors and flood runoff data; specifically, set a reasonable data range based on the actual situation of the local basin, and remove abnormal values that are out of range or do not conform to physical laws in the screened flood prediction factor data and flood runoff data. Use linear interpolation to fill missing values to ensure data integrity and obtain time series of equal time periods. Normalize different types of data and map the values to the [0,1] or [-1,1] interval. Normalization can be performed using the following formula: ; Where: is the normalized value, is the original value, and They are respectively the maximum and minimum values of the flood prediction factor data after screening.
[0026] S3. Build an LSTM-CAM-Transformer flood forecasting model.
[0027] The LSTM-CAM-Transformer flood forecasting model structure includes: The long-short dependency feature extraction module is used to extract the long-short dependency fusion feature vector in the hydrological dynamic characteristics of flood prediction factors, including: three independent LSTM subnetworks, a multi-scale feature fusion module, the first Transformer encoder, a feature alignment module, and a cross-attention mechanism feature fusion module; The flood prediction module is used to perform flood forecasting based on the long-short dependency fusion feature vector and flood data, including: a second Transformer decoder and a multi-layer perceptron (MLP).
[0028] Among them, the three independent LSTM subnetworks are hourly LSTM subnetwork, daily LSTM subnetwork and weekly LSTM subnetwork; among them, the hourly LSTM subnetwork is used to capture the hydrological dynamic characteristics of the hourly time scale; the daily LSTM subnetwork is used to capture the hydrological dynamic characteristics of the daily time scale; the weekly LSTM subnetwork is used to capture the hydrological dynamic characteristics of the weekly time scale.
[0029] Among them, the execution steps of the LSTM-CAM-Transformer flood forecasting model include: S301, input the selected flood prediction factors into three independent LSTM subnetworks to obtain the hydrological dynamic characteristics h at the hourly time scale. (1) , hydrological dynamic characteristics on daily time scale (2) and hydrological dynamic characteristics at weekly time scales (3) .
[0030] Taking the hour-level LSTM subnetwork as an example, the prediction factor data x with a time resolution of 1 hour t (1) Input into the hour-level LSTM subnet, refer to the hidden state h obtained by the model at the previous moment t-1 (1) , which information to keep and discard is determined by the input gate and the forget gate. Combining the screening results of the forget gate and the input gate with the candidate cell state, the hour-level LSTM subnet updates the cell state at the current moment. The output gate determines how much information in the current cell state can be used as the hidden state h at the current moment. t (1) Output. The hidden state h output at each time step t (1) Finally, the hourly-scale hydrological dynamic characteristics h output by the hourly-scale LSTM subnetwork are formed. (1) Similarly, the hidden state output by the daily LSTM subnetwork constitutes the hydrological dynamic characteristics h at the daily time scale (2)The hidden state output by the weekly LSTM subnetwork constitutes the hydrological dynamic characteristics h at the weekly time scale. (3) .
[0031] S302, using the multi-scale feature fusion module to use the softmax function to transform the hourly time scale hydrological dynamic feature h (1) , hydrological dynamic characteristics on daily time scale (2) and hydrological dynamic characteristics at weekly time scales (3) Perform dynamic weighted fusion to obtain a comprehensive short-term feature vector .
[0032] The comprehensive short-term eigenvector Calculation formula: ; ; ; In the formula, is the input feature of the kth scale at time t, represents the hidden state output by the kth scale at time t-1, represents the hidden state of the kth scale at time t, represents the feature vector of the kth scale, represents the weight matrix of the kth scale in the softmax function, represents the weight matrix of the j-th scale in the softmax function, represents the feature vector of the jth scale, represents the bias vector of the jth scale in the softmax function, represents the bias vector of the kth scale in the softmax function, represents the hidden state output by the kth scale at time 1, represents the hidden state output by the kth scale at time 2, Represents the hidden state output by the kth scale at time T.
[0033] Among them, k and j can be 1, 2, and 3, respectively representing the hydrological dynamic characteristics of the hourly time scale, the hydrological dynamic characteristics of the daily time scale, and the hydrological dynamic characteristics of the weekly time scale.
[0034] S303: Mapping the downsampled flood prediction factor to a low-dimensional vector space and the comprehensive short-term feature vector through the embedding layer of the first Transformer encoder After fusion, we get the fused vector sequence , and fused vector sequence Perform position encoding, and pass the position encoded fusion vector through the self-attention mechanism, normalization layer, feedforward network layer, and normalization layer in turn to obtain the long-term feature vector .
[0035] Wherein, the position encoding formula includes: ; ; Where: Represents a fused vector sequence The position index of the element in, i represents the dimension index, The model dimension is set to 128 dimensions. Represents a fused vector sequence The positional encoding value of the elements in the even-numbered dimensions, Represents the fusion vector sequence The positional encoding value of the elements in the odd dimensions.
[0036] Among them, the long-term feature vector Calculation formula: ; ; ; Where x is the fusion vector sequence , represents the weight matrix of the query, represents the weight matrix of the key, A weight matrix representing the values, represents the query vector, represents the key vector, represents a value vector, represents the dimension of the key vector, T represents the transpose operation of the key vector, represents the activation function, represents the multi-head attention concatenation function, Represents a single-head attention calculation function.
[0037] S304: aligning the comprehensive short-term feature vector and the long-term eigenvector Mapped to the same dimension, specifically, the feature alignment module uses line interpolation to integrate the short-term feature vector and the long-term eigenvector Refine to the same time step and use a fully connected layer to integrate the short-term feature vector and the long-term eigenvector Mapped to the same dimension.
[0038] Among them, The dimension is , The dimension is , For the target dimension: ; ; Where: , is a fully connected layer, , is the bias vector, The dimension is , The dimension is . is the comprehensive short-term eigenvector, is the comprehensive short-term feature vector for dimension alignment, is the long-term feature vector for dimension alignment, is the long-term eigenvector.
[0039] S305, using the cross attention mechanism feature fusion module to use the cross attention mechanism CAM to combine the comprehensive short-term feature vectors of the same dimension and the long-term eigenvector Fusion is performed to obtain the long-short dependency fusion feature vector Specifically, the aligned The query matrix Q is obtained by linear transformation, and the aligned The key matrix K and value matrix V are obtained through linear transformation, and the long-short dependency fusion feature vector is calculated using the cross attention mechanism. ; The principle of the cross attention mechanism (CAM) can be found in Figure 2 .
[0040] S306: Process the predicted output of the previous moment through the masked self-attention mechanism of the second Transformer decoder to obtain a feature vector and a long-short dependency fusion feature vector After the cross-attention mechanism fusion, it passes through the normalization layer, feedforward network layer and multi-layer perceptron of the second Transformer decoder in turn to obtain the flood forecast result.
[0041] S4. The normalized and screened flood prediction factors and flood data are divided into two-thirds as rate period data, and the remaining one-third as validation period data.
[0042] S5. The LSTM-CAM-Transformer flood forecasting model is trained using the root mean square propagation method (RMSprop) based on rate-periodic data. Specifically, the selected RMSprop optimization method is used to update the parameters of the LSTM-CAM-Transformer flood forecasting model according to the gradient information of the loss function. The training is iterated for about 200 rounds to determine the structural parameters of the LSTM-CAM-Transformer flood forecasting model, such as the number of layers and the number of neurons in each layer, until the LSTM-CAM-Transformer flood forecasting model converges or the loss function decreases very little.
[0043] The rate period data is input into the LSTM-CAM-Transformer flood forecasting model, and the mean square error loss function MSE is calculated according to the difference between the prediction results of the LSTM-CAM-Transformer flood forecasting model and the actual value: wherein the prediction results of the LSTM-CAM-Transformer flood forecasting model can be flood water level data and / or flood flow data.
[0044] ; Where: n is the number of samples, is the predicted value of the ith sample, is the true value of the i-th sample.
[0045] S6. Based on the validation period data, the accuracy of the LSTM-CAM-Transformer flood forecasting model is verified using the determination coefficient, and flood forecasting is performed using the trained LSTM-CAM-Transformer flood forecasting model.
[0046] Specifically, the flood prediction factors of the validation period are input into the trained LSTM-CAM-Transformer flood forecasting model to obtain the predicted flood forecast results (flood level data and / or flood flow data), which are compared with the actual flood data. The determination coefficient R is calculated. 2 To predict the accuracy and reliability of the LSTM-CAM-Transformer flood forecasting model: ; Where: n is the number of samples, is the predicted value of the ith sample, is the true value of the i-th sample, is the average of the true values.
[0047] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device.
[0048] Finally, it should be noted that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art can still modify the technical solutions described in the aforementioned embodiments or replace some of the technical features therein by equivalents. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A LSTM-CAM-Transformer flood forecasting model for long- and short-term dependency feature fusion, characterized in that: The steps include: Obtain flood runoff data and flood prediction factor data, and use the mutual information method to screen flood prediction factors; The normalized and screened flood prediction factors and flood data are divided into rate period data and validation period data; Constructing an LSTM-CAM-Transformer flood forecasting model, wherein the LSTM-CAM-Transformer flood forecasting model structure includes a long-short dependency feature extraction module and a flood prediction module; Among them, the long-short dependency feature extraction module is used to extract the long-short dependency fusion feature vector in the hydrological dynamic characteristics of the flood prediction factor, and the long-short dependency feature extraction module includes: three independent LSTM subnets, a multi-scale feature fusion module, a first Transformer encoder, a feature alignment module and a cross-attention mechanism feature fusion module; A flood prediction module, used for performing flood forecasting based on long-short dependency fusion feature vectors and flood data, the flood prediction module comprising: a second Transformer decoder and a multi-layer perceptron; The LSTM-CAM-Transformer flood forecasting model is trained using the root mean square propagation method based on the rate periodic data; The accuracy of the LSTM-CAM-Transformer flood forecasting model was verified using the determination coefficient based on the validation period data, and flood prediction was performed using the trained LSTM-CAM-Transformer flood forecasting model.
2. The LSTM-CAM-Transformer flood forecasting model for long-short dependency feature fusion according to claim 1 is characterized in that: The three independent LSTM subnetworks are respectively an hour-level LSTM subnetwork, a day-level LSTM subnetwork and a week-level LSTM subnetwork; The hourly LSTM subnet is used to capture the hydrological dynamic characteristics at the hourly time scale; The daily LSTM subnet is used to capture the hydrological dynamic characteristics at the daily time scale; The weekly LSTM subnetwork is used to capture the hydrological dynamic characteristics at the weekly time scale.
3. The LSTM-CAM-Transformer flood forecasting model for long-short dependency feature fusion according to claim 1 is characterized in that: The LSTM-CAM-Transformer flood forecasting model execution steps include: The screened flood prediction factors are input into three independent LSTM subnetworks to obtain the hydrological dynamic characteristics at the hourly time scale, the daily time scale, and the weekly time scale respectively. The multi-scale feature fusion module is used to dynamically weight and fuse the hydrological dynamic features of the hourly time scale, the daily time scale, and the weekly time scale to obtain a comprehensive short-term feature vector. ; The downsampled flood prediction factor is mapped to a low-dimensional vector space and the comprehensive short-term feature vector through the embedding layer of the first Transformer encoder After fusion, the long-term feature vector is obtained by passing through the self-attention mechanism, normalization layer, feedforward network layer, and normalization layer of the first Transformer encoder in turn. ; The comprehensive short-term feature vector is aligned by the feature alignment module and the long-term eigenvector Mapped to the same dimension; The cross-attention mechanism feature fusion module is used to combine the comprehensive short-term feature vectors of the same dimension and the long-term eigenvector Fusion is performed to obtain the long-short dependency fusion feature vector ; The masked self-attention mechanism of the second Transformer decoder is used to process the predicted output of the previous moment to obtain the flood feature vector and the long-short dependency fusion feature vector After the cross-attention mechanism fusion, it passes through the normalization layer, feedforward network layer and multi-layer perceptron of the second Transformer decoder in turn to obtain the flood forecast result.
4. The LSTM-CAM-Transformer flood forecasting model for long-short dependency feature fusion according to claim 1 is characterized in that: The multi-scale feature fusion module uses the softmax function to assign different weights to the output of each LSTM subnetwork for weighted summation to obtain a comprehensive short-term feature vector ; The comprehensive short-term eigenvector Calculation formula: ; ; ; In the formula, represents the hidden state of the kth scale at time t, is the input feature of the kth scale at time t, represents the hidden state output by the kth scale at time t-1, represents the feature vector of the kth scale, represents the hidden state output by the kth scale at time 1, represents the hidden state output by the kth scale at time 2, represents the hidden state output by the kth scale at time T; represents the weight matrix of the kth scale in the softmax function, represents the weight matrix of the j-th scale in the softmax function, represents the feature vector of the jth scale, represents the bias vector of the jth scale in the softmax function, Represents the bias vector of the kth scale in the softmax function; Among them, k and j can be 1, 2, and 3, respectively representing the hydrological dynamic characteristics of the hourly time scale, the hydrological dynamic characteristics of the daily time scale, and the hydrological dynamic characteristics of the weekly time scale.
5. The LSTM-CAM-Transformer flood forecasting model for long-short dependency feature fusion according to claim 1 is characterized in that: The downsampled flood prediction factor is mapped to a low-dimensional vector space and a comprehensive short-term feature vector through the embedding layer of the first Transformer encoder After fusion, we get the fused vector sequence , and fused vector sequence Perform position encoding; The position encoding formula includes: ; ; Where: Represents a fused vector sequence The position index of the element in, i represents the dimension index, The model dimension is set to 128 dimensions. Represents a fused vector sequence The positional encoding value of an element in an even dimension, Represents the fusion vector sequence The positional encoding value of the elements in the odd dimensions.
6. The LSTM-CAM-Transformer flood forecasting model for long-short dependency feature fusion according to claim 3 is characterized in that: The long-term eigenvector Calculation formula: ; ; ; Where x is the fusion vector sequence , represents the weight matrix of the query, represents the weight matrix of the key, A weight matrix representing the values, represents the query vector, represents the key vector, represents a value vector, represents the dimension of the key vector, T represents the transpose operation of the key vector, represents the activation function, represents the multi-head attention concatenation function, Represents a single-head attention calculation function.
7. The LSTM-CAM-Transformer flood forecasting model for long-short dependency feature fusion according to claim 3 is characterized in that: The feature alignment module uses line interpolation to integrate the short-term feature vector and the long-term eigenvector Refine to the same time step and use a fully connected layer to integrate the short-term feature vector and the long-term eigenvector Mapped to the same dimension.
8. The LSTM-CAM-Transformer flood forecasting model for long-short dependency feature fusion according to claim 3 is characterized in that: The cross-attention mechanism feature fusion module uses the cross-attention mechanism to combine the comprehensive short-term feature vectors of the same dimension and the long-term eigenvector Perform long-short dependency feature fusion to obtain the long-short dependency fusion feature vector .
Citation Information
Patent Citations
LSTM-based medium and small river short-term flood forecasting method
CN109615011A
Regional LSTM flood forecasting method
CN114707753A
Intelligent flood forecasting method based on MCRBiLSTM
CN115860231A
Cited By
Basin flood forecasting method and system based on artificial intelligence
CN121234163A
Artificial intelligence-based basin flood forecasting method and system
CN121234163B