Fig 1.
Overview of the data preprocessing pipeline for multi-target weather forecasting.
Starting from raw monthly weather data (1961–2022, 24 stations) from the Bangladesh Agricultural Research Council (BARC), the process includes missing data handling via KNN imputation (k = 5), integration of seasonal features (e.g., Month_sin, Month_cos) and lagged statistics (e.g., 1-3 month lags, rolling means/std), outlier detection using IQR with replacement by nearest non-outlier values, correlation-based feature selection (removing highly correlated features with Pearson’s > 0.9), data normalization (Min-Max scaling to [0,1]), and quality validation (e.g., using Matplotlib and Seaborn). The data is split temporally and spatially: training (1961–2012), validation (2013–2015), and test (2016–2022) sets, sorted by station code and year, with exclusion of flat stations (e.g., Tangail, Syedpur, Mongla etc.). This ensures no information leakage and prepares sequential inputs (time steps = 12) for the HTC-LSTM-Attn model.
Fig 2.
Architecture of the proposed Hierarchical Temporal Convolutional Long Short-Term Memory with Attention (HTC-LSTM-Attn) model for one-month-ahead forecasting of maximum temperature and humidity.
The input window consists of a sequence of 12 time steps with multivariate features (e.g., solar radiation, PET, sunshine hours, wind speed, cloud coverage, rainfall, and seasonal/lagged components). Hierarchical Temporal Convolutional (HTC) layers extract multi-scale patterns using Conv1D filters (e.g., 96, 64, 96 filters with kernels ), followed by batch normalization, ReLU activation, and concatenation. Bidirectional LSTM layers (96 units) capture forward and backward sequential dependencies, with an attention mechanism computing context vectors, softmax-weighted scores (e.g.,
), and concatenated hidden states using
. The output layers include dense units (256) with ReLU, dropout (0.1), and final predictions for temperature (
) and humidity (
). This design uses purely historical temporal data up to month t to predict the next month (horizon = 1), ensuring no future data leakage.
Fig 3.
Hyperparameter tuning process using Keras Tuner for the HTC-LSTM-Attn model.
Using the training and validation sets (Adam optimizer, MSE loss, batch size 32, maximum 50 epochs, patience 10), a RandomSearch tuner performs 15 trials (2 executions per trial) to minimize validation MSE. The search optimizes key parameters including HTC filters (96 at , 64 at
, 96 at
), Conv1D filters (128), LSTM units (96), dense units (256), and dropout rates (0.1 for HTC/LSTM and 0.5 for dense). The tuned hyperparameters are then applied to build the final HTC-LSTM-Attn model for forecasting, ensuring robustness across both temporal and spatial test sets while preventing overfitting.
Table 1.
Overall station-level metrics for the HTC-LSTM-Attn model (Temporal Test).
Table 2.
Overall station-level metrics for the HTC-LSTM-Attn model (Spatial Test: 5 unseen stations).
Table 3.
Selected station-level metrics for the HTC-LSTM-Attn model (Temporal).
Table 4.
Selected station-level metrics for the HTC-LSTM-Attn model (Spatial).
Table 5.
Performance comparison for maximum temperature forecasting.
Table 6.
Performance comparison for humidity forecasting models.
Fig 4.
Temperature prediction comparisons for selected stations (Temporal).
Fig 5.
Humidity prediction comparisons for selected stations (Temporal).
Fig 6.
Prediction (Temperature & Humidity) comparisons for selected stations (Temporal)-Bar Chart.
Fig 7.
Temperature prediction comparisons for selected stations (spatial).
Fig 8.
Humidity prediction comparisons for selected stations (Spatial).
Fig 9.
Prediction (Temperature & Humidity) comparisons for selected stations (Spatial)-Bar Chart.
Fig 10.
Overall time-series comparison of temperature and humidity predictions (Temporal).
Fig 11.
Overall time-series comparison of temperature and humidity predictions (Temporal)- Bar Chart.
Fig 12.
Overall time-series comparison of temperature and humidity predictions (Spatial).
Fig 13.
Overall time-series comparison of temperature and humidity predictions (Spatial)- Bar Chart.
Fig 14.
Scatter plot comparison of predicted vs. actual values (Temporal).
Fig 15.
Scatter plot comparison of predicted vs. actual values (Spatial).
Table 7.
Ablation study results comparing HTC-LSTM-Attn and HTC-LSTM (no attention).
Fig 16.
Ablation Study.
Table 8.
Ablation study results comparing HTC-LSTM-Attn and HTC-LSTM (no attention) across five runs for temperature and humidity forecasting.
Fig 17.
Attention Weights Across 12 Time Steps.
Fig 18.
Weather Stations in Bangladesh with Temperature and Forecast Accuracy.
This map was generated using data from Natural Earth [1:10m Cultural Vectors]. Natural Earth data is in the public domain; therefore, the map is presented under a CC BY 4.0 license.
Table 9.
Calibrated Uncertainty Metrics (95% Prediction Intervals).