LinkedIn ↗ · GitHub ↗ · Berlin, Germany

← From the lab

Experiment · Case studyTime-series forecasting experiment · 2026

Air-quality forecasting with a Temporal Fusion Transformer

Lower average error, weak uncertainty: a transformer that beats a naive baseline on average — and loses where it matters.

Role
Independent experiment · evaluation design
Status
Public source
Disciplines
Data Analytics · AI Engineering
Links
TFT MAE1.125
Persistence MAE1.260
80% interval covers43.0%
Mean absolute error by forecast horizon, TFT versus persistenceTFT error rises from 0.88 at one hour to about 1.15 at 24 hours. Persistence error rises to about 1.43 around 17 hours and falls back to 0.78 at 24 hours. Persistence wins at 1–3 h and 22–24 h.0.500.751.001.251.501h6h12h18h24hforecast horizon · MAE in mg/m³

Values and chart marker are for 12 hours ahead. The lines show errors across all 24 horizons.

TFT medianPersistence baselinePersistence winsTFT 10.7% lower error

Line chart of actual carbon-monoxide measurements, the TFT median forecast and its P10–P90 interval over a week of the test period.
Committed 24-hour forecast versus observed CO, from the source repository.

Question

Can lower average carbon-monoxide forecast error coexist with unreliable uncertainty? The experiment uses hourly CO measurements (mg/m³) from the UCI Air Quality dataset.

Design

The implementation uses PyTorch Forecasting’s TFT rather than writing the architecture from scratch. Training, validation and test periods are split chronologically, and the evaluation covers both the median forecast and the P10–P90 interval. Same-origin persistence — repeating the last observed value for every future hour — is the deliberately simple benchmark the model must beat to justify its complexity.

Measurement

Across all 24 horizons, MAE is 1.109 mg/m³ against 1.203 for persistence: a 7.8% reduction. The 32,437 evaluated forecast-origin/horizon pairs cover 1,374 unique timestamps; overlapping windows are not independent observations.

Where it fails

The nominal 80% interval covers only 43.3% of observations overall. Persistence wins at both ends of the forecast window, including the next hour and the same hour tomorrow. The evidence ledger and chart show the full winning ranges. Lower point error does not establish reliable uncertainty. This is a single-site experiment, not an operational air-quality service.

Inspect the evidence

Code and methodology at source commit 26ee667. The interactive chart uses a local copy of the committed metrics and per-horizon CSV; per-horizon persistence MAE is derived from the same prediction CSV and checked against its aggregate.

Data attribution: Vito, S. (2008), Air Quality, UCI Machine Learning Repository, DOI 10.24432/C59K5F, CC BY 4.0 as documented in the source repository.