Open-access A machine learning and neural network approach to flood forecasting in the Wupper river

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.

Key words
flood prediction; hydrological forecasting; k-nearest neighbors; long short-term memory; machine learning

Introduction

Context and Motivation

Floods are among the most devastating natural disasters, causing significant socio-economic damage, loss of life, and environmental degradation worldwide. Over the past few decades, the frequency and intensity of flood events have increased, largely due to climate change and anthropogenic activities that alter land use and hydrological patterns (HIRABAYASHI et al. 2013, KUNDZEWICZ et al. 2014). The UNDRR 2015 reports that floods account for roughly 40% of all natural disasters worldwide, affecting millions annually. This underscores the need for accurate, timely forecasting systems.

Traditional hydrological models used for flood forecasting, such as rainfall-runoff and physically based simulations, rely on assumptions about physical processes and parameter estimation, limiting their ability to represent the nonlinear interactions among weather, land surface, and river dynamics (BEVEN 2012, BROWN et al. 2015). Model inaccuracies can lead to substantial uncertainties, hindering emergency response.

Machine Learning (ML) methods provide a data-driven alternative, capable of modeling nonlinear relationships and handling high-dimensional inputs. ML has been successfully applied to rainfall estimation (YADAV & ELIZA 2017), river flow prediction (SOLOMATINE & SHRESTHA 2009), and flood mapping (BENTIVOGLIO et al. 2022). Recent advances in algorithms and the availability of high-resolution data have accelerated their adoption in hydrology (SHEN 2018).

Among the various ML approaches, K-Nearest Neighbors (KNN) and Long-Short Term Memory (LSTM) networks are promising for flood forecasting (GERS et al. 2002). KNN approximates complex functions using neighbouring data points (LIU et al. 2020), while LSTMs, a type of Recurrent Neural Network (RNN), are effective at capturing long-term temporal dependencies (HOCHREITER & SCHMIDHUBER 1997, KRATZERT et al. 2018). Integrating such models with real-time data sources enables adaptive forecasting that can update predictions as conditions change.

The use of ML models in flood forecasting improves prediction accuracy and supports real-time applications. For instance, models can be integrated with sensor networks and satellite observations to provide up-to-date information on potential flood risks (LE et al. 2019, LIU et al. 2020). The integration of LSTM networks with meteorological data has been shown to significantly improve flood forecasts by incorporating real-time rainfall data and hydrological conditions (MOSAVI et al. 2018). In comparison to static traditional models, these data-driven approaches allow for adaptive updates, ensuring that forecasts remain accurate as new information becomes available.

Given the substantial impacts of flooding and the limitations of traditional modeling techniques, the application of ML methods as KNN and LSTM represent a crucial step forward in flood risk management. The potential of these models to better understand and predict flood events offers significant benefits to decision-makers, emergency responders, and at-risk communities.

Machine Learning and Neural Networks

ML and Neural Networks are powerful tools for identifying patterns in complex data and generating accurate predictions. Unlike traditional models that rely on strong assumptions, ML algorithms are data-driven and adaptive, making them well-suited to nonlinear, noisy, and incomplete datasets common in hydrology and environmental sciences (BISHOP & NASRABADI 2006, HASTIE et al. 2009, MURPHY 2012, SOLOMATINE & OSTFELD 2008)

Neural Networks (NN), inspired by biological systems, consist of interconnected layers of nodes capable of modeling nonlinear dynamics. Deep learning, with multiple hidden layers, has advanced predictive analytics through architectures such as Convolutional Neural Networks (CNNs) for spatial data and Recurrent Neural Networks (RNNs), including LSTM networks, for temporal data (GOODFELLOW et al. 2016, LECUN et al. 2015).

The rise of high-resolution environmental data from remote sensing, weather stations, and hydrological monitoring has accelerated the use of ML in flood forecasting. Studies show that methods like KNN and LSTM can effectively improve predictive accuracy and enable real-time applications (KRATZERT et al. 2018, LE et al. 2019, MOSAVI et al. 2018). Together, ML and NN provide a flexible framework that overcomes limitations of traditional hydrological models and enhances forecasting in systems marked by uncertainty and variability.

Thus, the integration of ML and NN offers a robust and flexible framework for understanding and predicting complex environmental systems, overcoming limitations of traditional models and enhancing forecasting capabilities in fields where uncertainty and variability are inherent.

Problem Statement

Accurate flood forecasting remains difficult due to the nonlinear and dynamic nature of hydrological systems influenced by precipitation, soil moisture, topography, land use, and basin characteristics (ALFIERI et al. 2015, CLOKE & PAPPENBERGER 2009). Traditional deterministic or semi-empirical models depend on precise parameterization and assumptions of stationarity, making them less adaptable to environmental changes such as climate impacts or urbanization (BERNDTSSON R et al. 2019).

Data-driven approaches, particularly ML, offer improvements by learning complex relationships directly from historical data. Yet their effectiveness depends on the choice of the algorithm and its ability to generalize across scenarios. Simple methods like linear regression or decision trees may succeed in limited cases but lack flexibility for the wide range of factors driving floods (MOSAVI et al. 2018). Robust ML techniques must therefore capture both nonlinear dynamics and temporal dependencies.

KNN and LSTM networks are promising candidates, but most prior studies evaluate them separately rather than under comparable conditions, and few explore hybrid strategies that could combine their strengths (KRATZERT et al. 2018, MOSAVI et al. 2018). Moreover, uncertainty quantification remains underdeveloped in ML-based flood models, limiting their reliability in real-world applications (LIU et al. 2024).

It is important to recognize that forecasting floods involves modeling complex, partly stochastic processes influenced by both deterministic hydrological dynamics and unpredictable environmental variability (ZHANG et al. 1998). The KNN method, though empirically effective, is constrained by its reliance on distance metrics that assume local smoothness and relevance across high-dimensional spaces. KNN is sensitive to feature scaling, redundant variables, noise in the training data, and lacks any intrinsic temporal modeling capability, which can mislead distance calculations and degrade performance (COVER & HART 1967). While ML methods such as LSTM are effective in capturing temporal dependencies, they can misrepresent stochastic signals. As shown by BARAUNA et al. 2024, LSTM models may converge to generating outputs that reflect auto-correlated replicas of the input signal rather than genuinely forecasting future dynamics − particularly when the underlying structure is weak or dominated by noise. This can result in deceptively high R2 scores without true predictive value. Both models thus require cautious interpretation, and their performance should be evaluated not only by statistical accuracy but also by robustness to the stochastic and nonlinear characteristics of flood-related time series.

Integrating ML models with real-time data sources such as weather radar and sensor networks remains challenging. Current approaches often suffer from latency, data-quality issues, and limited updating mechanisms, restricting their ability to adapt to rapidly changing conditions (SANKARANARAYANAN et al. 2020). Progress requires algorithms that can process continuous streams and update forecasts dynamically.

This study addresses these gaps by evaluating KNN and LSTM models for flood forecasting, comparing predictive accuracy, computational efficiency, and adaptability using hydrological and meteorological data from the Wupper River basin. While hybrid approaches and uncertainty quantification are promising directions, they are beyond the current scope and remain topics for future work. Our unified comparison highlights the relative strengths and weaknesses of KNN and LSTM, offering guidance for ML-based flood forecasting systems

Research Objectives

