EHRDiff : Exploring Realistic EHR Synthesis with Diffusion Models
Authors: Hongyi Yuan
Songchi Zhou
Sheng Yu
Venue: Accepted by TMLR ()

Abstract: Electronic health records (EHR) contain a wealth of biomedical information, serving as valuable resources for the development of precision medicine systems. However, privacy concerns have resulted in limited access to high-quality and large-scale EHR data for researchers, impeding progress in methodological development. Recent research has delved into synthesizing realistic EHR data through generative modeling techniques, where a majority of proposed methods relied on generative adversarial networks (GAN) and their variants for EHR synthesis. Despite GAN-based methods attaining state-of-the-art performance in generating EHR data, these approaches are difficult to train and prone to mode collapse. Recently introduced in generative modeling, diffusion models have established cutting-edge performance in image generation, but their efficacy in EHR data synthesis remains largely unexplored. In this study, we investigate the potential of diffusion models for EHR data synthesis and introduce a novel method, EHRDiff. Through extensive experiments, EHRDiff establishes new state-of-the-art quality for synthetic EHR data, protecting private information in the meanwhile.

Published in Transactions on Machine Learning Research (03/2024)
EHRDiff Exploring Realistic EHR Synthesis with Diffusion Models
Hongyi Yuan!
Center for Statistical Science Tsinghua University
Songchi Zhout
Shon-sc220mmllstiinnniiio edm.cc
Center for Stafistical Science Tsinghua University
Sheng Yu
syu@lsinghua edu.cn
Center for Statistical Science Tsinghua University
Reviewed on OpenReview:
Abstract
Electronic health records (EHR) contain wealth of biomedical information, serving as valuable resources for the development of precision medicine systems. However, privacy concerns have resulted in limited access to high-quality and large-scale EHR data for researchers, impeding progress in methodological development. Recent research has delved into synthesizing realistic EHR data through generative modeling techniques, where majority of proposed methods relied on generative adversarial networks (GAN) and their variants for EHR synthesis. Despite GAN- methods attaining state-of- th-artte-rrttt performance in generating EHR data, these approaches are difficult to train and prone to mode collapse. Recently introduced in generative modeling, diffusion models have established cutting- edge performance in image generation, but their efficacy in EHR data synthesis remains largely unexplored. In this study, investigate the potential of diffusion models for EHR data synthesis and introduce novel method, EHRDIFF. Through extensive experiments, EHRDIFF establishes new state-of-the-aa quality for synthetic EHR data, protecting private information in the meanwhile.
1 Introduction
Electronic health records (EHR) contain vast biomedical knowledge. EHR data may enable the development of state-of-tho-art computational biomodical methods for dynamical treatment (Sonabend et al. (0200), differentiable diagnosis (Yuan & Yu 2021), rare genetic disease identification (Alsentzer et al. 2022), etc. However, EHRs contain sensitive patients' private health information. Before being publicly accessible, real-world EHRs need undergo de-identification (Johnson al. 2016 2023). The de-identification process uses automatic algorithms and requires tedious thorough human reviewing. Pending releasing approval take months out of legal or ethical concerns (Hodge et. al.) 1999). Such circumstances limit. the public release of rich EHR data, hence impeding the advancement of precision medicine methodologies. To mitigate the issue of limited publicly available EHR data, researchers alternatively explored generating synthetic EHR data (Choi et al. 2017 Walonoski et al. 2017). Realistic synthetic EHR generation has recently become a research field of medical informatics.
A line of work approached EHR data synthesis through generative modeling techniques, where they trained generative models limited real EHR data to generate synthetic EHR data. Recent research developed
*Corresponding Author. Contributed Equally. Codes are released in https: thub. com/sczzz3/EHR01ff. git

---

Published in Transactions on Machine Learning Research (03/2024)
variants of auto-encoders Vincent et al.
or generative adversarial networks (GAN) [Goodfellow et al., 2014 Choi et al. 2017) The majority of EHR data synthesis methodologies have relied on GAN (Choi et al. 2017 Baowaly et al. 2018 Zhang et al.
2008
Biswal et al.
2020
Yan et al. 2020). Although GAN-based methods achieved statc-of-the-art performance with respect to synthetic EHR quality and privacy preservation, they suffer from training instability and mode collapse (Che et al.
2019
2017 Previous research proposed different. techniques to mitigate the problem, while as shown in our experiments, GAN-based methods still are prone to such problems, resulting in unsatisfactory synthetic data quality. This may raise concerns when developing real-world systems using synthetic EHR data from GAN-based methods.
Most recently, novel diffusion models (Sohl-Dickstein et al. 2015 in generative modcling have been proposod and have achieved cutting-edge generation performance in the field of vision (Ho et al., 2020; Song et al.) 2021), audio (Kong et al. 2021), or texts (Li et al., 2022 Gong et al. 2023 Yuan et al. 2022). Many variants of diffusion models have surpassed the generation performance of GANs in sample quality and diversity. In general, starting from random noise features, diffusion models use a trained denoising distribution gradually remove noise from the features and ultimately generate realistic synthetic features. The efficacy of diffusion models on realistic EHR synthesis is less studied compared to GANss Considering the superior performance of diffusion models in other domains, our work explores the synthesizing performance of such techniques on EHR data. We introduce EHRDIFF, a diffusion model-based EHR synthesizing model.
Our work conducts comprehensive experiments using publicly available real EHR data and compares the effectiveness of EHRDIFF against several other GAN-based EHR data synthesizing methods. We provide empirical evidence that EHRDIFF is capable of generating synthetic EHR data with a high degree of quality. Additionally, our findings reveal that the synthetic EHR data produced by EHRDIFF is of superior quality compared to those generated by GAN-based models, and it is more consistent with the distribution of real-world EHR data.
Our research has two primary contributions: Firstly, we introduce the use of diffusion models to the realm of realistic EHR synthesis and propose a diffusion-based method called EHRDIFF Secondly, through extensive experimentation on publicly available EHR data, we demonstrate the superior quality of synthetic EHR data generated by EHRDIFF in comparison GAN-based EHR synthesizing methods. Furthermore, the synthetic EHR data generated by EHRDIFF exhibits excellent correlation with real-worie EHR data.
Our work is summarized as two following contributions:
We introduce diffusion models to the fields of EHR data synthesis and propose a diffusion- based method called EHRDIFF
Through extensive experiments on publicly available real EHR data, we empirically demonstrate the superior generation quality of EHRDIFF over GAN-based EHR synthesis methods for various EHR feature formats, including categorical, continuous, and time-series features. In the meanwhile, EHRDIFF can safeguard private information in real training EHR.
2
Related Work
2.1 EHR data synthesis
In the literature on EHR synthesis, rescarchers are usually concerned with the generation of discrete code features such as ICD codes rather than clinical narratives. Researchers have developed various methods to generate synthetic EHR data. Early work was usually disease-specifie or covered limited number of diseases. Buczak et al. (201 developed method that generates EHR including visit records, clinical activity, and laboratory results for 203 synthetic tularemia outbrcak patients of tularemia. The features in synthetic EHR daia are generated based on retrieving similar real-world EHR which is inflexible and prone to privacy leakage. Walonoski et al. (2017) developed a software named Synthea which generates synthetic EHRs with various patient information basod on publicly available data. They build generation workflows based on biomedical knowledge and wolld feature statistics. Various models are aggregated for different feature synthesis. However, Synthea only covered the 20 most common conditions.
2

---

Published in Transactions on Machine Learning Research (03/2024)
Recently, researchers mainly applied generative modeling methods for EHR synthesis (Ghosheh et al 2022. Medical GAN (medGAN) (Choi et al.) 2017) introduced GAN to EHR synthesis. medGAN can generate synthetic EHR data with good quality and is free of tedious feature engineering. Following medGAN, various GAN-based methods are proposed, such as medBGAN (Baowaly et al. 2018). EHRWGAN (Zhang et al.) 2019), CorGAN (Torfi & Fox 2020a); etc. These GAN-based methods advance synthetic EHR to higher quality. However, common drawback of GAN-based methods is that these methods suffer from the mode collapse phenomenon which results in circumstance where a GAN-based model is capable of generating only few modes of real data distribution (Thanh-
al., 2018). To mitigate the problem, GAN methods for EHR generation rely on pre-trained auto-encoders to reduce the feature dimensions for training stability. However, inappropriate of synthetic EHR quality or even failure to generale realistic data. There is also research that uses GAN-based models for conditional synthetic EHR generation to model the temporal structure of real EHR data (Zhang ct al.] 2020a). Since diffusion models are less studied in EHR. synthesis, we focus on the unconditional generalion of EHR and leave modeling conditional lemporal structure with diffusion models to future work.
choices and autoencoder pre-training will lead to sharp degradation
Besides GAN-based methods, there also exists research that explores generating synthetic EHR data through variational auto-cncoders (Biswal et al., 2020) or language models (Wang & Sun 2022 Concurrently, MedDiff (He et al., 2023) is proposed and explores diffusion models for synthetic EHR generation, and they
propose a new sampling technique without which the diffusiin model fails to generate high-quality EHRs.
Ceritli et al. )023)) directly apply TabDDPM (Kotelnikov et al. 2022 to synthesizing EHR data.
2.2 Diffusion Models
Diffusion models are formulated with forward and reverse processes. The forward process corrupts real- world data by gradually injecting noise, and harvesting training data with different noise levels for denoising distribution, while the reverse process generates realistic data by removing noise using the denoising distribution. -Schs-Dik et al. (2015) first proposed and provided theoretical support for diffusion models. Denoising diffusion probabilistic models (DDPM) (Ho et al.) (020)) and noise conditional score networks (NCSN) (Song et al. 2021) have discovered the superior capability image gencration, and diffusion models have become a locused research direction since then. Recent research generalizes diffusiin models to the synthesis of other data modalities and achieves excellent performance (Li et al.) [022] Kong et al. 20211 Our
work is among the first rescarch that introduces diffusion models to realistic EHR synthosis (He al. 2023
Ceritli et al. 2023
3 Method
In this section, we give an introduction to the problem formulation of details of our proposed EHRDIFF
realistic EHR synthesis and the technical
3.1 Problem Formulation
Real-world EHR contains diverse patient information including demographies, physiological conditions, laboratory results, ICD codes, etc. Such information may be presented in various data formats (c.g., categorical, binary, continuous, etc). Features of different information may also have different scales, such ages and heights. In this work, the dimension of EHR features of interest. We treat all features of different formats as real numbers ranging from to 1. Following previous research @Choi et al., 2017 Baowaly et al. 2018) which only focused on binary code data, we use standing for code occurrence and O otherwise. For continuous and categorical features, we normalize each feature within the range.
vector zo to represent the EHR, where zp RI and C represents
3.2 General Framework for Diffusion Model
Diffusion models are characterized by forward and reverse Markov processes with latent variables where the forward process transforms the real samples to random Gaussian noise while the reverse process generates
3

