All models

ClinicalGAN

Transformer-based GAN that forecasts the medical codes of a patient's subsequent hospital visits.

Time series · 348 operations Checked

100%

Showing the top corner; full diagram not loaded yetShowing a small copy; full diagram not loaded yetLarge diagram, not loaded yet

Open SVG

Loading diagram (25 KB)

Open in a new tab

Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.

At a glance

Parameters
9.7M
Operations
348
Framework
PyTorch
Recurrent
No
Published
2022, Artificial Intelligence in Medicine
Cited by
22 (as of 29 October 2026)
Authors
Vignesh Shankar, Elnaz Yousefi, Alireza Manashty and others
Checked
Passed: the trace was replayed operation by operation and matched the model's own output for this input.

Files

The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.

Details
Stable ID
m15317
Graph hash
f0e6cc005ae71279237bc83125679b3e5df42dd23d532865c1a3946e5e7af3d0
Skeleton hash
fd0ea8c174470f824a584bce7df292821453db207ffcccd59f4366ec4a3a9b06
Architecture hash
b78986466a7cc1586f88d29708b33360548493c373c3747aee12f4ef0a412499
Diagram SHA-256
511380f4455ff0f2333945985ff3c7b4a7110e1100bab4224b1745436041af78
TorchLens version
2.36.0
Renderer
graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
Check
Forward pass replayed in PyTorch

What it is

Clinical-GAN forecasts a patient's future hospital visits as medical codes, combining a Transformer with a generative adversarial network (GAN) to predict diagnosis, procedure and prescription drug codes. Each patient's visits are grouped into one token sequence using three additional tokens, including a start-of-history token before the first visit and an end-of-visit token after each visit.

The Generator is a Transformer Encoder-Decoder and the Discriminator is a Transformer Encoder. Training uses an adversarial loss along with a negative log-likelihood loss. For the adversarial part the thesis adopts WGAN, chosen to avoid mode collapse. The Generator's multi-head attention is also used to visualize how much each input contributed to the forecasted codes.

The model was evaluated on the public MIMIC-IV v1.0 dataset. For forecasting diagnosis codes of subsequent visits, the thesis reports 57.04% Mean Average Recall at 250 and 76.57% Mean Average Precision at 250. The thesis describes the method as using the vanilla Transformer and WGAN, and names transfer learning as a direction for future work.

Key idea. Clinical-GAN trains a Transformer Encoder-Decoder Generator against a Transformer Encoder Discriminator to forecast the medical codes of a patient's subsequent visits.

  • Clinical-GAN
  • ClinicalGAN
  • patient trajectory forecasting
  • clinical event forecasting
  • electronic health records
  • EHR
  • medical code prediction
  • sequential disease prediction
  • MIMIC-IV
  • transformer GAN

AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.

Cite the paper

@article{clinicalgan2022,
  title = {Clinical-GAN: Trajectory Forecasting of Clinical Events using Transformer and Generative Adversarial Networks},
  author = {Vignesh Shankar and Elnaz Yousefi and Alireza Manashty and D. Blair and Deepika Teegapuram},
  year = {2022},
  journal = {Artificial Intelligence in Medicine},
  doi = {10.1016/j.artmed.2023.102507}
}