An Acad Bras Cienc. 2026 Aug 24;98(suppl 1):e20250485. doi: 10.1590/0001-3765202620250485. eCollection 2026.
ABSTRACT
Floods are among the most destructive natural disasters, necessitating accurate and timely prediction systems to mitigate their impact. This study evaluates the performance of two machine learning models, – K-Nearest Neighbors (KNN) and Long Short-Term Memory (LSTM) networks – in predicting daily water levels based on hydrological and meteorological data from the Wupper River in Wuppertal, Germany. The KNN model yielded the best accuracy (R2 = 0.97; MAE = 1.65; RMSE = 2.84). Owing to its lazy-learning nature, KNN incurs negligible training cost but requires full dataset storage and high computational effort during inference due to repeated distance evaluations. In contrast, the LSTM model (optimal window t = 1 day) reached R2 = 0.84, MAE = 4.19, and RMSE = 6.84. Unlike KNN, the LSTM forms an explicit parametric model during training – an expensive step – but produces fast predictions once deployed.
PMID:42659525 | DOI:10.1590/0001-3765202620250485