The primary objective of this study is to evaluate the effectiveness of ML methods in improving the accuracy and reliability of flood forecasting in the Wupper River. Specifically, this research aims to:

  1. Compare the predictive performance of KNN and LSTM networks for flood forecasting, focusing on their ability to handle the nonlinearities and temporal dependencies in hydrological data.

  2. Examine the computational efficiency of each method, assessing their suitability for real-time flood forecasting applications.

By addressing these specific objectives, the study seeks to contribute to the development of more robust and adaptable ML-based flood forecasting systems, with practical implications for risk management and disaster response.

Methodology

Data Description

The dataset used in this study consists of time-series measurements from both river and weather stations located along the Wupper River in Wuppertal, Germany. The data was made available during Deloitte’s Quantum Climate Challenge 20241. The data spans a considerable period, with river station measurements ranging from October 31, 1999, to February 22, 2024, and weather station measurements covering the period from January 1, 1990, to December 31, 2023. The merged dataset, hereafter referred to as the master dataframe, combines river station data with the nearest weather station data, ensuring a comprehensive representation of hydrological and meteorological conditions in the region.

River Station Data

The river station data includes measurements from five stations along the Wupper River: Kluserbrücke, Krebsöge, Stausee Beyenburg Ablaufpegel, Leimbach, and Laaken.

The variables collected at these stations consist of the following:

  • Date (MESS_DATUM): The date and time when the measurement was performed.

  • Discharge (DISCHARGE): The volumetric discharge, measured in cubic meters per second (m3/s), representing the flow rate of the river.

  • Water Level (WATER-LEVEL): The height of the water surface, measured in centimeters (cm), recorded during the measurement.

  • Station (STATION): The name of the river station where the measurement was conducted.

  • Latitude (LAT) and Longitude (LON): The geographical coordinates of each river station.

The number of daily measurements at these stations varied considerably, ranging from 2 to 25 observations per day, with measurement intervals spanning from 15 minutes to 1 hour. To standardize the dataset for modeling purposes, the daily measurements were aggregated by selecting the maximum water level recorded each day. This approach ensured consistency with the daily measurement frequency of the weather station data and allowed for a more streamlined integration of datasets.

Weather Station Data

The weather station data was obtained from the Deutscher Wetterdienst (DWD, German Weather Service), providing precipitation measurements from three weather stations located throughout the region: Solingen-Hohenscheid, Wermelskirchen, and Wuppertal-Buchenhofen.

For each station, the following variables were recorded:

  • Station (STATION_ID): The identifier for the weather station where the data was collected.

  • Date (MESS_DATUM): The date corresponding to the measurement.

  • Accumulated Precipitation (RS): The total daily precipitation measured in millimeters (mm).

  • Precipitation Forecasts (RS1, RS2, RS3, RS7, RS14): Forecasted precipitation values for 1, 2, 3, 7, and 14 days ahead, respectively.

  • Precipitation Form (RSF): A categorical variable indicating the form of precipitation. The possible values are: 0: no precipitation, 4: unknown form of precipitation, 6: only rain, 7: only snow, 8: rain and snow, and 9: missing value or unidentifiable form.

The weather station data was recorded once per day at regular intervals, ensuring consistency in the time series for each station.

Data Integration and Preprocessing

The integration of river and weather station data was performed by merging the river station data with the nearest weather station based on geographical proximity. The Kluserbrücke river station and Wuppertal-Buchenhofen weather station were selected for the initial analysis, as Kluserbrücke is centrally located within Wuppertal, providing a representative dataset for the region’s hydrological conditions.

The preprocessing steps included several key operations:

  1. Daily Aggregation: The river station data was aggregated to daily statistics by computing, for each day, the maximum, mean, and minimum values for the Water Level and Discharge variables. This approach preserved more information on intra-day variability than using only the maximum, while ensuring consistency with the daily frequency of the weather station data.

  2. Handling Missing and Invalid Data: All measurements with negative values or invalid entries (NaNs) for the Water Level and Discharge variables were removed, as negative water levels and discharges are not physically meaningful.

  3. Chronological Sorting: The master dataframe was sorted chronologically, ensuring that all observations were ordered from the oldest to the most recent before further analysis.

Flood-stage Categorization

To contextualize the predicted water levels, we adopted the operational flood-stage thresholds used at the Kluserbrücke gauge: 125 cm for a flood warning (≊50 m3 s−1) and 253 cm for a flood alarm (≊130 m3 s−1). These pairs correspond to reference points on the local stage–discharge curve and are used operationally, but they do not imply that water level can be uniquely inferred from discharge.

In this work, we adopt a slightly more conservative warning criterion in order to increase the number of records in the intermediate-risk regime and to better characterize potential high-flow episodes. The daily maximum water level is thus mapped to a discrete variable FLOOD_STAGE with three classes:

  • 0: no flood, if WATER-LEVEL<90cm;

  • 1: warning regime, if 90cm≤WATER-LEVEL<253cm;

  • 2: alarm regime, if WATER-LEVEL≥253cm.

The FLOOD_STAGE label is used in this paper solely for descriptive purposes (for instance, to quantify how often different flood regimes occur in the dataset and to interpret regression predictions with respect to warning and alarm thresholds). All predictive models considered here are formulated as a regression on the continuous daily maximum water level, rather than as a classification task.

Additional Aggregations

To explore the impact of different temporal resolutions on model performance, two additional dataframes were generated:

  • Weekly Averages: Aggregated by calculating the average values of the variables over weekly intervals.

  • Monthly Averages: Aggregated by calculating the average values over monthly intervals.

These additional datasets enabled the investigation of flood forecasting at varying temporal scales, offering insights into model behavior under different data granularities.

Time Series Visualization

Figure 1 summarizes Water-Level and Discharge data at daily, weekly, and monthly resolutions, showing how aggregation progressively smooths short-term variability. Complementing this, Figure S1 presents their empirical distributions. Both variables are strongly right-skewed, with most observations at low values and a long upper tail representing infrequent high-flow conditions.

Figure 1
Time series of Water-Level and Discharge measurements from river stations along the Wupper River. The top panel displays daily measurements, the middle panel shows weekly averages, and the bottom panel presents monthly averages. The shaded orange region indicates the flood warning threshold, highlighting periods where water levels exceeded critical values across different temporal aggregations.

Experimental Setup

Although a flood-stage label is available (Flood-stage Categorization), preliminary experiments showed that formulating the problem as a classification task suffers from severe class imbalance, with the majority of days falling in the no-flood regime. As a consequence, classifiers tend to predict the dominant class almost exclusively, providing little useful information about actual flood-risk episodes. For this reason, in the present work, we focus on a regression formulation, where the target variable is the continuous daily maximum water level.

The KNN algorithm is a widely used method in ML, known for its simplicity and effectiveness in regression tasks. Originating from the field of pattern recognition, KNN operates on a straightforward principle: to predict the class or value of a data point, it considers the k nearest data points (neighbors) in the feature space (COVER & HART 1967). Despite its conceptual simplicity, KNN is a powerful non-parametric technique capable of capturing complex relationships in the data without assuming an underlying distribution (HASTIE et al. 2009). More details on the mathematical foundations of KNN can be found in HALDER et al. 2024.

In hydrological modeling, KNN has been applied for regression tasks. For instance, KNN classification can be used to categorize flood risks, while KNN regression has shown promise in predicting continuous variables such as streamflow and water level, as explored in SOLOMATINE & OSTFELD 2008.