---

Published in Transactions on Machine Learning Research (03/2024)
synthetic samples by gradual denoising the noise. As demonstrated by Song et al. (0021). the forward and reverse processes can be described by stochastic differential equations (SDE). The general SDE form for modeling the forward process follows:
dx = [(x ((cx,)dd t)dt + g(t)dw,
(1)
where x represents data points, represents the standard Wiener process, f is diffusion time, and ranges from 0 to T. At t = 0, zu follows real data distribution while at t = T, 24 asymptotically follows random Gaussian distribution. Functions f and respectively define the sample corruption pattern and the level of injected noises. f and g together corrupt real-world samples to random noise. Based on the forward SDE, the SDE for the reverse process can be derived as follows:
dæ (f(x, - g² (t) Pag)) dt g(t)dw,
(2)
where Pr( is the marginal density of æ at time t, and V (xx) is the score function, which indicates a vector field of which the direction is pointed to the high-density data area. With reparameterization proposed
in Karras et al. (2022). the reverse generation process can also be described with the probability flow ordinary differential equations (ODE) instead of SDEs (Song et al. 2021
dæ - -o(t)o (t) log lognr
(t)o w. log (x)ddt,
(3)
h(t) exp (J, F(E)dE)
(4)
d() = = V.. h(E)2
g(5)2
de,
(5)
where o(t) represents the derivative of (t).. SDE and probability flow ODE indicate stochas- tic and deterministic generation processes respectively. To generate synthetic samples following re- verse processes, it is required to learn score function se(x) parameterized by by score matching ming Ep (ml)aa) [1]))(x)) - Vz log Po. (=11=)))
3.3 EHRDiff
For the diffusion process of EHRDIFF we use h(t) = and or = from previous research (Karras et al. a- a=Do( then the objective
2022). Therefore V can be derived as:
Po, Po. z-ma and reparameterize sp(x)
Do(æ, σ1) Dy
27
min Bp( (mlma)
(6)
o²
and with further simplification of ignoring of, the final objective becomes:
min Ep(ro),, (m|ma) [I) o.) - xol
(7)
Generally, Do(ær, o.) can be modeled by neural networks, while such direct modeling may cause obstacles for optimization because the variance of 2, and the scale of o, are diverse at different time step Therefore, we chose the pre-conditioning design of Dø(x, oe) (Karras et al.) 2022 where Dg(x, a,) is decomposed as:
Do(a;;)) Cokip())æz + Cout(a) Fo (Ciu(o) Cuoise
Fa modeled with neural networks and such designs of Cin and Cnoise regulate the input to the network to be unit variance across different time step t, and Cout and Gakip together set the neural model prediction to be unit variance with minimized scale. Therefore in EHRDIFF we chose Cout = ao /o2 + o and (o) = o (a + aaaa)) Cnoise 0.25 which is designed empirically with the principle of constraining the input noise scale from varying immensely and In(o) NN(meenn Paaa) following Karras et al. (2022). where P Pmean and Pata are hyper-parameters be set.
4

---

