Floods are a frequent disaster in Semarang city, Indonesia, requiring an accurate and real-time forecasting system to support effective risk management. This study introduces a hybrid long short-term memory-gated recurrent unit (LSTM-GRU) model with an attention mechanism (attention-enhanced LSTM-GRU) designed to improve the accuracy of flood predictions based on multiparameter internet of things (IoT) data. The novelty of this study lies in the integration of the attention mechanism within the hybrid LSTM-GRU architecture, which allows the model to provide adaptive focus on features and time periods that most influence flood occurrences. The dataset used consists of 1,736 time series samples covering rainfall and water level data collected every 15 minutes from IoT sensors in the upstream and downstream areas of Semarang, Indonesia. Experimental results show that the hybrid model with the attention mechanism provides the best performance with a mean absolute percentage error (MAPE) value of 1.4%, root mean squared error (RMSE) of 1.05, and coefficient of determination (R²) reaching 0.96. This model also achieves 100% recall for the “Danger” class, demonstrating its reliability in detecting critical conditions. The practical implication of this research is the availability of a flood prediction model that is accurate, adaptive, and can be directly applied to IoT-based early warning systems in flood-prone urban areas.
Copyrights © 2026