Data Partitioning: Training and Testing Sets

The first step in constructing the KNN regression model was to partition the dataset into training and testing sets. The training set encompassed daily measurements from January 1, 1990, to December 31, 2022, while the testing set was comprised of data from the year 2023, spanning January 1, 2023, to December 31, 2023. The final training set contains 11697 daily samples, while the test set contains 365 samples. Only days with valid river and weather measurements for all selected features were retained.

The features used in the regression model were selected from the data presented in Data Description: DISCHARGE_MAX, DISCHARGE_MEAN, DISCHARGE_MIN, RS, and RSF. The target variable, WATER-LEVEL, represented the maximum daily water level recorded at the river station. Accurate prediction of WATER-LEVEL is crucial for flood inference since specific thresholds of this variable dictate the occurrence of flood warnings and alarms.

Using the flood-stage indicator defined in Flood-stage Categorization, we note that the dataset contains only 17 days in the warning regime (FLOOD_STAGE =1), all within the training period, and no warning or alarm events in the 2023 test period. Therefore, the metrics reported in Results evaluate the models predominantly under non-extreme hydrological conditions. The present study focuses on continuous water-level regression, and the assessment of model behavior during rare high-water events requires alternative temporal splits or resampling strategies, which we identify as an important direction for future work.

Model Evaluation Metrics

Evaluating the accuracy and reliability of predictive models is crucial, particularly in environmental modeling and flood forecasting, where decisions are based on the model’s outputs. In this study, three fundamental performance metrics - Mean Absolute Error (MAE), Root Mean Squared Error (RMSE), Coefficient of Determination (R2), and Nash–Sutcliffe Efficiency (NSE) − are used to assess the regression models’ ability to predict water levels accurately. These metrics provide insights into the model’s overall performance, error distribution, and explanatory power (WILLMOTT & MATSUURA 2005). A brief description of these metrics follows:

  1. MAE: measures the average absolute difference between predicted values and actual observed values. A lower MAE indicates better predictive performance. The formula for MAE is

    MAE=1n∑i=1n|ŷi−yi| ,(1)
    where ŷi and yi denotes the predicted and actual observed values for the ith observation, respectively, and n is the number of predictions.

  2. RMSE: penalizes larger errors more heavily due to the squaring of individual differences before averaging. It is particularly sensitive to outliers, making it suitable for applications where larger errors are more critical. Mathematically, is calculated as

    RMSE=1n∑i=1n(ŷi−yi)2=MSE .(2)

  3. Coefficient of Determination: measures the proportion of variance in the observed data that is predictable from the features. An R2 value close to 1 indicates that the model explains most of the variability in the data, while an R2 value near 0 indicates little explanatory power. It is calculated as

    R2=1−∑i=1n(ŷi−yi)2∑i=1n(yi−y¯)2 ,(3)
    where y¯ is the mean of the observed values. The numerator represents the Residual Sum of Squares, and the denominator represents the Total Sum of Squares.

  4. NSE: evaluates the predictive skill of a model by comparing the magnitude of residual variance to the variance of the observed data. An NSE value of 1 indicates a perfect match between predictions and observations, while a value of 0 means the model is only as accurate as using the mean of the observed data. Negative values indicate that the model predictions are less accurate than the mean of the observations. It is calculated as

    NSE=1−∑i=1n(yi−ŷi)2∑i=1n(yi−y¯)2 .(4)

In hydrological and environmental modeling, performance metrics are essential to assess the reliability of flood forecasts and other predictions. In this study, the combination of MAE, RMSE, and R2 ensures a thorough analysis of the regression models’ effectiveness in predicting water levels, facilitating comparisons between KNN, LSTM, and other approaches.

Implementation of KNN for Regression

The primary objective of the regression model was to forecast the daily peak Water-Level (WATER-LEVEL) of the Wupper River, based on a set of hydrological and meteorological features, in order to infer potential flooding events. The prediction of this continuous target variable would allow the detection of critical thresholds associated with flood warnings. Below, the methodology followed for the KNN regression model is described in detail:

To ensure that the features were on a comparable scale, normalization was applied to the training data. This step is especially important for KNN models, as they are sensitive to the scale of input variables; features with larger numerical ranges can dominate the distance calculations, potentially biasing the prediction. Normalization was achieved by removing the mean and scaling the features to unit variance. The following transformation was applied

X′=X−μσ ,(5)
where X is the original feature matrix, μ is the mean of each feature in the training set, and σ is the standard deviation of each feature in the training set. The same transformation parameters (μ and σ) calculated from the training set were subsequently applied to the test set to maintain consistency.

For the KNN regression model, the parameter k, representing the number of nearest neighbors, was initially set to 5. This choice was guided by preliminary testing to balance model complexity and accuracy, considering the trade-off between bias and variance. The KNN algorithm calculates the prediction by averaging the target variable values of the 5 closest training instances (neighbors) in the feature space. The “closeness" was computed using the Euclidean distance d(𝒙i,𝒙j). The prediction value ŷ for a query point 𝒙q is

ŷregression=1k∑i∈𝒩kyi ,(6)
where yi is the target value of the ith nearest neighbor, and k is the number of nearest neighbors considered. The performance of the KNN regression model was evaluated using the metrics described in Model Evaluation Metrics.

To assess the potential for overfitting, the model was evaluated using cross-validation. A 5-fold cross-validation technique was employed, where the training data was split into 5 subsets. In each iteration, four subsets were used for training, and one subset was used for validation. The process was repeated five times, ensuring that each subset served as a validation set once.

Additionally, learning curves were plotted to examine the relationship between training set size and prediction error. These curves provide insight into the model’s behavior as it learns from varying amounts of data, enabling the identification of potential overfitting (where the model performs well on training data but poorly on unseen data) or underfitting (where the model fails to capture the data’s complexity). An optimal value of k was suggested based on the highest cross-validation score. This value of k balances the trade-off between bias (underfitting) and variance (overfitting), leading to a more reliable predictive model for unseen data. The optimal value obtained was kopt=17.

The Permutation Feature Importance (PFI) test is a model-agnostic method used to evaluate the relative importance of features in predictive models. This technique, introduced by BREIMAN 2001 in the context of random forests but applicable to any model, assesses the importance of each feature by measuring the impact of randomly permuting its values, and when the model’s performance permutation of a feature results in a significant drop in performance, it suggests that the feature has a substantial impact on predictions. Conversely, a negligible performance change implies that the feature has limited influence on the model (ALTMANN et al. n.d.). The PFI works by disrupting the relationship between a specific feature and the target variable, and then observing the effect on model performance. As emphasized in MOLNAR 2020, if a feature is crucial for accurate predictions, randomizing its values will impair the model’s performance considerably. This technique is especially valuable for understanding “black-box“ models, where feature importance is not easily interpretable. The steps in PFI are:

  1. Baseline Performance: First, the model’s performance is evaluated on a dataset without any modifications, producing a baseline metric (e.g., accuracy, RMSE).

  2. Feature Permutation: For each feature individually, its values are shuffled (permuted) across samples, effectively breaking any relationship with the target variable.

  3. Re-evaluate Model Performance: The model’s performance is measured again on the dataset with the permuted feature.

  4. Calculate Importance Score: The difference between the baseline performance and the performance with the permuted feature is computed. This difference quantifies the importance of the feature; the greater the decrease in performance, the more significant the feature is.

