Papers
Topics
Authors
Recent
Search
2000 character limit reached

Conditional Recurrent GAN (cR-GAN)

Updated 31 May 2026
  • cR-GAN is a generative framework that uses recurrent structures and explicit conditioning to generate sequential data with control over target attributes.
  • It employs GRUs and attention-driven conditioning via a smooth matrix to improve the fidelity and consistency of synthetic EHR sequences, especially for rare diseases.
  • The approach demonstrates enhanced performance in synthetic data evaluation metrics and downstream prediction tasks, reducing rare-needle metrics significantly.

A conditional recurrent GAN (cR-GAN) is a generative adversarial framework that incorporates recurrent structures and explicit conditional mechanisms, enabling the generation of sequential data conditioned on specified attributes. In the clinical time-series domain, cR-GANs are realized by Multi-label Time-series GANs (MTGAN), which are designed for generating realistic and controllable electronic health record (EHR) sequences, particularly addressing the challenge of rare disease modeling. These architectures employ gated recurrent units (GRUs) for sequential modeling, smooth conditioning matrices to enforce explicit label control, and critic (discriminator) networks that score entire sequences along with temporal features using Wasserstein distance and gradient penalty for stable training (Lu et al., 2022).

1. Generator Architecture and Recurrence

The generator GG accepts as input a noise vector z∈Rsz\in\mathbb{R}^s (where ss is the GRU hidden-state dimension) and a target disease index i∈{1,…,d}i\in\{1,\dots,d\}. The output is a patient-level time-series matrix of disease probabilities: P=[P1,  P2,  …,  PT]∈[0,1]d×TP = [P_1,\;P_2,\;\dots,\;P_T]\in[0,1]^{d\times T} and the corresponding GRU hidden states

H~=[h~1,  h~2,  …,  h~T]∈Rs×T.\widetilde H = [\tilde h_1,\;\tilde h_2,\;\dots,\;\tilde h_T]\in\mathbb{R}^{s\times T}.

Generation proceeds by:

  • Initializing the hidden state: h~0=0\tilde h_0 = 0.
  • First-visit probability: P1=σ(Wz z+bz)∈(0,1)dP_1 = \sigma(W_z\,z + b_z)\in(0,1)^d.
  • For each t=1,…,T−1t=1,\ldots,T-1:

h~t=ggru(Pt, h~t−1)\tilde h_t = g_{\mathrm{gru}}(P_t,\,\tilde h_{t-1})

z∈Rsz\in\mathbb{R}^s0

The GRU cell is specified by: z∈Rsz\in\mathbb{R}^s1 where z∈Rsz\in\mathbb{R}^s2 denotes the element-wise product and all z∈Rsz\in\mathbb{R}^s3, z∈Rsz\in\mathbb{R}^s4, z∈Rsz\in\mathbb{R}^s5 are appropriately dimensioned parameters.

2. Conditional and Attention Mechanisms

Disease-conditioning employs a "smooth conditional matrix" z∈Rsz\in\mathbb{R}^s6. Steps are:

  • For each time z∈Rsz\in\mathbb{R}^s7:

z∈Rsz\in\mathbb{R}^s8

z∈Rsz\in\mathbb{R}^s9

where ss0 is a learnable vector.

  • Set ss1 for the target disease ss2.
  • Final output:

ss3

This smooths the presence of rare diseases across the synthetic trajectory, raising the likelihood of their consistent appearance throughout the sequence and drastically reducing the "rare-needle" (RN) metric from ss4 down to ss5 for rare codes (Lu et al., 2022).

3. Critic Network and Wasserstein Loss

The critic ss6 evaluates the realism of a full time-series sequence in conjunction with its temporal features:

  • For real data ss7, compute temporal features ss8 via a frozen GRU, ss9.
  • Concatenate at each time: i∈{1,…,d}i\in\{1,\dots,d\}0.
  • Pass i∈{1,…,d}i\in\{1,\dots,d\}1 through a small MLP and average over i∈{1,…,d}i\in\{1,\dots,d\}2:

i∈{1,…,d}i\in\{1,\dots,d\}3

  • Use Wasserstein-GP loss:

i∈{1,…,d}i\in\{1,\dots,d\}4

where i∈{1,…,d}i\in\{1,\dots,d\}5 are linear interpolations between real and generated samples, and i∈{1,…,d}i\in\{1,\dots,d\}6 is the penalty coefficient.

The generator loss is

i∈{1,…,d}i\in\{1,\dots,d\}7

4. Training Procedure and Stabilization

Training alternates updating the critic and the generator. The procedure includes:

  • Pre-training the GRU i∈{1,…,d}i\in\{1,\dots,d\}8 on next-visit binary prediction (binary-cross-entropy), then freezing it to extract real temporal features for the critic.
  • Discrete sampling: instead of feeding i∈{1,…,d}i\in\{1,\dots,d\}9-valued probabilities directly to P=[P1,  P2,  …,  PT]∈[0,1]d×TP = [P_1,\;P_2,\;\dots,\;P_T]\in[0,1]^{d\times T}0, each P=[P1,  P2,  …,  PT]∈[0,1]d×TP = [P_1,\;P_2,\;\dots,\;P_T]\in[0,1]^{d\times T}1 is Bernoulli-sampled to yield P=[P1,  P2,  …,  PT]∈[0,1]d×TP = [P_1,\;P_2,\;\dots,\;P_T]\in[0,1]^{d\times T}2.
  • Pseudocode:

h~0=0\tilde h_0 = 05

