# Is the LSTM Model Better than RNN for Flood Forecasting Tasks? A Case Study of HuaYuankou Station and LouDe Station in the Lower Yellow River Basin

^{*}

## Abstract

**:**

## 1. Introduction

## 2. Research Object

#### 2.1. Research Area and Data

^{2}. The downstream Henan and Shandong provinces are flat, and the sediment accumulation forms a suspended river on the ground. The river channel safety directly affects more than 300 million people in the North China Plain. Therefore, it is necessary to establish an accurate flood forecasting model for the river channel [31].

^{2}, accounting for 92% of the Yellow River basin area. The water supply of the HuaYuankou station mainly comes from the upstream river channel, with three inflow stations: XiaoLangdi, WuZhi, and HeiShiguan. In addition, due to the flat river channel and sediment accumulation in the lower reaches of the Yellow River, the riverbed elevation increases, and the rainfall in the station interval makes it difficult to converge into the main river channel of the Yellow River. Therefore, this station no longer takes the interval rainfall as a model input factor. The topography and river conditions of the HuaYuankou station are shown in Figure 1.

^{3}/s. All data were divided into a training set, a validation set, and a test set according to the ratio of 70:25:5 (since the flood lasted for a long time, the last flood was chosen as the test set). The data division is shown in Figure 2.

^{2}. It flows into the Dongping Lake from east to west and then into the Yellow River. Affected by the monsoon climate, the precipitation in the flood season accounts for more than 70% of the year, and the river flow changes are greatly affected by rainfall. Seasonal floods are likely to occur, and the flood confluence and the mainstream overlap may even affect the safety of the main river channel of the Yellow River. The Loude station has two inflow stations: the GuangMing Reservoir and the DongZhou Reservoir, and there are 16 rainfall stations such as XiaFeng and MengYinzhai in the station interval. The topography and river conditions of the HuaYuankou station are shown in Figure 3.

#### 2.2. Input and Output Sequence Settings

#### 2.3. Research Process

## 3. Methods

#### 3.1. Basic Model

#### 3.1.1. RNN Unit

#### 3.1.2. LSTM Unit

#### 3.1.3. Model Transmission Structure

#### 3.2. Attention Mechanism Coupling Model

#### 3.3. Model Hyperparameter Optimization

#### 3.4. Analysis of Model Differences

#### 3.5. Related Parameter Settings

#### 3.6. Model Evaluation Indicators

## 4. Results and Discussion

#### 4.1. Model Structure Comparison Analysis

#### 4.2. Basic Model Comparison Analysis

#### 4.3. Basic Model Hyperparameter Optimization Comparison Analysis

#### 4.4. Attention Mechanism Coupling Model Comparison Analysis

#### 4.5. Model Parameter and Computational Cost Comparison Analysis

## 5. Conclusions

## Author Contributions

## Funding

## Institutional Review Board Statement

## Informed Consent Statement

## Data Availability Statement

## Conflicts of Interest

## References