In this work, we apply PFI testing exclusively to the KNN regression model to assess the relevance of each input feature in predicting daily water levels. Since KNN models base their predictions on the nearest neighbors in the feature space, it is crucial to understand which variables most significantly influence the model output. Identifying feature importance not only improves the interpretability of the model but also guides future improvements by highlighting the most critical variables for flood prediction

The PFI test was applied to the trained KNN regression model using the training data set. For each feature, the analysis calculated an average importance score over multiple shuffles to ensure stability and mitigate the influence of random noise. In this work, we used 50 shuffles.

The Figure S2 illustrates the KNN regression workflow. It starts with the Input Data, comprising features like Discharge, RS, and RSF, alongside the target variable, Water-Level. Step 1 involves the preprocessing phase, where the dataset is split into training and testing sets, and feature normalization is applied to ensure consistent scaling across all variables in step 2. In step 3, cross-validation and learning curves are plotted to monitor for overfitting. Steps 4 and 5 are the training and prediction phase, respectively, where the number of neighbors was optimized via 5-fold cross-validation over the range k∈[1,20], utilizing the Euclidean distance metric to determine the nearest neighbors and generate forecasts for the Water-Level, based on the average values of the closest data points. The optimal value was kopt=17, which was then used for all subsequent KNN regression experiments. The model’s accuracy and generalizability are assessed using the metrics MAE, RMSE/MSE, R2/NSE. Following this, step 6 involves Feature Importance Analysis using a permutation-based test, which measures the influence of each feature on the model’s output by examining changes in prediction accuracy when individual features are shuffled. Finally, step 7 presents prediction visualization, comparing the model’s predicted values against the actual values over time to validate its accuracy visually.

Implementation for LSTM Regression

LSTM networks are a specialized type of RNN designed to handle sequential data and time-series forecasting. Unlike traditional RNNs, which struggle with learning long-term dependencies due to the vanishing gradient problem, LSTM networks incorporate a more sophisticated internal architecture, allowing them to retain information over longer sequences. This makes LSTMs particularly effective for capturing temporal patterns in hydrological and meteorological data, where dependencies often span multiple time steps (HOCHREITER & SCHMIDHUBER 1997).

LSTM networks have proven highly effective in hydrology for tasks such as streamflow forecasting, rainfall prediction, and flood risk assessment. Unlike traditional statistical models, LSTMs can handle nonlinearities and long-term dependencies in hydrological time-series data, making them suitable for flood prediction and other complex forecasting tasks (KRATZERT et al. 2019). Their ability to learn directly from raw data reduces the need for manual feature engineering, allowing them to adapt to various conditions without relying on predetermined assumptions.

To predict daily water levels using an LSTM neural network, a systematic approach was adopted, incorporating data preparation, model architecture design, and training processes. The LSTM model was constructed to capture temporal dependencies within the input features − Discharge, RS, and RSF − and predict the target variable, WATER-LEVEL. The methodology is outlined in detail below. More details on the mathematical foundations of LSTM networks can be found in SHERSTINSKY 2020.

The data was split into training and testing sets based on time. The training set comprised records from January 1, 1990, to December 31, 2022, while the test set contained data for the year 2023 (from January 1 to December 31).

Feature scaling was essential for ensuring that all variables were on comparable scales, which helps the LSTM model converge more effectively during training. Min-Max Scaling was applied to normalize the range of the features and the target variable between 0 and 1

X′=X−Xmin.Xmax.−Xmin. ,(7)
where X′ represents the scaled value, X is the original value, and Xmin. and Xmax. are the minimum and maximum values of each feature across the training data, respectively. The scaled data was then converted to sequences for input to the LSTM model.

For the LSTM model, both features and the target variable were scaled to the [0,1] range using Min–Max normalization before sequence generation. All predictions were subsequently inverse-transformed to the original units of water level prior to metric computation.

We note that different scaling transformations were applied for the two models. For the KNN regression, z-score standardization was used because KNN relies on Euclidean distances, which are highly sensitive to differences in feature scale. Standardization ensures that each variable contributes proportionally to the distance metric.

For the LSTM model, min–max scaling to the interval [0,1] was adopted, which is standard practice in neural-network training, as it improves numerical stability and prevents internal activations (particularly in tanh and sigmoid gates) from saturating. In preliminary tests, this scaling resulted in more stable training dynamics than z-score normalization.

Therefore, the use of different scalings is deliberate and reflects the distinct numerical properties of distance-based methods and recurrent neural architectures.

To generate the input sequences for the LSTM model, we constructed sliding windows of length t, where t was varied across the set {1,7,15,30,45,60}. For each value of t, the model receives the previous t days of observations as input and predicts the water level for the following day. This approach allows the network to capture temporal dependencies at different scales, ranging from short-term dynamics (t=1) to multi-week seasonal structure (t=60).

The transformation from raw data to sequences can be expressed as follows

Input Sequence : Xt=[Xt−30,…,Xt−1] ,Target Value : yt=Xt ,(8)
where Xt denotes the target variable at time t.

This sequential input structure enables the LSTM to learn dependencies over the defined time window, effectively capturing temporal patterns that influence water levels. In addition, several time steps were utilized to generate the sequences. The time step values used were t=[1,7,15,30,45,60], ranging from 1 day to 2 months in length. The analysis was performed for each of the sequences generated from these time steps. This approach was adopted to capture events with different seasonalities and improve the model’s ability to learn from diverse temporal patterns.

The architecture of the LSTM network was designed with two stacked LSTM layers, followed by dense (fully connected) layers, to provide both temporal learning and generalization. The primary components of the model are described as follows

  1. First LSTM Layer: The initial layer consisted of 50 units, with a return sequence parameter set to true, which allows the full sequence of outputs to be passed to the next LSTM layer.

  2. Dropout Layers: After each LSTM layer, a dropout layer with a dropout rate of 0.2 was added to reduce overfitting by randomly setting 20% of the connections to zero during training. This prevents the network from becoming overly reliant on specific nodes, enhancing its generalizability.

  3. Second LSTM Layer: A second LSTM layer with 50 units was added, with the return sequence parameter set to false, indicating that only the last output in the sequence would be passed to the following dense layers. This reduces the dimensionality of the output while retaining the learned temporal features.

  4. Dense Layers: Following the LSTM layers, two dense (fully connected) layers were included:

    • The first dense layer with 25 units enables the network to transform the sequence of learned features into a more refined representation.

    • The final dense layer with a single unit produces the model’s output, representing the predicted water level.

Both dense layers use linear activations, which are appropriate for regression tasks where the network is expected to output a continuous, unbounded value.

The model was compiled using the Adam optimizer (KINGMA & BA 2015), known for its adaptive learning rate capabilities, making it well-suited for time-series data. The MSE loss function was used to minimize the discrepancy between predicted and observed values, given by the MSE term in Equation (2).

Loss functions are used to quantify the discrepancy between the predicted and observed water levels, guiding the optimization process during model training. In this study, the MSE is employed as the primary loss function for the LSTM regression model, as it penalizes larger errors more significantly, making it suitable for capturing sudden spikes in water levels. The model iteratively minimizes this loss during training, enabling it to learn from the data and improve prediction accuracy. By leveraging MSE, the model becomes more sensitive to significant deviations, which is particularly important in flood forecasting, where extreme water level variations need to be accurately captured.

