WorksComputer Science
CAFE-AQI: Coverage-Aware Day-Ahead AQI Forecasting with Early Warning and Conformal Uncertainty in Bangladesh
Abstract
Next-day air quality forecasting often assumes city records are equally complete and independent. However, an audit of a large Bangladesh dataset revealed a sharp coverage expansion after August 2022 and showed that 103 city labels correspond to only 61 unique AQI trajectories. To address these issues, this paper presents CAFE-AQI, a coverage-aware framework for forecasting next-day maximum AQI. It also estimates the probability of Unhealthy-or-worse conditions (AQI >= 151). Data were divided chronologically into training (2022-2023), calibration (2024), and testing (2025). To prevent duplicate records from dominating training and evaluation, identical trajectories were weighted. The framework combines temporal and pollutant features with a five-neighbor spatial context. It also includes a class-balanced warning head and risk-conditional conformal calibration aimed at providing early warnings and prediction intervals. Evaluation on the duplicate-balanced 2025 data gave an MAE of 9.76, an RMSE of 15.04, and an R-squared value of 0.910 for CAFE-AQI. Its MAE was 3.63 AQI lower than persistence (95% CI: 3.49-3.76), with lower errors in each of the 61 trajectory groups. For unhealthy-air warnings, the F1-score was 0.908 and the AUROC was 0.982. The nominal 90% intervals covered 92.09% of observations. When an entire spatial block was excluded from training, the MAE remained 10.66, showing that the lightweight model transferred reasonably well to unseen locations.
Introduction
Air pollution is both a long-term health burden and a daily warning challenge. The WHO identifies particulate matter, , , , and CO as major health threats [1], while the World Bank has emphasized the need for stronger monitoring and early-warning systems in Bangladesh [2]. A practical next-day system should therefore forecast AQI severity and warn when it may exceed 151, the start of the Unhealthy category [3].
Machine-learning models can identify nonlinear temporal and spatial patterns. Because of their efficacy, these models have replaced time-series methods in air quality forecasting [4], [5]. However, accuracy can be misleading when the evaluation ignores data structure. Random temporal splits may leak future information, while separating city labels that share the same trajectory can create false spatial generalization. Reliable evaluation must preserve temporal order, and along with that, it should also account for dependent observations [6], [7].
These issues are especially important for the Bangladesh AQI dataset used here. It contains 3,193,198 hourly records from 103 labeled cities. But geographic coverage expanded in August 2022. The city labels represent only 61 unique AQI trajectories. Treating all labels as independent could result in duplicate evidence across training and testing. It is also possible that a random split could mix past, future, and identical trajectories. We first audit these dependencies to define a valid forecasting period and evaluation setting.
We propose CAFE-AQI, which is a lightweight, coverage-aware framework that predicts the next-day maximum AQI and the probability of AQI reaching the Unhealthy threshold of 151. It combines causal temporal and pollutant features with information from five nearest neighbors. A dedicated warning head handles class imbalance along with risk-conditional split-conformal intervals that represent prediction uncertainty [8].
The main contributions are:
A coverage and duplication audit identifying the August 2022 data transition and 61 unique trajectory groups among 103 city labels.
A lightweight dual-head framework for next-day AQI forecasting, Unhealthy-air warnings, uncertainty intervals, and grouped explanations.
A leakage-resistant protocol using 2022–2023 for training, 2024 for calibration, and 2025 for final testing, supported by baselines, ablations, group-level uncertainty analysis, and unseen-group transfer tests.
Data Audit and Problem Formulation
Data Product and Temporal Coverage
The analyzed data product contains 3,193,198 hourly records associated with 103 Bangladeshi city labels and spans January 1, 2000, to November 23, 2025 [9]. This dataset has also been used for the purpose of characterizing long-term air quality trends, seasonal patterns, and spatial pollution regimes across Bangladesh [10]. Each record provides a timestamp, city identifier, geographic coordinates, AQI, and seven atmospheric variables: PM, PM, CO, CO, NO, SO, and O. Because the available metadata do not establish that every row represents an observation from a verified physical monitoring station, we refer to these records as city-referenced air-quality estimates rather than station measurements.
The dataset has data from 103 locations, but before August 4, 2022, only 2 of them actually had data. After that date, all 103 started reporting. Also, the way AQI and CO were measured changed on that same date. We therefore use only the common coverage period beginning August 4, 2022. Forecasting starts on August 19, after the required 14-day history.
The dataset had 3,193,198 records with no duplicates. 2,472 rows were removed because AQI was missing, and 3,190,726 valid records remained. CO was dropped since most of its values (69.50%) were missing. Hourly data was grouped into daily averages, and a day was only removed if the AQI or a necessary feature was missing.
Duplicate-Trajectory Audit
No duplicate rows were found, but this does not mean that all 103 city series are independent. We created a complete daily maximum-AQI series for each city, retained missing dates, and compared series with matching SHA-256 hashes.
The audit found only 61 unique trajectories. Twenty-eight groups contained two to four cities with identical AQI values and missingness patterns, while 33 were single cities. To prevent repeated trajectories from receiving extra influence, each city-day was weighted as
where is the number of cities sharing the same trajectory. These weights were used for model fitting and evaluation. Cities with identical trajectories were also kept in the same partition during transfer experiments to prevent leakage.
Forecasting Tasks and Leakage Control
For city , CAFE-AQI predicts the maximum AQI of the following calendar day:
where indicates an Unhealthy-or-worse day under the U.S. AQI definition [3]. Using only information available by the end of day , the model estimates
Only consecutive day pairs are retained, and the split follows the target date. City identity is not used as a feature. After removing incomplete pairs, 122,879 city-days remain. Regression is trained with trajectory-group weights:
which prevents duplicated trajectories from receiving greater influence simply because they appear under multiple city labels.
Proposed CAFE-AQI Framework
Framework Overview
CAFE-AQI is designed as a lightweight forecasting and early-warning framework rather than a computationally heavy forecasting network. As illustrated in Figure 1, the audited city-day table is first converted into causal temporal, pollutant, and geographic features. We built two models: one to predict tomorrow’s peak AQI (with a special confidence range) and another to predict the chance of unhealthy air. We gave equal importance to repeated weather patterns, ignored city names, and finalized all model settings before testing on 2025 data.

