A Digital Twin Inspired Edge AI Framework for Real-Time Flood Early Warning Using XGBoost and IoT Sensor Data
Abstract:
Flood early-warning systems increasingly use machine learning, but predictive studies rarely assess whether candidate models meet deployment constraints at warning locations. This study evaluated a six-layer, digital-twin-inspired edge artificial intelligence (AI) framework using five years of daily hydro-meteorological observations ($n$ = 1,826) from one river gauge in Indonesia. The framework integrated causal preprocessing, 93 engineered predictors, paired extreme gradient boosting (XGBoost) classification and regression models, a synchronised state-update surrogate for stage–inundation scenarios, and a rule-based alert engine. The alert engine used class-specific probability gates and dispatch de-duplication. Evaluation followed chronological partitions. Imputation statistics and risk thresholds were derived from training data, uncertainty was assessed using a moving-block bootstrap, and paired model comparisons used McNemar and Diebold–Mariano tests (DMs). On the held-out year, the deployed model achieved a macro F1-score of 0.788 (95% confidence interval: 0.721–0.830) and a next-day stage root mean squared error (RMSE) of 0.353 m. Nash–Sutcliffe efficiency was 0.872. Warning-state verification yielded a probability of detection (POD) of 0.945 and a false-alarm ratio (FAR) of 0.101 under the configured policy. XGBoost, random forest, and gradient boosting showed no statistically detectable performance differences in the reported tests, including an eightfold rolling-origin evaluation of 728 pooled test days. Sequence models trained on raw 30-day windows did not improve performance under the evaluated pipelines. However, the tree models used engineered predictors, so the comparison does not isolate architectural effects. The XGBoost classifier was approximately 41 times smaller and 175 times faster at the 99th-percentile inference latency than the random forest. The complete deployed bundle occupied 134 kB and achieved a 99th-percentile latency of 1.39 ms on the benchmark host. These findings support deployment cost as a practical selection consideration when available tests cannot distinguish predictive performance. Generalisation requires multi-station replication, formal equivalence testing where equivalence is claimed, and hardware-in-the-loop validation.
1. Introduction
Hydro-meteorological hazards affect populations worldwide, and floods account for a substantial proportion of their impacts. Recent reviews document rapid progress from conceptual rainfall–runoff models to sophisticated data-driven forecasting approaches [1]. However, improvements in prediction do not necessarily translate into timely warnings for exposed communities. Warning delivery also depends on infrastructure reliability, processing latency, and confidence in operational decisions.
Two architectural approaches address these operational requirements. Digital twins maintain an updated virtual representation of a physical system and support scenario analysis. Recent implementations have demonstrated this approach at urban [2] and basin [3] scales. Edge artificial intelligence (AI) processes data near sensors, reducing dependence on continuous connectivity when communication infrastructure is disrupted [4], [5]. These approaches have developed largely in parallel. Digital-twin studies often emphasise system architecture without extensively benchmarking embedded prediction models. Conversely, edge-AI studies frequently quantify memory and latency without evaluating warning-related hydrological decisions.
Evaluation practices create a second challenge. Many comparative flood-modelling studies rank algorithms by small differences in reported scores without corresponding paired significance tests. Model rankings also vary across flood-susceptibility settings [6], [7], [8]. Although recurrent neural networks are widely used for hydrological time series [9], [10], broader research shows that tree ensembles remain competitive on moderate-sized tabular datasets [11]. Evidence from data-scarce hydrological applications supports similar caution [12]. Consequently, comparative claims should account for dataset characteristics, statistical uncertainty, and the representations supplied to competing models.
These gaps motivate a practical model-selection question: how should candidates be selected when the available tests do not detect a meaningful performance difference? Selecting the highest observed validation score can overstate small sample-dependent differences. It may also overlook memory and latency constraints on the intended device. This study therefore examined whether deployment cost provides a useful additional selection criterion when paired comparisons do not distinguish leading candidates. Failure to reject a difference is not, by itself, proof of statistical equivalence; the conclusions are consequently limited to the evidence provided by the reported tests and deployment measurements.
The study evaluated an integrated six-layer framework and made five contributions. First, it combined an edge inference engine, a synchronised digital-twin-inspired state surrogate, and rule-based alert dissemination in one evaluated pipeline. The state surrogate was not designed as a geometry-resolved hydraulic digital twin. Second, paired statistical comparisons and eightfold rolling-origin evaluation were used to assess whether leading tree ensembles showed detectable differences. Third, sequence models were evaluated using raw time windows, while tree models used engineered tabular predictors; this was treated as a pipeline-level comparison rather than an architecture-controlled experiment. Fourth, model footprint and inference latency were measured using common benchmark instrumentation. Finally, warning-state skill was distinguished from de-duplicated dispatch counts, because these quantities answer different operational questions.
2. Literature Review
Physically based flood models represent hydrological processes explicitly but often require intensive calibration, identifiable parameters, and substantial computational resources. Coupled hydrological–hydraulic systems can produce defensible inundation estimates [13], and integration with ensemble weather predictions improves fine-resolution forecasting [14]. These approaches may nevertheless be difficult to operate in poorly instrumented catchments or settings with limited computing infrastructure.
Data-driven models offer a different balance between representation and operational cost. Gradient-boosted trees have been applied to hourly stage prediction [15] and river-ice processes [16]. A systematic review also documents wider extreme gradient boosting (XGBoost) applications in water resources engineering [17]. Together, these studies illustrate the versatility of tree boosting for hydro-meteorological prediction, although operational costs require separate measurement. XGBoost also includes sparsity-aware split selection and learned default directions for missing inputs [18]. These algorithmic features are distinct from the imputation strategy adopted in this study.
Related work on discharge forecasting has shown that distributed hydrological representations can improve machine-learning predictions for ungauged basins [19]. Deep neural networks have also achieved strong reservoir-stage predictions, although deployment resource requirements were not the focus of that evaluation [20]. Remote-sensing approaches to flood susceptibility provide further examples of predictive modelling without comprehensive operational cost assessment [21]. A remaining issue is the choice of benchmark. Comparisons limited to learned algorithms may not establish whether the proposed predictor improves on a simple persistence forecast. This baseline is especially important for short-horizon stage prediction.
Digital-twin approaches are increasingly used in flood management. Geospatial systems support urban-scale flood visualisation [2], while physics-informed graph neural networks have been integrated with basin-scale twin architectures [3]. Other frameworks combine machine learning with physical models for adaptive emergency management [22]. Heterogeneous sensor integration also provides the continuous observations required for synchronised state updates [23].
Despite these advances, the predictive component of a digital-twin framework is not always evaluated with the same detail as its architecture. Headline accuracy alone may not establish a meaningful advantage over simpler models, particularly when uncertainty and execution cost are unreported. This limitation matters because forecasting quality constrains the usefulness of downstream warning decisions. Uncertainty-aware approaches offer one route to more transparent assessment [24].
Edge-computing research provides established measures for operational efficiency. Reviews of tiny machine learning (TinyML) identify memory use, inference latency, and energy consumption as important deployment metrics [4]. Broader assessments of embedded AI likewise emphasise trade-offs between predictive accuracy and resource requirements [5]. Practical developments include energy-efficient inference on unmanned aerial platforms [25], remote deployment of models to Internet of Things (IoT) devices [26], hardware accelerators for microcontrollers [27], and benchmarks for lightweight neural networks [28].
Flood-monitoring studies have deployed IoT and geographic information system platforms [29], multimodal river sensors [30], and AI-enabled warning systems for rural settings [31]. However, several such studies place greater emphasis on sensing and communication than on the measured memory and latency of predictive models. Reporting both predictive performance and resource cost would make the feasibility of gateway deployment easier to assess across systems.
Three evaluation concerns are particularly relevant to comparative forecasting. The first is temporal leakage. Estimating imputation statistics, scaling parameters, or target thresholds on a full dataset can introduce information from future observations into model development. Randomly shuffled cross-validation also disrupts the time order required for forecasting. Methodological analyses of spatiotemporal evaluation [32] and structurally unstable time series [33] support the use of chronologically appropriate validation.
The second concern is statistical precision. A single year of daily testing provides only a few hundred observations, and the effective sample size is further reduced by serial dependence. Small differences between model scores can therefore be unstable. Expanding-window, rolling-origin evaluation adds disjoint test periods and permits paired comparisons across different seasonal conditions. Nevertheless, additional temporal observations do not replace validation at independent stations.
The third concern is hyperparameter tuning. Automated tuning can materially change rainfall–runoff prediction performance [34]. Comparing a carefully tuned proposed model with untuned alternatives would therefore confound algorithmic differences with configuration quality. Streamflow studies also show that model behaviour depends on catchment and climatic conditions [35]. Model comparisons should report these design choices alongside performance metrics.
This study combined chronological evaluation, paired model comparisons, and deployment-cost benchmarking in a single flood-warning pipeline. The analysis focused on the absence or presence of statistically detectable differences, rather than treating small point-estimate gaps as definitive evidence of model superiority.
3. Methodology
Figure 1 shows the six-layer framework. Layer 1 acquired the historical meteorological record and simulated input from a real-time sensor stream. Layer 2 performed data cleaning, causal imputation, and feature construction. Layer 3 contained the edge inference engine: two offline-trained gradient-boosted models packaged as one serialised artefact for gateway-class execution. Layer 4 maintained an operational state based on assimilated observations, predicted stage, a stage–inundation surrogate, and counterfactual scenarios. Here, digital-twin-inspired refers to synchronised state updating and scenario evaluation, not to a surveyed, geometry-resolved hydraulic replica or bidirectional actuator control. Layer 5 stored state information and generated decision-support products. Layer 6 translated model outputs into alerts for dashboards, messaging, short-message services, and sirens. The design allowed prediction skill, model size, latency, and warning verification to be evaluated within the same pipeline.