Here, the Adam optimizer is used during the training of the LSTM regression model to minimize the MSE loss function. Adam is chosen due to its ability to adaptively adjust the learning rate based on both the mean and variance of the gradients, which accelerates convergence and stabilizes the training process. This is particularly important for the LSTM model, as the training involves optimizing a large number of parameters over sequential data, where gradient updates can vary significantly. By using Adam, the model achieves faster and more reliable convergence, ensuring that it learns complex temporal patterns efficiently without getting stuck in local minima.

The model was trained over 100 epochs with a batch size of 32, meaning the model updates were made after every 32 samples. Additionally, validation data from the test set was used to monitor the model’s performance during training. The 2023 data set was used as the validation set. This validation helps ensure that the model does not overfit the training data by providing early indications of when learning might start diverging.

The LSTM models were trained for a fixed number of epochs without checkpointing. Because the validation set corresponds to the 2023 data, early stopping was not applied to avoid data leakage into model selection. We ensured instead that all performance metrics were computed exclusively on the test sample.

This setup allowed the model to adapt to temporal dependencies in the data while also generalizing well to unseen instances in the test set, improving the LSTM’s capability for reliable water level prediction in flood forecasting applications.

Results

KNN Regression Model

Figure S3 presents the learning curves for the KNN regression model, with training and cross-validation scores plotted as a function of the number of neighbors k. The blue line represents the training score, while the red line represents the cross-validation score.

The training score starts near 1.0 for low values of k, indicating that the model fits the training data closely, which can suggest overfitting. As k increases, the training score gradually decreases, showing a looser fit to the training data. This behavior aligns with expectations, as a smaller k allows the model to be more sensitive to individual data points, while a larger k smoothens the predictions by averaging over more neighbors.

Although the cross-validation curve stabilizes for k≳10, the highest 5-fold CV score within the search range k∈[1,20] occurred at k=17 (see Figure S3). Because performance varied only mildly across the plateau region, we adopt the numerically optimal value returned by cross-validation rather than selecting an arbitrary point on the plateau.

The Figure 4 shows two graphs that collectively illustrate the performance of the KNN regression model. The Figure 2 compares the predicted and actual values, with each point representing a single prediction. The red dashed line, representing the ideal y=x dashed line, would imply perfect prediction accuracy if all points lay directly on it. The data points closely follow this ideal line, especially at lower and moderate values, which indicates strong alignment between the predicted and actual values. Some minor deviations are visible at higher values, suggesting that the model slightly underperforms in these regions, which aligns with the slightly elevated RMSE.

The Figure 3 shows the three main evaluation metrics: MAE, RMSE, and the R2 score. The MAE and RMSE, at 1.65 and 2.84 respectively, indicate the magnitude of average and squared prediction errors, respectively. The RMSE being higher than the MAE suggests that larger errors are present in some predictions, which the RMSE metric emphasizes more due to the squared error calculation. The R2=0.97 score indicates that the model explains 97% of the variance in the target variable, signifying a high degree of predictive accuracy.

Together, these visualizations demonstrate that the KNN model achieves a high level of predictive accuracy, with minimal error and a strong correlation between predicted and actual values, though some outliers contribute to larger errors in a few cases.

Figure 2
Prediction accuracy and performance metrics of the KNN regression model.
Figure 3
KNN model predictions and actual water level data for the year 2023.
Figure 4
Feature relevance and correlation structure for the KNN regression model.

The Figure 5 presents a comparison between the actual water level data (black circles) and the predicted values generated by the KNN model (red line) over the course of 2023. In general, the model closely follows the trend of the actual data, capturing seasonal fluctuations and sudden peaks in water levels throughout the year. This alignment suggests that the KNN model effectively learns and predicts the temporal patterns in water levels, particularly in periods of stability or gradual change. However, some discrepancies are noticeable during rapid spikes, especially where extreme water levels occur. In these instances, the model occasionally underestimates or overshoots the peaks, indicating potential challenges in predicting abrupt changes with high accuracy. Nonetheless, the model’s performance remains robust for general trend-following and lower-to-moderate variability, highlighting its potential reliability for predictive tasks involving water levels.

Figure 5
Time series comparison of actual and predicted water levels for the test set using the LSTM model for t = 1 day.

As shown in Figure 5, the model underestimates the highest water-level peaks. This is expected for a distance-based regressor, which produces local averages and tends to compress rare extremes toward the mean (see Figure S1). The effect is amplified by the right-skewed hydrological distribution and by the fact that the 2023 test set contains no warning- or alarm-level events (see Section Flood-stage Categorization). Consequently, the present evaluation reflects non-extreme conditions; assessing flood-stage performance requires an event-rich split, which we leave for future work.

The results of the permutation test in Figure 4a) clearly indicate that among the expanded set of characteristics, DISCHARGE_MAX is by far the most significant predictor in the model, with an importance score substantially higher than all other variables. DISCHARGE_MEAN and, to a lesser extent, DISCHARGE_MIN also contribute to the model’s predictive capability, but with considerably lower importance. In contrast, the meteorological features RS and RSF exhibit near-zero importance values, indicating minimal or no influence on the prediction outcomes. These results suggest that the model relies predominantly on discharge − related statistics and especially the maximum daily discharge − to generate accurate forecasts, while RS and RSF could potentially be excluded without adversely affecting performance. This insight can guide future refinements by prioritizing the quality and resolution of discharge measurements, particularly those capturing extreme events, and evaluating whether the inclusion of less relevant features is necessary.

To support the permutation-importance results, we computed the Pearson correlation matrix (see Figure 4b)). Water-Level and Discharge show extremely high correlation (ρ=0.96), consistent with discharge being the dominant hydrological driver at this gauge. In contrast, RS and RSF exhibit weak correlation with both variables (|ρ|<0.17) but are strongly correlated with each other (ρ=0.93) due to the smoothing embedded in the rolling precipitation feature.

These correlations align with the permutation-importance analysis: Discharge overwhelmingly dominates predictive skill, while RS and RSF contribute minimally. Their low importance is not due to multicollinearity with Discharge but reflects genuinely limited explanatory power for day-to-day water-level variability. Together, the PFI and correlation structure consistently indicate that Discharge is the primary determinant of daily water levels.

Although permutation importance and correlation analysis show that RS and RSF contribute little to daily water-level prediction, we retain them for completeness. Standardization ensures that uninformative variables do not harm KNN performance, and the low dimensionality makes their inclusion computationally irrelevant. Moreover, RS and RSF remain physically meaningful predictors for rainfall-driven flood events, which are absent from the 2023 test period.

The computational efficiency of the KNN regression model was also evaluated, and the time required to train and execute the model, and perform the feature importance test was measured as 44.377 seconds. This relatively short duration highlights the simplicity and computational efficiency of the KNN algorithm, as it does not involve iterative optimization or complex architectures such as neural networks. Despite the fast execution, it is important to consider that the computational cost during prediction can increase significantly for larger datasets, as the KNN model requires the calculation of distances between the query point and all training samples. This characteristic makes KNN suitable for small to moderate datasets, but potentially impractical for real-time applications with large amounts of data.

LSTM Regression Model

