Application of Long Short Term Memory, Gated Recurrent Unit, and Hybrid LSTM-GRU in Air Quality Forecasting Based on Air Pollution Index in Semarang City
DOI:
https://doi.org/10.15294/ujm.v14i2.27771Keywords:
LSTM, GRU, Hybrid LSTM-GRU, Peramalan, Kualitas UdaraAbstract
Air pollution harms human health, and Semarang City is among the most polluted cities in Indonesia, so forecasts of the Air Pollution Index (ISPU) are needed to anticipate poor air quality. This study compares three deep learning methods for forecasting the ISPU: Long Short Term Memory (LSTM), which retains long-term information through its memory cell and gates and overcomes the vanishing gradient problem; Gated Recurrent Unit (GRU), which has fewer gates and parameters and therefore trains faster; and a Hybrid LSTM-GRU, which is expected to combine the long-term memory of LSTM with the efficiency of GRU. The data are 35,064 hourly observations of seven pollutant parameters (PM10, PM2.5, SO2, CO, O3, NO2, and HC) from the Semarang City Environmental Agency, from January 1, 2021 to December 31, 2024. After time-based interpolation of missing values, min–max normalization, an 80:20 split, and a sliding window of 24 hours, each model was trained with two numbers of neurons and three learning rates (six combinations per model) and evaluated with the mean RMSE and MAE. The best LSTM (100 neurons, learning rate 0.001) gave a mean RMSE of 0.7631 and MAE of 0.2470, the best GRU (50 neurons, 0.001) 0.7600 and 0.2215, and the best Hybrid LSTM-GRU (50 neurons, 0.001) 0.7597 and 0.2193. The Hybrid model is the most accurate, but its advantage over GRU is very small (0.04% in RMSE and 1.0% in MAE) and is clearer against LSTM in MAE (11.2%). The 24-hour forecast for January 1, 2025 shows PM2.5 as the determining parameter, with unhealthy air quality in the early morning and late evening. The forecasts can support early warning; the models should still be tested with repeated runs and against baseline models.