- Collet, L.; Beevers, L.; Stewart, M.D. Decision-Making and Flood Risk Uncertainty: Statistical Data Set Analysis for Flood Risk Assessment. Water Resour. Res.
**2018**, 54, 7291–7308. [Google Scholar] [CrossRef] - Herath, H.; Chadalawada, J.; Babovic, V. Hydrologically informed machine learning for rainfall-runoff modelling: Towards distributed modelling. Hydrol. Earth Syst. Sci.
**2021**, 25, 4373–4401. [Google Scholar] [CrossRef] - Hao, S.; Wang, W.; Ma, Q.; Li, C.; Wen, L.; Tian, J.; Liu, C. Model-Based Mechanism Analysis of “7.20” Flash Flood Disaster in Wangzongdian River Basin. Water
**2023**, 15, 304. [Google Scholar] [CrossRef] - Wang, W.-C.; Zhao, Y.-W.; Chau, K.-W.; Xu, D.-M.; Liu, C.-J. Improved flood forecasting using geomorphic unit hydrograph based on spatially distributed velocity field. J. Hydroinformatics
**2021**, 23, 724–739. [Google Scholar] [CrossRef] - Lian, X.; Hu, X.L.; Bian, J.; Shi, L.S.; Lin, L.; Cui, Y.L. Enhancing streamflow estimation by integrating a data-driven evapotranspiration submodel into process-based hydrological models. J. Hydrol.
**2023**, 621, 129603. [Google Scholar] [CrossRef] - Yang, S.Y.; Yang, D.W.; Chen, J.S.; Santisirisomboon, J.; Lu, W.W.; Zhao, B.X. A physical process and machine learning combined hydrological model for daily streamflow simulations of large watersheds with limited observation data. J. Hydrol.
**2020**, 590, 125206. [Google Scholar] [CrossRef] - Li, B.-J.; Sun, G.-L.; Liu, Y.; Wang, W.-C.; Huang, X.-D. Monthly Runoff Forecasting Using Variational Mode Decomposition Coupled with Gray Wolf Optimizer-Based Long Short-term Memory Neural Networks. Water Resour. Manag.
**2022**, 36, 2095–2115. [Google Scholar] [CrossRef] - Yuan, X.; Wang, J.H.; He, D.M.; Lu, Y.; Sun, J.R.; Li, Y.; Guo, Z.P.; Zhang, K.Y.; Li, F. Influence of cascade reservoir operation in the Upper Mekong River on the general hydrological regime: A combined data-driven modeling approach. J. Environ. Manag.
**2022**, 324, 116339. [Google Scholar] [CrossRef] - Elman, J.L. Finding structure in time. Cogn. Sci.
**1990**, 14, 179–211. [Google Scholar] [CrossRef] - Vaswani, A.; Shazeer, N.; Parmar, N.; Uszkoreit, J.; Jones, L.; Gomez, A.N.; Kaiser, Ł.; Polosukhin, I. Attention is all you need. In Proceedings of the 31st International Conference on Neural Information Processing Systems, Long Beach, CA, USA, 4–9 December 2017; pp. 6000–6010. [Google Scholar] [CrossRef]
- LeCun, Y.; Boser, B.; Denker, J.S.; Henderson, D.; Howard, R.E.; Hubbard, W.; Jackel, L.D. Backpropagation Applied to Handwritten Zip Code Recognition. Neural Comput.
**1989**, 1, 541–551. [Google Scholar] [CrossRef] - Chen, C.; Luan, D.B.; Zhao, S.; Liao, Z.; Zhou, Y.; Jiang, J.G.; Pei, Q.Q. Flood Discharge Prediction Based on Remote-Sensed Spatiotemporal Features Fusion and Graph Attention. Remote Sens.
**2021**, 13, 5023. [Google Scholar] [CrossRef] - Li, W.; Kiaghadi, A.; Dawson, C. Exploring the best sequence LSTM modeling architecture for flood prediction. Neural Comput. Appl.
**2021**, 33, 5571–5580. [Google Scholar] [CrossRef] - Chen, P.-A.; Chang, L.-C.; Chang, F.-J. Reinforced recurrent neural networks for multi-step-ahead flood forecasts. J. Hydrol.
**2013**, 497, 71–79. [Google Scholar] [CrossRef] - Kao, I.F.; Liou, J.-Y.; Lee, M.-H.; Chang, F.-J. Fusing stacked autoencoder and long short-term memory for regional multistep-ahead flood inundation forecasts. J. Hydrol.
**2021**, 598, 126371. [Google Scholar] [CrossRef] - Zou, Y.; Wang, J.; Lei, P.; Li, Y. A novel multi-step ahead forecasting model for flood based on time residual LSTM. J. Hydrol.
**2023**, 620, 129521. [Google Scholar] [CrossRef] - Andréassian, V.; Perrin, C.; Berthet, L.; Le Moine, N.; Lerat, J.; Loumagne, C.; Oudin, L.; Mathevet, T.; Ramos, M.H.; Valéry, A. HESS Opinions “Crash tests for a standardized evaluation of hydrological models”. Hydrol. Earth Syst. Sci.
**2009**, 13, 1757–1764. [Google Scholar] [CrossRef] - Beven, K. Changing ideas in hydrology—The case of physically-based models. J. Hydrol.
**1989**, 105, 157–172. [Google Scholar] [CrossRef] - Holländer, H.M.; Blume, T.; Bormann, H.; Buytaert, W.; Chirico, G.B.; Exbrayat, J.F.; Gustafsson, D.; Hölzel, H.; Kraft, P.; Stamm, C.; et al. Comparative predictions of discharge from an artificial catchment (Chicken Creek) using sparse data. Hydrol. Earth Syst. Sci.
**2009**, 13, 2069–2094. [Google Scholar] [CrossRef] - Perrin, C.; Michel, C.; Andréassian, V. Does a large number of parameters enhance model performance? Comparative assessment of common catchment model structures on 429 catchments. J. Hydrol.
**2001**, 242, 275–301. [Google Scholar] [CrossRef] - Gao, S.; Huang, Y.; Zhang, S.; Han, J.; Wang, G.; Zhang, M.; Lin, Q. Short-term runoff prediction with GRU and LSTM networks without requiring time step optimization during sample generation. J. Hydrol.
**2020**, 589, 125188. [Google Scholar] [CrossRef] - Kang, J.L.; Wang, H.M.; Yuan, F.F.; Wang, Z.Q.; Huang, J.; Qiu, T. Prediction of Precipitation Based on Recurrent Neural Networks in Jingdezhen, Jiangxi Province, China. Atmosphere
**2020**, 11, 246. [Google Scholar] [CrossRef] - Le, X.-H.; Hung Viet, H.; Lee, G.; Jung, S. Application of Long Short-Term Memory (LSTM) Neural Network for Flood Forecasting. Water
**2019**, 11, 1387. [Google Scholar] [CrossRef] - Gholami, H.; Mohammadifar, A.; Golzari, S.; Song, Y.; Pradhan, B. Interpretability of simple RNN and GRU deep learning models used to map land susceptibility to gully erosion. Sci. Total Environ.
**2023**, 904, 166960. [Google Scholar] [CrossRef] [PubMed] - Byeon, W.; Breuel, T.M.; Raue, F.; Liwicki, M. Scene labeling with LSTM recurrent neural networks. In Proceedings of the 2015 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Boston, MA, USA, 7–12 June 2015; pp. 3547–3555. [Google Scholar] [CrossRef]
- Eck, D.; Schmidhuber, J. A First Look at Music Composition Using LSTM Recurrent Neural Networks. 2002. Available online: https://people.idsia.ch/~juergen/blues/IDSIA-07-02.pdf (accessed on 15 March 2002).
- Graves, A. Generating Sequences With Recurrent Neural Networks. arXiv
**2013**, arXiv:1308.0850. [Google Scholar] - Hochreiter, S.; Schmidhuber, J. Long Short-Term Memory. Neural Comput.
**1997**, 9, 1735–1780. [Google Scholar] [CrossRef] - Chen, C.; Jiang, J.G.; Zhou, Y.; Lv, N.; Liang, X.X.; Wan, S.H. An edge intelligence empowered flooding process prediction using Internet of things in smart city. J. Parallel Distrib. Comput.
**2022**, 165, 66–78. [Google Scholar] [CrossRef] - Peng, T.; Zhang, C.; Zhou, J.Z.; Xia, X.; Xue, X.M. Multi-Objective Optimization for Flood Interval Prediction Based on Orthogonal Chaotic NSGA-II and Kernel Extreme Learning Machine. Water Resour. Manag.
**2019**, 33, 4731–4748. [Google Scholar] [CrossRef] - Li, T.; Li, J.B.; Zhang, D.D. Yellow River flooding during the past two millennia from historical documents. Prog. Phys. Geogr. Earth Environ.
**2020**, 44, 661–678. [Google Scholar] [CrossRef] - Sherstinsky, A. Fundamentals of Recurrent Neural Network (RNN) and Long Short-Term Memory (LSTM) network. Phys. D Nonlinear Phenom.
**2020**, 404, 132306. [Google Scholar] [CrossRef] - Jiang, S.J.; Zheng, Y.; Wang, C.; Babovic, V. Uncovering Flooding Mechanisms Across the Contiguous United States Through Interpretive Deep Learning on Representative Catchments. Water Resour. Res.
**2022**, 58, e2021WR030185. [Google Scholar] [CrossRef] - Bahdanau, D.; Cho, K.; Bengio, Y. Neural Machine Translation by Jointly Learning to Align and Translate. arXiv
**2014**, arXiv:1409.0473. [Google Scholar] - Ding, Y.K.; Zhu, Y.L.; Feng, J.; Zhang, P.C.; Cheng, Z.R. Interpretable spatio-temporal attention LSTM model for flood forecasting. Neurocomputing
**2020**, 403, 348–359. [Google Scholar] [CrossRef] - Ahmadlou, M.; Ghajari, Y.E.; Karimi, M. Enhanced classification and regression tree (CART) by genetic algorithm (GA) and grid search (GS) for flood susceptibility mapping and assessment. Geocarto Int.
**2022**, 37, 13638–13657. [Google Scholar] [CrossRef] - Pelikan, M.; Goldberg, D.E.; Cantú-Paz, E. BOA: The Bayesian optimization algorithm. In Proceedings of the 1st Annual Conference on Genetic and Evolutionary Computation, San Francisco, CA, USA, 13–17 July 1999; Volume 1, pp. 525–532. [Google Scholar] [CrossRef]
- Alizadeh, B.; Bafti, A.G.; Kamangir, H.; Zhang, Y.; Wright, D.B.; Franz, K.J. A novel attention-based LSTM cell post-processor coupled with bayesian optimization for streamflow prediction. J. Hydrol.
**2021**, 601, 126526. [Google Scholar] [CrossRef] - Japel, R.C.; Buyel, J.F. Bayesian optimization using multiple directional objective functions allows the rapid inverse fitting of parameters for chromatography simulations. J. Chromatogr. A
**2022**, 1679, 463408. [Google Scholar] [CrossRef] - Abidi, M.A.; Gribok, A.V.; Paik, J. Selection of the Regularization Parameter. In Optimization Techniques in Computer Vision: Ill-Posed Problems and Regularization; Springer: Cham, Switzerland, 2016; pp. 29–50. [Google Scholar] [CrossRef]
- Adil, M.; Ullah, R.; Noor, S.; Gohar, N. Effect of number of neurons and layers in an artificial neural network for generalized concrete mix design. Neural Comput. Appl.
**2022**, 34, 8355–8363. [Google Scholar] [CrossRef] - Iiduka, H. Appropriate Learning Rates of Adaptive Learning Rate Optimization Algorithms for Training Deep Neural Networks. IEEE Trans. Cybern.
**2022**, 52, 13250–13261. [Google Scholar] [CrossRef] - Chadalawada, J.; Babovic, V. Review and comparison of performance indices for automatic model induction. J. Hydroinform.
**2019**, 21, 13–31. [Google Scholar] [CrossRef]

