Some air-pollution policies move emissions in time rather than removing them. Beijing's daytime ban on heavy diesel trucks pushed truck traffic into the night. At night the lowest layer of the atmosphere, where pollution mixes, cools and becomes shallow, so diesel soot accumulates close to the ground. Long-term measurements show the resulting nighttime spikes in elemental and organic carbon (Ji et al.) and in light-absorbing aerosol (He et al.). The health events these exposures might trigger, such as ambulance calls for respiratory or cardiac crises, are rare at the hourly scale and follow their own daily rhythm. People are awake, active and outdoors during the day, so more emergencies occur then whatever the air quality.
A machine-learning model trained to predict such events faces two problems at once. Positives are scarce, and the hour of day predicts both pollution and events. Standard fixes for imbalance make the second problem worse. Oversampling or reweighting the rare positives mostly duplicates daytime hours, which teaches the model that the daytime pollution profile is what matters and hides any delayed effect of nighttime exposure. Environmental epidemiology already solves the confounding half of this problem. The time-stratified case-crossover design compares each event hour with the same hour of the day on other days of the same month. We propose to use that comparison as the negative-sampling rule and the training loss for a flexible neural risk model. In this way one design choice handles both the class imbalance and the confounding by daily schedule.
Core Claim
For rare acute events driven by environmental time series, choose negatives the way a case-crossover study chooses control hours: same district, same hour of day, same day-type, other days in the same month. Then train with a matched-set (conditional) likelihood. This should recover exposure–response relationships that random-negative, reweighted or SMOTE-style classifiers get wrong. The main target is the delayed effect of nighttime, displaced diesel exposure on events the following morning and day.
The likelihood is principled, not a heuristic. Model the event rate in district $s$ at hour $t$ as
$$\lambda_s(t) = \exp\big(\alpha_{k(s,t)} + f_\theta(x_{s,t-L:t})\big),$$
where $\alpha_k$ is a free baseline for matched stratum $k$, and the stratum absorbs hour-of-day, weekday, season and district behaviour. $f_\theta$ is a neural network applied to the preceding $L$ hours of multi-pollutant and meteorological history $x$. Conditioning on one event in each matched set cancels every $\alpha_k$, which leaves
$$P(\text{case} \mid \text{set } k) = \frac{\exp f_\theta(x_{\text{case}})}{\sum_{j \in k} \exp f_\theta(x_j)}.$$
This is a softmax over the event hour and its three or four referent hours. The class ratio is fixed by design rather than tuned. The behavioural baseline cannot leak into $f_\theta$, and "false negatives" cannot occur, because a referent hour is by construction one with no event in that stratum. This is the matched-design counterpart of the false-negative problem that SIP-LDL identifies in contrastive learning on imbalanced time series. SIP-LDL repairs in-batch negatives with pseudo-labels learned from data. We remove the problem by choosing negatives from the study design.
The prediction this sets up is falsifiable. The Shenzhen hourly study reports a weaker nighttime effect: a 1.4% increase in all-cause ambulance calls per interquartile-range rise in PM2.5 at night, against 1.7% in the day. That study stratifies by when the event occurs. If nighttime soot triggers events 4–12 hours later, after people wake, its effect would be booked as daytime risk. A model that attributes risk by when the exposure occurred should then find substantial lagged weight on nighttime, diesel-tracer-rich hours. If it does not, the "behavioural insulation" explanation offered in that paper stands.
Research Program
The first component is the exposure representation. Hourly district-level fields of PM2.5, PM10, NO2, O3 and CO, plus elemental carbon or absorption where measured (Beijing), are interpolated from the station networks used by AirPhyNet. We use its released code (kethmih/AirPhyNet) both to fill station gaps and, in the forecasting variant, to produce exposure 0–4 hours ahead. A proxy for nighttime boundary-layer depth is added as a covariate, built from the meteorological variables available. Since NO2 is the most widely available diesel-related tracer, we also build an explicit "displaced-exposure" feature: concentration in the trucking window relative to the same district's daytime level.
The second component is the model. $f_\theta$ is a small temporal convolution or GRU over a 48-hour history, read out through a distributed-lag layer so that the lag–response curve can be inspected directly. It is trained with the conditional loss above.
The third component is a semi-synthetic benchmark. Event rates are generated from real Beijing and Shenzhen hourly pollution histories, a realistic diurnal behavioural baseline, and a planted exposure–response. The planted response includes a nighttime-EC effect with a 4–12 hour lag and a weaker concurrent daytime PM effect. We sweep event rarity down to below 0.1% of district-hours, the regime the research file identifies for acute events. Because the true response curve is known, attribution can be scored directly.
The fourth component is real data. The target is hourly ambulance-dispatch records of the kind used in the Shenzhen study, which requires a data-sharing collaboration. As a fallback we use any city registry with true calendar timestamps and district of pickup. De-identified EHR benchmarks with shifted dates, such as MIMIC-IV, cannot be linked to real pollution and are used only to motivate the problem: COP-IV shows the familiar gap between ranking quality and rare-event precision, with 86.86% AUROC and 17.24% PR-AUC for PubMedBERT on emergency-department diagnoses. An optional extension weights district exposure by hourly phone-derived population, following Liu et al.. It tests whether commuter redistribution changes the attribution, since residence-based exposure is known to be biased (Bashan et al.).
Baselines
The naive reference point is a model of behaviour alone: a Poisson model with hour, weekday, holiday, month and district effects and no pollution inputs. Any pollution model must beat it on held-out event likelihood and on PR-AUC at the district-hour level, or the pollution signal is not worth predicting from.
The strongest existing method for this exact question is the time-stratified case-crossover design with a distributed lag nonlinear model (DLNM), a regression that fits smooth, possibly nonlinear effects across a range of lags. This is the method used in the Shenzhen hourly study. It reports increases per interquartile-range rise over a 24-hour lag of 1.8% for all-cause calls and 2.5% for respiratory calls (PM2.5, 24.0 µg/m³), 2.0% for all-cause calls with PM10, and 1.7% versus 1.4% for day versus night. We reproduce it on our data with the same referent scheme, confounder set, lag span and multi-pollutant inputs. Its spline degrees of freedom get the same tuning budget as our model's hyperparameters, chosen on the same validation months. To beat it, our model must achieve higher held-out conditional log-likelihood on real data and lower error in the recovered lag–response curve on the semi-synthetic benchmark. Above all it must recover the planted nighttime lagged effect where DLNM, which is single-pollutant per term and additive, does not. No hourly predictive metric such as PR-AUC is reported for this setting: we found no reported result on Lacuna for pollution-triggered hourly event classification.
The strongest machine-learning competitors are gradient-boosted trees, chosen because the pediatric study found tree ensembles (Random Forest, Gradient Boosting, CatBoost) on par with one another and strong on tabular clinical data. We run three variants. The first uses inverse-frequency class weights. The second uses SMOTE-ENN resampling as in that study, which reports 92.58% F1 on a different, curated task that is not comparable here. The third is a model with the same features as ours, explicit hour-of-day inputs and focal loss. All three receive identical features, splits and tuning budgets. We also include a daily random-forest count model in the style of the Seoul NEDIS study, for which no reported error metric was found on Lacuna.
The ablation that isolates the key ingredient keeps $f_\theta$ and the features fixed and changes only how negatives are chosen. Negatives are drawn at random with class weights, matched by month only without the hour-of-day constraint, or matched by full case-crossover rules. A second ablation removes the displaced-exposure and boundary-layer features to test whether the nighttime finding depends on them.
Why not just…?
Why not just fit a DLNM case-crossover model, which already controls for time of day? This is the most serious alternative, and for single-pollutant effects that are close to linear it may be all that is needed. The Shenzhen study found a nearly linear response with no threshold. Our model differs only in that $f_\theta$ can represent multi-pollutant interactions, such as soot multiplied by shallow-boundary-layer conditions, and longer lagged structure. The semi-synthetic benchmark settles the question. If DLNM recovers the planted nighttime effect as accurately as our model, and matches it on real held-out likelihood, we will report that the matched design is what matters and the neural network adds nothing. That would still be a useful negative result for the ML imbalance literature.
Why not just train a boosted classifier with class weights and hour-of-day as a feature? Including hour as a feature does not stop the model from using pollution features that are correlated with hour as substitutes for behaviour. Reweighting also changes the effective mix of hours in training. The month-only and random-negative ablations measure this directly. The prediction is that these models score well on raw PR-AUC by learning the daily rhythm but misattribute the planted nighttime effect to daytime hours. If they recover it correctly, our central motivation fails.
Why not just use SMOTE or a contrastive method like SIP-LDL? Synthetic positives interpolated between event hours are mostly daytime blends, and they create histories that never occurred. Tousignant et al.'s warning about memorisation under oversampling (as summarised in the file) applies here. SIP-LDL addresses false negatives but learns which negatives to trust. Here the study design supplies a cleaner answer at no cost. We include SMOTE-ENN as a baseline rather than argue against it in the abstract.
Why not just use 24-hour average exposure? Daily averaging removes the separation between night and day that the hypothesis depends on. The Shenzhen study locates most acute risk within 0–4 hours. The ablation that replaces hourly inputs with daily means quantifies how much attribution is lost.
Proposed Experiments
The decisive semi-synthetic check plants a known nighttime-EC effect with a 4–12 hour lag and sweeps event rarity from 1% to 0.01% of district-hours. It then scores each method on integrated squared error of the recovered lag–response curve and on the fraction of attributable risk assigned to exposures in the trucking window. The matched-negative neural model should stay accurate down to the rarest settings. Random-negative and resampled classifiers should push attribution toward concurrent daytime hours as rarity increases. A null-effect control, with behaviour only and no pollution effect, checks that no method invents a pollution signal from the daily rhythm.
On real hourly dispatch data, the metrics are held-out conditional log-likelihood and PR-AUC with calibration at the district-hour level for absolute risk. Absolute risk is recovered by combining $f_\theta$ with the behaviour-only baseline. We also report the estimated attributable fraction by exposure hour, compared against the published 1.7% and 1.4% day–night split.
The policy-relevant test is a contrast between Beijing districts inside and outside the heavy-truck restriction zone. The displacement hypothesis predicts larger nighttime-exposure attribution inside the zone. A placebo test that shifts the trucking window by 12 hours should remove that difference.
The forecasting variant feeds AirPhyNet's 0–4 hour exposure forecasts into $f_\theta$ and reports how much PR-AUC is lost relative to using observed exposure. This tells us whether early warning of next-morning respiratory risk is practical.
References
- Impact of air pollution control measures and regional transport on carbonaceous aerosols in fine particulate matter in urban Beijing, China: insights gained from long-term measurement
- An intensive study of aerosol optical properties in Beijing urban area
- Time-Series Contrastive Learning Against False Negatives and Class Imbalance
- Associations Between Hourly Ambient Particulate Matter Air Pollution and Ambulance Emergency Calls: Time-Stratified Case-Crossover Study
- AirPhyNet: Harnessing Physics-Guided Neural Networks for Air Quality Prediction
- Revisiting Clinical Outcome Prediction for MIMIC-IV
- Assessment of the Dynamic Exposure to PM2.5 Based on Hourly Cell Phone Location and Land Use Regression Model in Beijing
- Mobility-driven estimate reveals elevated air pollution exposure and socioeconomic disparities beyond residence-based approaches in Boston
- Explainable AI-Driven Clinical Decision Support for Mortality Risk Stratification in Pediatric Respiratory Disorders
- A Machine Learning-Based Study of the Effects of Air Pollution and Weather in Respiratory Disease Patients Visiting Emergency Departments