The LSTM regression model was evaluated using different time steps for sequence generation: t=[1,7,15,30,45,60] days. For each time step, the analysis generated four key graphs to assess the model’s performance: (1) Training and Validation Loss over epochs, (2) Predicted vs. Actual values, (3) Evaluation Metrics (MAE, RMSE and R2), and (4) Predicted and Actual time series for the test set. For illustrative purposes, we present the results for the model with the highest R2=0.843, corresponding to t=1 day. The performance metrics for all models and the time duration of each model are provided in Table 1. The “duration“ entry refers exclusively to the training time required for each model configuration. We clarified this in the text and removed redundant explanations about training cost.

Table I
Performance metrics for each LSTM regression model.

Figure S4 displays the training and validation loss as a function of epochs for the t=1-day model. The training loss decreases steadily, indicating effective learning during the optimization process. The validation loss follows a similar decreasing trend, though with some fluctuations, reflecting the stochastic nature of the data. The low final loss values suggest good model performance and generalization capability, with minimal overfitting observed.

Figure S5 shows the scatter plot of predicted versus actual water levels. The points are concentrated near the y=x diagonal line, demonstrating a strong correlation between predictions and ground truth values. While smaller water level predictions are highly accurate, larger water levels exhibit slightly greater dispersion, indicating higher prediction errors in extreme cases. This behavior could be attributed to the dataset’s imbalance, as fewer high-water level samples were available during training.

Figure S5 summarizes the model’s evaluation metrics for t=1-day: MAE=4.19, RMSE=6.84, and R2=0.84. These values indicate robust predictive performance, with a high proportion of variance in the target variable explained by the model. The moderate RMSE compared to MAE highlights the model’s sensitivity to larger errors, emphasizing the importance of minimizing these in future refinements.

Finally, Figure 5 illustrates the time series comparison of predicted and actual water levels for the test set. The model successfully captures the general trends, including seasonal variations and peaks, though discrepancies arise during extreme water levels. This result suggests that while the model excels at general forecasting, further improvements are required for predicting abrupt or extreme events.

The overall results demonstrate that the LSTM regression model, particularly with a time step of t=1 day, performs well in capturing temporal dependencies and forecasting water levels. The 15-day model achieved slightly lower MAE and RMSE than the 1-day model but with nearly identical R2. Because the 15-day model required ∼4× longer training and offered no clear advantage in generalization, we selected the 1-day model as the most balanced configuration.

Discussion

The results obtained from the KNN and LSTM regression models demonstrate the strengths and limitations of each method in the context of flood prediction. A comparative analysis of the models is presented below to address the key questions of this study.

LSTM Models Analysis

The best-performing LSTM model,

with t=1 day (Table 1), achieved an R2 value of 0.84, along with an MAE of 4.19 and an RMSE of 6.84, while requiring 113.27 seconds to complete. This configuration provided the most balanced trade-off between predictive accuracy and computational efficiency, capturing sufficient temporal dependencies without incurring the longer runtimes associated with larger time steps.

Although the t=15 days model achieved slightly lower MAE and RMSE values, its R2 score was marginally lower (0.84) and it required over 411 seconds to process, making it less advantageous for real-time or resource-constrained applications (Table 1). As shown in Table 1, models with longer time steps (t=30 to t=60) capture more extended temporal dependencies but showed diminishing returns in accuracy and substantially higher computational costs (up to 1358.83 seconds for t=60). Conversely, while shorter time steps like t=1 day offer faster computation, they still maintain strong accuracy, outperforming several intermediate configurations in key metrics.

Overall, the results suggest that for the present dataset and feature set, the t=1 day configuration offers the most practical and robust choice for flood forecasting, balancing high predictive skill with operational feasibility.

Model Comparison and Performance Evaluation

The KNN regression model achieved superior accuracy, as reflected by its R2 value of 0.97, compared to the LSTM regression model’s best R2=0.84 (achieved with a time step of t=1 day). Similarly, the KNN model’s MAE (=1.65) and RMSE (=2.84) values were significantly lower than those of the best LSTM model (MAE=4.19, RMSE=6.84). These results suggest that the KNN model excels in predictive accuracy for this particular dataset.

Mathematically, KNN’s simplicity and reliance on local proximity in the feature space make it highly effective for capturing the relationships in this dataset, particularly due to the relatively stable and structured nature of the hydrological data. In contrast, the LSTM model’s performance, though robust, is influenced by its inherent complexity and sensitivity to sequence generation parameters, such as the time step t.

To contextualize our results with existing literature, Table 2 presents a comparative summary of ML-based flood forecasting studies, including datasets, model types, and predictive performance. Our results are consistent with the findings of MOSAVI et al. 2018, LIU et al. 2020, and KRATZERT et al. 2018, but show improved accuracy on the Wupper dataset, particularly with the KNN model.

In this study, NSE and R2 are identical because both use the same formula: one minus the ratio of residual to total sum of squares, with the mean of observed values as baseline. Since metrics are computed after restoring data to its original scale, the baseline is the same, making the values numerically equal. This equivalence holds for any affine scaling of the target variable and only diverges if different baselines, transformations, or no-intercept definitions are applied.

Table II
Comparison of the results obtained in this work with other works in the literature. The values presented are the best values obtained for the metrics analyzed. The NSE is the Nash-Sutcliffe efficiency.

Computational Cost

The present dataset spans 25 years of daily observations, but real hydrological systems often involve multi-station networks, hourly measurements, or high-resolution rainfall products, all of which increase the dimensionality and the number of stored samples. In such settings, KNN’s inference cost can become a bottleneck, since each prediction requires distance computations against the full stored dataset. This contrasts with the LSTM, whose inference cost remains constant after training regardless of dataset size.

A key trade-off between the models lies in computational cost. The KNN regression model, while computationally inexpensive during training (44.377 seconds), becomes resource-intensive during prediction due to the need to calculate distances between the query point and all training samples. This characteristic makes KNN efficient for small to moderate-sized datasets but potentially impractical for real-time applications or larger datasets where fast predictions are crucial.

In contrast, the LSTM model requires significant computational resources during training due to its iterative optimization process and complex network architecture. The training time increases considerably with longer time steps, as shown in Table 1, ranging from 113.271 seconds (t=1 day) to 1358.826 seconds (t=60 days). While the best-performing LSTM model (t=1 days) required 113.271 seconds to complete training, it maintained strong predictive performance while offering the fastest training time among the tested configurations. Once trained, the LSTM model is computationally efficient during prediction, making it more suitable for real-time forecasting when the model is already deployed.

In operational settings, model efficiency must be evaluated across both training and deployment phases. Although training is typically performed offline, the computational profile provides useful information about scalability when larger multi-station datasets or more frequent retraining cycles are required. Inference cost is also relevant: KNN scales linearly with the number of stored samples, while the trained LSTM yields constant-time predictions. Thus, reporting both training and prediction costs clarifies the practical trade-offs between models in real deployments.

This trade-off highlights the importance of considering both training and deployment phases when selecting models for operational use. KNN may be preferable in situations where rapid training and straightforward implementation are required, while LSTM proves advantageous when temporal patterns are critical and real-time prediction efficiency is a priority.

The experiments were executed on a laptop equipped with Windows 11, an AMD Ryzen 7 5700U processor, 20 GB of RAM, 8 cores, and 16 threads.

Contextual Implications for Flood Prediction

While the LSTM architecture is designed to capture temporal dependencies, our results show that, for this dataset, the simpler KNN regressor achieves uniformly higher accuracy across all metrics. The LSTM does recover broad seasonal structure (see Figures S5 and 5), but its predictive skill does not surpass that of KNN under the present feature set and data conditions.