**Figure 5.**Research Process Diagram (in the figure, 31,043 and 4684 represent the length of the flood sequence time obtained from the HuaYuankou station and the LouDe station; 4 and 19 represent the types of model input factors; 31, 028 and 4669 represent the length of the flood sequence used for model training, validation, and testing after removing Time step 15; 1 represents the type of the output target).

**Figure 6.**RNN unit structure. In this figure, h stands for hidden state; x stands for input information; tanh is tangent activation; $t$ and $t-1$ stand for time.

**Figure 7.**LSTM unit structure. In this figure, c represents cell state; “F, I and O”, respectively, represent the forget gate, the input gate, and the output gate; $\oplus $ represents pointwise addition; $\otimes $ represents pointwise multiplication; $\sigma $ represents sigmoid activation.

**Figure 8.**Model Information Flow. In this figure, the unit can be an RNN unit or an LSTM unit. Linear is a linear layer, ${y}_{t}$ is output at time t.

**Figure 9.**MHAM coupled logic structure. In this figure, the unit can be an RNN unit or an LSTM unit.

**Figure 10.**Logical structure of the BOA coupling model. In this figure, the unit can be an RNN unit or an LSTM unit (1 represents the algorithm optimization process, and 2 represents the process where the model makes predictions based on the hyperparameters found by the algorithm.).