Standard settings: GRU hidden size P=[P1,  P2,  …,  PT]∈[0,1]d×TP = [P_1,\;P_2,\;\dots,\;P_T]\in[0,1]^{d\times T}3, P=[P1,  P2,  …,  PT]∈[0,1]d×TP = [P_1,\;P_2,\;\dots,\;P_T]\in[0,1]^{d\times T}4, batch size P=[P1,  P2,  …,  PT]∈[0,1]d×TP = [P_1,\;P_2,\;\dots,\;P_T]\in[0,1]^{d\times T}5, P=[P1,  P2,  …,  PT]∈[0,1]d×TP = [P_1,\;P_2,\;\dots,\;P_T]\in[0,1]^{d\times T}6, P=[P1,  P2,  …,  PT]∈[0,1]d×TP = [P_1,\;P_2,\;\dots,\;P_T]\in[0,1]^{d\times T}7, learning rates P=[P1,  P2,  …,  PT]∈[0,1]d×TP = [P_1,\;P_2,\;\dots,\;P_T]\in[0,1]^{d\times T}8, P=[P1,  P2,  …,  PT]∈[0,1]d×TP = [P_1,\;P_2,\;\dots,\;P_T]\in[0,1]^{d\times T}9 with 0.1 decay every H~=[h~1,  h~2,  …,  h~T]∈Rs×T.\widetilde H = [\tilde h_1,\;\tilde h_2,\;\dots,\;\tilde h_T]\in\mathbb{R}^{s\times T}.0 steps, Adam with H~=[h~1,  h~2,  …,  h~T]∈Rs×T.\widetilde H = [\tilde h_1,\;\tilde h_2,\;\dots,\;\tilde h_T]\in\mathbb{R}^{s\times T}.1, H~=[h~1,  h~2,  …,  h~T]∈Rs×T.\widetilde H = [\tilde h_1,\;\tilde h_2,\;\dots,\;\tilde h_T]\in\mathbb{R}^{s\times T}.2, pre-training epochs H~=[h~1,  h~2,  …,  h~T]∈Rs×T.\widetilde H = [\tilde h_1,\;\tilde h_2,\;\dots,\;\tilde h_T]\in\mathbb{R}^{s\times T}.3, H~=[h~1,  h~2,  …,  h~T]∈Rs×T.\widetilde H = [\tilde h_1,\;\tilde h_2,\;\dots,\;\tilde h_T]\in\mathbb{R}^{s\times T}.4 (Lu et al., 2022).

5. Evaluation Metrics and Downstream Tasks

Assessment comprises statistical and predictive metrics:

  • Statistical:
    • GT: Number of distinct disease codes appearing in the synthetic set.
    • JSDH~=[h~1,  h~2,  …,  h~T]∈Rs×T.\widetilde H = [\tilde h_1,\;\tilde h_2,\;\dots,\;\tilde h_T]\in\mathbb{R}^{s\times T}.5, JSDH~=[h~1,  h~2,  …,  h~T]∈Rs×T.\widetilde H = [\tilde h_1,\;\tilde h_2,\;\dots,\;\tilde h_T]\in\mathbb{R}^{s\times T}.6: Jensen–Shannon divergence, visit and patient-level disease frequency distributions.
    • NDH~=[h~1,  h~2,  …,  h~T]∈Rs×T.\widetilde H = [\tilde h_1,\;\tilde h_2,\;\dots,\;\tilde h_T]\in\mathbb{R}^{s\times T}.7, NDH~=[h~1,  h~2,  …,  h~T]∈Rs×T.\widetilde H = [\tilde h_1,\;\tilde h_2,\;\dots,\;\tilde h_T]\in\mathbb{R}^{s\times T}.8: Normalized distance (for rare diseases):

    H~=[h~1,  h~2,  …,  h~T]∈Rs×T.\widetilde H = [\tilde h_1,\;\tilde h_2,\;\dots,\;\tilde h_T]\in\mathbb{R}^{s\times T}.9 - RN: Number of synthetic samples needed before all h~0=0\tilde h_0 = 00 real disease codes appear at least once.

  • Downstream prediction: Models trained on synthetic + real data are evaluated on:

    • Multi-label diagnosis prediction (weighted h~0=0\tilde h_0 = 01 for h~0=0\tilde h_0 = 02 visit).
    • Heart-failure onset at h~0=0\tilde h_0 = 03 (AUC).
    • Parkinson’s disease onset at h~0=0\tilde h_0 = 04 (AUC).

RNN-based predictors evaluated include Dipole and GRAM, with and without synthetic pre-training. MTGAN yields lowest JSD/ND, much improved GT/RN, and the greatest improvement on rare-disease prediction (e.g., Parkinson’s onset) in MIMIC-III/IV datasets (Lu et al., 2022).

6. Limitations and Future Directions

MTGAN (cR-GAN) is limited to the generation of discrete diagnosis code sequences. Continuous variables such as labs, vitals, or medication dosages, as well as missing-data patterns, are not modeled in the current framework. Prospective research aims to extend cR-GANs to handle mixed-type EHR (discrete + continuous), incorporate privacy preservation (e.g., differential privacy), and multi-modal data (e.g., notes combined with codes) (Lu et al., 2022).

7. Context within Sequential Conditional GANs

The conditional recurrent GAN paradigm demonstrates utility beyond clinical EHR, such as in perceptual video compression, where recurrent conditional discriminators enforce both spatial and temporal consistency in generated sequences, as exemplified in PLVC (Yang et al., 2021). Both domains leverage conditioning (on target labels, or latent/motion/temporal state) and recurrence (via GRUs or ConvLSTMs) to enable high-fidelity, temporally coherent data generation. This suggests a broader applicability of cR-GANs to diverse sequential generative modeling tasks where explicit control and memory are operational requisites.

Definition Search Book Streamline Icon: https://streamlinehq.com
References (2)

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Conditional Recurrent GAN (cR-GAN).