The study used 1,826 consecutive daily records from 1 January 2018 to 31 December 2022 at one Indonesian meteorological and hydrological station. The measurements were obtained from the Indonesian Agency for Meteorology, Climatology and Geophysics (BMKG). The nine measured variables were river stage, discharge, rainfall, relative humidity, minimum temperature, maximum temperature, mean temperature, wind speed, and wind direction. Table 1 summarises the data-quality audit. Three types of irregularity required explicit handling. Rainfall used the sentinel code 888 during a contiguous 184-day outage from 1 July to 31 December 2019, entirely within the training period. Nine discharge values included estimated or provisional qualifiers; their numeric components were retained, together with qualifier indicators. A rainfall measurement of 499 mm on 15 February 2021 was flagged as unusually high but retained, with its influence moderated by a logarithmic transformation.
Variable | Missing | Sentinel-Coded | Out of Range | Complete (%) | Mean | SD | Min | Max |
|---|---|---|---|---|---|---|---|---|
Water level (m) | 0 | 0 | 0 | 100.0 | 1.17 | 1.01 | 0.00 | 5.8 |
Discharge (m$^3$/s) | 0 | 0 | 0 | 100.0 | 13.37 | 26.83 | 0.00 | 201.0 |
Rainfall (mm) | 0 | 184 | 1 | 89.9 | 12.41 | 28.17 | 0.00 | 499.0 |
Relative humidity (%) | 166 | 0 | 0 | 90.9 | 79.57 | 6.48 | 52.00 | 96.0 |
Min. temperature ($^\circ$C) | 87 | 0 | 0 | 95.2 | 25.22 | 0.98 | 20.00 | 29.7 |
Max. temperature ($^\circ$C) | 78 | 0 | 0 | 95.7 | 32.03 | 1.51 | 25.40 | 35.8 |
Mean temperature ($^\circ$C) | 166 | 0 | 0 | 90.9 | 28.06 | 1.09 | 24.10 | 33.2 |
Wind speed (m/s) | 30 | 0 | 0 | 98.4 | 4.61 | 1.58 | 0.00 | 18.0 |
Wind direction ($^\circ$) | 30 | 0 | 0 | 98.4 | 241.59 | 80.16 | 0.00 | 360.0 |
Of the 1,826 daily observations, the first 14 days (1–14 January 2018) supplied the historical context required by the maximum 14-day antecedent-rainfall feature window. The final observation (31 December 2022) was unavailable as a modelling input because its next-day target fell outside the record. The remaining 1,811 supervised samples covered 15 January 2018 to 30 December 2022. These samples were partitioned chronologically without shuffling. Model training used 1,082 samples (15 January 2018–31 December 2020), validation and hyperparameter selection used 365 samples (1 January–31 December 2021), and held-out testing used 364 samples (1 January–30 December 2022; Table 2). The High-risk class accounted for approximately 10% of the training observations and 16% of the test observations. This difference in class prevalence was retained as a characteristic of the record.
Partition | Period | Days | Low | Medium | High | High (%) | Mean Stage (m) |
|---|---|---|---|---|---|---|---|
Train | 2018-01-15–2020-12-31 | 1,082 | 752 | 220 | 110 | 10.2 | 0.967 |
Val | 2021-01-01–2021-12-31 | 365 | 185 | 95 | 85 | 23.3 | 1.457 |
Test | 2022-01-01–2022-12-30 | 364 | 165 | 141 | 58 | 15.9 | 1.437 |
The raw observation count overstates the amount of independent evidence available for model fitting. The 14-day feature warm-up reduced the eligible training interval to 1,082 samples, while serial dependence further reduced its effective information content. All records also came from a single gauge. The resulting estimates describe temporal performance at this station during 2018–2022; they do not establish transferability to other catchments. Rolling-origin evaluation added temporal test periods but did not provide independent spatial observations. The limited record also constrained the data available to train higher-parameter sequence models. External multi-station validation is needed to assess geographic transfer.
Missing values were imputed using information available at or before each time step. A day-of-year climatology was estimated from the training partition only. Gaps of up to three days were first forward-filled. Remaining gaps were filled using the training-period climatological median within a $\pm$7-day calendar window, followed by the overall training median when needed. Each imputed input received a binary indicator. This procedure retained information about reconstructed measurements and permitted separate assessment of the 2019 rainfall outage. A perturbation test confirmed that changes to test-year values did not affect fitted climatology or fallback statistics.
Feature causality was evaluated with an additional perturbation test. Multiplying the final 120 observations by an arbitrary constant did not change any feature rows preceding that window. A separate screening rule rejected features with absolute target correlation greater than 0.999; the highest observed correlation was 0.876.
The feature set comprised 93 predictors grouped into eight families (Table 3). It included contemporaneous measurements at time $t$, circular encoding of wind direction, and a logarithmic rainfall transform. Historical features comprised one-, two-, three-, five-, and seven-day lags; shifted three- and seven-day rolling statistics; rainfall accumulations over two, three, five, seven, and fourteen days; and wet-day counts. Additional features represented changes in stage and discharge, exponentially decaying antecedent precipitation, humidity-weighted antecedent wetness, seasonal harmonics, and data-quality indicators.
| Family | $\boldsymbol{n}$ | Description | $\boldsymbol{\Delta}$ Macro F1 |
|---|---|---|---|
| Raw | 13 | Instantaneous observations at time $t$, circular wind encoding, log rainfall, diurnal range | -0.0189 |
| Lag | 30 | Lagged values at $t-1$, $t-2$, $t-3$, $t-5$, $t-7$ for six core variables | -0.0029 |
| Rolling | 20 | 3- and 7-day rolling mean and standard deviation, shifted to exclude time $t$ | -0.0021 |
| Cumulative | 7 | 2/3/5/7/14-day antecedent rainfall totals, wet-day counts, 7-day maximum | -0.0017 |
| Dynamics | 7 | First differences and rates of change of stage and discharge | -0.0008 |
| Antecedent | 2 | Exponentially decaying antecedent precipitation index ($k$ = 0.85) and humidity-weighted variant | -0.0053 |
| Seasonal | 4 | Harmonic day-of-year terms, month, monsoon indicator | -0.0008 |
| Quality | 10 | Per-variable imputation indicators and discharge qualifier flags | -0.0053 |
Two one-day-ahead targets were defined. The regression target was next-day river stage in metres. The classification target divided stage into Low (below the 70th percentile), Medium (70th to below the 90th percentile), and High (at or above the 90th percentile) risk bands. Thresholds were estimated from the training partition only and were 1.120 m and 2.098 m. Perturbing test-year values did not change these thresholds. The bands are statistical categories of stage, not independently documented flood or inundation events. This distinction limits the interpretation of warning performance (Section 9).
The 93 predictors were derived from the underlying observed variables rather than from 93 independent sensors. Removing engineered feature families would mainly reduce historical buffering, feature calculations, and vector serialisation. It would not directly reduce sensor acquisition or radio transmission. Savings from eliminating physical measurement channels would require excluding corresponding raw variables, which was considered separately through feature-family ablation in Section 4.6.
The proposed forecasting pipeline combined an XGBoost classifier and regressor [18]. A 60-iteration randomised search with five-fold TimeSeriesSplit cross-validation was conducted within the training partition. Classification settings were selected by macro F1-score, and regression settings by negative root mean squared error (RMSE); Table 4 lists the resulting configurations. Balanced sample weights addressed class imbalance without resampling high-stage observations. Before final testing, the operational models were refitted using the combined training and validation partitions.
Model | n_estim. | max_depth | Learn. Rate | Subsample | Colsample | min_child_wt | reg_$\boldsymbol{\lambda}$ |
|---|---|---|---|---|---|---|---|
XGBoost classifier | 200 | 2 | 0.02 | 1.00 | 0.60 | 10 | 5.0 |
XGBoost regressor | 800 | 5 | 0.10 | 0.60 | 1.00 | 1 | 1.0 |
Four classification baselines were evaluated: random forest, gradient boosting, decision tree, and multinomial logistic regression. These models used the same engineered feature matrix and sample-weighting scheme. Where a baseline required complete inputs, median imputation was applied within its processing pipeline. Regression comparisons also included ridge regression and a naive persistence forecast. Persistence provided an operationally relevant benchmark for next-day stage prediction.
Three sequence-model baselines were evaluated: a long short-term memory (LSTM) network, a gated recurrent unit (GRU), and a dilated temporal convolutional network (TCN). They used 30-day windows of raw daily observations, whereas the tree models received the engineered 93-feature matrix. These representations differed: cumulative rainfall, rolling statistics, antecedent precipitation, nonlinear transforms, and data-quality indicators were supplied explicitly to the tree models but had to be inferred from raw sequences by the neural models. Scaling statistics and class weights were fitted on training data only, early stopping used the validation year, and each sequence architecture was trained with three seeds. Results were reported as the mean and standard deviation. Thus, the comparison evaluated practical pipelines with different feature engineering, not the isolated effect of model architecture.
The classifier, regressor, ordered feature contract, and risk thresholds were packaged in a single serialised artefact with a single-record prediction interface. Inference latency was measured on the benchmark host over 2,000 randomised single-record calls after warm-up. Model size was measured from the compressed serialised artefact. Identical benchmark procedures were applied to all candidate models.
Layer 4 maintained a lightweight operational state rather than a high-fidelity engineering digital twin. It used the deployed predictions and a parameterised trapezoidal channel-and-floodplain relation to estimate relative changes in inundated area and overbank depth. Counterfactual scenarios perturbed rainfall and antecedent-moisture features coherently. The state model did not incorporate surveyed channel geometry, a hydraulic mesh, computer-aided design or building information modelling, bidirectional asset control, or lifecycle tracking. Accordingly, the stage–inundation relation supported comparisons of scenario sensitivity, not calibrated predictions of absolute inundation. Robustness was assessed with simulated Gaussian measurement noise, calibration drift, and Bernoulli packet loss.
The alert engine used class-specific probability thresholds, a persistence setting, and de-duplication. The probability threshold was 0.40 for Medium-risk, 0.35 for High-risk, and 0.00 for Low-risk. Persistence was set to one consecutive prediction; therefore, a single elevated prediction satisfied the persistence condition. These operating parameters were specified heuristically and were not optimised on the held-out 2022 data or derived from an agency cost–loss model. De-duplication prevented repeated dispatches while the same alert level remained active. One dispatch could therefore represent an episode spanning several warning-days. Skill was scored against the warning state rather than against dispatch events, which were reported separately as alert load. Future evaluations should vary the thresholds and persistence settings under explicit agency-defined costs.
Classification was evaluated using accuracy, balanced accuracy, macro and weighted F1-scores, Matthews correlation coefficient, quadratically weighted Cohen’s kappa, and macro one-versus-rest areas under receiver-operating characteristic and precision–recall curves. Class-specific measures included probability of detection (POD), false-alarm ratio (FAR), specificity, and critical success index. Regression metrics were RMSE, mean absolute error, coefficient of determination, Nash–Sutcliffe efficiency, Kling–Gupta efficiency, and percentage bias (PBIAS).
Uncertainty was estimated by moving-block bootstrap with 14-day blocks and 1,000 replicates to accommodate serial dependence. Classification predictions were compared using the exact paired McNemar test. Regression forecasts were compared using the Diebold–Mariano test (DM) on squared errors. Rolling-origin evaluation comprised eight expanding-window folds, each with 91 test days beginning on 1 January 2021. Within each fold, thresholds were re-estimated using only the available training data. Model comparisons used a Wilcoxon signed-rank test across valid folds and a pooled McNemar test on concatenated test predictions.
The eight test windows were F1, 1 January–1 April 2021; F2, 2 April–1 July 2021; F3, 2 July–30 September 2021; F4, 1 October–30 December 2021; F5, 31 December 2021–31 March 2022; F6, 1 April–30 June 2022; F7, 1 July–29 September 2022; and F8, 30 September–29 December 2022. F3 and F7 contained fewer than three observed risk classes. Both were retained in the pooled analysis of 728 test days but excluded from fold-level means, standard deviations, and Wilcoxon tests, for which a missing class can distort macro F1. The trajectories of all eight folds are presented in the rolling-origin evaluation results. Including the two restricted-class folds would have increased the XGBoost fold mean from 0.742 to 0.763. The six-fold mean was therefore used for fold-level comparisons.
Model interpretability was assessed using TreeSHapley Additive exPlanations (SHAP) [36] for global and local attribution. These results were compared with permutation importance and split-gain rankings. Leave-one-family-out ablation was used to estimate the marginal contribution of each engineered feature family.
A fixed master seed controlled stochastic elements of the tabular-model and simulation pipeline. Sequence models were trained with three seeds, as described in Section 3.5. The core workflow executed the primary preprocessing, tabular modelling, explainability, inference benchmarking, scenarios, and alerting analyses from the raw data. Forty-nine automated assertions checked sentinel handling, qualifier retention, calendar completeness, training-only climatology, feature causality, threshold provenance, metric calculations, artefact round-trip consistency, and alert logic. Execution metadata recorded the computing environment, software versions, selected hyperparameters, principal metrics, and runtime.
4. Results
Figure 2 presents the hydro-meteorological record, chronological data partitions, and the reconstructed period of missing rainfall observations. River stage exhibited seasonal variation, with wetter conditions generally occurring from November to April. During extended dry periods, stage fell below 0.5 m. Figure 3 shows the training-derived risk thresholds and the class distribution across partitions. The High-risk share increased from approximately 10% in training to 16% in testing, while the Low-risk share decreased from about 70% to 45%.


