One Batch Is Enough: A Unified Dataset Condensation Framework for General Time Series Analysis

May 17, 2026 · View on GitHub

In this paper, we propose UniTSC, a unified dataset condensation framework for general time series analysis.

The framework of UniTSC consists of three stages: (i) Task-Adaptive Synthetic Initialization: We initialize latent parameters Xsyn\mathcal{X}_{syn} by utilizing task-adaptive priors. (ii) Multi-View Hybrid Encoder: A shared backbone extracts holistic representations by integrating temporal, spectral, and topological views. (iii) Tri-Space Alignment: We optimize Xsyn\mathcal{X}_{syn} by minimizing the divergence between student and expert models across parameter, frequency, and topology spaces, yielding the condensed dataset S\mathcal{S}.

Extensive experiments show that UniTSC retains up to 97.9% of downstream performance using as little as 0.01% of the original training data, revealing that a single batch-equivalent budget (\textless\textless 128 samples) is sufficient to capture the essential dynamics of complex time-series data.

Overview of UniTSC

Environment

  • Python.version = 3.9.21
  • PyTorch.version = 2.5.1
  • Other dependencies are listed in requirements.txt.

Datasets

We evaluate UniTSC on across four mainstream time-series tasks on 22 datasets, with detailed statistics summarized in the table below.

TasksDatasetsDimLengthTrainTestInformation
ForecastingETTm1, ETTm279634,36911,425Electricity
ETTh1, ETTh27968,4492,785Electricity
Weather219636,69610,444Weather
Electricity3219618,2215,165Electricity
Traffic8629612,0893,413Transportation
ImputationETTm1, ETTm279634,36911,425Electricity
ETTh1, ETTh27968,4492,785Electricity
Weather219636,69610,444Weather
Electricity3219618,2215,165Electricity
Classification (UEA)EthanolConcentration31751261263Alcohol
FaceDetection1446258903524Face
Handwriting3152150850Handwriting
Heartbeat61405204205Heart Beat
JapaneseVowels1229270370Voice
PEMS-SF963144267173Transport
SelfRegulationSCP16896268293Health
SelfRegulationSCP271152200180Health
SpokenArabicDigits139365992199Voice
UWaveGestureLibrary3315120320Gesture
Anomaly DetectionSMAP25100135,183427,617Spacecraft
PSM25100132,48187,841Server
SMD38100708,405708,420Server
SWaT51100495,000449,919Infrastructure
MSL5510073,72958,317Spacecraft

Please refer to TSLib for the download links of each dataset.

Code Structure

UniTSC/
├── README.md                                   # Official README
├── requirements.txt                            # pip dependency list for quick environment setup
├── run.py                                      # Unified entry that parses args and dispatches tasks
├── framework.jpg                               # README figure
├── buffer_forecast.py                          # Forecasting experts training
├── buffer_imputation.py                        # Imputation experts training
├── buffer_cls.py                               # Classification experts training
├── buffer_ad.py                                # Anomaly detection experts training
├── distill_forecast.py                         # Forecasting dataset condensation
├── distill_imputation.py                       # Imputation dataset condensation
├── distill_cls.py                              # Classification dataset condensation
├── distill_ad.py                               # Anomaly detection dataset condensation
├── data_provider/                              # Dataset loaders and splits
│   ├── data_factory.py                         # Chooses the proper DataLoader per task
│   ├── data_loader.py                          # Generic TS reader with sliding-window logic
│   └── uea.py                                  # Parsers for UEA formats
├── models/                                     # All model implementations
│   ├── backbone.py                             # Main forecasting models
│   ├── layers.py                               # Reusable attention / conv / embedding blocks
│   └── embed.py                                # Shared primitives
├── tools/                                      # Utility toolbox
│   ├── augmentation.py                         # Augmentations for classification / detection
│   ├── data_generator.py                       # Task-adaptive synthetic initialization
│   ├── dtw.py                                  # DTW calculator
│   ├── exp.py                                  # Training utilities for four tasks
│   ├── masking.py                              # Imputation masking
│   ├── metrics.py                              # MSE / MAE / DTW and other metrics
│   ├── reparam_module.py                       # Reparameterizes modules
│   ├── timefeatures.py                         # Time feature generators
│   └── utils.py                                # General helpers such as EarlyStopping
├── scripts_buffer/                             # Bash scripts for generate expert buffer
│   ├── forecast/                               # Forecasting scripts
│   ├── imputation/                             # Imputation scripts
│   ├── classification/                         # Classification scripts
│   └── anomaly_detection/                      # Anomaly detection scripts
└── scripts_distill/                            # Bash scripts for dataset condensation
    ├── forecast/                               # Forecasting scripts
    ├── imputation/                             # Imputation scripts
    ├── classification/                         # Classification scripts
    └── anomaly_detection/                      # Anomaly detection scripts

Quick Start

bash scripts_buffer/forecast/etth1.sh
bash scripts_distill/forecast/etth1.sh