**Figure 11.**Gradient propagation process of each batch of data in flood forecasting tasks. The black arrow represents the forward-propagation process; the red arrow represents the backpropagation process.

**Figure 17.**Scatter plot of the model prediction performance at the LouDe station under different lead times (“✳” represents the distribution of data in observed and predicted values).

**Figure 19.**Scatter plot of the model prediction performance at the HuaYuankou station under different lead times (“✳” represents the distribution of data in observed and predicted values).

**Figure 22.**Algorithm optimization model prediction effect of the Loude station during the testing period.

**Figure 23.**Algorithm optimization model prediction effect of the HuaYuankou station during the testing period.

Optimization Objectives | Optimization Scope | Reason for Selection |
---|---|---|

Learning rate | (1 × 10^{−4}, 1 × 10^{−2}) | Control model gradient descent |

Hidden units | (10, 200) | Control model’s nonlinear expression ability |

L2 Regularization | (1 × 10^{−7}, 1 × 10^{−3}) | Avoid overfitting |

Name | Setting | Reason |
---|---|---|

Learning rate | 1 × 10^{−3} | Beneficial for stable gradient descent |

Hidden units | 128 | Sufficient nonlinear expression ability |

L2 Regularization | 1 × 10^{−5} | Avoidable overfitting |

Gradient descent algorithm | Adam | Stable effect |