Table 5 summarises the deployed classifier’s performance. In the held-out test year, accuracy was 0.8132 (95% confidence interval (CI)): [0.758, 0.876]), macro F1 was 0.7882 (95% CI: [0.721, 0.830]), and Matthews correlation coefficient was 0.7043 (95% CI: [0.618, 0.781]). Macro one-versus-rest ROC-AUC and PR-AUC were 0.9483 and 0.8886, respectively. Macro F1 was higher during validation (0.8553) than testing (0.7882). This difference coincided with the change in class prevalence, although the available results do not isolate its contribution.
Metric | Validation (2021) | Test (2022) | 95% CI (Test) |
|---|---|---|---|
Accuracy | 0.8822 | 0.8132 | [0.758, 0.876] |
Balanced accuracy | 0.8583 | 0.8025 | – |
Macro F1 | 0.8553 | 0.7882 | [0.721, 0.830] |
Weighted F1 | 0.8833 | 0.8163 | – |
MCC | 0.8116 | 0.7043 | [0.618, 0.781] |
Quadratically weighted Cohen’s kappa | 0.8992 | 0.8073 | – |
ROC-AUC (macro one-versus-rest) | 0.9659 | 0.9483 | – |
PR-AUC (macro) | 0.9203 | 0.8886 | – |
Table 6 shows class-specific performance. Low-risk predictions achieved an F1-score of 0.900 and a FAR of 0.071. Medium-risk predictions were less reliable (F1 = 0.767), reflecting the difficulty of separating adjacent stage bands. For the High-risk class, recall was 0.776 and precision was 0.634. The relative operational costs of missed warnings and false alarms determine whether this balance is acceptable. The confusion matrices in Figure 4 show that no High-risk observation was classified as Low-risk; all High-risk errors involved the adjacent Medium class. The quadratically weighted kappa was 0.807. Figure 5 displays class-wise discrimination curves.
| Risk Class | Support | Precision | POD | F1 | Specificity | FAR | CSI |
|---|---|---|---|---|---|---|---|
| Low | 165 | 0.929 | 0.873 | 0.900 | 0.945 | 0.071 | 0.818 |
| Medium | 141 | 0.775 | 0.759 | 0.767 | 0.861 | 0.225 | 0.622 |
| High | 58 | 0.634 | 0.776 | 0.698 | 0.915 | 0.366 | 0.536 |
| Macro average | 364 | 0.779 | 0.803 | 0.788 | 0.907 | 0.221 | 0.659 |