Published in Transactions on Machine Learning Research (03/2024)
With the aforementioned formalization of h(t), att) and the learned score function sø, the generation process of EHRDIFF can be expressed as the ODE:
da = tt
(9)
Solving the ODE numerically requires discretization of the time step t and a proper design of noise level o, along the solution trajectory. Therefore, following previous research (Karras et al. 2022 we set the maximum and minimum noise levels as mmxx and mmin and use the following form of discretization:
- 1 ((0min) (0max) 01, = ((omax)) + N N
(10)
where i's are integers and range from 0 to N, Oty = 0, - = min, and p controls the schedules of discretized time step I and trades off the discretized strides 4 4i-1 the larger value of which indicates a larger stride near to. In order to solve the ODE more precisely and generate synthetic EHR with higher quality, we use Heun's 2nd order method, which adds a correction updating step for each t, and alleviates the truncation errors compared to the 1st order Euler method. We leave the detailed sampling procodure Appendix A
4 Experiments
To demonstrate the effectiveness of our proposed EHRDIFF we conduct extensive experiments evaluating the quality of synthetic EHRs and the privacy concerns of the method. We also compare FHRDDFF the several GAN-based realistic EHR synthesis methods to illustrate the performance of EHRDIFF.
4.1 Dataset
Many previous research uses in-house EHR data which not publicly available for method evaluation [Zhang et al. 2019: Yan et al. 2020). Such experiment designs set obstacles for later research to reproduce experiments. In this work, we use publicly available EHR database, MIMIC-IIT, to evaluate EHRDIFF
Deidentified and comprehensive clinical EHR data is integrated into MIMIC-III (Johnson et al., 2016). The patients are admitted to the intensive care units of the Beth Israel Deaconess Medical Center in Boston. For each patient's EHR for one admission, we extract the diagnosis and procedure ICD-9 code and truncate the ICD-9 code the first three digits. This preprocessing can reduce the long-tailed distribution of the ICD-9 code distribution and results in 1,782 code set. Therefore, the EHR for each patient formulated binary vector of 1,782 dimensions. The final extracted number of EHRs is 46,520 and we randomly select 41,868 for model training while the rest are held out for evaluation.
Although most of the existing research focused on synthesizing discrete code features, real-world EHR data contains various data formats such as continuous test results values or time series of electrocardiograms (ECG). In this work, we extend the previous rescarch and explore applying EHRDIFF the synthesis of EHR data other than binary codes. We use the following two dalasets: CinC2012 Data and PTB-ECG Data. CinC2012 Data is dataset for predicting the mortality of ICU patients and contains various feature formats such categorical age, continuous serum glucose values. PTB-ECG Data contains ECG signal data for heart discase diagnosis. Detailed introductions of both datasets are left in C All the categorical features are converted into binary columns by one-hot encoding, and continuous features are normalized to values in the range of [0.0, 1.0]. We use sets and B in CinC2023 Data as training and held-out testing sets respectively. The PTB-ECG Data split with a ratio of 8:2 for training and held-out testing.
4.2 Baselines
To better demonstrate EHR synthesis performance, we compare EHRDIFF to several strong baseline models as follows.
medGAN
Choi al. 2017 the first work that introduces GAN generating realistic synthetic Considering the obstacle of directly using GAN to generate high-dimensional binary EHR
EHR data.
5

---

Published in Transactions on Machine Learning Research (03/2024)
vectors, medGAN alters to low-dimensional dense space for generation by taking advantage of pre-trained auto-encoders. The model generates dense EHR vector and then recovers synthetic EHR with decoders.
2018 are two improved GAN models for realistic EHR synthesis. medGAN is based on the conventional GAN model for EHR synthesis, and such model is prone to mode collapse where GAN models may fail to learn the distribution of real-world data. medBGAN and medWGAN integrate Boundary-secking GAN (BGAN) (Hjelm et al., 2018) and Wasserstein GAN (WGAN) respectively to improve the performance of medGAN and stabilize model training.
medBGAN and medWGAN (Baowaly et al.
Adler & Lunz 2018
2020b is a novel work that utilizes convolutional neural networks (CNN) instead of multilayer perceptrons (MLP) to model EHR data. Specifically, they use CNN to model the autoencoder and the generative network. They empirically elucidate through experiments that CNN can perform better than the MLP in this task.
CorGAN Torfi & Fox,
EMR-WGAN Zhhang et al. 2020b) is proposed to further refine the GAN models from several perspectives. To avoid model collapse, the authors take advantage of WGAN. The most prominent feature of is that it is directly trained on the discrete EHR data, while the previous rescarch universally uses an autoencoder to first transform the raw EHR data into low-dimensional dense space. They utilize BatchNorm (Toff & Szegedy 2015) for the generator and LayerNorm (Ba et al., 2016) for the discriminator to improve performance. As is shown in their experiments, these modifications significantly improve the performance of GAN.
4.3 Evaluation Metric
In our experiments, we evaluate the generative models' performance from two perspectives: utility and privacy Yan et al. 2022). Utility metrics evaluate the quality of synthetic EHRs and privacy metrics assess the risk of privacy breaches. In the following metrics, we generate and use the same number of synthotic EHR samples as the number real training EHR samples.
4.3.1 Utility Metrics
We follow previous research for set of utility metrics. The following metrics evaluate synthetic EHR quality from diverse perspectives.
Dimension-wise distribution describes the feature-level resemblance between the synthetic data and the real data. The metric is widely used in previous research to investigate whether the generative model is capable of learning the high-dimensional distribution of real EHR data. For each code dimension, we calculate the empirical mean estimation for synthetic and real EHR data respectively. The mean estimation indicates the prevalence of the code. We visualize the dimension-win distribution using scatter plots where both axes represent the prevalence synthetic and real EHR respectively. Many codes have very low prevalence real EHR data. The generation model may be prone to mode collapse and fail to generate the codes with low prevalence. Therefore, count the number of codes that exist in the synthetic EHR samples and dub the quantity non-zero code columns.
Dimension-wise correlation measures the difference between the feature correlation matrices of real and synthetic EHR data. The j entry of correlation matrices calculates the Pearson correlation between the ith and jth features. For both the synthetic and real EHR data, we calculate first the correlation matrices, and then the averaged absolute differences between the correlation matrices. We name this metric the correlation matrix distance (CMD).
Dimension-wise prediction evaluates whether generative models capture the inherent code feature relation by designing classification tasks. Specifically, we select one of the code features to be the classification target and use the rest of the features as predictors. To harvest a balanced target distribution, we sort the code features according to the entropy H()) of code prevalence p, where H(p) lolog(p) (1 1 p) log(1 p)-

---

Published in Transactions on Machine Learning Research (03/2024)
Table 1: NZC represents Non-Zero code Columns, CMD represents Correlation Matrix Distance. + and f indicate the respectively lower and higher numbers for better results.
NZC (t)
CMD (4)
medGAN
643:159.4
45.652
medBGAN
898::36.8
63.186#16.355
medWGAN
3765533.5 8.603#0.163
CorGAN
753:115.11
10.997=0.420
EMR-WGAN
1060:129.6
8.173::0.274
EHRDIFF
1770#1.9
7.769=0.013
We select the top 30 code fealures according to entropies and form 30 individual classífication tasks. For each task, we fit classification model with logistic regression using real training and synthetic EHR data and assess the F1 score on the preset evaluation real EHR data.
4.3.2 Privacy Metrics
Generative modeling methods need real EHR data for training which raises privacy concerns among practi- tioners. Attackers may infer sensitive private information from trained models. Besides the utility of synthotic EHR data, we also evaluate existing models from privacy protection perspective (Choi et al. 2017 Zhang
et al.
2019 Yan et al. 2022
Attribute inference risk describes the risk that sensitive private information of real EHR training data may be exposed based on the synthetic EHR data It assumes a situation where the attackers already have several real EHR training samples with partially known features, and try to infer the rest features through synthotic data. Specifically, we assume that attackers first use the k-nearest neighbors method to find the top k most similar synthetic EHRs each real EHR based on the known code features, and then recover the rest of unknown code features by majority voting of similar synthetic EHRs. We set k to and use the most frequent 256 codes the features known by the attackers. The metric is quantified by the prediction Fi-score of the unknown code features.
Membership inference risk evaluates the risk that given a set of real EHR samples, attackers may infer the samples used for training based on synthetic EHR data. We mix a subset of training real EHR data and held-out testing real EHR data to form an EHR set, For each EHR in this set, we calculate the minimum L2 distance with respect to the synthetic EHR data. The EHR whose distance is smaller than a preset threshold is predicted the training EHR. We report the prediction F1 score to demonstrate the performance of each model under membership inference risk.
4.4 Implementation Detail
In our experiments, for the diffusion noise schedule, we Fmin and maxx to be 0.02 and 80. p to 7 and the time step is discretized to N 32. P Pmean is set -12 and Pat is set 1.2 for noise distribution in the training process. For F& in Equation g it is parameterized by MLP with ReLU (Nair & Hinton 2010) activations and the hidden states are set to [1024,384 384, 384, 1024). For the baseline methods, we follow the settings reported in their papers. The reported standard errors marked with = are calculated under 5 different runs.
4.5
Results on MIMIC
4.5.1
Utility Results
Figure 1 depicts the dimension- wise prevalence distribution of synthetic EHR data against real data. The scatters from EHRDIFF distributed more closely to the diagonal dashed line compared to other baseline
7

---

Published in Transactions on Machine Learning Research (03/2024)
medGAN
medBGAN
medWGAN
0.6
0.6
Testure Deslore pieeeencce of syntteetii data
0.5
0.5
0.5
preaeence symtrett
0.4
0.3
0.3
0.3
0.2
0.2
0.2
Corr 0.9909
Corr = 0.9929
Corr = 0.9911
0.1
0.0
0.0
0.0
0.0
0.1
0.2
0.3
0.4
0.5
0.6
0.0
0.1
0.2
0.3
0.4
0.5
0.6
0.0
0.1
0.3
0.4
0.5
0.6
Feature prevalence of real deta
Feature prevalence of real data
Feature prevalence of real data
CorGAN
EMR-WGAN
EHRDiff
0.6
0.6
0.6
00ta
Tisture prevatncee www.neellnyyine sytberic datee
0.5
0.5
0.5
preveence synthere
0.4
0.4
0.4
0.3
0.3
0.3
0.2
Corr 0.9849
Corr 0.9993
Corr 0.9988
0.1
0.1
0.1
0.0
0.0
0.0
0.0
0.2
0.4
0.0
0.5
0.1
Feature prevalence real
Feature data
Feature
Figure 1: The dimension-wise probability scatter plot of synthetic EHR data from different generative models against real EHR data. The diagonal lines represent the perfect match of code prevalence between synthetic and real EHR data.
models, and EHRDIFF and EMR-WGAN achieve near-perfect correlation. As shown in Table EHRDIFF outperforms all baseline methods in non-zero code column number (NZC) by large margins. This shows that GAN-based baselines all suffer from model collapse to different extents. The GAN-based method of best performance, EMR-WGAN, still fails to generate 722 code fcatures with the same number of synthetic EHR samples as the real data. Although EMR-WGAN achieves near-perfect correlation between real and synthetic code prevalence and is slightly better than EHRDIFF NZC demonstrates that the correlation can be biased by high prevalence features and overshadow the evaluation of low prevalence features. The results above demonstrate that EHRDIFF
better capture the code feature prevalence of the real data than the GAN-based baselines, and is free from mode collapse. The synthetic EHR data by EHRDIPP has better diversity than that by GAN-based methods.
From CMD results in Table [ EHRDIFF surpasses all baseline models. CMD results demonstrate that EHRDIFF can better capture the inherent pair-wise relations between code features than GAN-based methods. The F1 score scatters in Figure ? of EHRDIFF are closer to the diagonal lines and achieve the highest correlation value compared baselines. This means that training on synthetic EHR data by EHRDIFF can lead to more similar performance to training on real data, and demonstrates that EHRDIFF can better model complex interactions between code features than basclines. It is indicated that synthetic EHR data by EHRDIFF may have superior utility for training downstream models biomedical tasks. We present more results on other utility metrics in B
4.5.2 Privacy Results
we list the results against privacy attacks. In terms of attribute inference risk and membership inference risk, EHRDIFF achioves intermediate results, while medGAN and CorGAN respectively achieve the best results on attribute inference risk and membership inference risk. However, shown in utility results, the quality of synthetic EHR data by both models is far worse than F.RDDIFF.. In extreme circumstance
In Table 2
8

---

Published in Transactions on Machine Learning Research (03/2024)
medGAN
medBGAN
medWGAN
1.0
1.0
F1 score on synthetic data
0.9
0.9
0.9
0.8
0.8
0.8
0.7
score on syntheiic
F scone on synthetic
0.7
0.5
0.5
0.5
0.4
0.4
0.4
0.3
0.3
0.3
0.2
0.2
orr 0.9751
0.9921 Corr
0.1
Corr 0.9676
0.0
0.0
0.0
0.0
0.1
0.2 0.3 0.4
0.7 0.9 1.0
0.0
0.2 0.3 0.4 0.5 0.6 0.7 0.8 1.0
0.0
0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.
F1 score real data
F1 score real data
F1 score on real data
CorGAN
OMR-WGAN
EHRDiff
1.0
1.0
1.0
score on synthetic data
0.9
0.9
0.9
0.8
0.7
synthetic
0.7
0.6
0.6
0.6
0.5
score on 0.5
0.5
0.4
0.4
0.4
0.3
0.2
0.2
0.1
Corr 0.9239
0.1
Corr = 0.9945
B 0.1
Corr 0.9997
0.0
0.0
0.0
0.0
0.2 0.300.4...
0.6 0.8
0.0
0.2 0.3 005000000000000..00000000
0.0 0.2 0.3 0.
F1
data
score data
F1 score real data
Figure/ 2: The dimension-wise prediction scatter plot of synthetic EHR data from different generative models against real EHR data. The diagonal lines represent the perfect match of code prediction betweon synthetic and real EHR data. Each scatter represents lask.
Table 2: The privacy assessment for each model. indicates the lower numbers for better results.
Attribute Inference Risk (4)
Membership Inference Risk (4)
medGAN
0.0011 +0011+000006
0.2941+0.0001
medBGAN
0.0069+10.002.
0.2961110.004F
medWGAN
0.0066=100011
012928:000005.
CorGAN
0.0033+-0.005
0.2413+0.0061
EMR-WCR -GAN
0.0259+0.0008
0.2943++0.000
EHRDIFF
0.0190:1000133
0.2956:10.0013
where generative model fails to fit the real EHR data distribution, the model may achieve perfect results on both privacy metrics, since attackers can not infer private information through synthetic data of bad quality. Therefore, there exists an implicit trade-off between utility and privacy. We suspect that medGAN and AARN
CorGAN can better safeguard privacy due to mediocre synthesis quality. When compared which achieves the best synthesis quality among baselines, F.HRDIPF surpasses FMR-WGAN attribute inference risk and achieves on-par results in terms of membership inference risk. To conclude, EHRDIFF well protect the sensitive private information of real EHR training data.
4.6 Results on PTB-ECG and CinC2023
Since both datasets are designed for classification, we inspect the utilities of synthesized data by evaluating the Area Under receiver operating characteristic Curve (AUC) of classifiers trained with synthetic data. We

---

Published in Transactions on Machine Learning Research (03/2024)
Table 3: The AUC values on Cinc2012 Data and PTB-ECG Data.
Cinc2012 Data
PTB-ECG Data
Real
0.8479
0.9963
medGAN
0.6176=#0.067
0.7550++0.0375
medBGAN
0.5942+1000700
0.7301+0.0225
medWGAN
0.7012+0.044
1.8071+000273
CorGAN
0.6352:10.220 1259
0.4521
0.8010=000143
0.8011#0.0171
EHRDiT
0.8405=+0.002
0.0000+0000010
Table 4: Ablation results of utility and privacy on different aspects of EHRDIFF designs. VE and VP are
short for variance exploding and variance preserving respectively. Pre-Cond represents pre-conditioning
Utility NZC(1)
Privacy
Corr (t)
CMD (4)
AIR (4)
MIR (4)
EHRDIFF
0.90001000001
1771.011.4
7.76810.013
0.018710000110
0.2954100.0014
on Diffusion Process
w/ VE
0.98761000003
1553.015.0
8.05710.022
0.0130+0.0010
0.2549+0.0023
w/ VP
0.99761100001
1564.3+1.2
8.00210.013
0.0143+00.0007
0.302410.0007
Sampling Method
w/ 1st Euler 0.997410.0001
1541.3+4.2
7.889
0.0155:10.0003
0.3111
on Network Design
w/o Pre-Cond 0.9655+00.0027
432.0+:26.8
8.719+0.058
0.0030++0.0009
0.3184+0.0018
use LightGBM Ke et al. 2017 as classifiers and train on synthetic data of the same size real training data.
The results shown in Table 3 that classifiers trained by synthotic data from EHRDIFF achieve the highest AUC values and are consistently better than GAN-based methods, reaching 0.8405 and 0.9898 on average on CinC2012 Data and PTB-ECG Data respectively. They also have on-par performance with classifiers trained by real data. The results show the great utility of EHRDIFF generated EHR data, and the efficacy is consistently good across different EHR data feature formats. This demonstrates EHRDIFF is practical in real-world scenarios and can approach EHR synthesis of diverse formats. The downstream biomedical models can benefit from training on synthetic EHR data by EHRDIFF, potentially overcoming the obstacles of limited publicly available real EHR data.
5 Discussion
5.1 Ablation Study
In this section, we discuss and conduct ablation experiments on the effective designs of EHRDIFF The designs of EHRDIPP include three major aspects: diffusion process, sampling method for inference, and neural network design for modeling denoising functions. We demonstrate the performance for each through the utility and privacy metrics MIMIC-III The results are shown in Table 4 For the diffusion process, compare the diffusion process of EHRDIFF to the choice of variance exploding (VE) and variance preserving (VP) diffusion process. VE and VP are diffusion processes originally proposed in [Snn et al. (2021). We can see that EHRDIFF outperforms both choices in terms of utility metrics while regarding the privacy concerns, EHRDIFF performs a little inferior to VP and VE diffusion processes. As discussed Section [.5.2] the privacy performance can be compromised to better utility performance. For the sampling process, Heun's 's 2nd order method outperforms Euler's 1st method in utility. A 2nd order sampling method can lead better step-wise estimation of each denoising step, and hence has better generation performance than 1st met
10

---

Published in Transactions on Machine Learning Research (03/2024)
0.84
6.95
0.82
AUC CIN22012
0.80
0.78
0.05
0.76
0.74
6.75
EMIRAGAA
0.72
ENILWGAN
EHRDAY
EHRONT
Roal
0.70
Real
2000
4000
6000
5000
10000
12000
2000
4000
6000
5000
10000
Synthetic Sample Number for training
Synthetic Sample Namber for training
Figure The line plots for CinC2012 and PTE-ECG with different data scales, The green star represents the performance of the model trained real data.
when using the same trained denoising function. For the network design, we can see that EHRDIFF without pre-conditioning fails generate high-quality EHR. data as shown by the lowest NZC results of only 432. The possible explanation for this is that the binary code features may have diverse prevalence which leads to much difference in variance of each feature. Pre-conditioning sets the inputs and outputs of the neural networks to be unit variance and thus eases the modeling difficulty for the network in the denoising function.
Overall, we have demonstrated the effectiveness of the design choices in EHRDIFF regarding diffusion processes, sampling methods, and network designs. EHRDIFF achieves the best performance regarding utility metrics, indicating a superior generation quality, while such designs EHRDIPP only compromise the privacy concerns marginally.
5.2 Influence of Synthetic Data Scale
Our main motivation is to use the synthetic data from EHRDIFF to aid the downstream methodology development on EHR, emphasizing the limitation of scarce real-world EHR data. Therefore, we further demonstrate the influence of synthetic EHR data scales on training downstream models. We train classifiers of the same type on PTB-ECG and CinC2023 data with different scales of synthetic data from EHRDIFF and the previous statc-of-the-art EMR- WGAN for comparison. The results are shown Figure B
As can be from the results, the downstream performance of models trained synthetic data from EHRDDIF improves as the size of synthesized data scales up. Models trained on synthetic data generated from EHRDIFF outperformed those trained on data from EMR-WGAN across different sizes of synthetic training data for both CinC2012 and PTB-ECG, except on minimal data size of 100 on CinC2012. Notably, our results demonstrate that smaller sample sizes of synthetic EHR data from EHRDIFF can lead to superior downstream model performance compared to larger sample sizes from EMR-WGAN.
6 Potential Social Impacts
The generative models including our EHRDIFF for synthesizing EHR data can potentially reveal their training data, resulting in unexpected patient privacy information leakage. Although in our experiments conduct extensive experiments for privacy protection from attacking risks following existing rescarch (Yan et al. 2022), we also find the potential drawbacks of the privacy assessment metries from our results and the extent to which applying our generative model in real-world application require further studying.
Data-driven generative models are prone to generating content with potential biases in training data. The EHR synthotic models may also suffer from such malicious tendencies gender or demographic bias. Existing research generative models has proposed methods to measure Teoo & Cheung 2021 mitigate such
11

---

Published in Transactions on Machine Learning Research (03/2024)
problem Grover et al. 2019b Teo et al. 2022). Assessing and alleviating the bias of generative models for EHR synthesis remains an important research question.
7
Conclusion
In this work, explore EHR data synthesis with diffusion models. We proposed EHRDIFF diffusion-based model, for EHR data synthesis. Through comprehensive experiments binary code EHR data, empirically demonstrate the superior performance in generating high-quality synthetic EHR data from multiple evaluation perspectives, setting new state-of-the-art EHR synthesis methods. In the meanwhile, we also show EHRDIFF can safeguard sensitive private information in real EHR training data. Furthermore, beyond binary code features in EHR. data, the efficacy of EHRDIFF consistently excels in continuous and time-series features. EHRDIFF can help downstream biomedical methodology research overcome the obstacles of limited publicly available real EHR data.
Acknowledgment
This work was supported by the Natural Science Foundation of China (Grant No. 12171270) and the Natural Science Foundation of Beijing Municipality (Grant No. Z190024).
References
Jonas Adler and Scbastian Lunz. Banach wasserstein gan. In S. Bengio, H. Wallach, H. Larochelle, K. Grauman, N. Cesa-Bianchi, and R. Garnetl (eds.), Advances in Newral Information Processing Systems, volume 31. Curran Associates, Tnc., 2018. URL. fttts::/proceedigs.eevrr http:///gggn.rrrrsssss/////////e cc/paper/2018/file.
Emily Alsentzer, Michelle M. Li, Shilpa N. Kobren, Undiagnosed Diseases Network, Isaac S. Kohane, and Marinka Zitnik. Deep learning for diagnosing patients with rare genotic diseases. medRriv, 2022. doi:
00.1001/022.12.07.2222 22222233. URL http://////.....ooooooooooortrre 22283238
Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E. Hinton. Layer normalization, 2016. URL https:
7/arxiv. berrxiv.org/bbae. org/abs/1607.66 06450
Mrinal Kanti Baowaly, Chia-Ching Lin, Chao-Lin Liu, and Kuan-Ta Chen. Synthesizing electronic health records using improved generative adversarial networks. Journal of the American Medical Informalics Association, :228 241, 12 2018. ISSN 1527-974X. doi: 10.1093 10.1093/jamia//o /ja//jaaaaa//1222 URL https:///oi.org//
10. 1t.1093/jamaaocy1444
Siddharth Biswal, Soumya Shubhra Ghosh, Jon D. Duke, Bradley A. Malin, Walter F. Stewart, and Jimeng Sun. Eva: Generating longitudinal electronic health records using conditional variational autoencoders. Arxio, abs/2012.1002g) 2020.
Ralf Bousseljot, Dieter Kreiseler, and Allard Schnabel. Nutzung der ekg-signalddatenbank cardiodat der plb über das internet. 1995.
Anna L. Buezak, S. Babin, and Linda J. Moniz. Data-driven approach for creating synthetic electronic medical records. BMC Medical Informatics and Decision Making, 10:59 59, 2010.
Taha Ceritli, Ghadeer O. Ghosheh, Vinod Kumar Chauhan, Tingting Zhu, Andrew P. Creagh, and David A. Clifton. Synthesizing mixed-type cloctronic health records using diffusion modcls, 2023.
Tong Che, Yanran Li, Athul Paul Jacob, Yoshua Bengio, and Wenjic Li. Mode regularized generative adversarial networks, 2017.
Edward Choi, Siddharth Biswal, Bradley Malin, Jon Duke, Walter F. Stewart, and Jimeng Sun. Generating multi-label discrete patient records using generative adversarial networks. In Finale Doshi-Velex, Jim
12

---

Published in Transactions on Machine Learning Research (03/2024)
Fackler, David Kale, Rajesh Ranganath, Byron Wallace, and Jenna Wiens (eds.), Proceedings of the 2nd Machine Learning for Healtheare Conference, volume 68 of Proceedings of Machine Learning Research, pp- 286 305. PMLR, 18 19 Aug 2017. URL https://proceeeding.. werpiiinnsmmr.r.....mm mmlr.prres//66/cho177a html
Ghadeer O. Ghosheh, Jin Li, and Tingting Zhu. A review of generative adversarial networks for electronic health records: applications, evaluation measures and data sources. ArXiu, /bss/220.000188, 2022.
Shansan Gong, Mukai Li, Jiangtao Feng, Zhiyong Wi, and Lingpeng Kong. Diffuseq: Sequence to sequence text generation with diffusion models, 2023.
Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde- Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. In Z. Chahramani, M. Welling, C. Cortes, N. Lawrence, and K.Q. Weinberger (eds.), Advances in Newral Information Processing Systems, vol- ume 27. Curran Associates, Inc., 2014. URL httpss//proceedings.eer newrrddiiinnnnniiipppppp.. httpp//ppsppppppppr//////////// (155866622266111166664c776c1c1ff
.dd]
Aditya Grover, Kristy Choi, Rui Shu, and Stefano Ermon. Fair generative modeling via weak supervision. In International Conference on Machine Learning, 2019a. URL/https: http:/ppi..emmmtttccsccorrrrrr/r
204904806
Aditya Grover, Jiaming Song, Alekh Agarwal, Kenneth Tran, Ashish Kapoor, Eric Horvitz, and Stefano Ermon. Bias correction of Icarned generative models using likelihood-free importance weighting. ArXiv, abs/1906.008 09531, 2019b. URL
Huan Hc, Shifan Zhao, Yuanzhe Xi, and Joyce C Ho. Meddiff: Generating cloctronic health records using accelerated denoising diffusion model, 2023. URL http:///aaaxiv..raabbss///s 04355
R Devon Hjelm, Athul Paul Jacob, Adam Trischler, Gerry Che, Kyunghyun Cho, and Yoshua Bengio. Boundary seeking GANs. In International Conference on Learning Representations, 2018, URL https: //openreview. wwtp:eeet/ooommmidrrrrraaaa
Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. In H. Larochelle, M. Ranzato, R. Hadsell, M.F. Balcan, and H. Lin (eds.), Advances in Neural Information Processing Systems, volume 33, pp. 6840 6851. Curran Associates, Inc., 2020. URL https::/prroceednggs... neurips
James G. Hodge, Jr, Lawrence O. Gostin, and Peter D. Jacobson. Logal Issucs Concerning Electronic Health Informationn Privacy, Quality, and Liability. JAMA, 282(15):1466 1471, 10 1999. ISSN 0098-7484. doi:
10.1001/jama.220) 2.. URL httpp:://oi.orrg org/1/00....//00.. /001/jama. 282. 15. 1466
Sergey Tolle and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In Francis Bach and David Blei (eds.), Proceedings of the 32nd International Conference on Machine Learning, volume 37 of Proceedings of Machine Learning Research, pp. 448 456, Lille, France, 07-09 Jul 2015. PMLR. URL https://proceeddngss mlr. pwwss/v37/ioffel// https://prreeeenssss...rrss/ssss
Alistair E. W. Johnson, Tom J. Pollard, Lu Shen, Li wei H. Lehman, Mengling Feng, Mohammad Mahdi Ghassemi, Benjamin Moody, Peter Szolovits, Leo Anthony Celi, and Roger G. Mark. Mimic-ili, a freely accessible critical care database. Scientáfic. Data, 3, 2016.
Alistair E. W. Johnson, Lucas Bulgarelli, Lu Shen, Alvin Gayles, Ayad Shammout, Sleven Horng, Tom J. Pollard, Benjamin Moody, Brian Gow, Li wei H. Lehman, Leo Authony Celi, and Roger G. Mark. Mimic-iv, a freely accessible electronic health record datasct. Scientific Data, 10, 2023.
Alistair EW Johnson, Nic Dunkley, Louis Mayaud, Athanasios Tsanas, Andrew A Kramer, and Gari D Clifford. Patient specific predictions in the intensive care unit using a bayesian ensemble. In Computing in Cardiology (CinC), 2012, pp. 249 252. IEEE, 2012.
Mohammad Kachuoe, Shayan Fazeli, and Majid Sarrafzadeh. Ecg heartbeat classification: deep transfcrable representation. In 2018 IEEE international conference on healthcare informatics (ICHI), pp. 443-444. TEFE, 2018.
13