iterations | 1500 | Meet iteration requirements |

Station | Model | NSE | KGE | MAE | RMSE |

LouDe | RNN | 0.9789 | 0.9591 | 13.1555 | 24.9860 |

LSTM | 0.9621 | 0.9184 | 20.4024 | 33.4670 | |

HuaYuankou | RNN | 0.9994 | 0.9988 | 14.2209 | 29.6959 |

LSTM | 0.9992 | 0.9984 | 17.3051 | 35.2501 |

Lead Time | Station | Model | NSE | KGE | MAE | RMSE |
---|---|---|---|---|---|---|

2 h | LouDe | RNN | 0.9305 | 0.9305 | 23.8539 | 45.3195 |

LSTM | 0.8988 | 0.8887 | 28.6722 | 54.6817 | ||

HuaYuankou | RNN | 0.9985 | 0.9988 | 24.0427 | 47.8815 | |

LSTM | 0.9981 | 0.9976 | 27.3378 | 54.9296 | ||

3 h | LouDe | RNN | 0.9009 | 0.9225 | 29.7196 | 54.1151 |

LSTM | 0.8783 | 0.8907 | 31.6699 | 59.9619 | ||

HuaYuankou | RNN | 0.9971 | 0.9979 | 35.0459 | 67.4454 | |

LSTM | 0.9966 | 0.9957 | 36.9041 | 73.3273 |

Lead Time | Station | NSE | KGE | MAE | RMSE |

2 h | LouDe | 3.53% | 4.70% | 16.80% | 17.12% |

HuaYuankou | 0.04% | 0.12% | 12.05% | 12.83% | |

3 h | LouDe | 2.57% | 3.57% | 6.16% | 9.75% |

HuaYuankou | 0.05% | 0.22% | 5.04% | 8.02% |

Model | Station | Learning Rate | Hidden Units | L2 Regularization |
---|---|---|---|---|

RNN | LouDe | 9.94721325044244 × 10^{−3} | 102 | 1.24128822320419 × 10^{−6} |