Figure 1. CAFE-AQI workflow. The task-specific models are trained on 2022–2023 data, calibrated on 2024, and evaluated on the untouched 2025 test set.
The term dual-head refers here to two separate learners fitted on the same audited forecasting table. It does not imply a shared neural encoder. This separation allows the continuous forecast and the public-health warning to be optimized for their respective objectives.
Causal Temporal and Neighbour Features
For every city and forecast date , the regression input is
The model uses 24 features total. Twelve of these features describe the current day’s AQI, recent changes, and seasonal patterns. They include daily statistics (maximum, mean, standard deviation), lagged values (1 and 7 days ago), rolling averages (3, 7, and 14 days), volatility, day-to-day change, and seasonal encodings. The other twelve are the daily mean and maximum values of six key pollutants (PM, PM, CO, NO, SO, and O). Spatial context is constructed using the five geographically nearest cities. Distances are calculated from latitude and longitude using the haversine formula. For a neighbour , the normalized inverse-distance weight is
where is the distance in kilometres and indicates that the neighbour has a valid AQI value on day . The neighbourhood AQI and its dispersion are
The four neighbor features are , , the local-to-neighbor gap , and the neighborhood change . Only information available on day is used. This construction should be understood as a fixed geographic neighborhood representation, not as a learned graph neural network.
Dual-Head Forecasting and Warning
The regression branch uses a histogram-based gradient-boosting model [11] with all 30 features to predict the next-day maximum AQI:
It minimizes duplicate-weighted absolute error and uses 180 iterations, a learning rate of 0.08, 31 leaf nodes, 30 samples per leaf, and regularization of 1.0.
A separate classifier estimates the probability of Unhealthy-or-worse air:
This branch uses only the 24 temporal and pollutant features, and does not include location and neighbor information. Training applies both trajectory-group weights and inverse-frequency class weights. The warning threshold is chosen on the 2024 calibration set by maximizing duplicate-balanced F1 and then fixed for the 2025 test set.
Risk-Conditional Conformal Calibration
Prediction intervals are calibrated using only the 2024 residuals. Repeated observations from the same trajectory group and target date are first collapsed into one group-day.
| Partition | Target dates | City-days | Groups |
| Training | Aug. 19, 2022–Dec. 31, 2023 | 51,500 | 61 |
| Calibration | Jan. 1–Dec. 31, 2024 | 37,698 | 61 |
| Future test | Jan. 1–Nov. 23, 2025 | 33,681 | 61 |
Table 1. Chronological partition used in all experiments.
For absolute residuals , the global 90% conformal radius is
Because uncertainty changes with AQI severity, predictions are divided into four predefined ranges: , , , and . Separate lower and upper residual quantiles are estimated for each range, giving
For AQI ranges with too few calibration examples (fewer than 100), we use a general interval instead of a range-specific one. We also add a safety mechanism that widens the forecast interval for high-risk predictions to ensure we catch at least 95% of very unhealthy days (AQI 201+). All these settings are finalized before the 2025 evaluation.
Related features are grouped together for model auditing. Grouped permutation importance measures how each feature group affects test MAE. Local occlusion measures how replacing a feature group with its median changes the warning probability. These tools help explain the model, but do not prove causation.
Experimental Protocol
Chronological Evaluation Design
Samples were split by target date rather than randomly in order to reflect real-world use. The model was trained on 2022–2023 data, calibrated on 2024, and tested on the untouched 2025 period. August 19, 2022 was the first usable target date because 14 prior days were needed to construct the longest rolling features.
All models used the same valid samples, and city identity was not included as a feature. Standardization was fitted only on the training set. Trajectory weights from (1) prevented duplicated city trajectories from receiving extra influence. No 2025 outcomes were used for model selection, calibration, or warning-threshold tuning. Transfer was also tested by holding out complete trajectory groups. One experiment used randomly selected groups, while the spatial experiment held out one of five geographic clusters. Both used the same number of groups, and all cities sharing an identical trajectory were kept together.
Baselines and Ablation Settings
The AQI regressor was compared with persistence, weekly-naive, ridge, Extra Trees, and XGBoost baselines. Persistence reused the maximum AQI from day , and weekly-naive used the value from seven days earlier. These provide important references because day-ahead AQI is strongly autocorrelated. The machine-learning baselines used the same 24 temporal and pollutant features and duplicate-balanced training weights.
To examine each feature group, the same histogram-gradient regressor was trained with increasingly complete inputs:
temporal and seasonal features;
temporal and pollutant features;
temporal, pollutant, and coordinate features; and
all features, including neighbor context.
This design isolates the added value of pollutants, location, and neighboring AQI conditions without changing the model.
The warning head was compared with current-AQI persistence, thresholded regression forecasts, and class-balanced logistic regression. Its decision threshold was selected on 2024 by maximizing duplicate-balanced over values from 0.05 to 0.95, then frozen for the 2025 test.
Uncertainty experiments compared a global conformal interval, risk-conditional intervals, and the full severity-guarded method. Coverage auditing and trajectory weighting were retained throughout all experiments. Instead of just ablating a model feature, their removal would alter the valid data regime and unit of evidence.
Evaluation Metrics and Statistical Analysis
Day-ahead forecasts were evaluated using duplicate-balanced MAE, RMSE, and , with MAE as the primary metric:
where is the inverse size of the corresponding trajectory group. Warning performance was measured using precision, recall, , balanced accuracy, and AUROC. AUPRC and Brier score were reported as supplementary measures. Prediction intervals were assessed by duplicate-balanced coverage and mean and median width, both overall and across AQI-severity levels.
Statistical analysis was performed across the 61 unique trajectory groups. Daily errors were first averaged within each group, and improvement over persistence was calculated as
where favours CAFE-AQI. A 95% confidence interval was estimated using 2,000 group-level bootstrap samples, together with a one-sided Wilcoxon signed-rank test. Resampling by trajectory group avoids treating duplicated and temporally related observations as independent. All experiments used a fixed random seed of 42.
Results and Discussion
Future-Year Forecasting Performance
On the untouched 2025 test set, CAFE-AQI achieved an MAE of 9.76, an RMSE of 15.04, and an of 0.910 (Table II). It reduced MAE by 27.1% compared with persistence and by 66.5% compared with the weekly-naive baseline. It also outperformed GPU-XGBoost and Extra Trees by 5.2% and 6.7%, respectively.
| Model | Feat. | Device | MAE | RMSE | U-recall | Runtime (s) | |
| HGB: temporal only | 12 | CPU | 12.52 | 17.64 | 0.877 | 0.814 | 4.22 |
| HGB: + pollutant | 24 | CPU | 9.95 | 15.31 | 0.907 | 0.815 | 3.81 |
| HGB: + coordinates | 26 | CPU | 9.90 | 15.16 | 0.909 | 0.815 | 3.73 |
| CAFE-AQI: + neigh. context | 30 | CPU | 9.76 | 15.04 | 0.910 | 0.817 | 4.04 |
| GPU-XGBoost | 24 | GPU | 10.29 | 15.28 | 0.907 | 0.785 | 3.53 |
| Extra Trees | 24 | CPU | 10.46 | 15.30 | 0.907 | 0.754 | 6.61 |
| Ridge regression | 24 | CPU | 15.29 | 19.89 | 0.843 | 0.504 | 0.06 |
| Persistence | — | — | 13.39 | 19.26 | 0.853 | 0.868 | < 0.01 |
| Weekly naive | — | — | 29.12 | 38.79 | 0.403 | 0.709 | < 0.01 |
Table II. Duplicate-balanced results on the untouched 2025 test set. Runtime includes training and test inference.
The ablation shows that pollutant measurements provided most of the gain, reducing MAE from 12.52 to 9.95. Adding coordinates and neighbor context produced smaller improvements (Section 5.5).
CAFE-AQI also outperformed persistence across all 61 trajectory groups (Figure 2 and Figure 3). The mean improvement was 3.63 AQI, with a group-bootstrap 95% confidence interval of 3.49–3.76 AQI. The one-sided Wilcoxon test confirmed this improvement (, ).