For next-day stage prediction, RMSE was 0.3527 m, mean absolute error was 0.2318 m, Nash–Sutcliffe efficiency was 0.8715, Kling–Gupta efficiency was 0.8895, and PBIAS was -0.9243% (Table 7). Figure 6 compares predicted and observed stages and presents residual diagnostics. Residuals were approximately symmetric with limited overall bias. Underestimation was more apparent at the largest observed stages.
Metric | Value | Interpretation |
|---|---|---|
RMSE (m) | 0.3527 | 26% below the naive persistence forecast (0.475 m) |
MAE (m) | 0.2318 | Typical error $\approx$ 23 cm |
$R^2$ | 0.8715 | 87% of test-year variance explained |
NSE | 0.8715 | “Very good” by conventional hydrological criteria ($>$0.75) |
KGE | 0.8895 | Correlation, variance and bias jointly satisfactory |
PBIAS (%) | -0.9243 | Negligible systematic bias |

Table 8 compares test-year prediction scores, confidence intervals, paired significance tests, and deployment costs; Figure 7 displays predictive performance. Gradient boosting had the highest observed macro F1 (0.8151), followed by random forest (0.8073) and XGBoost (0.7882). However, exact McNemar tests did not detect significant differences between XGBoost and gradient boosting ($p = 0.185$) or random forest ($p = 0.405$). Confidence intervals also overlapped substantially. The decision tree performed significantly worse than XGBoost ($p = 0.016$). In the regression analysis, DMs found no significant difference between XGBoost and gradient boosting ($p$ = 0.851), random forest ($p$ = 0.460), or ridge regression ($p$ = 0.503). The persistence forecast performed significantly worse (DM = -2.647, $p$ = 0.008). Non-significant results do not establish formal equivalence; they show that the reported tests did not distinguish the candidates at the chosen significance level.
Model | Accuracy | Macro F1 | 95% CI (F1) | MCC | ROC-AUC | McNemar $\boldsymbol{p}$ | Size (kB) | P99 (ms) |
|---|---|---|---|---|---|---|---|---|
XGBoost (proposed) | 0.8132 | 0.7882 | [0.721, 0.830] | 0.7043 | 0.9483 | – | 60.8 | 0.74 |
Random forest | 0.8297 | 0.8073 | [0.734, 0.848] | 0.7249 | 0.9393 | 0.405 | 2502.6 | 129.57 |
Gradient boosting | 0.8352 | 0.8151 | [0.747, 0.852] | 0.7351 | 0.9467 | 0.185 | 341.4 | 2.03 |
Decision tree | 0.7610 | 0.7430 | [0.666, 0.792] | 0.6312 | 0.8773 | 0.016 | 5.4 | 0.45 |
Logistic regression | 0.7830 | 0.7624 | [0.690, 0.815] | 0.6541 | 0.9204 | 0.161 | 6.0 | 0.76 |

