Temporal Patch Shuffle (TPS): Leveraging Patch-Level Shuffling to Boost Generalization and Robustness in Time Series Forecasting

📄 Paper (Hugging Face): https://huggingface.co/papers/2604.09067
📄 Paper (arXiv): https://arxiv.org/abs/2604.09067
💻 Original GitHub: https://github.com/jafarbakhshaliyev/TPS


Paper

This repository implements the method proposed in the paper:
👉 https://arxiv.org/abs/2604.09067


Temporal Patch Shuffle (TPS): Leveraging Patch-Level Shuffling to Boost Generalization and Robustness in Time Series Forecasting arXiv

Abstract

Data augmentation is a crucial technique for improving model generalization and robustness, particularly in deep learning models where training data is limited. Although many augmentation methods have been developed for time series classification, most are not directly applicable to time series forecasting due to the need to preserve temporal coherence. In this work, we propose Temporal Patch Shuffle (TPS), a simple and model-agnostic data augmentation method for forecasting that extracts overlapping temporal patches, selectively shuffles a subset of patches using variance-based ordering as a conservative heuristic, and reconstructs the sequence by averaging overlapping regions. This design increases sample diversity while preserving forecast-consistent local temporal structure. We extensively evaluate TPS across nine long-term forecasting datasets using five recent model families (TSMixer, DLinear, PatchTST, TiDE, and LightTS), and across four short-term forecasting datasets using PatchTST, observing consistent performance improvements. Comprehensive ablation studies further demonstrate the effectiveness, robustness, and design rationale of the proposed method.

Key Contributions

  • TPS (Temporal Patch Shuffle):
    • Time Series Forecasting implementation: time_series_forecasting/utils/augmentations.py
    • Univariate classification implementation (MiniRocket): time_series_classification/minirocket/src/augmentation.py
    • Multivariate classification implementation (MultiRocket): time_series_classification/MultiRocket/augmentation.py

TPS Architecture

Repository Structure

  • time_series_forecasting/: forecasting models + augmentation pipeline (TPS and others)
  • time_series_classification/:
    • minirocket/: univariate classification (MiniRocket) + augmentations (TPS and others)
    • MultiRocket/: multivariate classification (MultiRocket) + augmentations (TPS and others)

Quick Start

1) Time Series Forecasting

Dataset

Download all forecasting datasets from:

Create the dataset folder and put the downloaded files inside:

mkdir -p time_series_forecasting/dataset

Install & Run

git clone https://github.com/jafarbakhshaliyev/TPS.git
cd TPS

python3 -m venv .venv_forecasting
source .venv_forecasting/bin/activate

pip install -r time_series_forecasting/requirements.txt

# Install PyTorch (choose the right command for your CUDA/CPU setup):
# https://pytorch.org/get-started/locally/

bash time_series_forecasting/scripts/example.sh

Notes:

  • time_series_forecasting/scripts/example.sh now runs relative to the repo
  • The training entrypoint is time_series_forecasting/run_longExp.py.

2) Univariate Time Series Classification (MiniRocket)

Dataset (UCR Archive)

The MiniRocket code expects TSV files under a folder you set in time_series_classification/minirocket/src/main.py via UCR_PATH.

Install & Run

cd TPS

python3 -m venv .venv_minirocket
source .venv_minirocket/bin/activate

pip install numpy pandas scikit-learn tqdm

# Run the provided script (SLURM `srun`):
bash time_series_classification/minirocket/scripts/example.sh

# If you're not on SLURM, run directly:
cd time_series_classification/minirocket
python3 ./src/main.py --dataset MiddlePhalanxOutlineAgeGroup

3) Multivariate Time Series Classification (MultiRocket)

Dataset (UEA Multivariate Archive)

Place .ts files under (recommended):

mkdir -p time_series_classification/MultiRocket/data/Multivariate_ts

Install & Run

MultiRocket has its own pinned dependencies in time_series_classification/MultiRocket/requirements.txt.

cd TPS

python3 -m venv .venv_multirocket
source .venv_multirocket/bin/activate

pip install -r time_series_classification/MultiRocket/requirements.txt

# The provided script uses SLURM `srun` and contains cluster-specific paths.
# For a portable local run, prefer calling `main.py` directly:
cd time_series_classification/MultiRocket
python3 main.py --datapath ./data/Multivariate_ts --problem FaceDetection --iter 5 --verbose 1

Augmentation Code (Direct Links)

Results

Headline numbers from the tables:

  • Long-term forecasting (9 datasets × 4 horizons): TPS is rank-1 in most settings (e.g., DLinear: 35/36 wins for MSE; 34/36 wins for MAE).
  • Short-term traffic forecasting (PeMS03/04/07/08 with PatchTST): TPS wins on most metrics (e.g., PeMS03: MSE/MAE 0.104/0.216).
  • Classification (mean ± std): TPS improves both univariate MiniRocket (0.804 ± 0.0098) and multivariate MultiRocket (0.643 ± 0.0253).

Citation

If you find this repository useful, please cite our paper:

@misc{bakhshaliyev2026temporalpatchshuffletps,
      title={Temporal Patch Shuffle (TPS): Leveraging Patch-Level Shuffling to Boost Generalization and Robustness in Time Series Forecasting}, 
      author={Jafar Bakhshaliyev and Johannes Burchert and Niels Landwehr and Lars Schmidt-Thieme},
      year={2026},
      eprint={2604.09067},
      archivePrefix={arXiv},
      primaryClass={cs.LG},
      url={https://arxiv.org/abs/2604.09067}, 
}

Acknowledgements

This work builds upon and extends prior research on time series data augmentation, particularly frequency-domain and wavelet-based methods:

These methods form strong baselines for time series forecasting augmentation, and TPS is designed as a complementary approach that operates directly in the temporal domain via patch-level transformations.

We also acknowledge that parts of the experimental pipeline and augmentation comparisons build upon publicly available implementations of these methods.

Additionally, TPS is evaluated on modern forecasting architectures, including:

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Papers for bakhshaliyev/TPS