Table of Contents
Fetching ...

Time Weaver: A Conditional Time Series Generation Model

Sai Shankar Narasimhan, Shubhankar Agarwal, Oguzhan Akcin, Sujay Sanghavi, Sandeep Chinchali

TL;DR

This work tackles the problem of generating realistic time series conditioned on heterogeneous metadata (categorical, continuous, and time-varying). It proposes Time Weaver, a diffusion-based generator that front-loads metadata processing with a dedicated tokenizer and self-attention block to produce a metadata embedding used by a denoiser backbone (CSDI or SSSD). A key contribution is the Joint Frechet Time Series Distance (J-FTSD), a metric learned via contrastive multi-modal embeddings to evaluate conditional generation, capturing both time-series realism and metadata specificity. Empirical results across energy, healthcare, pollution, and traffic datasets show Time Weaver surpasses GAN baselines by substantial margins in downstream classification tasks and distributional similarity, demonstrating the practical potential for scenario analysis, capacity planning, and privacy-preserving data synthesis. The work also discusses limitations (slower inference/training) and future directions (distillation, broader forecasting/anomaly detection).

Abstract

Imagine generating a city's electricity demand pattern based on weather, the presence of an electric vehicle, and location, which could be used for capacity planning during a winter freeze. Such real-world time series are often enriched with paired heterogeneous contextual metadata (e.g., weather and location). Current approaches to time series generation often ignore this paired metadata. Additionally, the heterogeneity in metadata poses several practical challenges in adapting existing conditional generation approaches from the image, audio, and video domains to the time series domain. To address this gap, we introduce TIME WEAVER, a novel diffusion-based model that leverages the heterogeneous metadata in the form of categorical, continuous, and even time-variant variables to significantly improve time series generation. Additionally, we show that naive extensions of standard evaluation metrics from the image to the time series domain are insufficient. These metrics do not penalize conditional generation approaches for their poor specificity in reproducing the metadata-specific features in the generated time series. Thus, we innovate a novel evaluation metric that accurately captures the specificity of conditional generation and the realism of the generated time series. We show that TIME WEAVER outperforms state-of-the-art benchmarks, such as Generative Adversarial Networks (GANs), by up to 30% in downstream classification tasks on real-world energy, medical, air quality, and traffic datasets.

Time Weaver: A Conditional Time Series Generation Model

TL;DR

This work tackles the problem of generating realistic time series conditioned on heterogeneous metadata (categorical, continuous, and time-varying). It proposes Time Weaver, a diffusion-based generator that front-loads metadata processing with a dedicated tokenizer and self-attention block to produce a metadata embedding used by a denoiser backbone (CSDI or SSSD). A key contribution is the Joint Frechet Time Series Distance (J-FTSD), a metric learned via contrastive multi-modal embeddings to evaluate conditional generation, capturing both time-series realism and metadata specificity. Empirical results across energy, healthcare, pollution, and traffic datasets show Time Weaver surpasses GAN baselines by substantial margins in downstream classification tasks and distributional similarity, demonstrating the practical potential for scenario analysis, capacity planning, and privacy-preserving data synthesis. The work also discusses limitations (slower inference/training) and future directions (distillation, broader forecasting/anomaly detection).

Abstract

Imagine generating a city's electricity demand pattern based on weather, the presence of an electric vehicle, and location, which could be used for capacity planning during a winter freeze. Such real-world time series are often enriched with paired heterogeneous contextual metadata (e.g., weather and location). Current approaches to time series generation often ignore this paired metadata. Additionally, the heterogeneity in metadata poses several practical challenges in adapting existing conditional generation approaches from the image, audio, and video domains to the time series domain. To address this gap, we introduce TIME WEAVER, a novel diffusion-based model that leverages the heterogeneous metadata in the form of categorical, continuous, and even time-variant variables to significantly improve time series generation. Additionally, we show that naive extensions of standard evaluation metrics from the image to the time series domain are insufficient. These metrics do not penalize conditional generation approaches for their poor specificity in reproducing the metadata-specific features in the generated time series. Thus, we innovate a novel evaluation metric that accurately captures the specificity of conditional generation and the realism of the generated time series. We show that TIME WEAVER outperforms state-of-the-art benchmarks, such as Generative Adversarial Networks (GANs), by up to 30% in downstream classification tasks on real-world energy, medical, air quality, and traffic datasets.
Paper Structure (35 sections, 10 equations, 17 figures, 11 tables, 1 algorithm)