Figure 2. City-level 2025 MAE improvement over persistence. Marker size represents the number of 2025 test city-days. Green markers indicate lower MAE than persistence.

Figure 3. Bootstrap distribution of group-level improvement.
By contrast, an invalid random city-day split produced an MAE of 6.15, 37.0% below the valid future-year result. This shows how random splitting can substantially overstate performance when related temporal and duplicated trajectories appear in both training and test data.
Unhealthy-Air Warning Performance
Using the threshold of 0.475 selected on the 2024 calibration set, the CAFE-AQI warning head achieved an -score of 0.908, with 0.943 precision and 0.876 recall on the 2025 test set (Table III). It also obtained an AUROC of 0.982 and an AUPRC of 0.976.
Thresholding the AQI forecast gave the highest precision but missed 19.5% of Unhealthy-or-worse events. The dedicated warning head improved recall from 0.805 to 0.876 and from 0.883 to 0.908. Its advantage over logistic regression was smaller, suggesting that the warning signal was already well captured by the causal features, although CAFE-AQI remained the best overall model.
Prediction-Interval Reliability
Both the fixed and risk-conditional intervals fell slightly below the nominal 90% coverage, reaching 88.6% and 88.7%, respectively (Table IV). However, risk conditioning reduced the mean interval width from 45.81 to 42.19 AQI. Adding the severe-risk guard raised coverage to 92.1%, while selectively widening intervals for high-risk forecasts.
The guard detected 97.2% of AQI 201-or-higher events while flagging 27.5% of the test observations. Coverage varied across severity levels and was lowest for Unhealthy for Sensitive Groups at 86.8% (Figure 4). The interval results should therefore be interpreted as marginal coverage over the full test set, not as equal coverage within every AQI category.