The principal comparative result was that the available tests did not distinguish the three leading tree ensembles despite different point estimates. Their deployment costs differed substantially (Figure 8). The random-forest classifier occupied 2,502.6 kB and required 129.57 ms at the 99th percentile of single-record latency. Gradient boosting occupied 341.4 kB and required 2.03 ms, whereas XGBoost occupied 60.8 kB and required 0.74 ms. The observed macro-F1 spread was 0.027, while the ratio of random-forest to XGBoost cost was approximately 41 for model size and 175 for latency. These resource differences offer a practical selection consideration, subject to the predictive uncertainty and device-specific benchmarks.

Table 9 and Figure 9 report the sequence-model results. Across three random seeds, macro F1 was 0.7617 $\pm$ 0.0041 for the GRU, 0.75 $\pm$ 0.015 for the LSTM, and 0.7191 $\pm$ 0.0222 for the TCN. Under the evaluated pipelines, none exceeded the engineered-feature XGBoost model. Paired tests found significantly lower classification performance for LSTM (McNemar $p$ = 0.0295) and TCN ($p$ = 0.0008), but not for GRU ($p$ = 0.1848). The LSTM and GRU regression forecasts were not significantly different from XGBoost (DM $p$ = 0.901 and 0.823, respectively), whereas TCN was worse (DM = -3.079, $p$ = 0.002). Because the tree models used engineered tabular features and the sequence models used raw 30-day windows, these results do not isolate the effect of architecture.
| Model | Seeds | Macro F1 | SD | RMSE (m) | SD | Size (kB) | p99 (ms) | McNemar $\boldsymbol{p}$ |
|---|---|---|---|---|---|---|---|---|
| XGBoost (proposed) | – | 0.7882 | – | 0.3527 | – | 60.8 | 0.74 | – |
| LSTM | 3 | 0.7500 | $\pm$0.0150 | 0.3571 | $\pm$0.0053 | 78.8 | 0.47 | 0.0295 |
| GRU | 3 | 0.7617 | $\pm$0.0041 | 0.3551 | $\pm$0.0078 | 60.1 | 2.22 | 0.1848 |
| TCN | 3 | 0.7191 | $\pm$0.0222 | 0.4464 | $\pm$0.0557 | 205.4 | 2.79 | 0.0008 |

Deployment measurements provide another basis for comparing these pipelines. GRU model size was similar to that of the XGBoost classifier, at approximately 60 kB, but its inference latency was higher. The TCN was both larger and slower than XGBoost. In this dataset, the sequence pipelines did not show a predictive advantage that justified their measured resource costs. A controlled architecture comparison would require either training XGBoost on raw lagged inputs or supplying equivalent engineered information to the sequence models.
The held-out test year provided a limited basis for assessing small model differences. Rolling-origin evaluation examined whether the absence of significant differences among leading tree ensembles persisted across additional time periods. Eight 91-day expanding-window test folds provided 728 pooled prediction-days. Table 10 and Figure 10 summarise the results.
Model | Macro F1 (Pooled) | MCC (Pooled) | Fold Mean | Fold SD | Wilcoxon $\boldsymbol{p}$ | Pooled McNemar $\boldsymbol{p}$ |
|---|---|---|---|---|---|---|
Random Forest | 0.8328 | 0.7643 | 0.7382 | 0.1311 | 0.844 | 0.3966 |
XGBoost | 0.8225 | 0.7528 | 0.7419 | 0.0859 | – | – |
Gradient Boosting | 0.8159 | 0.7453 | 0.7173 | 0.1215 | 0.562 | 1.0000 |
Logistic Regression | 0.7747 | 0.6937 | 0.6745 | 0.1159 | 0.062 | 0.0165 |
Decision Tree | 0.7575 | 0.6593 | 0.6498 | 0.0985 | 0.031 | 0.0002 |

Paired tests again did not detect significant differences among the leading ensembles. XGBoost and gradient boosting produced 34 discordant pooled predictions in each direction (McNemar $p$ = 1.000), while the comparison with random forest gave $p$ = 0.3966. Wilcoxon tests across six non-degenerate folds also yielded non-significant results ($p$ = 0.562 and 0.844, respectively). The larger pooled sample detected differences from logistic regression ($p$ = 0.0165) and decision tree ($p$ = 0.0002). These findings strengthen the evidence that large performance differences among the leading ensembles were not detected under this evaluation. They do not constitute a formal equivalence test or establish that the study had sufficient power to exclude all practically relevant differences.
Among the six folds containing all three risk classes (F1, F2, F4, F5, F6, and F8), XGBoost had the lowest between-fold macro-F1 standard deviation (0.0859). The corresponding values were 0.1311 for random forest and 0.1215 for gradient boosting. Lower variability may be desirable across seasonal conditions, although the small number of eligible folds limits precision. The restricted-class dry-season folds, F3 and F7, remained in pooled testing and were displayed in Figure 10a. Including them in the XGBoost fold mean would have raised it from 0.7419 to 0.763.
Global SHAP attribution identified current river stage as the dominant predictor (mean absolute SHAP value = 0.554), followed by discharge (0.185) and same-day rainfall (0.173; Figure 11). Fourteen-day cumulative rainfall contributed more to the Low- and Medium-risk predictions, whereas shorter rainfall accumulations contributed more to High-risk predictions. This pattern is consistent with different temporal relationships between antecedent wetness and rapid stage increases. SHAP values describe model attribution and should not be interpreted as causal evidence of hydrological mechanisms.