This paper contains 35 sections, 10 equations, 17 figures, 11 tables, 1 algorithm.

Figures (17)

  • Figure 1: Time Weaver generates realistic metadata-specific time series. Consider generating the air quality index of a particular location (XYZ) given the expected precipitation (green) for a specific month (May). Time Weaver uses these metadata features to generate samples (red) that closely match reality (blue).
  • Figure 2: Time Weaver beats gans on all datasets on the Joint Frechet Time Series Distance (jftsd) and Train on Synthetic Test on Real (TSTR) metrics.jftsd indicates the distributional similarity between the generated and real time series datasets. Lower values of jftsd indicate that both generated and real time series distributions are closer. TSTR indicates the performance of a downstream task model trained on generated time series data and evaluated on real time series data. Higher values of TSTR indicate higher quality of the generated time series data. We show the percentage improvement of Time Weaver over state-of-the-art gan models on four diverse datasets.
  • Figure 3: Time Weaver architecture for incorporating metadata in the diffusion process: This figure shows the training and inference processes of Time Weaver. For training, we start from the original sample $x_0$ (on the left) and gradually add noise through a forward process $q(x_t \mid x_{t-1})$, resulting in noisy samples $x_t$. The denoiser, $\denoiser$, is trained to estimate the amount of noise added to obtain $x_t$ from $x_{t-1}$. During inference, the categorical and continuous metadata are first preprocessed with tokenizers $\theta_{\textnormal{token}}^{\textnormal{cat}}$ and $\theta_{\textnormal{token}}^{\textnormal{cont}}$, respectively. Then, we concatenate their output and process it through a self-attention layer $\theta_{\textnormal{condn}}$ to create the metadata embedding $z$. This embedding is fed into $\denoiser$ with the noisy sample $x_t$ to obtain $x_{t-1}$. The denoising process is repeated for $T$ diffusion steps to obtain a clean sample similar to $x_0$.
  • Figure 4: jftsd correctly penalizes the conditional time series data distribution. A good metric should penalize the conditional generation approaches for not being specific to the metadata and deviating from real time series data distribution. As such, we compare the sensitivity of different distance metrics under various synthetic disturbances on the Air Quality dataset (starting from the left); we add Gaussian noise, warp, impute, and randomly change the metadata of the time series samples. We clearly show that as the amount of perturbation increases, our jftsd metric (in red) shows the highest sensitivity, correctly capturing the dissimilarities between the perturbed and the original datasets. In contrast, the other metrics remain unchanged or show lower sensitivity.
  • Figure 5: Time Weaver generated time series distributions match the real time series distributions. Each column represents a different dataset. The real time series is in blue, while the generated time series is in red. The first & third rows correspond to the Time Weaver model, and the second & fourth rows correspond to the best-performing GAN model. The top two rows have the real and generated time series for unseen test metadata conditions. The bottom two rows compare the histograms of the real and generated time series values aggregated over their respective datasets, also for unseen test metadata conditions. Both results indicate that our Time Weaver model can generate realistic time series samples that are specific to the corresponding metadata conditions, beating the previous state-of-the-art GAN model. In both scenarios, the GAN model fails to match the real time series data distribution, while our Time Weaver model has learned the correct conditional distribution for specific metadata conditions, specifically for the Air Quality and Traffic datasets.
  • ...and 12 more figures