Figure 4. Coverage and interval width across true AQI categories.
Transfer to Unseen Trajectory Groups
When entire trajectory groups were held out, MAE rose from 9.76 to 10.22 for random unseen groups and to 10.66 for an unseen spatial block, increases of 4.7% and 9.1%, respectively. remained high at 0.899 and 0.887.
| Metric | Persistence | Regression forecast | Logistic warning baseline | CAFE-AQI warning head |
| Precision | 0.868 | 0.979 | 0.934 | 0.943 |
| Recall | 0.868 | 0.805 | 0.871 | 0.876 |
| F1 | 0.868 | 0.883 | 0.901 | 0.908 |
| Bal. acc. | 0.894 | 0.897 | 0.917 | 0.922 |
| AUROC | – | – | 0.980 | 0.982 |
| AUPRC | – | – | 0.971 | 0.976 |
| Brier | – | – | 0.0524 | 0.0488 |
| Threshold | 151 AQI | 151 AQI | 0.530 | 0.475 |
Table 3. Duplicate-balanced warning results on the 2025 test set. Learned thresholds were selected using only 2024 data.
| Method | Coverage | Mean width | Median width | ||
| Fixed split-conformal | 0.886 | 45.81 | 45.81 | ||
| Risk-conditional | 0.887 | 42.19 | 42.14 | ||
| Risk-conditional + guard | 0.921 | 52.28 | 42.14 | ||
| Evaluation | Groups | MAE | RMSE | U-recall | |
| Seen-group future test | 0 | 9.76 | 15.04 | 0.910 | 0.817 |
| Random unseen groups | 13 | 10.22 | 15.88 | 0.899 | 0.791 |
| Unseen spatial block | 13 | 10.66 | 15.55 | 0.887 | 0.846 |
Table 4. Uncertainty and trajectory-transfer results on the test set. (a) Conformal interval performance. (b) Trajectory-group transfer performance.
The larger drop under spatial transfer suggests that geographic extrapolation is harder than generalizing to randomly held-out groups. But the degradation was modest since the model retains useful structure for unseen locations within the same data source. These results should not be treated as external validation on a different monitoring network.
Model-Audit Findings
The audit showed that PM drove most of the model’s predictions. Permuting its features increased MAE by 33.57 AQI (Figure 5), compared with 3.15 for PM and 1.16 for O. Coordinates and neighbor context had almost no effect (0.05 and −0.01 AQI), consistent with their small ablation gain from 9.90 to 9.76 MAE. Thus, CAFE-AQI’s performance mainly came from pollutant and temporal information rather than geographic context.