---

Published in Transactions on Machine Learning Research (03/2024)
Tero Karras, Mikka Aittala, Timo Aila, and Samuli Laine. Elucidating the design space of liffusion-based generative models. In Proc. NewrIPS, 2022.
Guolin Ke, Qi Meng, Thomas Finley, Taileng Wang, Wei Chen, Weidong Ma, Qiwei Ye, and Tie- Yan Liu. Lightgbm: A highly efficient gradient boosting decision tree. Advances in neural information processing systems, 30, 2017.
Zhifeng Kong, Wei Ping, Jiaji Huang, Kexin Zhao, and Bryan Catanzaro. Diflwave: A versatile diffusion model for audio syuthesis. In International Conference on Learning Representations, 2021. URL https: //openreview.net/fooee wwwp:neettooomiidaaaa-----e XFKKYm25]
Akim Kotelnikov, Dmitry Baranchuk, Tvan Rubachev, and Artem Babenko. Tabddpm: Modelling tabular data with diffusion models, 2022.
Xiang Lisa Li, John Thickstun, Ishaan Gulrajani, Percy Liang, and Tatsunori Hashimoto. Diffusion-LAN improves controllable text generation. In Alice H. Oh, Alekh Agarwal, Danielle Belgrave, and Kyunghyun Cho (eds.), Advances in Neurol Information Processing Systems, 2022. URL https:///ppenrewiews net/ Forum?id-339LLEEsjJyy
Vinod Nair and Gcoffrey E. Hinton. Rectified lincar units improve restricted boltzmann machines. In International Conference on Machine Learning, 2010. URL
15539264
Ikaro Silva, George Moody, Daniel J Scott, Leo A Celi, and Roger G Mark. Predicting in-hospital mortality of icu patients: The physionet/computing cardiology challenge 2012. Computing in cardiology, 39:245, 2012.
Jascha Sohh-Dicksttein Eric Weiss, Niru Maheswaranathan, and Surya Ganguli. Deep unsupervised learn- ing using nonequilibrium thermodynamics. In Francis Bach and David Blei (eds.), Proceedings of the 32nd International Conference Machine Learning, volume 37 of Proceedings of Machine Learning Research, pp. 2256 2265, Lille, France, 07- 09 Jul 2015. PMLR. URL https://prrceednngg.lr..rcc 137/sohl-dicksttenn1.... html,
Aaron Sonabend, Junwei Lu, Leo Anthony Celi, Tianxi Cai, and Peter Szolovits. Expert-supervised reinforcement learning for offline policy learning and evaluation. In Advances in Newral Information Processing Systems, volume 33, pp. 18967 18977, 2020. URL https://proceedingg neurips. cttps/crccppp/////p/p 218 F9c7-PPap .ddf
Yang Song, Jascha Sohl-Dickstein, Diederik Kingma, Abhishek Kumar, Stefano Ermon, and Ben Poole. Scoro-based generative modeling through stochastic differential equations. In International Conference on Learning Represenlations, 2021. URL http::///ppeereeveee.ee////rrrrp 2RRHS
Christopher T. H. Teo and Man Cheung. Measuring fairness fairness in generative models. ArXiv, abs 2107.07554 2021. URL orttas//ppp..emmmmm..ccccoooooop
Christopher T. H. Teo, Milad Abdollahzadeh, and Ngai-Man Cheung, Fair generative models via transfer learning. Arx, abs/2212 222/22222222222 2022. URL https: http:/ppp...emmaniccchchlollle :ttg/oopppII:::52220 195
Hoang Thanh- Tung, T. Tran, and Svetha Venkatesh. On catastrophic forgetting and mode collapse in generative adversarial networks. ArXiv, abs/ abs/1807.00 .0001,, 2018.
Amirsina Torfi and Edward A. Fox. Corgan: Correlation convolutional generative adversarial networks for generating synthetic healthcare records. In The Florida Al Research Society, 2020a.
Amirsina Torfi and Edward A Fox. Corgan: Correlation-capttringg convolutional generative adversarial
networks for generating synthotic healthcare records. arXiv preprint arXiv:2001.09346 2020b.
Pascal Vincent, Hugo Larochelle, Yoshua Bengio, and Pierre-Antoina Manzagol. Extracting and composing robust features with denoising autocncoders. In Proceedings of the 25th International Conference on Machine Learnång, ICML '08, pp. 1096-1103, New York, NY, USA, 2008. Association for Computing Machinery. ISBN 9781605582054. doi: 10.1145/ 01145/139015 11901391166 1390994. URL https::///ol www.:/o...rgg///../ 11tp://11.11119999111111 13982294
14