Although this study focused on supervised models, there are promising avenues for incorporating advanced ML techniques. For instance, data augmentation methods or generative models could improve the representation of extreme events. Transfer learning, commonly used in image and NLP domains, could allow models trained on rivers with rich data (e.g., the Wupper) to inform predictions in sparse regions (e.g., Ladário). Furthermore, reinforcement learning and hybrid architectures combining physical and neural components are emerging as viable strategies for adaptive flood management systems, especially when control actions (e.g., dam operations) are involved.

The 2023 test period contains no days exceeding the operational warning threshold; thus, our evaluation concerns continuous water-level forecasting under non-extreme conditions rather than event-based flood prediction. Assessing model skill during high-water episodes would require an event-rich temporal split or synthetic resampling and remains an important direction for future work.

Conclusions

This study explored the application of ML models, specifically K-Nearest Neighbors (KNN) and Long Short-Term Memory (LSTM) networks, for flood prediction based on simple hydrological and meteorological data from the Wupper river. The primary goal was to evaluate the predictive performance, strengths, and limitations of these models under comparable conditions and to assess their suitability for flood forecasting.

The KNN regression model demonstrated remarkable predictive accuracy, achieving an R2 value of 0.97, with low error metrics (MAE=1.65, RMSE=2.84). This performance underscores KNN’s effectiveness in capturing relationships within the data, particularly for relatively structured datasets where proximity-based predictions excel (LIU et al. 2020, SOLOMATINE & SHRESTHA 2009). However, its inability to incorporate temporal patterns limits applicability for forecasting dynamic, time-dependent phenomena, such as seasonal flood trends or long-term water level fluctuations (JAMES et al. 2013).

The LSTM regression model, designed to capture temporal dependencies, achieved its best performance with a time step of t=1 day, yielding R2=0.84, MAE=4.19, and RMSE=6.84. These results validate the effectiveness of LSTMs in modeling sequential data, as supported by studies in hydrology that highlight their ability to capture long-term dependencies (HOCHREITER & SCHMIDHUBER 1997, KRATZERT et al. 2018). Despite its lower overall accuracy compared to KNN, the LSTM model proved effective in forecasting trends and variations over time. However, the challenges in predicting extreme water levels suggest the need for further refinement, consistent with findings in the literature on improving LSTM performance through larger datasets or feature engineering (MOSAVI et al. 2018).

In terms of computational cost, KNN’s simplicity allows for rapid training (44.377 seconds) but results in a computationally expensive prediction phase, which may hinder its scalability for real-time applications (DUDA et al. 2000, HE & GARCIA 2009). Conversely, the LSTM model requires significant computational resources during training (ranging from 113.27 seconds for t=1 day to 1358.83 seconds for t=60 days) but offers efficient predictions once trained, making it advantageous for operational forecasting systems. This trade-off reinforces the importance of balancing model complexity, predictive accuracy, and computational efficiency, as discussed in SHEN 2018.

Because no warning- or alarm-stage water levels occur in the 2023 test set, our evaluation focuses on typical, non-extreme conditions. A proper assessment of flood-stage prediction will require alternative temporal partitions or resampling strategies that include high-water events.

In our implementation, the KNN model computes distances to all stored samples at inference time, causing prediction cost to scale linearly with dataset size. For the current dataset (≊11,700 training samples), predictions remain fast (<1 ms), but larger archives or multi-station deployments would increase this cost proportionally. The LSTM, by contrast, performs constant-time predictions once trained. Thus, while KNN yields higher accuracy here, LSTM offers more favorable scalability for long-term operational use.

Overall, this study demonstrates the potential of both KNN and LSTM models for flood prediction, each with distinct advantages. KNN excels in accuracy for static predictions, while LSTM offers dynamic forecasting capabilities essential for understanding temporal patterns. These findings provide valuable insights for the development of robust, ML-based flood forecasting systems, with implications for improving disaster preparedness, risk management, and decision-making in hydrology.

Future work could explore hybrid approaches that combine the strengths of both models, investigate alternative ML architectures, and integrate real-time data sources to enhance prediction accuracy and adaptability. By addressing these challenges, ML models can further contribute to mitigating the impacts of floods and protecting vulnerable communities, as emphasized in recent reviews on the potential of data-driven models for environmental forecasting (BENTIVOGLIO et al. 2022, KUNDZEWICZ et al. 2014).

Additionally, an interesting future application is the analysis of flood dynamics at the Ladário ruler on the Paraguay River, a region of national interest in Brazil. Given similar challenges of seasonality and stochasticity, both KNN and LSTM models could be adapted to this context. In addition, integrating environmental variables from global datasets such as NASA POWER, ERA5, or CHIRPS − including precipitation, temperature, and radiation − could enhance model accuracy and interpretability. Exploring such applications would also provide insight into the transferability and robustness of ML models across distinct hydroclimatic regimes.

A potential improvement for future work is the use of automated hyperparameter optimization frameworks such as Optuna (AKIBA et al. 2019), which would enable a systematic search over batch size, network depth, and other parameters. This could further refine model performance and complement the comparative analysis presented here.

It is also worth mentioning that recent studies have explored the use of quantum computing techniques for flood prediction, utilizing the same dataset employed in this study. Notably, PERLA et al. 2024 proposed a hybrid approach combining classical and quantum machine learning models, while LIN et al. 2024 developed the Quantum-Train LSTM model, which leverages quantum computing to enhance parameter efficiency. Although both quantum approaches demonstrated promising results, classical methods still outperform them in terms of accuracy and practicality in real-world scenarios.

SUPPLEMENTARY MATERIAL

ACKNOWLEDGMENTS

This work was supported the Coordenação de Aperfeiçoamento de Pessoal de Nível Superior (CAPES), by the Simons Foundation (Grant Number 1023171, RC), the Conselho Nacional de Desenvolvimento Científico e Tecnológico (CNPq, Grants No.307295/2020-6, No.403181/2024-0 and 301687/2025-0) and the Financiadora de Estudos e Projetos (grant 1699/24 IIF-FINEP).