Figure 5. Grouped permutation importance of the regression features. was the dominant predictive feature group.
For Cox’s Bāzār on January 30, 2025, the model predicted a warning probability of 1.000. The observed maximum AQI was 172. Replacing PM features with their training medians reduced this probability by 0.145. All other feature changes had negligible effects. This case shows the model’s reasoning but does not imply causation.
Overall Interpretation
From the results, it is apparent that reliable next-day AQI forecasting did not require a large model. CAFE-AQI, which runs on a standard CPU, beat the persistence baseline for all 61 trajectory groups. The most important inputs were pollutant measurements, especially PM. Both neighbour data and dedicated warning head provided smaller gains. However, interval coverage remained uneven across severity levels, and so findings are limited to the audited Bangladesh data source.
Limitations
This study has a few limitations. Identical AQI trajectories were found under multiple city labels; although trajectory-group weighting reduced their influence, the results should not be interpreted as evidence from 103 fully independent stations. Moreover, all experiments used the same Bangladesh AQI data source. The unseen-group and spatial-block tests show the model can generalize within this dataset, but independent validation at real monitoring stations is necessary before deployment. The model also does not include weather or emission data. The inclusion of these data could help predict sudden pollution events. Prediction intervals were not equally reliable across all AQI levels. The feature importance analysis explains what the model uses, but it does not explain what causes pollution. Future work should focus on independent observations, richer inputs, and continued calibration.
Conclusion
This study presented CAFE-AQI, a compact framework for next-day AQI forecasting, unhealthy-air warning, and uncertainty estimation. Under the strict 2025 future-year evaluation, CAFE-AQI achieved an MAE of 9.76 AQI, improving upon persistence by 27.1%. It also produced the best warning performance, with an F1-score of 0.908, while the severity-guarded prediction intervals achieved 92.1% overall coverage. Importantly, the forecasting improvement was observed across all 61 independent trajectory groups.
The findings show that careful chronological evaluation, duplicate-aware weighting, and pollutant information (particularly ) were more important than model complexity. The geographic neighbor context provided a small but noticeable improvement. Although CAFE-AQI provides a useful and transparent forecasting framework, it is crucial to remember that, before thinking about real-world deployment, validation using independently verified monitoring data would be required.
References
- [1]World Health Organization, “WHO Global Air Quality Guidelines: Particulate Matter (PM₂.₅ and PM₁₀), Ozone, Nitrogen Dioxide, Sulfur Dioxide and Carbon Monoxide,” WHO, Geneva, Switzerland, 2021. [Online]. Available: https://www.who.int/publications/i/item/9789240034228
- [2]World Bank, “Breathing Heavy: New Evidence on Air Pollution and Health in Bangladesh,” World Bank, Washington, DC, USA, 2022. [Online]. Available: https://documents.worldbank.org/en/publication/documents-reports/documentdetail/909440011162223258
- [3]U.S. Environmental Protection Agency, “Technical Assistance Document for the Reporting of Daily Air Quality—The Air Quality Index (AQI),” Office of Air Quality Planning and Standards, Research Triangle Park, NC, USA, Rep. EPA-454/B-24-002, May 2024. [Online]. Available: https://nepis.epa.gov/Exe/ZyPURL.cgi?Dockey=P101P0QX.TXT
- [4]X. Yi, J. Zhang, Z. Wang, T. Li, and Y. Zheng, “Deep distributed fusion network for air quality prediction,” in Proc. 24th ACM SIGKDD Int. Conf. Knowl. Discov. Data Mining, 2018, pp. 965–973, doi: 10.1145/3219819.3219822.
- [5]I. E. Agbehadji and I. C. Obagbuwa, “Systematic review of machine learning and deep learning techniques for spatiotemporal air quality prediction,” Atmosphere, vol. 15, no. 11, Art. no. 1352, 2024, doi: 10.3390/atmos15111352.
- [6]V. Cerqueira, L. Torgo, and J. Mozetič, “Evaluating time series forecasting models: An empirical study on performance estimation methods,” Mach. Learn., vol. 109, no. 11, pp. 1997–2028, 2020, doi: 10.1007/s10994-020-05910-7.DOI
- [7]D. R. Roberts et al., “Cross-validation strategies for data with temporal, spatial, hierarchical, or phylogenetic structure,” Ecography, vol. 40, no. 8, pp. 913–929, 2017, doi: 10.1111/ecog.02881.DOI
- [8]A. N. Angelopoulos and S. Bates, “Conformal prediction: A gentle introduction,” Found. Trends Mach. Learn., vol. 16, no. 4, pp. 494–591, 2023, doi: 10.1561/2200000101.DOI
- [9]T. Paul, “Bangladesh Air Quality Index (AQI) Dataset (2000–2025): Historical Hourly Air Pollution Data Across 103 Cities,” Mendeley Data, V1, 2026, doi: 10.17632/9j447cynb9.1.DOI
- [10]M. R. Islam, R. Jany, M. F. Islam, R. B. Zaman, M. Saifuddin, and S. Sultana, “Twenty-five years of air quality in Bangladesh: Trends, seasonality, and spatial pollution regimes,” arXiv:2608.11652, 2025. [Online]. Available: https://doi.org/10.48550/arXiv.2608.11652
- [11]J. H. Friedman, “Greedy function approximation: A gradient boosting machine,” Ann. Statist., vol. 29, no. 5, pp. 1189–1232, 2001, doi: 10.1214/aos/1013203451.DOI