completed Jan 2024 - Jul 2025

PanelFormer: A Robust Transformer for Panel Time Series Forecasting

#Panel Time Series #Forecasting #Deep Learning #Transformers #Temporal Fusion Transformer #Attention Mechanisms
PanelFormer: A Robust Transformer for Panel Time Series Forecasting

Overview

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.

Motivation & Objectives

Traditional models struggle to adapt to non-stationarity, diverse temporal patterns and complex entity interactions within panel data, and model performance varies sharply from one panel type to another. Developing a generalisable architecture that adapts to varying panel characteristics is therefore crucial for reliable forecasting in critical domains. The project pursued the following objectives:

Benchmarking Existing Models – To analyse the performance of established deep learning models (LSTM, GRU, BiLSTM, BiGRU and TFT) across 11 datasets representing all eight panel data combinations.

Architectural Analysis – To evaluate the strengths and weaknesses of these architectures in handling different dataset characteristics such as completeness, aggregation level and series length.

Model Development – To design and implement a new model with innovative architectural features that improves on TFT across the evaluated datasets.

Comparative Evaluation – To compare the new model against TFT and intermediate variants using Mean Absolute Percentage Error (MAPE).

Impact & Results

Performance

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.

Key Contributions

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.

Real-world Impact

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.

Gallery

Project poster presented at the Final Year Project Showcase 2025

Project poster presented at the Final Year Project Showcase 2025

PanelFormer architecture with parallel seasonal and trend pathways

PanelFormer architecture with parallel seasonal and trend pathways

Project Team

Kajaani Balabavan

Kajaani Balabavan

Undergraduate Researcher

Focused on applying machine learning and deep learning to time series analysis, with an emphasis on panel time series forecasting.

Shabthana Johnson

Shabthana Johnson

Undergraduate Researcher

Focused on machine learning and deep learning techniques for time series analysis and NLP, contributing to robust panel forecasting models.

Sathurgini Uthayakumar

Sathurgini Uthayakumar

Undergraduate Researcher

Focused on building a robust deep neural network model for panel time series analysis, combining deep learning with full-stack development skills.