Panel time series data, observations collected over time from multiple entities such as countries, firms, customers or regions, underpin forecasting in economics, environment, transport and healthcare. Panel datasets are highly heterogeneous: they differ in the number of entities and time steps, in their level of aggregation, and in whether every entity is observed at every time step. In practice no single deep learning model performs consistently across these characteristics, and established architectures such as LSTM, GRU and the Temporal Fusion Transformer (TFT) show poor robustness across varying panel structures.
This project introduces a three-dimensional categorisation of panel data, by completeness (balanced vs. unbalanced), aggregation level (micro vs. macro) and temporal span (short vs. long), yielding eight panel types, and assembles 11 real-world datasets spanning all of them. Building on TFT, the team proposes PanelFormer, which adds five targeted innovations: segment-wise attention for localised temporal patterns, cross-entity attention to model inter-entity dependencies, learnable multi-scale series decomposition to separate trend and seasonal components, parallel processing pathways (an LSTM and attention pathway for seasonal signals and a Gated Residual Network stack for trend), and adaptive weighting that dynamically combines the two components for the final prediction.
Evaluated across 11 diverse panel datasets covering eight panel type combinations, PanelFormer outperformed the baseline Temporal Fusion Transformer on 9 of 11 datasets, with an average MAPE improvement of 7.99%. The largest gain was on Foreign Exchange (24.4%, MAPE reduced from 3.91% to 2.96%), where cross-entity attention captures cross-currency dependencies, followed by COVID Recovered (18.1%, 50.49% to 41.36%), COVID Deaths (12.3%, 35.67% to 31.29%), Surface Temperature (11.5%, 5.30% to 4.69%) and Electricity (10.4%, 217.49% to 194.91%). Moderate improvements were obtained on COVID Confirmed (7.2%), CO2 Emissions (5.8%), Air Traffic (5.7%) and Sales (4.9%). Performance degraded on the low-frequency annual Stock Price (2.5%) and Africa GDP (9.8%) datasets, where limited temporal resolution restricts effective decomposition. An ablation study over incremental variants (TFT + SA, TFT + SD, TFT + SA + SD, TFT + SA + SD + CW) showed that individual components produce mixed results, while their integration in the full model yields consistent improvements.
PanelFormer Architecture
An enhanced Temporal Fusion Transformer combining segment-wise attention (reducing attention complexity from O(n²) to O(n·s)), cross-entity attention, learnable multi-scale series decomposition, parallel seasonal and trend pathways, and adaptive component weighting for robust panel forecasting.
Panel Data Categorisation and Benchmark
A three-dimensional framework classifying panel data by completeness, aggregation level and temporal span into eight panel types, together with a benchmark of 11 real-world datasets spanning sales, air traffic, GDP, climate, foreign exchange, stock prices, electricity, CO2 emissions and COVID-19.
Open-Source Panelformer Library
A Python library released on PyPI that supports the full modelling pipeline, from preprocessing and training to evaluation and visualisation, with source code published in the AAIVU GitHub organisation.
PanelFormer provides a single, robust forecasting model for heterogeneous panel time series, reducing the need to select a different architecture for each dataset. Its consistent gains on long, macro-level and daily-frequency panels make it suitable for forecasting in healthcare, environmental, economic and energy domains, and its public release as a pip-installable library allows researchers and practitioners to apply and extend it directly. The project also produced a survey on statistical and deep learning models for panel data analysis and a comparative study of recurrent neural network models for panel forecasting, both submitted for journal review.
Project poster presented at the Final Year Project Showcase 2025
PanelFormer architecture with parallel seasonal and trend pathways