Local attribution was examined for the highest-risk test day, 20 January 2022. The reported contributors were current stage (4.50 m; SHAP +0.456), same-day rainfall (83 mm; +0.353), five-day rainfall (230 mm; +0.171), two-day rainfall (134 mm; +0.153), and discharge (115 m$^3$/s; +0.137). These values provide a model-based explanation that an operator can inspect alongside the observed inputs. The attribution scale and target class should be specified when presenting individual SHAP values in operational interfaces.
The leave-one-family-out ablation is shown in Table 3. Removing raw observations reduced test-year macro F1 by 0.019. Removing antecedent-index or data-quality features reduced it by approximately 0.005 each. Removing lags, rolling statistics, cumulative rainfall, dynamics, or seasonal features reduced macro F1 by 0.003 or less per family. Together, these five lower-marginal-contribution families contained 68 of the 93 predictors (30 lags, 20 rolling features, 7 cumulative features, 7 dynamic features, and 4 seasonal features). Retaining the raw, antecedent, and quality families would yield a candidate 25-feature input contract, a 73% reduction in feature count. With scalar float32 storage, this would reduce the input-vector width from 372 to 100 bytes per record; with float64 storage, the corresponding values are 744 and 200 bytes. These figures exclude metadata and temporal buffers. However, individual ablation effects are not additive. The candidate input contract has not been jointly retrained or validated, and no proportional reduction in model size or end-to-end latency can be inferred. Because derived features use the same physical measurements, potential savings primarily concern buffering, computation, and serialisation rather than sensor acquisition.
Table 11 and Figure 12 summarise inference performance of the complete deployed bundle. The classifier, regressor, feature contract, and risk thresholds occupied 134.3 kB. Across 2,000 single-record measurements, median latency was 0.92 ms, 95th-percentile latency was 1.15 ms, and 99th-percentile latency was 1.39 ms. The maximum observed latency was 5.99 ms. All 364 operational time steps met the one-second service objective, corresponding to approximately 720-fold headroom at the 99th percentile on the benchmark host. Batched inference required an average of 0.008 ms per record at batch size 364. This batching measurement excluded sensor acquisition, historical buffering, feature construction, and communication overhead.
Quantity | Value |
|---|---|
Serialised artefact size | 134.3 kB |
Mean latency | 0.957 ms |
Median latency | 0.916 ms |
95th-percentile latency | 1.146 ms |
99th-percentile latency | 1.389 ms |
Maximum observed latency | 5.991 ms |
Time steps within the 1 s objective | 100.0% |
Headroom against the 1 s objective | 720$\times$ |
Amortised latency at batch = 364 | 0.008 ms per record |

Figure 13 shows the simulated operational state through the test year, including observed and predicted stage, risk classifications, active warning periods, and dispatch events. Under the probability thresholds and one-step persistence setting described in Section 3.6, the warning-state contingency table contained 188 hits, 11 misses, 21 false alarms, and 144 correct negatives (Table 12). Probability of detection was 0.945, false-alarm ratio was 0.101, critical success index was 0.855, and Heidke skill score was 0.822. The classifier produced 138 Medium-risk and 71 High-risk prediction-days, totalling 209 elevated prediction-days. Every elevated prediction passed its class-specific probability threshold, and the one-step persistence setting imposed no additional filtering. Thus, these settings did not reduce active warning-days in the simulation. De-duplication reduced 209 warning-days to 66 distinct dispatches, equivalent to an alert load of 18.1% of test days. The observed dispatch reduction was attributable to de-duplication, not to probability gating or persistence filtering.

