Conditional Generation of Periodic Signals with Fourier-Based Decoder

Jiyoung Lee, Wonjae Kim, Daehoon Gwak, Edward Choi

Abstract: Periodic signals play an important role in daily lives. Although conventional sequential models have shown remarkable success in various fields, they still come short in modeling periodicity; they either collapse, diverge or ignore details. In this paper, we introduce a novel framework inspired by Fourier series to generate periodic signals. We first decompose the given signals into multiple sines and cosines and then conditionally generate periodic signals with the output components. We have shown our model efficacy on three tasks: reconstruction, imputation and conditional generation. Our model outperforms baselines in all tasks and shows more stable and refined results.

Introduction

Generating realistic periodic signals, such as electrocardiograms (ECG), is a significant challenge for standard deep learning models. Traditional sequential architectures like Recurrent Neural Networks (RNNs) and Transformers often produce "collapsed" outputs (flat lines), diverge into chaotic noise, or fail to capture subtle but critical high-frequency details. These limitations are particularly problematic in medical contexts where high-fidelity synthetic data is needed to train diagnostic AI for rare conditions.

The Fourier-Based Decoder Framework

To address these issues, we propose a framework based on a Conditional Variational Autoencoder (CVAE) that incorporates a novel Fourier-based decoder. Instead of predicting signal values point-by-point, the decoder learns to output the mathematical coefficients of a Fourier series.

Architecture of the proposed Fourier-based decoder framework.

The architecture consists of several key components:

  1. Encoder ($E_\theta$): A 1D Convolutional Neural Network (CNN) that takes an input signal (along with timestamps and diagnostic labels) and compresses it into a latent representation vector $z$.
  2. Basis Embeddings ($B_\psi$): To handle multiple frequencies efficiently, the model uses "basis embeddings." For each frequency $k$, a specific embedding is added to the latent vector before being passed to the decoder.
  3. Shared Decoder ($D_\phi$): A shared network processes these combined vectors to output Fourier coefficients $a_k$ and $b_k$ in parallel.
  4. Signal Synthesis: The final signal is reconstructed using the classic Fourier series formula: $$\hat{f}(t) = \sum_{k=0}^{n} (a_k \cos(2\pi kt) + b_k \sin(2\pi kt))$$

By forcing the output to be a sum of sinusoids, the model is mathematically guaranteed to produce a periodic signal, providing a strong inductive bias that matches the nature of the data.

Experimental Evaluation

We evaluated the model on a toy sinusoid dataset and the Physionet2021 ECG dataset, focusing on diagnoses like Atrial Fibrillation (AF). The Fourier-based model was compared against several baselines, including Gated Recurrent Units (GRU), Transformers, Neural ODEs (NODE), and Neural Processes (NP).

Qualitative comparison of generated signals across different models and signal types.

Key Results and Insights

The Fourier-based model demonstrated superior performance across reconstruction, imputation, and conditional generation tasks:

  • Quantitative Accuracy: On the Physionet2021 dataset, our model achieved a Reconstruction Mean Squared Error (MSE) of 2.164, significantly outperforming the GRU (77.393) and the Neural Process baseline (2.630).
  • Diagnostic Fidelity: Synthetic ECGs generated by our model achieved an F1-score of 0.734 when evaluated by a pre-trained medical classifier, closely approaching the real dataset's score of 0.805. In contrast, the Transformer baseline lagged at 0.239.
  • Capturing Fine Details: A key advantage was the model's ability to generate "f-waves" in Atrial Fibrillation. While other models smoothed these high-frequency oscillations as noise, the Fourier decoder captured them because they are represented as specific high-frequency components in the series.

Conclusion

By baking the physics of periodicity directly into the neural architecture, the Fourier-based decoder generates more stable, refined, and medically accurate synthetic signals than traditional sequential models. While the current model assumes a fixed period, future work will focus on dynamically handling varying periods to enhance robustness for real-time clinical applications.

Summary updated

BibTeX
@inproceedings{lee2021conditional,
  author = {Jiyoung Lee and Wonjae Kim and Daehoon Gwak and Edward Choi},
  title = {{Conditional Generation of Periodic Signals with Fourier-Based Decoder}},
  booktitle = {DGMs Applications @ NeurIPS},
  year = {2021},
  url = {https://openreview.net/forum?id=y9Sxt1Lpyw},
}
Figure