---

Published in Transactions on Machine Learning Research (03/2024)
Jason Walonoski, Mark Kramer, Joseph Nichols, Andre Quina, Chris Moesel, Dylan Hall, Carlton Duffett, Kudakwashe Dube, Thomas Gallagher, and Scott. McLachlan. Synthea: An approach, method, and software mechanism for generating synthetic patients and the synthetic electronic health care record. Journal of the Americon Medical Informatics Association, 25(3):230 238, 08 2017. ISSN 1527-974X. doi: URL
Zifeng Wang and Jimeng Sun. Promplehr: Conditional electronic healtheare records generation with prompt learning. In Conference on Empirical Methods in Natural Language Processing, 2022.
Chao Yan, Ziqi Zhang, Steve Nyemba, and Bradley A. Malin. Generating electronic health records with multiple data types and constraints. AMIA Annaal Symposium proccedings. AMTA Symposium, 2020: 1335 1344, 2020.
Chao Yan, Yao Yan, Zhiyu Wan, Ziqi Zhang, Larsson Omberg, Justin Guinney, Scan D. Mooncy, and Bradley A. Malin. A multifaceted benchmarking of synthetic electronie health record generation models. Nature Communications, 13, 2022.
Chunhui Yuan and Haitao Yang. Research on k-value selection method of k-means clustering algorithm. J, 2 (2):226-235, 2019.
Hongyi Yuan and Sheng Yu. Efficient symptom inquiring and diagnosis via adaptive alignment of reinforcement learning and classification. CoRR, 0bs/2111.007733 2021. URL
00733
Hongyi Yuan, Zheng Yuan, Chuanqi Tan, Fei Huang, and Songfang Huang. Seqdiffusoq: Text diffusion with encoder-decoder transformers. ArXie, abs/2212.100 2022.
Ziqi Zhang, Chao Yan, Diego Mesa, Jimeng Sun, and Bradley A Malin. Ensuring electronic medical record simulation through better training, modeling, and evaluation. Journal of the American Medical Informalics Association, 27(1):99- 10 2019. TSSN 1527-974X. doi: 10.1093/jamia/oc2116 URL
https://6ol.orr//15 1093/ /ttp///aa//cc///////// acc216
Ziqi Zhang, Chao Yan, Thomas A. Lasko, Jimeng Sun, and Bradley A. Malin. Synteg: a framework for temporal structured clectronic health data simulation. Journal of the American Medical Informatics Associalion JAMIA, 2020a.
Ziqi Zhang, Chao Yan, Diego Mesa, Jimeng Sun, and Bradley A Malin. Ensuring electronic medical record simulation through better training, modeling, and evaluation. Journal of the American Medical Informalics Association, 270,) 2020b.
15

