Conditional Recurrent GAN (cR-GAN)
- 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 accepts as input a noise vector (where is the GRU hidden-state dimension) and a target disease index . The output is a patient-level time-series matrix of disease probabilities: and the corresponding GRU hidden states
Generation proceeds by:
- Initializing the hidden state: .
- First-visit probability: .
- For each :
0
The GRU cell is specified by: 1 where 2 denotes the element-wise product and all 3, 4, 5 are appropriately dimensioned parameters.
2. Conditional and Attention Mechanisms
Disease-conditioning employs a "smooth conditional matrix" 6. Steps are:
- For each time 7:
8
9
where 0 is a learnable vector.
- Set 1 for the target disease 2.
- Final output:
3
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 4 down to 5 for rare codes (Lu et al., 2022).
3. Critic Network and Wasserstein Loss
The critic 6 evaluates the realism of a full time-series sequence in conjunction with its temporal features:
- For real data 7, compute temporal features 8 via a frozen GRU, 9.
- Concatenate at each time: 0.
- Pass 1 through a small MLP and average over 2:
3
- Use Wasserstein-GP loss:
4
where 5 are linear interpolations between real and generated samples, and 6 is the penalty coefficient.
The generator loss is
7
4. Training Procedure and Stabilization
Training alternates updating the critic and the generator. The procedure includes:
- Pre-training the GRU 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 9-valued probabilities directly to 0, each 1 is Bernoulli-sampled to yield 2.
- Pseudocode:
5
Standard settings: GRU hidden size 3, 4, batch size 5, 6, 7, learning rates 8, 9 with 0.1 decay every 0 steps, Adam with 1, 2, pre-training epochs 3, 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.
- JSD5, JSD6: Jensen–Shannon divergence, visit and patient-level disease frequency distributions.
- ND7, ND8: Normalized distance (for rare diseases):
9 - RN: Number of synthetic samples needed before all 0 real disease codes appear at least once.
Downstream prediction: Models trained on synthetic + real data are evaluated on:
- Multi-label diagnosis prediction (weighted 1 for 2 visit).
- Heart-failure onset at 3 (AUC).
- Parkinson’s disease onset at 4 (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.