Quantity | Value | Quantity | Value |
|---|---|---|---|
Hits | 188 | POD | 0.9447 |
False alarms | 21 | FAR | 0.1005 |
Misses | 11 | CSI | 0.8545 |
Correct negatives | 144 | HSS | 0.8217 |
Days with a warning in effect | 209 | POFD | 0.1273 |
Distinct dispatches | 66 | Alert load (% of days) | 18.1% |
Table 13 reports sensitivity to forecast lead time and simulated telemetry degradation. At one-, two-, and three-day horizons, macro F1 decreased from 0.788 to 0.685 and 0.631, respectively. Nash–Sutcliffe efficiency decreased from 0.872 to 0.585 and 0.423. Performance was strongest at the one-day horizon. The longer-horizon results reflected the constraints of daily observations and the absence of forecast meteorological forcing.
Condition | Macro F1 | Accuracy | RMSE (m) | NSE |
|---|---|---|---|---|
Forecast Lead Time | ||||
$t+1$ day | 0.7882 | 0.8132 | 0.352 | 0.8715 |
$t+2$ days | 0.6854 | 0.7245 | 0.6338 | 0.5847 |
$t+3$ days | 0.6313 | 0.6657 | 0.7476 | 0.4225 |
Telemetry Quality at $\boldsymbol{t+1}$ | ||||
Clean (BMKG) | 0.7882 | 0.8132 | 0.3527 | 0.8715 |
Nominal IoT (1$\times$ noise, 2% dropout) | 0.7793 | 0.8049 | 0.3552 | 0.8697 |
Degraded IoT (2$\times$ noise, 8% dropout) | 0.7641 | 0.7912 | 0.4052 | 0.8304 |
Severe IoT (4$\times$ noise, 15% dropout) | 0.7655 | 0.7857 | 0.3816 | 0.8496 |
Performance was less sensitive to the simulated telemetry disturbances. Under nominal noise and 2% packet loss, macro F1 decreased by 0.009. With fourfold noise and 15% packet loss, the reduction relative to clean data was approximately 0.023. Nash–Sutcliffe efficiency remained above 0.83 in the evaluated disturbance settings. Multi-day feature aggregation may explain part of this robustness, but the simulation does not establish performance under real field failures.
Table 14 shows the counterfactual scenario outputs. Its High-risk percentage refers to model-predicted days: 71 of the 364 test-day predictions were High (19.5%) at baseline. By contrast, Table 2 reports 58 observed High-risk days (15.9%). Doubling rainfall increased the proportion of High-risk days from 19.5% to 30.2% and increased the surrogate-estimated mean inundated area by 79% relative to baseline. The compound scenario, which combined 50% higher rainfall, wetter antecedent conditions, and a 0.2 m stage offset, produced the largest median stage response. Because the stage–inundation relation was not hydraulically calibrated, these values represent relative scenario sensitivities rather than absolute inundation forecasts.
Scenario | Median Stage (m) | P95 Stage (m) | Mean Area (ha) | $\boldsymbol{\Delta}$ Area (%) | Model-Predicted High-Risk Days (%) |
|---|---|---|---|---|---|
S0 Baseline | 1.223 | 3.162 | 42.0 | +0.0 | 19.5 |
S1 Rainfall +25% | 1.228 | 3.729 | 51.7 | +23.0 | 23.4 |
S2 Rainfall +50% | 1.268 | 4.053 | 61.1 | +45.4 | 26.6 |
S3 Rainfall +100% | 1.282 | 4.274 | 75.2 | +79.1 | 30.2 |
S4 Wet antecedent | 1.227 | 3.160 | 41.8 | -0.4 | 19.5 |
S5 Extreme compound | 1.389 | 4.034 | 65.5 | +55.9 | 28.6 |
S6 Dry antecedent | 1.184 | 2.813 | 32.1 | -23.7 | 15.7 |
5. Discussion
Interpretation is limited to the single gauge and the observed 2018–2022 hydro-meteorological regime. The rolling-origin analysis provided additional within-station evaluation periods but not spatial validation. Accordingly, predictive comparisons, feature-attribution patterns, and deployment measurements should be interpreted in this specific data and hardware context until independently replicated.
The leading tree ensembles had different observed macro-F1 scores, but the reported paired tests did not identify significant differences among them. This finding illustrates the need to separate numerical rankings from inferential conclusions. Small differences in a single test sample may not be reliable enough to justify a deployment choice. The rolling-origin analysis added temporal test periods and detected significant differences for some simpler baselines. Nevertheless, non-significant tests should not be described as demonstrating statistical equivalence without a prespecified equivalence margin and an appropriate equivalence-testing procedure.
When available evidence does not clearly distinguish candidate models on predictive performance, deployment cost can inform selection alongside uncertainty and operational requirements. In this study, XGBoost required approximately 41 times less storage and had approximately 175 times lower 99th-percentile inference latency than random forest on the benchmark host. These measured differences were much larger in relative terms than the observed differences in macro F1. Consequently, selecting the highest point estimate without considering computational requirements would overlook a substantial resource trade-off. The proposed cost-based criterion remains conditional on this dataset, the benchmark configuration, and the range of predictive differences that the evaluation could detect.
Under the evaluated input representations, the LSTM, GRU, and TCN pipelines did not outperform the engineered-feature XGBoost pipeline. This finding is consistent with evidence of strong tree-ensemble performance on moderate-sized tabular datasets [11] and in data-scarce hydrological settings [12]. However, approximately 1,050 training sequences were available to the deep models, and the input representations differed. The tree models received engineered rainfall accumulations, rolling features, antecedent indices, and quality flags, whereas the sequence models used raw time windows. Earlier research on runoff simulation also examined deep-learning model components and inputs [37]. Therefore, the observed performance differences cannot be attributed to architecture alone. They support a pipeline-specific comparison under the available record and feature representations.
Two implications follow. First, repeated training seeds are important because sequence-model variability reached a standard deviation of 0.022 macro F1 for the TCN. Second, future comparisons should control input representation. For example, researchers could compare raw-lagged XGBoost with sequence models or provide comparable engineered summaries to both model families. Such experiments would be needed before drawing general conclusions about relative architectural performance.
Explainable AI has been applied to streamflow modelling [38], flood susceptibility [39], and disaster-loss estimation [40]. In the present study, feature attribution differentiated contributions from longer antecedent rainfall histories and short-duration accumulations. These patterns were hydrologically interpretable, but attribution methods alone cannot establish that a model has learned physical causation rather than statistical associations. Their primary contribution is to make model behaviour more transparent and open to domain-specific scrutiny.
Local attributions can also support operational review. Presenting important model inputs and their contributions allows an operator to examine the basis of an elevated-risk prediction. Such explanations may improve documentation when warning decisions are later reviewed, provided that the reported attribution scale and uncertainty are clear. Feature-family ablation also suggested opportunities to simplify historical buffering and feature computation. Because engineered features were calculated from the same measured variables, this potential simplification does not imply an equivalent reduction in physical sensors.
Warning verification depended on the operating policy specified in Section 3.6. The observed probability of detection was 0.945 and the false-alarm ratio was 0.101. Medium- and High-risk probability thresholds (0.40 and 0.35) were heuristic settings, not thresholds selected by a formal cost–loss analysis. All 209 elevated predictions exceeded their corresponding thresholds in the 2022 replay, and one-step persistence imposed no further filtering. Therefore, the operationally relevant observed counts were 11 missed event-days, 21 false-alarm days, and 66 de-duplicated dispatches. Different thresholds or longer persistence rules may change these outcomes and should be tested against agency-defined costs and warning priorities.
Warning states and dispatch events serve different purposes. A warning may remain active for several days even though only one notification is dispatched for the episode. Scoring the 66 de-duplicated dispatches against all elevated days yielded a POD of 0.291, whereas scoring the active warning state yielded 0.945 on the same predictions. The latter represents day-level warning coverage; the former does not measure whether a warning remained active. Operational studies should therefore state the verification unit explicitly when reporting detection metrics.
Spatial coverage is the main constraint on generalisation. The study provides repeated temporal evidence from one gauge but no independent evidence for catchments with different rainfall regimes, channel geometry, land cover, or response times. The resulting model rankings, threshold settings, and deployment trade-offs may differ at other stations. External holdout gauges are therefore required before extending the findings beyond the observed catchment. The record also exhibited a change in class prevalence: High-risk days increased from about 10% during training to 16% during testing. This shift coincided with lower test-year performance, although the analysis did not isolate its causal contribution. Across rolling-origin folds, the 70th-percentile threshold increased from 1.120 m to 1.330 m. These observations motivate monitoring and reassessing stage-band thresholds over time rather than assuming they remain fixed [35].
Five years of observations from one gauge cannot reliably separate long-term non-stationarity from interannual variability. Rolling-origin evaluation assessed temporal robustness within the observed period but did not identify the physical drivers of the shift. Longer records are needed to characterise temporal drift, and independent gauges are needed to assess spatial transfer. The two requirements address different sources of uncertainty. For the distinct problem of short-response hazards, recent small-river flash-flood forecasting [41] and urban water-level prediction using radar rainfall [42] illustrate potential directions for improved temporal resolution.
6. Conclusion
This study evaluated a six-layer, digital-twin-inspired edge-AI pipeline for one-day-ahead flood-risk stage bands and river-stage prediction at a single Indonesian gauge. On the held-out test year, the model achieved a macro F1-score of 0.788 and Nash–Sutcliffe efficiency of 0.872. Warning-state verification gave a probability of detection of 0.945 and a false-alarm ratio of 0.101. The complete model bundle occupied approximately 134 kB and achieved a 99th-percentile inference latency of 1.39 ms on the benchmark host. The synchronised state layer supported relative scenario assessment but was not a geometry-resolved hydraulic digital twin.
XGBoost, gradient boosting, and random forest showed no statistically detectable differences in the reported paired comparisons, including the 728-day rolling-origin evaluation. This finding does not establish formal equivalence. Sequence models trained on raw 30-day windows did not demonstrate a performance advantage under the evaluated input representations, but their comparison with engineered-feature trees was not architecture controlled. Deployment cost differed much more substantially among the leading ensembles than their observed predictive scores. The findings therefore support considering model footprint and latency when selecting among candidates whose predictive differences remain unresolved. Replication across stations, representation-matched modelling, and benchmarking on target hardware are necessary before broader operational recommendations can be made.
Two methodological findings also affect the interpretation of warning systems. First, warning-state verification and dispatch-event counting produced different detection statistics because de-duplication reduced notifications without reducing the duration of active warnings. Second, including folds that lacked an observed risk class would have raised the fold-mean macro F1 by 0.021. Explicitly defining the verification unit and checking class composition across evaluation folds can therefore prevent misleading performance summaries.
7. Theoretical Implications
The study highlights an inferential distinction in comparative hydrological machine learning. A model with the highest observed score in one sample is not necessarily demonstrably better than its competitors. Paired testing across multiple disjoint forecast origins can assess whether observed differences are detectable under the evaluation design. However, absence of statistical significance does not define a formal equivalence class without an equivalence margin and a suitable test. Model-selection conclusions should therefore report uncertainty and recognise the distinction between non-detection of a difference and evidence that a difference is sufficiently small.
A second implication concerns the role of computational cost in model selection. Memory and inference latency are often evaluated only after predictive modelling. Here, they provided additional discriminating information because the available tests did not distinguish several leading candidates by predictive skill. This supports joint reporting of predictive uncertainty and execution cost in applied hydrology, consistent with established edge-computing evaluation practices. The relative importance of these criteria depends on the target hardware and operational context.
A third implication concerns comparisons between sequence models and tree ensembles. The sequence architectures did not outperform the engineered-feature XGBoost pipeline on the available record. Because the input representations were different, this result is evidence about the evaluated pipelines rather than the inherent superiority of one architecture. Future studies should jointly consider data volume, feature engineering, and model complexity when designing controlled comparisons.
8. Practical Implications
For resource-constrained flood-warning systems, the results suggest that a compact XGBoost classifier may be a practical option when tested alternatives offer no clear predictive advantage. The complete bundle occupied 134.3 kB and achieved inference latency well below the one-second objective on the benchmark host. These findings indicate technical plausibility, not validated field performance or a universal model-procurement rule. Target-hardware benchmarking remains necessary.
The warning engine also illustrates why alert-policy components should be assessed separately. In the replay, probability thresholds passed all 209 elevated predictions, and one-step persistence did not smooth warnings across days. De-duplication reduced those warning-days to 66 notifications. Warning-state verification yielded a POD of 0.945 and a FAR of 0.101. Agencies should therefore evaluate gating, persistence, and notification frequency independently, using sensitivity analysis and context-specific cost–loss assumptions before deployment.
Interpretability may assist operational decision-making when model inputs and attributions are presented with clear units and uncertainty. Such information can help operators review and document warning decisions. Its usability and effect on decisions, however, were not directly evaluated in this study. Operator-facing interfaces should therefore be assessed in future field trials.
The observed change in stage-band prevalence also indicates a need for monitoring. The 70th-percentile threshold changed by 0.21 m across the reported fold-level recalculations. Operational implementations should track the distribution of stage observations and review thresholds periodically, with any updates assessed against actual flood-event records and agency requirements.
9. Limitations and Future Research
Five principal limitations constrain interpretation and identify priorities for further evaluation.
First, the dataset covered five years at a single gauge. Although rolling-origin testing expanded the pooled temporal sample to 728 days, it did not provide independent spatial evidence. Model comparisons, feature contributions, risk thresholds, and resource trade-offs may differ across hydrological conditions. External validation using geographically independent gauges is therefore required before broader generalisation.
Second, the classification targets were percentile-based river-stage categories rather than observed flood events. No independent inundation or incident register was available. The reported classification and warning scores therefore evaluate stage-band prediction, not verified flood occurrence. Linking gauge records with independently documented flood incidents is an important next step.
Third, inference latency was measured on a benchmark host rather than on the intended field gateway. Telemetry disturbances were simulated using noise, calibration drift, and packet loss. The resource and robustness measurements therefore support feasibility but do not demonstrate performance in operational conditions. Hardware-in-the-loop tests should include sensor acquisition, feature construction, and communication on the target device. Established embedded-inference benchmarking approaches provide useful guidance.
Fourth, the digital-twin-inspired layer used a parameterised trapezoidal stage–inundation relation and synthetic vulnerability weights. It supported synchronised state updates and relative scenario comparison, but did not include surveyed geometry, bidirectional physical coupling, or lifecycle asset representation. Its inundation outputs should therefore not be interpreted as calibrated geographic extents. Future work could integrate surveyed cross-sections, elevation data, and hydraulic modelling, as demonstrated in related digital-twin research.
Fifth, the daily observation interval limited the temporal resolution of warnings. In rapidly responding catchments, relevant flood processes may unfold within hours. Performance also decreased at horizons beyond one day. Sub-daily telemetry and forecast meteorological forcing could improve the usefulness of future warning systems. Related flash-flood forecasting and radar-rainfall-driven water-level prediction studies provide potential directions for further evaluation.
Two additional research needs follow. Energy per inference was not measured and should be included when assessing battery- or solar-powered field devices. Multi-catchment replication should also evaluate whether predictive rankings and deployment trade-offs remain stable across hydrological regimes. If formal statistical equivalence is of interest, future studies should prespecify a practically meaningful equivalence margin and use an appropriate equivalence-testing design.
Conceptualization, M.R.H.; methodology, M.R.H.; software, M.R.H.; validation, M.; formal analysis, M.; writing—original draft preparation, D.H.; writing—review and editing, A.R. and S.S. All authors have read and agreed to the published version of the manuscript.
This work is funded by the Ministry of Higher Education, Science, and Technology of the Republic of Indonesia (Grant number: 136/C3/DT.05.00/PL-MULTITAHUN LANJUTAN/2026).
The daily hydro-meteorological record analysed in this study was obtained from the Indonesian Agency for Meteorology, Climatology and Geophysics (BMKG). Derived datasets, trained model artefacts, the core analysis pipeline, and scripts supporting preprocessing, tabular modelling, explainability, edge benchmarking, scenario analysis, and alerting are available from the corresponding author upon reasonable request.
The authors acknowledge funding from the Ministry of Higher Education, Science, and Technology of the Republic of Indonesia.
The authors declare no conflicts of interest.
During manuscript preparation, ChatGPT was used to assist with language editing and organisation. The authors reviewed and revised the resulting text and retain full responsibility for the accuracy and integrity of the manuscript.
AI | Artificial intelligence |
API | Antecedent precipitation index |
CSI | Critical success index |
DM | Diebold–Mariano test |
EWS | Early-warning system |
FAR | False-alarm ratio |
GRU | Gated recurrent unit |
HSS | Heidke skill score |
IoT | Internet of Things |
KGE | Kling–Gupta efficiency |
LSTM | Long short-term memory network |
MAE | Mean absolute error (m) |
MCC | Matthews correlation coefficient |
NSE | Nash–Sutcliffe efficiency |
PBIAS | Percentage bias |
POD | Probability of detection |
POFD | Probability of false detection |
PR-AUC | Area under the precision–recall curve |
RMSE | Root mean squared error (m) |
ROC-AUC | Area under the receiver-operating characteristic curve |
SHAP | SHapley Additive exPlanations |
TCN | Temporal convolutional network |
XAI | Explainable artificial intelligence |
XGBoost | Extreme gradient boosting |