---

Published in Transactions on Machine Learning Research (03/2024)
Algorithm Heun's 2nd Method for Sampling
Input: Time Step & and noise level ot,
Using Equation 9 caleulate the derivative 9t, dx//tt
9t: = a,,
(art (t,),
Get intermediate Bts4s by taking Euler step:
tt,41 9r, (li+1 - (,)
2t, +t,
3: Calculate the gradient correction gt.
91: 1, Pt - 1 ( (441))
Get next time step sample Tt..1²
0i+1 = 84 + (li+1 4)(59 20441)
return 24,41
Table 5: MCAD represents Medical Concept Abundance Distance. J and 1 indicate the respectively lower and higher numbers for better results.
Latent Distance (4)
MCAD (4)
medGAN
4.300=+0.009
0.257=0.014
medBGAN
-5.407+-2.452
0.123++0.010
medWGAN
-12.968
0.076+1.024
CorGAN
-9.917
0.129110.053
EMR- WGAN
-14.437-0.549
0.101=0.008
EHRDIFF
-13.560+0.211
0.076+00002
A Sampling Algorithm
B
Additional Results
The quality synthetic EHR data can be evaluated from a multifaceted perspective Yaan et al. 2022). We use additional metrics further evaluate the synthetic EHR data on MIMIC-III.
B.1 Latent cluster analysis
The metric evaluates the distributional difference between the synthetic and real EHR data in the latent space. The metric first uses principle component analysis to reduce the sample dimension for both data and then cluster the samples in the latent space. Ideally, synthetic and real EHR data are identically distributed, the synthetic and real EHR samples should respectively comprise half of the samples in one cluster. Therefore, the metric is calculated
log
K
n
real
0.5)²
(11)
K
where K is the number of resulted clusters, n, and neeaa are the sample number and the real sample number in ith cluster, respectively. The lower the value, the less synthetic dala distribution deviates from the real data distribution. In our experiments, K is decided by the elbow method (uuan & Yang 2019 for each synthetic data and in this work is 4 or 5 according to different methods.
B.2 Medical concept abundance
The metric assesses the synthetic EHR data distribution on the record level. The metric calculates the empirical distribution of the unique positive (occurred) code number within each sample. The empirical
16

---

Published in Transactions on Machine Learning Research (03/2024)
3000
4000
Real data medGAN
Real data
Real data
Density Distributios
Density Distributions
2500
medBGAN
Density Distributions
2000
medWGAN
2000
1500
2000
1500
1000
1000
1000
500
0
20
40
60
80
100
20
100
20
40
60
80
100
Numbee of features per record
Number of features record
Number of features per record
2500
Real dala
Real data
Real dala
CorGAN
EMR-WGAN
EHRDiff
Densily Distributions
2000
Density Distributions
2000
Density Distributions
2000
1500
1500
1500
1000
1000
500
500
500
0
20
40
60
80
100
20
80
100
20
40
60
80
100
Number of features per record
Number of features per record
Number of features per record
Figure 4: The histograms plot the empirical distributions of the unique code counts on the sample level. The solid lines are the kernel density estimations of the distribution.
distributions are calculated by histograms. The discrepancy between synthetic and real EHR data is calculated as follows:
1 2N
(1) (i)l.
(12)
where M the number of bins histograms, denotes the number of samples for real (or synthotic) data, and (i) and (i) respectively represent the ith bin in the histograms of real and synthetic EHR data. In this work, M is set to 20.
B.3 Results
From Table 5 is shown that EHRDIFF performs better than most baselines and only marginally falls behind EMR-WGAN by 0.877 the latent distance metric. In terms of MCAD, EHRDIFF consistently outperforms all baselines, and depicted in Figure 4 can see that the histogram of unique code count distribution of synthetic EHR data by EHRDDIF achieves the best fit to that of real EHR data. From a sample-level perspective, latent distance results illustrate that synthetic EHR data by EHRDIFF is closely distributed to real EHR data. The MCAD results show that synthetic data by EHRDIFF resembles the real EHR most terms of unique positive code counts. This result is line with the findings of the non-zero code column metric.
C Data Materials
C.1
CinC2012 Data
CinC2012 Data Siiva et al. 2012) is dataset proposed predict the mortality of ICU patients in the
C21C It contains general descriptors such age, gender, and ICU type and time series records like
17