References

  • AKIBA T, SANO S, YANASE T, OHTA T & KOYAMA M. 2019. Optuna: A next-generation hyperparameter optimization framework. In: Proc 25th ACM SIGKDD Int Conf Knowl Discov Data Min, p. 2623-2631.
  • ALFIERI L, FEYEN L, DOTTORI F & BIANCHI A. 2015. Ensemble flood risk assessment in Europe under high end climate scenarios. Glob Environ Change 35: 199-212.
  • ALTMANN A, TOLOŞI L, SANDER O & LENGAUER T. 2010. Permutation importance: a corrected feature importance measure. Bioinformatics 26: 1340-1347.
  • BARAUNA LO, ROSA RR, WUENSCHE CA, SAUTTER RA, DE SANTIAGO JÚNIOR VA, SHIGUEMORI EH & PADUA MB. 2024. Characterizing Colored Noise Time Series Patterns with Deep Learning Models. Fluct Noise Lett 23: 2450053.
  • BENTIVOGLIO R, ISUFI E, JONKMAN SN & TAORMINA R. 2022. Deep learning methods for flood mapping: a review of existing applications and future research directions. Hydrol Earth Syst Sci Discuss 2022: 1-50.
  • BERNDTSSON R ET AL. 2019. Drivers of changing urban flood risk: A framework for action. J Environ Manag 240: 47-56.
  • BEVEN KJ. 2012. Rainfall-runoff modelling: the primer. Chichester: John Wiley & Sons, 488 p.
  • BISHOP CM & NASRABADI NM. 2006. Pattern recognition and machine learning. New York: Springer, 738 p.
  • BREIMAN L. 2001. Random forests. Mach Learn 45: 5-32.
  • BROWN CM, LUND JR, CAI X, REED PM, ZAGONA EA, OSTFELD A, HALL J, CHARACKLIS GW, YU W & BREKKE L. 2015. The future of water resources systems analysis: Toward a scientific framework for sustainable water management. Water Resour Res 51: 6110-6124.
  • CLOKE HL & PAPPENBERGER F. 2009. Ensemble flood forecasting: A review. J Hydrol 375: 613-626.
  • COVER T & HART P. 1967. Nearest neighbor pattern classification. IEEE Trans Inf Theory 13: 21-27.
  • DUDA RO, HART PE & STORK DG. 2000. Pattern Classification. New York: John Wiley, 688 p.
  • GERS FA, SCHRAUDOLPH NN & SCHMIDHUBER J. 2002. Learning precise timing with LSTM recurrent networks. J Mach Learn Res 3: 115-143.
  • GOODFELLOW I, BENGIO Y & COURVILLE A. 2016. Deep learning. Cambridge: MIT Press, 775 p.
  • HALDER RK, UDDIN MN, UDDIN MA, ARYAL S & KHRAISAT A. 2024. Enhancing K-nearest neighbor algorithm: a comprehensive review and performance analysis of modifications. J Big Data 11: 113.
  • HASTIE T, TIBSHIRANI R & FRIEDMAN J. 2009. The Elements of Statistical Learning: Data Mining, Inference, and Prediction. New York: Springer, 767 p.
  • HE H & GARCIA EA. 2009. Learning from imbalanced data. IEEE Trans Knowl Data Eng 21: 1263-1284.
  • HIRABAYASHI Y, MAHENDRAN R, KOIRALA S, KONOSHIMA L, YAMAZAKI D, WATANABE S, KIM H & KANAE S. 2013. Global flood risk under climate change. Nat Clim Change 3: 816-821.
  • HOCHREITER S & SCHMIDHUBER J. 1997. Long short-term memory. Neural Comput 9: 1735-1780.
  • JAMES G, WITTEN D, HASTIE T & TIBSHIRANI R. 2013. An introduction to statistical learning. New York: Springer, 426 p.
  • KINGMA D & BA J. 2015. Adam: A method for stochastic optimization. In: INTERNATIONAL CONFERENCE ON LEARNING REPRESENTATIONS, 3, San Diego. Proceedings..., San Diego: ICLR, 15 p.
  • KRATZERT F, KLOTZ D, BRENNER C, SCHULZ K & HERRNEGGER M. 2018. Rainfall-runoff modelling using long short-term memory (LSTM) networks. Hydrol Earth Syst Sci 22: 6005-6022.
  • KRATZERT F, KLOTZ D, HERRNEGGER M, SAMPSON AK, HOCHREITER S & NEARING GS. 2019. Toward improved predictions in ungauged basins: Exploiting the power of machine learning. Water Resour Res 55: 11344-11354.
  • KUNDZEWICZ ZW ET AL. 2014. Flood risk and climate change: global and regional perspectives. Hydrol Sci J 59: 1-28.
  • LE XH, HO HV, LEE G & JUNG S. 2019. Application of long short-term memory (LSTM) neural network for flood forecasting. Water 11: 1387.
  • LECUN Y, BENGIO Y & HINTON G. 2015. Deep learning. Nature 521: 436-444.
  • LIN CHA, LIU CY & CHEN KC. 2024. Quantum-train long short-term memory: Application on flood prediction problem. In: IEEE Int Conf Quantum Comput Eng, p. 268-273.
  • LIU M, HUANG Y, LI Z, TONG B, LIU Z, SUN M, JIANG F & ZHANG H. 2020. The applicability of LSTM-KNN model for real-time flood forecasting in different climate zones in China. Water 12: 440.
  • LIU X, LI J, ZHAO J, CAO B, YAN R & LYU Z. 2024. Evolutionary Neural Architecture Search and Its Applications in Healthcare. Comput Model Eng Sci 139: 143-185.
  • MOLNAR C. 2020. Interpretable machine learning. Munich: Lulu.com, 318 p.
  • MOSAVI A, OZTURK P & CHAU KW. 2018. Flood prediction using machine learning models: Literature review. Water 10: 1536.
  • MURPHY KP. 2012. Machine learning: a probabilistic perspective. Cambridge: MIT Press, 1104 p.
  • PERLA M, JAGADISH S, AGGARWAL A, MARAM B, CREESY R & DAS S. 2024. Flood Forecasting with Classical and Quantum Machine Learning Models: A Comparative Analysis. In: Int Conf Intell Comput Sustain Innov Technol (IC-SIT), p. 1-6.
  • SANKARANARAYANAN S, PRABHAKAR M, SATISH S, JAIN P, RAMPRASAD A & KRISHNAN A. 2020. Flood prediction based on weather parameters using deep learning. J Water Clim Change 11: 1766-1783.
  • SHEN C. 2018. A transdisciplinary review of deep learning research and its relevance for water resources scientists. Water Resour Res 54: 8558-8593.
  • SHERSTINSKY A. 2020. Fundamentals of recurrent neural network (RNN) and long short-term memory (LSTM) network. Physica D 404: 132306.
  • SOLOMATINE DP & OSTFELD A. 2008. Data-driven modelling: some past experiences and new approaches. J Hydroinform 10: 3-22.
  • SOLOMATINE DP & SHRESTHA DL. 2009. A novel method to estimate model uncertainty using machine learning techniques. Water Resour Res 45: 1-16.
  • UNDRR – UNITED NATIONS OFFICE FOR DISASTER RISK REDUCTION. 2015. The human cost of weather-related disasters 1995-2015. UNDRR. Available at: https://www.undrr.org/publication/human-cost-weather-related-disasters-1995-2015
    » https://www.undrr.org/publication/human-cost-weather-related-disasters-1995-2015
  • WILLMOTT CJ & MATSUURA K. 2005. Advantages of the mean absolute error (MAE) over the root mean square error (RMSE) in assessing average model performance. Clim Res 30: 79-82.
  • YADAV B & ELIZA K. 2017. A hybrid wavelet-support vector machine model for prediction of Lake water level fluctuations using hydro-meteorological data. Measurement 103: 294-301.
  • ZHANG G, PATUWO BE & HU MY. 1998. Forecasting with artificial neural networks: The state of the art. Int J Forecast 14: 35-62.

Correspondence

Correspondence to: Gabriel Wendell Celestino Rocha E-mail: gabrielwendell@fisica.ufrn.br

Handling editor

Ulisses Barres de Almeida

Publication Dates

  • Publication in this collection
    24 Aug 2026
  • Date of issue
    2026

History

  • Received
    08 May 2025
  • Accepted
    16 Mar 2026
location_on
Academia Brasileira de Ciências Rua Anfilófio de Carvalho, 29, 3º andar, 20030-060 Rio de Janeiro RJ Brasil, Tel: +55 (21) 2391-7901 - Rio de Janeiro - RJ - Brazil
E-mail: aabc@abc.org.br
rss_feed Acompanhe os números deste periódico no seu leitor de RSS
Ir para o topo