Abstract
Short-term forecasting of the Air Quality Index (AQI) can support public health risk management and real-time environmental decision-making. In this study, we propose a multivariate, one-step-ahead time-series forecasting approach based on a Transformer encoder. The model predicts the AQI at the next time point using an observation sequence within a fixed historical window (five time steps in this work), where the input features include AQI and other numerical variables. For data preprocessing, the observation time column is converted into a temporal index, missing values are handled using forward-fill, and Min–Max normalization is fitted on the training set and then applied to the test set to prevent data leakage. Supervised learning samples are constructed using a sliding-window scheme, and the dataset is split into training and test sets in chronological order. The proposed model stacks encoder blocks composed of multi-head self-attention and feed-forward networks, and a causal mask is applied in the attention mechanism to ensure that predictions rely only on historical information. The representation at the final time step is fed into a regression head to output the AQI forecast. To improve reproducibility, we fix random seeds and enable deterministic settings during training. Experimental results on the test set show that the proposed method achieves MSE = 19.84, RMSE = 4.45, and MAE = 3.57, demonstrating its ability to capture short-term temporal dependencies and provide stable AQI forecasting performance.
Author supplied keywords
Cite
CITATION STYLE
Lee, K. C., & Chen, S. Q. (2026). Transformer encoder for one-step-ahead AQI forecasting using multivariate air-quality monitoring data. Frontiers in Environmental Science, 14. https://doi.org/10.3389/fenvs.2026.1815865
Register to see more suggestions
Mendeley helps you to discover research relevant for your work.