HuaYuankou | 6.31430706313691 × 10^{−4} | 169 | 2.29751978936061 × 10^{−5} | |

LSTM | LouDe | 8.60162246721079 × 10^{−3} | 141 | 1.00331686970300 × 10^{−6} |

HuaYuankou | 1.16040150867700 × 10^{−3} | 130 | 5.49314205875754 × 10^{−6} |

Station | Model | NSE | KGE | MAE | RMSE |
---|---|---|---|---|---|

LouDe | BOA-RNN | 0.9819 | 0.9679 | 11.4860 | 23.1318 |

BOA-LSTM | 0.9752 | 0.9607 | 13.4444 | 27.0929 | |

HuaYuankou | BOA-RNN | 0.9994 | 0.9988 | 14.5352 | 30.1463 |

BOA-LSTM | 0.9993 | 0.9985 | 15.6075 | 32.1723 |

Station | Model | NSE | KGE | MAE | RMSE |
---|---|---|---|---|---|

LouDe | BOA-RNN/RNN | 0.31% | 0.92% | 12.69% | 7.42% |

BOA-LSTM/LSTM | 1.36% | 4.61% | 34.10% | 19.05% | |

HuaYuankou | BOA-RNN/RNN | 0.00% | 0.00% | −2.21% | −1.52% |

BOA-LSTM/LSTM | 0.01% | 0.01% | 9.81% | 8.73% |

Station | Model | NSE | KGE | MAE | RMSE |
---|---|---|---|---|---|

LouDe | MHAM-RNN | 0.9758 | 0.9569 | 14.2923 | 26.7232 |

MHAM-LSTM | 0.9556 | 0.9433 | 20.4595 | 36.2084 | |

HuaYuankou | MHAM-RNN | 0.9991 | 0.9979 | 18.6464 | 36.9343 |

MHAM-LSTM | 0.9986 | 0.9960 | 24.0945 | 46.4824 |

Station | Model | NSE | KGE | MAE | RMSE |
---|---|---|---|---|---|

LouDe | MHAM-RNN/RNN | −0.32% | −0.23% | −8.64% | −6.95% |

MHAM-LSTM/LSTM | −0.68% | 2.71% | −0.28% | −8.19% | |

HuaYuankou | MHAM-RNN/RNN | −0.03% | −0.09% | −31.12% | −24.38% |

MHAM-LSTM/LSTM | −0.06% | −0.24% | −39.23% | −31.86% |

Model | RNN | LSTM | BOA-RNN | BOA-LSTM | MHAM-RNN | MHAM-LSTM |
---|---|---|---|---|---|---|

Parameters | 19,201 | 76,417 | 19,201 | 76,417 | 68,737 | 125,953 |

Time Cost(s) | 57.02 | 63.00 | -- | --- | 80.13 | 88.12 |

Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |

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

## Share and Cite

**MDPI and ACS Style**

Wang, Y.; Wang, W.; Zang, H.; Xu, D.
Is the LSTM Model Better than RNN for Flood Forecasting Tasks? A Case Study of HuaYuankou Station and LouDe Station in the Lower Yellow River Basin. *Water* **2023**, *15*, 3928.
https://doi.org/10.3390/w15223928

**AMA Style**

Wang Y, Wang W, Zang H, Xu D.
Is the LSTM Model Better than RNN for Flood Forecasting Tasks? A Case Study of HuaYuankou Station and LouDe Station in the Lower Yellow River Basin. *Water*. 2023; 15(22):3928.
https://doi.org/10.3390/w15223928

**Chicago/Turabian Style**

Wang, Yiyang, Wenchuan Wang, Hongfei Zang, and Dongmei Xu.
2023. "Is the LSTM Model Better than RNN for Flood Forecasting Tasks? A Case Study of HuaYuankou Station and LouDe Station in the Lower Yellow River Basin" *Water* 15, no. 22: 3928.
https://doi.org/10.3390/w15223928