---

Published in Transactions on Machine Learning Research (03/2024)
heart rate, respiration rate, and serum glucose. In our experiments, dataset from (Johnson et al. 2012), which is derived by applying simple extraction the time-series features and excluding abnormal outliers in the physiological measurements. We then added the label of in-hospital mortality to the records, making 115 features in total. There are 4000 records for model training and another 4000 records for model lesting, as split by the CinC authority. We use this dataset to evaluate the models' performance on mixed-type EHR data.
the preprocessed version of this
C.2 PTB-ECG Data
PTB-ECG Data (Bousseljot et al. 1995 is a collection ECG signals for heart disease diagnosis. We utilize preprocessed version from (Kachuce al. 2018) to carry on our experiments, where the signals are segmented and preprocessed from the original PTB Diagnostic ECG Database. The dataset contains 4046 normal patients and 10506 records with heartbeat classified as abnormal. Specifically, all the signals are cropped, downsampled, padded to make each sample into a fixed dimension of 188. We use this dataset to explore models' ability to generate continuous medical time series data.
18


Reviews:
[{"review_id": "0pjvsykXAM", "reviewer": "Reviewer_r6Wj", "summary": "", "questions": "", "limitations": "", "rating": null, "confidence": null, "soundness": null, "presentation": null, "contribution": null, "strengths": "", "weaknesses": "", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "Strengths:\n\nTo the best of the reviewer’s knowledge, this is the very first paper to apply diffusion models which often used for visual generation to EHR data.\nThe method is effective and generate more diverse data than previously proposed GAN based method.\nThe effectiveness of the method is validated on multiple datasets.\nWeakness:\n\nThe method is a rather direct application of the current existing diffusion models. The proposed method did not update the original diffusion models designed for vision to the EHR data.", "was_revised": false, "final_justification": "", "rebuttal": "", "claims_and_evidence": "Yes", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "paper_topic_and_main_contributions": "", "excitement": null, "reproducibility": null, "ethical_concerns": "", "main_review": "", "summary_of_the_paper": "", "summary_of_the_review": "", "strength_and_weaknesses": "", "limitations_and_societal_impact": "", "review_text": "", "summary_of_contributions": "Due to privacy concerns, there is only limited access to large scale and high-quality EHR data. Therefore, it is of importance to synthesize high-quality EHR data. Previous methods focus on Generative Adversarial Networks (GAN) while this paper explores how to use the diffusion model to generate EHR data. This diffusion model-based method outperforms the previous methods and achieves the SoTA performance on this task.", "claims_and_evidence_yn": "Yes", "claims_explanation": "", "audience_yn": "Yes", "audience_explanation": "", "requested_changes": "The authors have fully addressed the previous comments.", "broader_impact_concerns": "N/A", "additional_comments": "", "extra_scores": {}, "extra_text": {}}, {"review_id": "FlkIPHHb38", "reviewer": "Reviewer_bnZM", "summary": "", "questions": "", "limitations": "", "rating": null, "confidence": null, "soundness": null, "presentation": null, "contribution": null, "strengths": "", "weaknesses": "", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "I have no further comments to the current version.", "was_revised": false, "final_justification": "", "rebuttal": "", "claims_and_evidence": "Yes", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "paper_topic_and_main_contributions": "", "excitement": null, "reproducibility": null, "ethical_concerns": "", "main_review": "", "summary_of_the_paper": "", "summary_of_the_review": "", "strength_and_weaknesses": "", "limitations_and_societal_impact": "", "review_text": "", "summary_of_contributions": "The reviewers have fully addresses the previous comments.", "claims_and_evidence_yn": "Yes", "claims_explanation": "", "audience_yn": "Yes", "audience_explanation": "", "requested_changes": "None", "broader_impact_concerns": "N/A", "additional_comments": "", "extra_scores": {}, "extra_text": {}}, {"review_id": "ZTVJWlY60m", "reviewer": "Reviewer_F7A1", "summary": "", "questions": "", "limitations": "", "rating": null, "confidence": null, "soundness": null, "presentation": null, "contribution": null, "strengths": "", "weaknesses": "", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "*Strengths*\n\nOverall the paper is in a much better condition than its previous version. It is also generally well written and they've addressed all of my previous comments.\n\n*Limitations*\n\nThe paper still requires further proofreading, e.g., missing full stops or rephrasing certain things like \"achieves middling results\".", "was_revised": false, "final_justification": "", "rebuttal": "", "claims_and_evidence": "Yes", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "paper_topic_and_main_contributions": "", "excitement": null, "reproducibility": null, "ethical_concerns": "", "main_review": "", "summary_of_the_paper": "", "summary_of_the_review": "", "strength_and_weaknesses": "", "limitations_and_societal_impact": "", "review_text": "", "summary_of_contributions": "This paper is a resubmission based on the review comments provided earlier. The authors propose to synthesize EHR data using diffusion models. In particular they make the following contributions:\n1. They apply diffusion methods from existing work (Song et al. and Karras et al.) to EHR data.\n2. They perform experiments and compare the diffusion approach to GAN- based baselines, using diagnosis and procedure codes in MIMIC-III (a publicly available dataset). The utility and privacy metrics are adopted from previous work. The results show that while the performance of EHRDiff is comparable to existing work in terms of dimension-wise distribution, it has a significantly better result in terms of non-zero code columns, hence it overcomes the issue of mode collapse compared to GAN based methods. However, in terms of attribute inference risk and membership inference risk, GAN based methods perform better.\n3. They also test diffusion on two datasets: CinC2012 and PTB-ECG, and show that EHRDiff performs best in terms of AUC.", "claims_and_evidence_yn": "Yes", "claims_explanation": "", "audience_yn": "Yes", "audience_explanation": "", "requested_changes": "Please see above.", "broader_impact_concerns": "There are ethical implications associated with the work so I would recommend adding a Broader Impact statement. Previous work has highlighted issues of generative models and possible biases, which may also occur in EHR data. Hence, a discussion of similar concerns is necessary in the medical context.", "additional_comments": "", "extra_scores": {}, "extra_text": {}}]

Author rebuttal:

Meta-review: This is a "technical" resubmission due to the author's misunderstanding of the procedure. It is now ready to be published.
Decision: Accept (poster)