Skip to content

[Enhancement] Add Temporal Patch Shuffle (TPS) augmentation for forecasting and classification #852

Description

@jafarbakhshaliyev

Summary

I would like to propose adding Temporal Patch Shuffle (TPS), a model-agnostic data augmentation method, to TSlib. TPS is not a new model — it is an augmentation technique that can be applied to any existing backbone in TSlib (DLinear, PatchTST, TSMixer, TiDE, LightTS, TimesNet, etc.) to improve generalization.

Motivation

TSlib currently includes augmentation utilities in utils/augmentation.py for classification tasks (jitter, scaling, rotation, permutation, time warping, etc.), but has no augmentation support for forecasting tasks. Data augmentation for forecasting is an active research area, and several recent methods (FreqMask/Mix, WaveMask/Mix, Dominant Shuffle) have shown clear benefits. TPS outperforms all of these.

What TPS does

TPS extracts overlapping temporal patches, selectively shuffles a subset of low-variance patches, and reconstructs the sequence by averaging overlapping regions. It has three hyperparameters: patch length, stride, and shuffle rate.

Results

TPS has been evaluated on all five TSlib backbone families (TSMixer, DLinear, PatchTST, TiDE, LightTS) across nine long-term and four short-term forecasting benchmarks, consistently outperforming 13 existing augmentation baselines. TPS also extends to classification (UCR/UEA benchmarks with MiniRocket/MultiRocket).

Model MSE Improvement over 2nd-best augmentation
TSMixer 2.61%
DLinear 7.50%
PatchTST 2.84%
TiDE 2.08%
LightTS 10.51%
  • Paper: https://arxiv.org/abs/2604.09067
  • Code: https://github.com/jafarbakhshaliyev/TPS

What the contribution would look like

Option A (minimal): Add tps() function to utils/augmentation.py alongside existing augmentations (jitter, scaling, etc.), with a corresponding --tps argparse flag. This is a ~40-line NumPy function that fits the existing pattern exactly.

Option B (broader): Add a forecasting augmentation module (e.g., utils/augmentation_forecast.py) that includes TPS and could later accommodate other forecasting augmentations. This would integrate with exp/exp_long_term_forecasting.py at the batch level, applying augmentation during training.

I am happy to implement either option. I would appreciate guidance on which approach fits TSlib's roadmap, and whether you would consider augmentation contributions before formal publication (the paper is under review).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions