Leveraging an ECG Beat Diffusion Model for Morphological Reconstruction from Indirect Signals
Authors: Lisa Bedin
Gabriel Cardoso
Josselin Duchateau
Remi Dubois
Eric Moulines
Venue: NeurIPS 2024 poster (2024)
Keywords: Electrocardiogram
Denoising Diffusion Generative Models
Conditional Sampling
Healthcare
Bayesian Inverse Problem
Primary area: machine_learning_for_healthcare

Abstract: Electrocardiogram (ECG) signals provide essential information about the heart's condition and are widely used for diagnosing cardiovascular diseases. The morphology of a single heartbeat over the available leads is a primary biosignal for monitoring cardiac conditions. However, analyzing heartbeat morphology can be challenging due to noise and artifacts, missing leads, and a lack of annotated data.
Generative models, such as denoising diffusion generative models (DDMs), have proven successful in generating complex data. We introduce $\texttt{BeatDiff}$, a light-weight DDM tailored for the morphology of multiple leads heartbeats.
We then show that many important ECG downstream tasks can be formulated as conditional generation methods in a Bayesian inverse problem framework using $\texttt{BeatDiff}$ as priors. We propose $\texttt{EM-BeatDiff}$, an Expectation-Maximization algorithm, to solve this conditional generation tasks without fine-tuning. We illustrate our results with several tasks, such as removal of ECG noise and artifacts (baseline wander, electrode motion), reconstruction of a 12-lead ECG from a single lead (useful for ECG reconstruction of smartwatch experiments), and unsupervised explainable anomaly detection. Numerical experiments show that the combination of $\texttt{BeatDiff}$ and $\texttt{EM-BeatDiff}$ outperforms SOTA methods for the problems considered in this work.

Leveraging an ECG Beat Diffusion Model for Morphological Reconstruction from Indirect Signals
Lisa Bedin "
Gabriel Cardoso Ecole Polytechnique, IHU Liryc
Ecole Polytechnique
Josselin Duchateau
Remi Dubois
Eric Moulines Ecole Polytechnique
Bordcaux University Hospital, IHU Liryc
IHU Liryc
Abstract
Electrocardiogram (ECG) signals provide essential information about the heart's condition and are widely used for diagnosing cardiovascular diseases. The mor- phology of a single heartbeat over the available leads a primary biosignal for monitoring cardiac conditions. However, analyzing heartheat morphology challenging due to noise and artifacts, missing leads, and a lack of annotated data. Generative models, such as denoising diffusion generative models (DDMs), have proven successful generating complex data. We introduce BeatDiff, light- weight DDM tailored for the morphology of multiple leads heartbeats. We then show that many important ECG downstream tasks can be formulated as conditional generation methods in Bayesian inverse problem framework using BeatDiff priors. We propose EM- BeatDiff, an Expectation Expectatio-MMxxiizztioo algorithm, to solve this conditional generation tasks without fine-tuning. We illustrate our results with several tasks, such as removal of ECG noise and artifacts (baseline wander, electrode motion), reconstruction of a 12-lead ECG from a single lead (useful for ECG reconstruction of smartwatch experiments), and unsupervised explainable anomaly detection. Experiments show that the combination of BeatDiff and EM-BeatDiff outperforms SOTA methods for the problems considered in this work.
be
Introduction
Electrocardiograms (ECG) are essential tools for diagnosing cardiac conditions. Two main types of diagnostics can be obtained from an ECG signal: rhythm- basedd and morphology-bast based. Rhythm- based diagnostics focus the frequency and regularity of heartbeats, while morphology-bai diagnostics focus on the shape and amplitude of the various waves and segments of the ECG signal; be diagnosed by analyzing the morphology of the
[40]. Many eritical cardiac conditions
different phases of a single beat (166) 67 20 39 ). For example, an increase in the ST segment suggests a myocardial infarction (193). while long QT syndrome associated with increased risk of sudden death (192). In fact, patients who have survived events similar to sudden death often have abnormal intracardiac signals, even during sinus rhythm; see
34
Most generative models for ECG literature attempt to accurately represent the rhythm, i.e. the time at
which the individual ECG events occur; e.g., 30 99 79
104
100 3. We focus in this paper
on the morphology of a single heartheat.
Code available at http:///ggtttbaccc////aaaaaatttt wwwelin/enatdiittt. Pretrained models available al httpsss//uuggigggeeee
$Correspondence: lisa. wtw.eeesasaaiiiia.eeee bediin@poooyteeccniuuee org "Isuul contribution.
38th Conference on Neural Information Processing Systems (NcurIPS 2024).

---

The standard for ECG recording systems includes 12 leads, which are obtained using 9 electrodes. The use of multiple leads is required because pathologies may manifest only in one lead. For example, T wave inversions- wwhcch can indicate Arrhythmogenic Right Ventricula Dysplasia-min appear on one or two precordial leads ((022). ). Furthermore, the specific precordial lead in which a disease is detected has an important diagnostic value about the disease location in the heart (152).
only
Multi-lead ECGs can be affected by noise and artefacts, i.e. unwanted signals caused primarily by variations in potential and impedance at the electrode-skin interface, but also by other factors such as environmental interference, movement of the subject; see e.g.. [TOT 47 [6)] and the references
therein. These artefacts overlap in the spectral range of interest and manifest as morphological features that resemble inherent aspects of the ECG or -seecsee aspects. Therefore, methods
that can accurately reconstruct 12-lead ECGs from partial observations are central to analysing the morphology of heartheats. In this work, we address classical problems such as baseline wander or motion artefacts; we are also interested in the reconstruction of missing leads to be able to reconstruct the 12-lead representation from a reduced number of electrodes, which is an essential precursor for the reconstruction of 12-lead ECGs from smartwatch measurements; see [90]
The heartbeat morphology reconstruction problems are naturally formulated as Bayesian linear inverse problems (177 38 21).. The observation vector is an affine transformation of the signal of interest, which influenced by additive noise. This affine function is only partially known (it may depend on unknown parameters) and the corresponding inverse problem is usually ill ill-posed (in the missing lead case, the affine function not invertible). Inverse Bayesian problems require the use of a prior distribution for the signal to be reconstructed. Recently, the use of generative models to define priors has enabled us to achieve many successes various areas.; see e.g., [5 57 64 96]. Early works in this area used flow models or GANs. There has been a recent increase in interest in using diffusion models as a prior in Bayesian inverse problems (83 17 85 45 46 13 ) Many techniques have been recently proposed. We focus here MCGDiff (113) ), which constructs unbiased estimates of posterior distributions using Sequential Monte Carlo (SMC) methods, a.k.a. particle filter.
Our main contributions are as follow
We introduce BeatDiff new light-weight DDM model designed to generate 12-leads heart beat morphology. In comparison to 3. BeatDiff has a significanty lower memory footprint and faster generation speed. BeatDiff has shown superior performance to state-of the-art ECG generation methods accross all the metrics that we have considered.
We then show how BeatDiff can be used a prior address various challenges in heartbeat morphology reconstruction from partial observations. We show how the MCGDiff method can be combined with Monte Carlo Expectation Maximization (MCEM) algorithm to compute maximum likelihood estimate of the unknown parameters of the inverse linear model (c.g.. noise level estimation, noise and artifact model, etc.), leading new full- fledged algorithm for conditional ECG generation, called EM- Br-tteDDifff.
We demonstrate the effectiveness of our approach by comparing it to Our algorithm outperforms the current best approaches on multiple evaluation metrics specifically designed for ECGs, and offers new paths that have the potential to lead to novel applications.
methods.
33 as informative priors in solving 77 103 74). In particular, DDMs have been demonstrated as a particularly suitable choice of prior for solving inverse problems 85 45, [6).. DDMs are generative models that transform simple reference distribution into the training data distribution through a denoising process called denoising diffusion. These models capable of generating high-quality realistic samples on par with the best Generative Adversarial Networks (GANs) (32)) in terms of image and audio generation, without the intricacies of adversarial training (81 86
Related works: The use of generative models (50)
Bayesian inverse problems has attracted significant interest (44 96 88 42
(83 17
In this article, we follow the approach proposed in 13, 98), for sampling solutions to an inverse problem using a Sequential Monte Carlo (SMC) algorithm that guides the denoising process of a pretrained diffusion model. This method is accompanied by series of theoretical guarantees in realistic scenarios.
83 84
Generative modeling, denoising methods, and automatic anomaly detection algorithms are commonly used for ECG analysis. particular, DDMs have been demonstrated to capable of generating
realistic ECGs: [2] focuses on generating single healthy beat for single ECG lead, 3 generates

---

10-second period conditioned on various complementary ECG information. Additionally, numerous methods address the denoising problem in ECGs; see e.g., 779 56 13]. Classical approaches like
Dower matrices ((59) are used to reconstruct missing leads in ECGs. 197 43 rely on neural
networks to detect anomalies, and (76) use adversarial autoencoders for unsupervised anomaly detection. However, to our knowledge, there is no method that addresses all these problems with single pretrained model.
2 BeatDiff generative model for heartbeat morphology
Denoising Diffusion Generative Models (DDM): We briefly describe in this section the DDMs
and introduce some basic notations which are required below; see [24] 37 86 83 85 44 19 and the references therein for theory and practical implementation details. We focus on the variance- exploding (VE) framework (166). In the forward path an initial state Xy is sampled from the data distribution Qdata and independent Gaussian noise with zero-mean and increasing variance is added to generate subsequent states Xx = X + PEEK, where & E IN,,"" Pk > O, and EN ~ N/O,I), I). The joint p.d.f. of the Markov chain is qu:k (Fo:k) = qdata (mo) k= 9le (T (x where qu (n(-11xx (+)=-)) = -N( P) and K E N The conditional distribution of Xx given X, with k > 8 0 is given by qk|s(+|2z.) The number of forward steps K is chosen such that v = v is far larger than the variance of Adata- With such choice, O (k(o(-120)) is close to the reference distribution qref (O, u I). We learn for each state X denoiser Do with parameters & trained to minimize CD((p) :=
Nax,, (uf x with v Σド= P3 (and vg 0).
Σ x
[IDD (Xo + UKe, v&) - -xol3]. where {7k [=*]ke[]:K] is a sequence of appropriately defined positive weights. We denote the result of this minimization as s² In the backward path, we sample æk ~ qref and for k K to A 2 we sample - given Ia with
Pk- Pk-1 ( (2x) N (IR- MA- ( Doj (FR, Uz)). -
where the variances are hyperparameters
{m JeN satisfying vi S v and pa 1 xo)
To to (vg-1/of feof://o-nnm//a0 / - 20). Finally, sample xo- ~ po((1a,) == ND 0/1 (5), v1), To keep the notations simple, we remove in the sequel the dependence in 77 and yp" For k E [0 K-1), we denote by (x< the marginal distribution of Xx:
P (xx)) := g
gret (x
P. (1
BeatDiff model: In the standard ECG, the augmented limb leads (AVL, AVR, AVF) can be obtained from a known linear combination of the limb leads (I, II, III) (55 Vol 1, Chapter 11]). Hence, it is standard practice to select either the augmented leads or the limb leads to model the ECG (5)). We exclude the augmented leads and use the leads (1, II, III, V1-6). We denote by I. = 9 the number of leads, and by T the maximal heartheat duration (expressed in number of samples).
Various factors, including age (A), sex (S) and the RR interval, which is the reciprocal of heart rate, influence the morphology of the heartbeat; see e.g., 60 75 6). Therefore, we use the DDM described above to approximate the distribution qdata of heartbeats over the retained leads conditionally on the patient characteristies P ;= (A, S, RR). The denoiser of BeatDiff Doj takes as input (z, Uk, ep) where x the L x T matrix of single heartbeat samples. Uk the k-th step diffusion variance and ep encodes the patient features. We obtain from P = (A, S, RR) by first one-hot-coding the Boolcan variable S and then embedding using fully connected 2-layer network. For 24 we use the Fourier positional encoding (II) of log(vz) as in (24). For Di we use a modified 1d Unet, the specific details are given Appendix B. 1.4 The model has 10 parameters. Compared to 33, the inference time is 400 times shorter and the memory footprint is 900 times smaller.
BeatDiff training We utilize the PhysioNet Challenge dataset (BI 68 69 comprising 43,101 12-lead ECGs. The pre- pre-processing of [8] is used which consists of normalization of the sampling frequency, detection of R peaks to identify heartbeats, segmentation of the heartbeats. We obtain 214,460 single-beat ECGs, each with T = 176 samples and I, 9 (I. II, III, V1-V6). See Appendix B.I.T for details. Each patient (and the entirety of its recordings) attributed to one of the three datasets: Training, Cross- Cross-validatte validation (CV) or Test. During training, batch of size b
3

---

is constituted by firstly drawing b patients and then selecting randomly one of the beats for each given patient. For testing and cross-validation, due to the significant variability between patients in comparison to the variability between heartbeats, we randomly select a single beat per patient for model evaluation. The entire network Olk trained to minimize LD using the Adam optimizer
(149)) with a batch-size 2 the healthy training set, and the best model in terms of Lp over the cross-validation set is retained. See Appendix B.1.4 for details.
3 EM-BeatDiff conditional heartbeat generation from indirect measurements
We present EM-BeatDiff a method that allows us to sample heartbeat morphology from partial observations, focusing on a class of problems that can be formulated as Bayesian linear inverse problems. Our approach is based on Monte-Carlo guided diffusion (MCGDiff), introduced in [13 (sec also 88 65
which is used in combination with BeatDiff.
Monte Carlo Guided Diffusion (MCGDiff): In many applications of interest, the objective is to sample from a distribution dg (2r) == (20) Po (zn))/22 22 where Yo, is a nonnegative potential function, Pn. the marginal of the diffusion model at time O, and Z == 90 (o))))))) is the normalizing constant. For example, in a Bayesian setting, Do is the likelihood function (the conditional distribution of the observation given the current value of the state xo) and (o(x))) the prior distribution of the state. In such case, og (1x) is the posterior distribution of the state given the current observation. A simple idea for sampling the posterior (1 ) is to use sampling importance resampling (SIR, (72]), where is used as the instrumental distribution. However, this method may be inefficient since the instrumental distribution neglects the potential 9n-
We define a distribution over the path space
$o.k (2o.K) = Z -- 9o (3o)
K
Pk- (0r--1 (I gror((rk))))
In 13,, sequence of positive intermediate potentials {or kej]:K]] with gK = 1 was introduced to guide the backward Markov chain to regions where the potential Yo is large. The path space distributions may be equivalently rewritten
Φo:k (IO:K) xx guet (x) x) I
De (mme-1)
ge(ox) PR: 1/A (1x=1
x (rel(2K) IT WA (1x) )p= - 1
(3.1)
where, for E [1
K). Pe- (+100) = I2-1 (---1-)p--10 (/xxa) (zx),, and (x(x)) =
15-1((')P (P'DPP-IK''' 11 (2'2 )xx),, and wg formulas have closed form. Sampling according (311) passes through the intermediate distribu- tions @s (xxx) = ()e((x)) I [ w. (x,))), (x.-1 x. dd.dd for each [1 KJ, which verifies
2x(xx)/ ((lrx)/g0 (xx)). We implicitly assume that these
Φ (x x ( 1)-- (xx- x [ (x))x- (** (==))
(3.2)
Each Φ thus has the same structure as Φn a product of potential function and the marginal law at time k - the backward diffusion.
It remains to approximate this sequence of distributions. For this purpose, we use Sequential Monte Carlo (SMC); see (25 [6]. Suppose that have iteration a particle approximation of M -- Σド deg of de through a set of M e N>o particles 4 initiiaizzdd with e1:M q Plugging this approximation into Equation
3.2
gives
Φ x Ene WA (EA
Hence, to obtain cl:M
we first sample M ancestors according to R.M x M then we sample new particles C3-M 112 (-1ff-1)))
Cat((u MM wg (5t) }
MM
leading to o = M Σ/
8
Algorithm is given in Appendix A.1.1

---

Bayesian inverse problems heartbeat) is given by
We assume that the dy x vector of observations Y (noisy/partial
Y AgXo + by Dge, 10,,1, Xo~ Po
(3.3)
where Ag is a dy dz matrix (for selecting the lead/time observed indices), by is a dy vector (modeling hearbeat artifacts; c.g., baseline wander, electrode motion), De is a dy x dy invertible matrix (the variance of the noise), and 0 is a vector of unknown parameters. Define by P. (zo) the likelihood of the observation, given by 90 9.V (xo) ;= NYy; Agæ bg. D&Da Given an observation y and value of the parameter 6, we may sample X, from the posterior Xuly. with
90
p.d.f. v (mo) = (=( (2 f. (zo)) /z.,, zo.y
90 (o)))dd the normalizing constant. We
use MCGDiff with the intermediate potentials {9 ][[[o:K] defined
9
A-M N(v: Agx + by, Ea,9),
(3.4)
where the sequence of covariance matrices E,, are specified in Appendix A.2.1 For this choice of potentials, 1k- and w admit closed forms given in Appendix A.2.2
MCGDiff allows to sample Xoly, 9 for a known parameter 9. When A is unknown, we maximize the penalized marginal log-likelihood
0" argmax (1(0) Po)( 1(0) log n log f 08 l (z) (3.5)
BERa
where (f is a penalty. The best-known method for optimizing the marginal log- bog-likelihood (35 the expectation maximization algorithm (EM); see [61]. The EM iterates between two main steps: expectation (E) and maximization (M). Starting from an initial guess 9u the EM algorithm alternates between: (E) compute the surrogate function Q(0; 0,) == f log ( (xx))% 0..1
(ro) dæo; and (M) solve for 0++1 arg maxege Q(0: 0.) + Pon Under general conditions, the sequence of parameter estimates (0,) (e) converges to a stationary point 0, of the marginal penalized likelihood; see [6]] Chapter 3]. In this setting, the E-step is untractable; we approximate the surrogate function in the (E) step using MCCDiff with the current parameter 0; and the sequence of intermediate potentials defined in (3.4). Such scheme becomes specific instance of the Monte Carlo EM algorithm (MCEM),
initially introduced in (95] and further analyzed in [54 26 53
The Be--tDDDiff algorithm: We combine the BeatDiff for the prior and MCGDiff algorithms for posterior sampling, with MCEM steps for parameter inference. The only slight difference is that the observations and 7 the number of observed samples on each lead. The state are attempting to reconstruct is matrix of size L x T. The observation equation takes the form
gathered in matrix Y of size L T where L is the number of observed leads
Y Ag Ag + Bg Doc
where (Ag, Do) and (Ag. D2) are x L and T x î matrices, Bg is a x T matrix, and e is a L x T matrix with i..dd standard Gaussian entries. The model (3.3) obtained by applying the vectorization operator to Y. The full algorithm is detailed in Appendix A.3 Note that EM-Bean EM--BeaDDiff is also applicable to "standard" ECG signals and could be used combination with the ECG generative model of 3, for example.
4 Experimental validation
BeatDiff evaluation: We begin by assessing the impact of BeatDiff in a classifier improvement task. This involves comparing the performance of a classifier trained on a severely unbalanced dataset with that of the same classifier trained on a balanced dataset. The balancing is achieved by augmenting the minority class with new examples from a generative model. Results for sex classification from heartbeat are reported in Table [ including model size, inference time, Fl score, total accuracy, and AUC score are shown for the balanced dataset with BeatDiff and alternative ECG generation models from 13 retrained to generate ECGs conditioned on sex. Diffusion-basse models BeatDiff and SSDM (3) outperform WGAN (II) with BeatDiff being 400 times faster
than 3 See implementation details in Appendices B.3.1 B.3.2 and B.4
5

---

Table 1: Evaluation of ECG generation models for balancing eex-imbalanced datasets in heartbeat classification task. F and M refer to the number of female and male real heartbeats in the training set. Confidence intervals are obtained by re-initializing the classifier training and the generated data used to balance the datasets.
Model
Size (Mb, !)
Inference Time (ms. 4)
F 10%M Acc. (%, 7)
5%M Acc. (%,
FI (%, 1)
AUC (%, 1)
FI ()
AUC (%,
SSDM 3
39
10
7.5 x 10
76 +
69 +
77
74
64
71
WGAN 0
27
3.8 x 10
76 0
69 +
77
71
61
72 =
BeatDiff
42
1.0 x 102
78 = 0
73 =
79
77
72
76 +
Unbulanced
76 +
74
74
61
70 =
Balanced
82 +
+
86 +:
82 0
81 +
86
11:
WGAN
I
VI
EMD
V2
V3
V4
7
Test vs. Train
V5
DDM
V6
20
80
Backward diffusion
Diffusion step K
Figure Left: heartbeat generation along backward diffusion steps. Right: EMD between generated ECG distribution and real ECG distribution. EMD vs. test (resp. train) in plain (resp. dotted) line. EMD for DDM with different number of diffusion steps, in blue. DDM for WGAN model in gray. EMD between test and train distributions in red. Error bars correspond to different training batches of size 2864.
We also use the L2-Earth Mover's Distance (EMD) ((29) to evaluate the dissimilarity between the predicted and target distributions, excluding SSDM due to computational limitations. The EMD is computed from the generated set for both the test set and batches of the training set of the same size. Our results in [igure[]show show that few diffusion steps are sufficient generate an accurate prediction distribution, with BeatDiff performing better than [ in replicating the real data distribution. Appendix B.6.1 we present third evaluation of the generated ECGs' quality using the out-of-distribution score proposed in [18).
Prediction Corrected QT: Both the EMD and Classifier Enhancement tasks are concerned with how different the generated ECGs from the ECGs in the dataset. We now focusing the question "Is the algorithm able to correctly capture underlying physiological mechanism?".. To do so, we evaluate BefttDi on the prediction of corrected QT, which is an important clinical indicator obtained from the ECG; see 77
The QT interval is the duration between the Q wave, which marks the beginning of ventricular depolarization, and the end of the T wave, which signifies the completion of ventricular repolarization. This interval depends on heart rate: as the heart rate increases (and the RR interval decreases), the QT interval tends to shorten. Understanding the relationship between the RR and QT intervals crucial for diagnosing and managing various cardiac conditions. For instance, a prolonged QT interval may indicate an increased risk of arrhythmias, such as Torsades de Pointes, while a shortened QT interval can be associated with conditions like hypercalcemia. Moreover, certain medications known to prolong the QT interval; see [58].
We use EM-Beatee BeatDiff to generate the T- from given patient QRS complex (the sequence of waves (Q. S) with negative, positive, and negative deflections. respectively) and heart rate (RR). Each test ECG is trimmed to focus solely on the QRS complex. Then, for RR values ranging from 0.6 s to 1.2% s, or equivalently for heart rates ranging from 43 to 100 beats per minute, we sample x from the conditional distribution of the ECGs over all leads given the RR and the observed QRS as illustrated figure The configuration of the related inverse problem is given in Table under the name QT.

---

Input: single partial beat Output: generated beats
various various QTT
QT(s)
measured QT on generated beats per itit
II
0.4
regression of Fridericia formula, QT QT QTद MRR
V2
V3
0.35
V5
V6
RR((s)
0.2
RR 1.4
0.2
Figure 2: Left: Example of T-wave prediction (blue) conditioned Q-wave (red) for different value of RR. Right: QT as function of RR patients. measured 100 generated samples (resp. regressed with Fridericia formula) displayed in dots with 95%-CLT bars (resp. curve).
Table 2: Configurations used for EM-BeatDiff for each task.
Task
(L,T)
0
Aa
Aa
Bs
Do
Da
QT
(L, 70)
aut.
Ixxt
lxxf
diag(ona))
lxxt
AR
(L,T)
(oLLL (1KCA:))
LxL
Txxr
diag(ora)) a olix diag(on.1) Lixa diag(o I diag((..r. TExE
Ixx
ML (SW)
(1,7)
Ixx
Irxr
Ixr
ML (V1-6)
(3.T)
TLd
Ixx
Irxr
Ixxr
AD (MI)
(3,T)
(o 1.
Lxx
Irxr
1xxT
AD (LAB)
(3,7)
(or., (..
LLx
ITxT
ITxT
AD (LAD)
(L, 106)
Tle
LxxE
10 (0r.r-riIxxt
diag(o I
Irxt
AD (LQT)
(L,
IExE.
Irxr
diag(o ILxt.
I
1rxt
To evaluate this, we rely on well-known empirical formulas from 27 73
These formulas introduce coefficients called "corrected QT" denoted as QTù and QT which depend on the patient and are determined from ECGs measured during stress test. We regress the intercept QT and slope QT; of the Fridericia formula from 27]. which states that QT QT; + QTi VRR, from the generated curves. As shown in figure 2 we observe consistent trend between the observed and regressed curves for four patients. Additionally, Table indicates a high R2-score of 0.98 between observed and expected QT curves in the test set. OM-BeatDiff generates QT' for different RR that follow the Fridericia formula, one of the most correlated with patient QT vs. RR behaviour, without explicitly encoding this relationship during training. This demonstrates the ability of EM-BeatDiff to capture underlying physiological mechanisms.
Artifact removal (AR): Many solutions for removing ECG artifacts such as baseline wander-a
low-frequency artifact caused mainly by respiration and body movements- or electrode motion-als. also low-frequency artifact caused by bad electrode contact- have been proposed so far, most often based on adaptive filter, fre-ureyy (and most notably empirical mode decomposition) and time-scale decomposition; see [22] 194 101 55 14) and the references therein. We use in this experiment sparse representation of the artifacts a dictionary, and propose to use penalized MLE with DDM prior to estimate the artifacts and denoise the ECG. In this case, we set for given L {1, L} and E (1,
Be 16
1%]T with =K= (t) for f, [1 [1:
(4.1)
with { known set of functions (such as B-splines, a Fourier or a wavelet basis). We choose Fourier basis in the experiments expressed in Equation (B.I). The other parameters given in Table Junder the name AR.
We therefore remove the artifacts by subtracting vector assumed to have a sparse representation on an appropriate basis. We use the sparse group LASSO penalty defined as
(on = X E (0,,)))))) + by 10.el
(4.2)
which leads to parsimony both the group and individual levels, in order to promote the selection of the same functions (c.g. Fourier frequency) over all the leads; see (88 78). The first term promotes
7

---

Table 3: Evaluation of several reconstruction metrics for the AR task on beats corrupted with artifacts from MIT-BIH database from [62, with 95% intervals over the test-set.
Baseline Wander
Electrode Motion
Method
SSD (L)
MAD (
Cos. (x 100, f)
SSD (L)
MAD (L)
Cos. (x (x100,7
DeScoD 3
4.37 8.19
0.31 0.15
95.20 0.36
0.01
0.27 0.01
92.73 0.25
MW-BeatDiff
0.14 + 0.01
0.24 0.02
96.69 0.22
0.18 0.01
0.26 0.01
95.42 + 0.19
Table 4: Evaluation of ECG generation models for the missing lead retrieval task, with 95%-CLT intervals over the test-set.
Smartwatch MAD (L)
V1-6 MAD (4)
Method
SSD (L)
Cos. 100, f)
SSD (L)
Cos. (x1000 7)
ERGAN 41
1.63 1 0.47
0.36 1 0.03
91.33 1 0.38
2.10 1 0.83
0.35 1 0.03
93.42 1 0.00
EM EM-BeatDiff
1.03 + 0.05
0.35 + 0.01
86.02 + 0.99
1.10 + 0.06
0.36 = 0.01
87.78 + 0.98
group sparsity: it keeps or removes the projections of observations on oj across all leads. The second term promotes global spansity. Details are given in Appendix B.2.2
The evaluation of EM-BeatDiff in the AR task on 12-lead ECGs contaminated with per-lead independent noise from the MIT-BIE Noise Stress Test database ((22) is presented in Table 3 Despite not being exposed to MIT-BIH Noise during training, EM MM-BeatDiff outperforms DeScoD (156)) -a conditional DDM specifically trained to remove baseline wander- according to the following metrics: Sum of the square of the distances (SSD), Absolute maximum distance (MAD), and Cosine similarity (Cos.) (163), Appendix [B55). Visualizations of ECGs obtained with EM-BeatDiff and DeScoD are provided in figure and failure cases of DeScoD are discussed Appendix [B.6.4]
Missing Leads Reconstruction (MI.): In resource-limited clinical settings like ambulatory care, electrode placements can vary from six-lead montages and reduced Frank or EASI configurations to single-lead setups. Similarly, in non-clinical settings, smartwatches like the Apple Watch provide single lead ECG by measuring the potential between the wrist and the finger of the opposite hand. Recent studies such as [90] showed that this single lead ECG is essentially equivalent to the lead I ECG recorded in 12 lead ECG. Several papers have addressed the reconstruction of ECGs from a single lead with deep learning. indicating potential applicability in ECG reconstruction from smartwatch single-lead ECG; see e.g., 882 80 41).
In the first experiment, we evaluate the performance of EM-BeatDiff in reconstructing V1-6 from the limb leads (I, II, III). This corresponds to the setting ML (V1-6) in Table 2 The second task we consider is generating II, III, V1-6 from lead I, which we refer to as the Smartwatch task, This corresponds to setting ML (SW) in Table 2 In Table 4 MM-BeatDiff outperforms EkGAN (141), deep learning-based methods designed and trained for ECG missing lead reconstruction according to SSD, MAD and Cos. Unlike EkGAN, EM-BeatDiff does not require any task-specific training.
Cardiac Anomaly Detection (AD): In this section, we propose using EM-BeatDiff for detecting cardiac abnormalities. Our evaluation methodology consists of evaluating EM-BeatDiff 's capacity to detect four distinct medical conditions: Myocardial Infarction (MI,, Left Anterior Descending artery (LAD), Left Atrial Enlargement (LAB), and Long QT syndrome (LQT). These anomalies were selected due their typical association with localized alterations in P-Wave QRS, Wave morphologies. To incorporate patient-specific ECG data, we consider three distinct conditioning settings: (I. II, III, QRS, and ST. Conditioning on the limb leads (I. II, III) suggests that the abnormality is more prominently manifested in the precordial leads than the limb leads. Conditioning on QRS indicates that the abnormality is evident in the T-wave, while conditioning on the ST segment implies that the abnormality is present either in the QRS or the w-vave
For each conditioning type and medical condition, we generate samples from the posterior distribution using EM-BeatDiff. Th anomaly score is the 1 - R² metric between the mean of the generated ECGs from the posterior distribution and the observed ECG over the non-conditional ECG segment.
First, we conduct an ablation study to determine the optimal setting for each medical condition, as detailed in Appendix B.6.3 The chosen optimal settings presented in Table 2 designated AD
8

---

Table 5: AUC obtained using the proposed anomaly detection score (1 R2) for each medical conditioning. See Table 2 for details on the inverse problem in hand. Confidence intervals obtained by running 10 times EM- BeatDiff per heartbeat.
Model
MI
LAD
LAE
LQT
AAE 76
80.23 84.82 + 0.01
82.69
74.87 79.02 0.07
70.96 84.73 0.04
EM BeatDiff
93.06 + 0.03
Denoising
Inpuinting
Anomaly Detect.
BW
EM-BeatD
DeScoD
EM
EN-BeatD
DeScoD
EN-BeatD
EKGAN
MM-BeatDiff
III
V2
Or
or
or
V3
V4
V5
V6
Input: noisy/ incomplete beat Output: generated beats vs. ground-truth
MI
LQT
A:ummyaaly example
Figure 3: Illustration of EM-Bew BeatDiff the denoising. inpaiting and anomaly detection tasks. The red background indicate the parts the ECG that are observed through y. The red ECGs corresponds real ECG and the blue ECGs corresponds to each algorithm reconstructed ECG.
followed by the respective medical condition name. Showw that EM-BeatDiff outperforms AAE (176)), which uses as anomaly score the MSE between the output of an Adversarial Auto Encoder and the input ECG, according the AUC of the anomaly score. See Appendix [B.3.5 for implementation details. A key advantage of the aforementioned approach its ability to function in an interactive manner, unlike methods that rely training different set of ECG leads for conditioning, the posterior can be regenerated a near-online fashion following visual assessment of the posterior and the patient ECGs in the MI case in Figure
specific setting. By simply selecting
5 Conclusion
In this work, have described flexible method that addresses several challenges in heart beat morphology, including baseline wander and electrode-motion removal, missing lead reconstruction and anomaly detection, all formulated Bayesian linear inverse problems. Our method utilises BeatDiff DDM pre-trained to generate the heartbeat morphology on 12 leads, as prior for sampling solutions inverse problems with EM-BeatDiff. Several evaluation metrics show the effectiveness of EM-BeatDiff compared to baseline solutions, which contrary to EM-BeatDiff require specific training for the specific task in hand.
Our approach also enables new applications, such as generating a 12-lead ECG using a subset of electrodes, including 12-lead heartbeat morphology reconstruction from smartwatch measurements as an example. Another example is the anomaly detection algorithm which can enable diagnostic of long QT syndrome other diseases that specifically alter repolarization. In this paper, BeatDiff was trained only on healthy ECGs. However, BeatDiff could be trained on a dataset containing ECGs presenting pathologies by conditioning on the specific pathology as discussed below.
Discussion
This paper focus on generating 12-lead healthy heartbeats from partial measurements, e-g., limb leads only, samples corrupted with eletrocde artifacts, see Tables 3 and We show that EM-BeatDiff can also used to classify abnormal heartbeats in an unsupervised manner: we generate healthy counterparts of abnormal heartbeats and use the distance anomaly score. The flexibility of our

---

method allows the detection of various heart conditions (MI, LQT, LAD. LAE) by reconstructing 12 leads from limb leads only, QRS only, or ST only, see Tables and T2
Risk of hallucination We would like to point out that this anomaly detection tool is semi-white box: rather than outputting an abnormality score, our approach is also able to show the healthy counterparts of an abnormal signal and highlight where they differ from the patient's 's signals. This could theoretically enable cardiologists to rule out abnormalities that are not relevant. However, there is still risk of hallucinations. We have shown that the generated signals are close to the real signals for healthy patients, but clinical study must be performed before clinical use.
10s ECG signals Although our study focused on heartbeat morphology, we would like to discuss the feasibility of generating realistic longer samples that are more than beat. We trained a diffusion model to produce 5-second ECGs. We then applied our sampling algorithm to reconstruct 12-lead ECGs from limb leads only and limb leads V2 + V4. This second setting is similar to AliveCor's recent system Kardia I [ We found that reconstructing 12 leads from multi-beat ECGs is more complex and requires precordial leads for reasonable results (see figure ITI A special study is needed to build relevant diffusion model and adapt the algorithm''s parameters order to generate longer 12-lead ECGs from limb leads only. This adaptation is complex due to the need for larger models and more particles for posterior sampling.
Testing EM MM-BeftDiff's ability to reconstruct arrhythmic ECGs is valuable as would enable the use of additional simulated leads for abnormality detection from portable devices such as smartwatches or AliveCor products. We trained a diffusion model on 5-second ECGs with Atrial Fibrillation (AF) from PhysioNet and successfully predicted reasonable 12-lead ECG from limbs + V2 + V4 (Kardia121. setting) (see figure 12).. A larger AF dataset would yield more interesting results, but this experiment shows EN-BeatDiff potential for generating rhythmic abnormalities.
Arrhythmic data
Heartbeat segmentation We would like to discuss the use of external segmentation tools for segmenting heartbeats before applying EM-BeatDiff. The segmentation of heartbeats is common practice in the literature. Many works, including the baselines we analyzed in our paper, such as (56), and more recent papers 48 rely on external tools segment the common 10-second clinical ECG signal into heartbeats. The heartbeat settings of EM-BeatDiff could also be used for arrhythmic data such as Premature Ventricular Contractions (PVC), even they significantly alter the ECG phase. Indeed, one could detect PVCs using available methods such as [2] and remove them from inference.
7 Broader Impact
We demonstrate various ways in which BeatDiff and EM-BeatDiff can be utilized to address various heartbeat morphology analysis tasks. It is important to note that all our results are currently in prototype stage, and before any implementation a clinical environment, a prior impact assessment and clinical trial must be conducted. This notably includes verifying performance other datasets that better represent patient characteristics, as well as conditioning all the hyperparameters chosen in this study on this dataset.
8 Acknowledgment
This work was supported by the French National Research Agency (ANR- 10-AAHUO+LIRYCC) We would like to thank PNY Technology for the computing power made available us for this study. The work of LB and GC has been partly funded by the European Union (ERC-2022-SYC) OCEAN-101071601)) Views and opinions expressed are however those of the author(s) only and do not necessarily reflect those of the European Union or the European Research Council Executive Agency. Neither the European Union nor the granting authority can be held responsible for them.
10

---

References
[1] Adib, E., Afghah, E, and Prevost, J. (2022). Arhhythmia classification using cgan-augmented eeg signals*. 2022 IEEE International Conference on Bioinformatics and Biomedicine (BIBM), pages 1865-1872.
[2] Adib, E.,, Fernandez, A. S., Afghah, F., and Prevost, J. (2023). Synthetic eeg signal generation using probabilistic diffusion models. IEEE Access, 11:75818-7558
[3] Alcaraz, J. M. L. and Strodthoff, N. (2023). Diffusion-basee conditional eog generation with structured state space models. Computers in Biology and Medicine, 163:107115.
[4] Arjomand Bigdeli, S., Zwicker, M., Favaro. P., and Jin, M. (2017). Deep mean-shift priors for image restoration. Advances in Neural Information Processing Systems, 30.
[5] Bai, Y., Chen, W., Chen, J., and Guo, W. (2020). Deep learning methods for solving linear inverse problems: Research directions and paradigms. Signal Processing, 177:107729.
[6] Ball, R. L., Feiveson, A. H., Schlegel, T., Stare, V., and Dabney, A. R. (2014). Predicting "heart age" using electrocardiography. Journal of personalized medicine, 4(1 (16577777
[7] Bazett, H. (1997). An analysis of the time-relations of electrocardiograms. Annals of noninvasive electrocardiology. 172):177-194.
[8] Bear, L. R., Svehlikova, J., Bergquist, J. A., Good, W. W., Rababah, A., Coll-Font, J., Macleod, R. S., Van Dam, E., and Dubois. R. (2021). Impact of baseline drift removal on ecg beat classification and alignment. In 2021 Computing in Cardiology (CinC), volume 48, pages 01-04. IEEE
[9] Benton, J., Shi, Y., De Bortoli, V., Deligiannidis, G., and Doucet, A. (2022). From denoising diffusions to denoising markov models. arXiv preprint arXiv:2211.03595
[10] Blondel, M., Berthet, Q., Cuturi, M., Frostig, R., Hoyer, S., Llinares-López, F., Pedregosa, F., and Vert, J.-P. (2021). Efficient and modular implicit differentiation. arXiv preprint arXiv:2105. 15183.
[11] Brammer, J. C. (2020). biopeaks: a graphical user interface for feature extraction from heart- and breathing biosignals. Journal of Open Source Software, 5(54):2621.
[12] Cai, Z., Wang, T., Shen, Y., Xing, Y., Yan, R., L., by fusing expert system and deep learning. Biosensors, 12(4).
J., and Liu, C. (2022). Robust pvc identification
[13] Cardoso, G., el idrissi, J., Corff, S. L., and Moulines, E. (2024). Monte carlo guided denoising diffusion models for bayesian linear inverse problems. In The Twelfth International Conference on Learning Representations.
[14] Chatterjee, S., Thakur, R. S., Yadav, R. N., Gupta, L., and Raghuvanshi, D. K. (2020). Review noise removal techniques in eog signals. IET Signal Processing, 14(9):569-590.
[15] Chiang, H.-T., Hsieh, Y.-Y., Fu, S.-.., Hung. K.-H., Tsao, Y., and Chien, S.-Y. (2019). Noise reduction in eeg signals using fully convolutional denoising autoencoders. IEEE Access, 7:60806- 60813.
[16] Chopin, N., Papaspiliopoolos, O., et al. (2020). An introduction to sequential Monte Carlo, volume 4. Springer.
[17] Chung, H., Kim, J., Mccann, M. T., Klasky, M. L., and Ye, C. (2023). Diffusion posterior sampling for general noisy inverse problems. In The Eleventh International Conference on Learning Representations.
[18] Ciosek, K. Fortuin, V., Tomioka, R., Hofmann, K., and Turner, R. E. (2020). Conserva- tive uncertainty estimation by fitting prior networks. In International Conference on Learning Representations.

---

[19] Croitoru, F.-A., Hondru, V., Ionescu, R. T., and Shah, M. (2023). Diffusion models in vision: A survey, IEEE Transactions on Pattern Analysis and Machine Intelligence.
[20] Das, M. and Zipes, D. P. (2009). Fragmented qrs: a predictor of mortality and sudden cardiac death. Heart rhythm, 6(3):S8 S14.
[21] Dashti, M. and Stuart, A. M. (2017). The bayesian approach to inverse problems. In Handbook of uncertainty quantification, pages 31 I 4-8.. Springer.
[22] de Pinto, V. (1992). Filters for the reduction of baseline wander and muscle artifact in the ecg. Journal of electrocardiology 25:40-48.
[23] Delaney, A. M., Brophy, E.,, and Ward, T. E. (2019). Synthesis of realistic ecg using generative adversarial networks.
[24] Dhariwal, P. and Nichol, A. (2021). Diffusion models beat gans on image synthesis. Advances in neural information processing systems, 34:8780-879 8794.
[25] Doucet, A., De Freitas, N., Gordon, N. J., et al. (2001). Sequential Monte Carlo methods in practice, volume 1. Springer.
[26] Fort, G. and Moulines, E. (2003). Convergence the monte carlo expectation maximization for curved exponential families. The Annals of Statistics, 31(4):1220-125
[27] Fridericia, L. (1921). Die systolendauer im elcktrokarriogrramm bei normalen menschen und bei herzkranken. Acta Medica Scandinavica, 54(1):17-50.
[28] Friedman, J., Hastie, T., and Tibshirani, (2010). A note on the group lasso and a sparse group lasso. arXiv preprint arXiv:1001.07535
[29] Genevay, A., Cuturi, M., Peyré, G., and Bach, F. (2016). Stochastic optimization for large-scale optimal transport. Advances neural information processing systems, 29.
[30] Golany, T., Freedman, D., and Radinsky, K. (2021). Ecg ode-gan:
Learning ordinary differential
equations of eog dynamics via generative adversarial learning. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 35, pages 134-141.
[31] Goldberger, A. L., Amaral, Mark. R. G., Mictus, J. E., Moody, G. B., Peng, C.-K., and Stanley, H. E. (2000). PhysioBank, PhysioToolkia. and PhysioNet: Components of new research re- source for complex physiologic signals. Circulation, 10i(23):e215-e2)) Circulation Electronic Pages: http://cire.ahaa http:ummw...ooccoooo///////////a PMID:1085218; doi: 1..1611/0..CIR.101.22.4
N., Glass, L., Hausdorff, J. M., Ivanov, P. C..
[32] Goodfellow, I., Pouget-Abadie, J., Mirza, M., Xu, B., Warde-Farley D., Ozair, S., Courville, A., and Bengio, Y. (2014). Generative adversarial nets. Advances in neural information processing systems, 27.
[33] Gui, Sun, 7., Wen, Y., Tao, D and Ye, J. (2021). A review on generative adversarial networks: Algorithms, theory, and applications. IEEE transactions on knowledge and data engineering.
[34] Haissaguerre, M., Hocini, M., Cheniti, G., Duchateau, J., Sacher, F., Puyo, S., Cochet, H., Takigawa, M., Denis, A., Martin, R., et al. (2018). Localized structural alterations underlying a subset of unexplained sudden cardiac death. Circulation: Arrhythmia and Electrophysiology. 11 11(7):e00612) 120.
[35] Hannun, A. Y., Rajpurkar, P., Haghpanahi, M., Tison, G. H., Bourn, C., Turakhia, M. P., and Ng, A. Y. (2019). Cardiologist- arrhythmia detection and classification ambulatory electrocardiograms using a deep neural network. Nature medicine, 25(1):65-69,
[36] Heek, J., Levskaya, A., Oliver, A., Ritter, M., Rondepierre, B., Steiner, A., and van Zee, M. (2023). Flax: neural network library and ecosystem for JAX.
[37] Ho, J., Jain, A., and Abbeel, (2020). Denoising diffusion probabilistic models. Advances in Neural Information Processing Systems, 33:6840-6851.
12

---

[38] Idier, J. (2013). Bayesian approach to inverse problems. John Wiley & Sons.
[39] Iuliano, S., Fisher, S. G., Karasik, P. E., Fletcher, R. D., Singh, S. N., of Veterans Affairs Survival Trial Antiarrhythmic Therapy in Congestive Heart Failure, D., et al. (2002). Qrs duration and mortality in patients with congestive heart failure. American heart journal, 143 1091.
[40] Jameson, J. L., Fauci, A. S., Kasper, D. L., Hauser, S. L., Longo, D. L., and Loscalzo, J. (2018). McGraw-Hill Education, New York, NY.
[41] Joo,J., Joo, G., Kim, Y., Jin, M.-N., Park, J., and Im, H. (2023). Twelve-lead ecg reconstruction from single-lead signals using generative adversarial networks. In International Conference on Medical Image Computing and Computer-Assiiter Intervention, pages 184-194. Springer.
[42] Kaltenbach, S., Perdikaris, P., and Koutsourelakis, P.-S. (2023). Semi-supervised invertible neural operators for bayesian inverse problems. Computational Mechanics, pages 1-20.
[43] Kang. J. and Wen. H. (2022). A Study on Several Critical Problems on Arhythmia Detection using Varying- Dimensional Electrocarrdiogrpphy. Physiological Measurement, 43(6)00640077.
[44] Karras, T., Aittala, M., Aila, T., and Laine, (2022). Elucidating the design space diffusion- based generative models. In Proc. NeurIPS.
[45] Kawar, B., Elad, M., Ermon, S., and Song, (2022). Denoising diffusion restoration models. 35:23593-23606.
[46] Kawar, B., Vaksman, G., and Elad, M. (2021). Snips: Solving noisy inverse problems stochasti- cally. Advances Neural Information Processing Systems, 34:21757-21769.
[47] Kearney, K., Thomas, C., and McAdams, E. (2007). Quantification of motion artifact in eeg electrode design. In 2007 29th Annual International Conference of the IEEE Engineering in Medicine and Biology Society, pages 1533-1536. IEEE
[48] Kim, Y., Lee, M., Yoon, J., Kim, Y., Min, H., Cho, H., Park. J., and Shin, T. (2023). Predicting future incidences cardiac arrhythmias using discrete heartbeats from normal sinus rhythm ecg signals via deep learning methods. Diagnostics, 13(17).
[49] Kingma, D. P. and Ba, J. (2015). Adam: A method for stochastic optimization. In Bengio, Y. and LeCun, Y., editors, 3rd International Conference on Learning Representations, ICLR 2015, San Diego CA, USA. May 7-9, 2015, Conference Track Proceedings.
[50] Kingma, D. P., Welling, M., al. (2019). An introduction variational autoencoders. Founda- lions and Trends@ in Machine Learning, 1274):307-332
[51] Kobyzev, I., Prince, S. J., and Brubaker, M. A. (2020). Normalizing flows: An introduction and review current methods. IEEE transactions on pattern analysis and muchine intelligence, 43(11))3964-399 39799
[52] Kuchar, D. L., Ruskin, J. N., and Garan, H. (1989). Electrocardiographic localization of the site of origin of ventricular tachycardia in patients with prior myocardial infarction. Journal of the American College of Cardiology, 13(4):893-900.
[53] Kuntz, J., Lim, J. N., and Johansen, A. M. (2023). Particle algorithms for maximum likelihood training of latent variable models. In International Conference on Artificial Intelligence and Statistics, pages 5134 5180. PMLR.
[54] Levine, R. A. and Casella, G. (2001). Implementations of the monte carlo em algorithm. Journal of Computational and Graphical Statisties, (0(3):422-439
[55] Li, H. and Boulanger, (2021). An automatic method reduce baseline wander and motion artifacts on ambulatory electrocardiogram signals. Sensors, 21(24): 169.
[56] Li, H., Ditzler, G., Roveda, J., and Li, A. (2023). Descod-ecg: Deep score-based diffusion model for eeg baseline wander and noise removal. IEEE Journal of Biomedical and Health Informatics, pages 1-11.
13

---

[57] Li, H., Schwab, J., Antholzer, S., and Haltmeier. M. (2020), Nett: Solving inverse problems with deep neural networks. Inverse Problems, 36(6):065005.
[58] Li, M. and Ramos, L. G. (2017). Drug-induced qt prolongation and torsades de pointes. Pharmacy and Therapeutics, 42(7):473.
[59] Macfarlane, W., Van Oosterom, A., Pahlm, O., Kligfield, P., Janse, M., and Camm, (2010). Comprehensive electrocardiology Springer Science & Business Media.
[60] Malik, M., Hnatkova, K., Kowalski, D., Keims, J. J., and van Gelderen, E. M. (2013). Qt/rr curvatures in healthy subjects: sex differences and covariates. American Journal of Physiology- Heart and Circulatory Phystology, 305(12):H1798 H1806.
[61] McLachlan, G. J. and Krishnan, T. (2007). The EM algorithm and extensions. John Wiley Sons.
[62] Moody, G. B., Muldrow, W., and Mark, R. G. (1984). A noise stress test for arrhythmia detectors. Computers in cardiology, 11333381-384.
[63] Nygaard, R., Melnikov, G., and Katsaggelos, A. K. (2001). A rate distortion optimal eeg coding algorithm. IEEE Transactions on biomedical engineering, 48(1):28-44
[64] Ongie, G., Jalal, A., Metzler, C. A., Baraniuk, R. G., Dimakis, A. G., and Willett, R. (2020).
Deep learning techniques for inverse problems in imaging. IEEE Journal on Selected Areas in Information Theory, 111):39-56.
[65] Phillips. A., Dau, H.-D., Hutchinson, M. J., De Bortoli, V., Deligiannidis, G., and Doucet, A. (2024). Particle denoising diffusion sampler. arXiv preprint urXiv:2402.06320.
[66] Porthan, K., Viitasalo, M., Toivonen, L.,, Havulinna, A. S., Jula, A., Tikkanen, J. T., Väänä- nen, H., Nieminen, M. S., Huikuri, H. V., Newton-Cheh, C., et al. (2013). Predictive value of electrocardiographic t-wave morphology parameters and t-wave peak to t-wave end interval for sudden cardiac death in the general population. Circulation: Arrhythmia and Electrophysiology. 6(4):690-696.
[67] Ramírez, J., Orini, M., Mincholé, A., Monasterio, V., Cygankiewicz, I., Bayes de Luna, A., Martínez, J. P., Pueyo, E., and Laguna, P. (2017). T-wave morphology restitution predicts sudden cardiac death in patients with chronic heart failure. Journal of the American Heart Association, 6(5):c005310.
[68] Reyna, M. A., Sadr, N., Alday, E. A. P., Gu, A., Shah, A. J., Robichaux, C., Rad, A. B., Elola, A., Seyedi, S., Ansari, S., Ghanbari, H., Li, Q., Sharma, A., and Clifford, G. D. (2021). Will two do? varying dimensions in electrocardiography: The physionet/computing in cardiology challenge 2021. In 2021 Computing in Cardiology (CinC), volume 48, pages 1-4.
[69] Reyna, M. A., Sadr, N., Alday, E. A. P., Gu, A. P., Shah, A. J., Robichaux, C., Rad, A. B., Andoni, Elola, Seyedi, S., Ansari, S., Ghanbari, H.. Qiao, Li, Sharma, A., and Clifford, G. D. (2022). Issues in the automated classification of multilead eogs using heterogencous labels and populations. Physiological Measurement, 43.
[70] Ribeiro, A. H., Ribeiro, M. H., Paixão, M., Oliveira. D. M., Gomes, P. R.. Canazart, J. A., Ferreira, M. P., Andersson, C. R., Macfarlane, P. W., Meira Jr, W., et al. (2020). Automatic diagnosis of the 12-lead eeg using deep neural network. Nature communications, 11(1):1761
[71] Ronneberger, O., Fischer, P., and Brox. T. (2015). U-net: Convolutional networks for biomedical image segmentation. In Medical Image Computing and Computer-Assister Intervention-MMCCO 2015: 18th International Conference, Munich, Germany, October 5-9, 2015, Proceedings, Part III 18, pages 234 241. Springer.
[72] Rubin, D. B. (1987). The calculation of posterior distributions by data augmentation: Comment: A noniterative samplingiimportance resampling alternative to the data augmentation algorithm for creating a few imputations when fractions of missing information are modest: The sir algorithm. Journal of the American Statistical Association, 524398)
14

---

[73] Sagie, A., Larson, M. G., Goldberg. R. J.. Bengtson, J. R., and Levy, D. (1992). An improved method for adjusting the qt interval for heart rate (the framingham heart study). The American journal of cardiology, 70(7):797-801.
[74] Sahlström, T. and Tarvainen, T. (2023). Utilizing variational autoencoders in the bayesian inverse problem of photoacoustic tomography. SIAM Journal on Imaging Sciences, 16(1):89-110)
[75] Salama, G. and Bett, G. C. (2014). Sex differences in the mechanisms underlying long qi syndrome. American Journal of Physiology-Hearr and Circulatory Physiology, 307(5):H640- H648.
[76] Shan, L., Li. Y., Jiang, H., Zhou, P., Niu, J., Liu, R., Wei, Y., Peng, J., Yu, H., Sha, X., and Chang, S. (2022). Abnormal ecg detection based on an adversarial autoencoder. Frontiers in Physiology, 13.
[77] Shin, H. and Choi, M. (2023). Physics-informed variational inference for uncertainty quantifica- tion of stochastic differential equations. Journal of Computational Physics, page 121833.
[78] Simon, N., Friedman, J., Hastie, T., and Tibshirani, R. (2013). A sparse-group lasso. Journal of computational and graphical statistics, 22(2):231
[79] Singh, P. and Pradhan, G. (2020). A new eog denoising framework using generative adversarial network. IEEE/ACM transactions computational biology and bioinformatics, 18(2):55--764
[80] Smith, G. H., Van den Heever, D. J., and Swart, W. (2021). The reconstruction of 12- lead electrocardiogram from reduced lead set using a focus time-delay neural network. Acta Cardiologica Sinica, 37(1):47.
[81] Sohl-Dickstein, J., Weiss, E., Maheswaranathan, N., and Ganguli. S. (2015). Deep unsupervised learning using nonequilibrium thermodynamics, In International Conference Machine Learning, pages 2256-2265. PMLR.
[82] Sohn, J., Yang. S., Lee, J., Ku, Y., and Kim, H. C. (2020). Reconstruction of 12-lead electrocar- diogram from three-lead patch-type device using lstm network. Sensors, 20(11):3278.
[83] Song, J., Meng. C., and Ermon, (2021a). Denoising diffusion implicit models. In International Conference on Learning Representations.
[84] Song. Y., Durkan, C., Murray, I., and Ermon, S. (2021b). Maximum likelihood training of score-based diffusion models. Advances in Neural Information Processing Systems, 34:1415-1428.
[85] Song, Y., Shen, L., Xing, L.,, and Ermon, S. (2022). Solving inverse problems medical imaging with score-based generative models. In International Conference on Learning Representations.
[86] Song, Y., Sohl-Dickstein, J., Kingma, D. P., Kumar, A., Ermon, S., and Poole, B. (2021c). Score- based generative modeling through stochastic differential equations. In International Conference on Learning Representations.
[87] Stuart, A. M. (2010). Inverse problems: a bayesian perspective. Acta numerica, 19:451-559,
[88] Su, J., Xu, B., and Yin, H. (2022). A survey of deep learning approaches to image restoration. Neurocomputing, 487:46-65 65.
[89] Trippe, B. L., Yim, J., Tischer, D., Baker, D.,, Broderick, T., Barzilay, R., and Jaakkola, T. (2023). Diffusion probabilistic modeling of protein backbones in 3d for the motif-scaffolding problem. In The Eleventh International Conference on Learning Representations.
[90] van der Zande, J., Strik, M., Dubois, R., Ploux, S., Alrub, S. A., Caillol, T., Nasarre, M., Donker, D. W. Oppersma, E., and Bordachar, (2023). Using smartwatch record precordial electrocardiograms:: validation study. Sensors, 23(5):2555.
[91] Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L.,, Gomez, A. N., Kaiser, t.., and Polosukhin, I. (2017). Attention is all you need. Advances in neural information processing systems, 30.
15

---

[92] Viskin, S. (1999). Long qt syndromes and torsade de pointes. The Lancet, 354(9190):1625- 1633.
[93] Vogel, B., Claessen, B. E., Arnold, S. V., Chan, D., Cohen, D. J., Giannitsis, E., Gibson, C. M., Goto, S., Katus, H. A., Kerneis, M., et al. (2019). St-segment elevation myocardial infarction.
Nature reviews Disease primers, 5(1):39.
[94] Wang. Z., Wong, C. M., da Cruz, J. N., Wan, F., Mak, P.-.., Mak, P. U., and Vai, M. (2014). Muscle and electrode motion artifacts reduction in eeg using adaptive fourier decomposition. In 2014 IEEE International Conference on Systems, Man, and Cybernetics (SMC), pages 1456-1461. IEEE.
[95] Wei, G. C. and Tanner, M. A. (1990). A monte carlo implementation of the em algorithm and the poor man's ss data augmentation algorithms. Journal of the American statistical Association, 45(411):699-1)))
[96] Wei, X., van Gorp, H., Conzalez-Carabarin L.., Freedman, D., Eldar, Y. C., and van Sloun, J. (2022). Deep unfolding with normalizing flow priors for inverse problems. IEEE Transactions Signal Processing, 70:2962-2971.
[97] Wen, H. and Kang. J. (2021). Hybrid Arrhythmia Detection on Varying-Dimensinn Dimensionnl Elec- tnccardiography: Combining Deep Neural Networks and Clinical Rules. In 202/ Computing in Cardiology (CinC). IEEE
[98] Wu, L.., Trippe, B. L.,, Naesseth, C. A., Blei, D. M., and Cunningham, J. P. (2023). Practical and asymptotically exact conditional sampling diffusion models.
[99] Xia. Y., Wang, W., and Wang. K. (2023a). Ecg signal generation based on conditional generative models. Biomedical Signal Processing and Control, 82: 10:1077
[100] Xia, Y., Xu, Y., Chen, P., Zhang, J., and Zhang, Y. (2023b). Generative adversarial network with transformer generator for boosting ecg classification. Biomedical Signal Processing and Control, 80: 80:104276.
[101] Zhang, D. (2006). Wavelet approach for ecg baseline wander correction and noise reduction. 2005 IEEE engineering in medicine and biology 27th annual conference, pages 1212-1215. IEEE.
[102] Zhang, L., Liu, L., Kowey, P., and H Fontaine, G. (2014). The clectrocardiographic manifes- tations of arrhythmogenic right ventricular dysplasia. Current Cardiology Reviews, 10(3):237-245.
[103] Zhihang, X., Yingzhi, X., and Qifeng, I.. (2023). A domain-decomposed vae method for bayesian inverse problems. arXiv preprint arXiv:2301.0577
[104] Zhu, F., Ye, F., Fu, Y., Liu, Q., and Shen, B. (2019). Electrocardiogram generation with a bidirectional Istm-enn generative adversarial network. Scientific reports, 91)):673.
16

---

Contents
Theoretical appendix
18
A.1 Sequential Monte Carlo samplers
18
A.2 MCCDiff
18
A.3
Monte Carlo Expectation Maximization (MCEM)
19
Numerical appendix
19
BeatDiff
19
B.2
SM-BBetDiff parameters
24
B.3
Baseline methods and networks
25
B.4 4
Classifier network for Classifier Enhancement task
26
B.5
Evaluation Metrics
27
B.6
Additional Rs
27
B.7
Computational resources
31
17

---

A Theoretical appendix
A.1 Sequential Monte Carlo samplers
A.1.1 SMC Algorithm
In this section we first provide the SMC algorithm
|
Algorithm 1: SMC
Input: observation number diffusion steps Operations involving index are repeated for [1 M)
K, number of particles M
Initialization: Ek ~ Qeef for l K to do
T Cat Cat((wu (wx((()))) Eis (n((k+1))33)
Ek (-(144))1)
end for Output: -
A.2
MCGDiff
A.2.1
Covariance matrix
Simplified setting Following simplified case
13 Section 2.1], we first give explicitly the potentials for the
Y= Y= Y=V' E g ((,,
(A.1)
where V E Xdy is an orthonormal matrices and RR xdy diagonal. For i E [1 : dy). we define TÜ min(k [1 K]|lu >> 0 where s, is the i-th element of the diagonal matrix S. т is defined such that the i-th coordinate of Y, Y(] and the i-th coordinate of V X,, follow the same distribution. This is the fundamental idea of the MCGDiff algorithm for the noisy version and refer to 13 Section 2.1] for a detailed explanation.
We define, for le E [1 K]. Rg. Rdyxdd diagonal matrix with values
[u] v2,) 2/2 if k Ti
Re[i, d]
0y/s:
SST.
We can finally define the MCGDiff potentials when the measurement models are the type A.l For l [1: KJ. define
(x) = Noss Va, R.R.). Note that if min(7s]e dy]]. then o (x: (3)).
General Ag and diagonal Dy. Even though A.1 corresponds to simplified version of MCGDiff can also be applied to the case where Dg = Cy and thus
Y = AeX + by + 5.5
where E NN(Oa, ; Ia,) and 2 and the singular value decomposition (SVD) Ag U.S.VOT. where Vo E Rdaxd, Xdy, Un E xdy are two orthonormal matrices, and So E IR xdy is diagonal.
Set d - dy. Multiplying the measurement equation by S S and substracting S U by yields
Y == Uz (Y bu) VeX to T (7,
Therefore, it is possible to use the potentials defined above which yields
9 . (2) (yr Aex + by. Uo
18

---

A.2.2 Proposal Potential and Weight
Using conjugate formulas we compute the proposal kernel and the weights defined in Section 3 in SMC algorithm
used
(rx ((((T))PPKK))) +R|K+ (0
Pajk+1 (at (x+))
A.M
J (2)))) (2)(sP Pk: +++ (2)xx+1)dz
N (Ix: Wk.0 {
2 [A - ba) + Uk 2 (x(4x+1, Poja (xx++))) Wk.0) J (= (p)))) k+ 1 (2/ 1)) Nwn Aapen (U++1, 1, DOJK (2x+1)) + bu, En.o + vl An N(y; AgTa+1 + bo: EE+1,0)
wk-1 (IR+1)
9 (IK+I)
where W == ( 11 - 1VV -.
A.3 Monte Carlo Expectation Maximization (MCEM)
Algorithm 2: MCEM
Input: observation y, number of diffusion steps K, number of particles M, regularization parameters (A1, Aa) (4.2). M step optimization parameters (NM; 7), total number of iterations NEM, initial parameters Og. for = to NEM do Ci.M (O K, y, .)
0g < M-step(0:-1, Siars (A1, X2), 7,3) (Algorithm) 3
end for Output: ED-M
Algorithm 3: M-step (implemented using (10)
Input: initial parameter 0, particles ÇI.M. regularization parameters A2), number of gradient
steps NM. learning rate ?, observation y.
for A 1 to NM do < PRoxA, II-I +ha 1-Ila (0 + (OVF(O0; (see Equation A.2 for definition of F)
end for Output:
In algorithm 3 F is the empirical error defined as follow for parmater 0 when provided observation and particles {1:M0
1 M
F(0:
Σ |1oE:A Bo DocDo -112.
(A.2)
B Numerical appendix
B.1 BeatDiff
B.1.1 Preprocessing Implementation Details
Our preprocessing follows:
Align the aecording-rrqqueng of all ECGs to 250 Hz by performing down or up sampling. Thus, two consecutive points in the ECG are separated by 4ms.
Extract R peaks from the ECG. The first principal component is extracted channel-wise from the entire ECG. Subsequently, this extracted component is processed through a Savitzky- Golay filter. characterized by an order of 3 and a window length of 15. The extraction of R-peaks is then carried out based on the methodology proposed in [I]]
Select the window RR 192 ms, + 512 ms) containing the QRS. This window corresponds to 176 time- time-points (192 + 512) /4 176.
19

---

ECGs are not normalized, unless otherwise specified for comparing to baseline methods or for improving visual clarity figures.
B.1.2 Dataset statistics
Table 6: Distribution of patients, gender and number of recorded beats among train, test and MI sets.
Train
Test
MI
All (patients)
22580
2723
2864
468
Male (patients)
11722
1399
1497
343
Female (patients)
10858
1324
1367
125
All (beats)
214460
25694
27221
44911
Mean (beats)
9.-
9.4 0.2
9.5 +/- 0.2
96 +/-
Figure 4: Female (pink), male (blue) ages histograms in training (left), test (middle), MI (right) sets.
2500
300
2000
60
Count
1500
200
40
1000
500
20:
0
50 Ages (train)
50
75
80
Ages (test)
Ages (MI)
B.1.3
Backward generation
For ECG generation in Section 4 we follow the scheduling prposed by total number of backward steps K [1 K]. defining for / E [1 K]
44 which consists of, for
1/p
1//0
0x 1/p)
Ur =
Uk
K
Throughout our experiments, we used p = 5.
B.1.4 Network Architecture Details
In this work, we follow closely the architecture from [24], but adapting it to the case of the ECG. Denoising diffusion consists of using a single network to learn several denoising networks, one for each level of corruption {ux]K_ We denote those different instances of the same network as (D) k=1- We describe below the different adaptations that used for the specific case of the ECG. We start by describing how embed the conditioning variables, namely the patient information A, S, RR but also the creation of a positional embedding on the signal and the noise embedding. We then describe the parameterization used in (24 but formalized in [4 of the F, and finally describe precisely the structure the denoising network.
Encoding of patient features (cp): As explained in Section we use the P = (A, S, RR) as conditioning variable for D Po We encode the sex S as boolean feature S. For the numerical features, choose the following normalization:
(A 50)/50, RR (RR 500)/500.
This values are chosen that À 0 for 50 year old patient and RR O the patient heart rate is of 120 bpm. The resulting vector obtained by concatenating S, A, RR fed into a two-layer dense network, yielding a 192 x vector called ēp. The final embedding is obtained by passing ép through one MI.P with SiLu activation and x 192 neurons and second linear layer projecting back to R 192 This procedure leads to embedding vector ep.
20

---

Time conditioning (e7): We are interested in generating fixed ECG beat. Therefore, the time wise position (t E (]: of each event important determine what is the event that we want to model in this moment. Indeed, we expect that (this can vary slightly for each signal) for < 50 we observe the P-wave, for & E [50- 100) we should observe the QRS-wave and for > 100 we should observe the Tavev. Each of this phenomenon possesses unique distinctive characteristics. This means that the data is not translation invariant. Indeed, we created each of the ECG beats by placing the R peak at the position f 75.
Convolutional neural networks are translation invariant, therefore, we want to add information about the position of a certain value with respect to the whole beat window. To do so, we use positional embedding. first introduced in [91]. For a given embedding dimension E N and maximum sequence length T E N, Positional encoding generates, for each sequence time E [1 : 7] PosEnc(t) E R
by
PosEnc(t)[1] (11000 if l 2r cos 110000020//0
if l = 2r + 1.
For the time embedding, we set (PosEnc(I),.-.. PosEEccT)) 7
= 192 and we obtain a vector et
Noise level conditioning (co,)) ): For encoding the noise level, we follow sitional encoding to generate a first embedding é.g PPosEnc(4-1 log(w))) E R 192 The final embedding is obtained by passing Eug, through one MLP with SiLu activation and 2 x 192 neurons and second linear layer projecting back to I This procedure leads to embedding vector evp.
24 and used also Po-
Final conditioning vector (econd): We combine (ep, eT, , into single matrix econd E RR T'122 by broadcasting (repeating across the first dimension) ep and eu into (T, 192) matrices and then defining Econd == Sep + ey + cvg)
Denoising network design: We use the definition of the Denoising network used in 24 and which is called the F net decomposition in 44
Doj (2t, Uk, Gcond) = Cakip (Ug)ar + Coue (vx) Fe Po(Ccu(12
)ar fcond)
where x is a x 176 matrix corresponding to the noisy ECG beat, Cin (vx) = (vf + a 11/2 Cakip (vx) = (uî + + ''' (ou) = Ug (uz + + ) 1/2 and ddata is the (estimated) empirical standard deviation of qdata. The key idea of this decomposition is that what is expected of the neural network is different for small vi and large Vk-
For small UA, Cskip (1)) & 1 and Cout (vx) R O, thus Do (ar, Uk, Grond) ~ x, which is expected since is already a good reconstruction of the original data. On the contrary, when Us is large, then Cakip (vk) se 0 and Cout x 1, thus DojA( (x, Uk. Gcond) relies heavily on the network Fg to provide a good reconstruction.
The input scaling Cin (vk) = + 1/2 is introduced so that cin (vx) cin(
has always the same standard deviation. As x is a realization of X₁ Xo + UgCx with NO I), Xo ~ qdata and dataa is and approximation of the standard deviation of qdatas we expect Cin (vk) have an standard deviation of approximately 1.
Fo architecture The Fø is an evolution of the UNet firstly introduced in [71] and follow the one proposed by [24]. We illustrate the general architecture of our F, of depth 2 in figure More (or less) depth can be obtained by adding (or removing) Down blocks and Up blocks. Each block (Down, Up, Middle) is an instantiation of the general UNet block, whose architecture is shown in figure 6
The EncoderBlock consists of a 1d Convolutional layer with kernel size 3 and padding and stride 1, with 192 kernels.
EncoderBlock:
BecoderBlock:
The Decoder block consist of GroupNorm layer, followed by Sil activation and finally 1d Convolutional layer with kernel size 3 and padding and stride 1, with 9 kernels.
21

---

æ
Fo @cond)
cond
Encoder
Decoder
1
21
Average pool(2)
Down Block
Up Block
22
22
Average pool(4)
Down Block
Up Block
23
Middle Block
23
Figure 5: Illustration of Fa architecture for UNet of depth 2.
22

---

ingrtt,
residual,
Sooud
Up-False
Up-
Down
Down FFalse
Dense(dac)
Conv8.1.22
Conv(1 0.2)
Conw3.1.3)
Co11110011)
ConvT(3.2)
ConvT(332)
Baard
SAIp
Self-A Toll-Atenttionne (Wandd))
GrompNorm(32)
SiLu()
Attention
output
(ro)out(0.1)
Co11(3.111)
Figure 6: Illustration of UNet block. Inputs: (Up. Down, d,ut, Attention, Bhsods))
The terms in figure descrriing the UNet with parameters (Up, Down, dout Attention, ThJeade) block corresponds to:
UNet block:
Conw(k, p, 8) means Id-convolutional layer with kernel size k. padding p and strides s,
(k, s) means 1d transposed convolutional layer with kernel size is and stride using the padding configuration "Same".
The number output channels for the convolution layers are always dout. From UNet blocks, we construct
DownBlock(dout: Theads Attention): UNeiBlock(False, True, douts Attention, Rheadss
UpBlock(dout, Theads, Attention): UNerBlock(True, False, dout, False, Rheadss)
MiddleBlock(dout, Rheads Attention): Stack of two UNetBlock(False, False, douts Atten- tion, Theaads).
The final configuration retained for BeatDiff is given Table In Appendix B.I.5 we tested running deeper architecture that is given in Table 8. Each output from the U-Net blocks undergoes a multi-head attention layer [91], with the number of heads equal to the original dimension divided by 64. The entire network D oj. is trained to minimize Lp through stochastic gradient descent on the healthy training set, and the best model is selected using the cross- validation set.
23

---

Layer Name
Parameters
Output Dimension
EncoderBlock
T x 192
DownBlock
(dout Rheads Attention) (192, 0, False)
(T/2) 192
MiddleBlock
(dout: Rheads1 Attention) = (192, 3, True)
(2) 192
UpBlock
(dout, Rheads Attention) (192, 0, False)
T x 192
DecoderBlock
Tx9
Table 7: Final configuration of BeatDiff.
Layer Name
Parameters
Output Dimension
EncoderBlock
T 192
DownBlock
(dout, Theads
Attention) (192, 0, False)
(T/2) 192
DownBlock
(dout: Theads:
Attention) (384, 6, True)
(T/4) 384
MiddleBlock
(dout; Theads: Attention) = (384, 6, Truc)
(T/4) x 384
UpBlock
(out, Rheads: Attention) -(192, 6, True)
(T/2) 192
UpBlock
(dout, Theads,
Attention) (192, 0, False)
'T x 192
DecoderBlock
T
Table 8: Configuration of deeper network tested.
Optimization:
We use the Adam optimizer [49 with the following configuration
learning rate: 10-4,
Number of epochs: 104,
Batch Size: 1024.
We also use exponential moving average of the network parameters with coefficient 0.9999.
Forward diffusion parameters: For the (forward diffusion) we used the following parameters:
min X 10"4
mmax 80,
data 0.5.
Importance law of for training: (-
B.1.5 Deeper Unconditioned Denoisers networks
In this section we test two alternative architectures: a DDM unconditioned on the patient information P and a deeper DDM with configuration given in Table & We find that conditioning over A, S, RR leads to smaller EMD. No substantial improvements were observed when utilizing deeper network.
B.2
EM-BeatDiff parameters
B.2.1 Number of particles
As the number of particles, denoted as M. increases, we observe corresponding decrease in the discrepancy between the target posterior distribution and the distribution of particles generated by algorithm [T] A critical question arises: what is the optimal value for M that strikes a balance between accuracy and computational efficiency? To approach this question, we first selected patient from the test dataset and used algorithm 1 to generate 10 samples with a high particle count of M 10a. We consider these samples our reference representing the target posterior distribution. We then generated 10s samples with algorithm for different values of M and calculated the Earth Mover's Distance (EMD) relative to the reference samples. This process helps us evaluate the convergence of the distribution generated by the algorithm to the posterior as M varies. Figure illussrates the relationship between M and the EMD. From this analysis, M 50 provides effective equilibrium
24

---

that provides a reasonable approximation to the posterior distribution while ensuring manageable inference times.
2.55
2.50
2.45
EMD
2.40
2.35
2.30
101
102
10
M
Figure 7: EMD distance between 1000 samples from algorithm 1 with M particles and 1000 samples of algorithm 1 with 108 particles, that is considered the standard samples.
B.2.2 Artifacts removal parameters
Choice of artifact basis: We choose the following Fourier basis for removing baseline wander and electrode motion. For j E [] and [1,7)
(1) = ( - fmin)/ 3/5²) j J/2,
(B.I)
f/ f/a)) else,
where J = 200 is the number of Fourier function basis, ʃ 250Hz is the sampling frequency, f = OHz and fa 1Hz is the typical range of frequency of baseline wander and electrode motion artifact.
Regularization parameters: In Table we display the parameters used the EM algorithm inside EM-BeatDiff. (NM,7) indicates the number of gradient steps and the learning rate used in the M-step the EM algorithm algorithm 2 NEM indicates the total number EM steps used and Nx the number of iterations per M step.
Table 9: Parameters used fo EM- BeatDiff
Name
(A1,)2) from (42))
NEM
NM
QT
(0, 1)
10
AR (BW)
(10, 10)
10
5
AR (EM)
(10, 5)
10
5
ML (SW)
(0, 1)
10
ML (V1-6)
(0.
10
AD (MI)
(1,1)
AD (LAE)
(1
10
AD (LAD)
(1,1)
AD (LQT)
(1
10
B.3 Baseline methods and networks
In this section, we provide implementation details of the adaptations that were needed test the existing baselines to the problem in hand.
25

---

B.3.1 WGAN I
In ②. the WGAN is conditioned on 15 categorical heart disease labels. These labels are embedded into a vector size 100 and concatenated with the latent variable before being inputted into the generator. They are also embedded into vector of length T (where T is the temporal length of the signal) and then concatenated with the cardiac signal (fake or real) before being inputted into the critic. Embedding maps variables with finite number of possible values (i.e., categorical variables) into a vectorized representation. However, since in our DDM we condition on scalar variables(P (A, RR)), in order compare the results obtained with DDM and the WGAN, we instead use multi-layer perceptron (MLP) with the following architecture: a linear layer from to 864, ID normalization layer, LeakyReLU, and linear layer from 864 64. This MLP maps the s-size feature vector (A, S, RR) to 64-toc, which is then used in the same way the embedding was in the original paper.
B.3.2 SSSD
We adapt the approach described in B]. We first used the same training procedure to train network on the same training set as ours. We added conditioning on Sex and changed the sampling frequency from 100hz 250hz to match ours. To compare with our approach, we generate 10s according to patient characteristics and using the NSR label from the Physionet dataset. We then use the procedure described in Appendix BBI.I extract heartbeats from generated ECG. For all the generation done
with SSSD, we use DDIM 83 schedule with 100 steps and 0.01.
B.3.3 DeScoD (56)
The model proposed in [56] is trained to denoise the beats from the PhysioNet training set, to which noise from the MIH dataset added. The provided code [ was modified to train the model on 9-lead ECGs instead 1-lead ECGs. The 9-lead preprocessed PhysioNet training set, as described in Appendix B.I.I] was used for clean ECGs, and independent random noise was added to each lead. The training procedure followed [56]. where noise was sampled from 80% of the first lead of baseline wander noise from the MIT-BIH database [62] and multiplied by a random factor uniformly sampled in [0.1, 20J. At test time, the noise was sampled from the remaining 10% of the second lead of the noise, and no multiplication factor was used. The model was run 10 times per ECG, and the average of the 10 outputs was evaluated.
B.3.4 ERGAN [1
We train the model proposed in [41] to reconstruct IIII,III, V1-6 leads from (with 1r=0.0001 for 100 epochs and then applied weight decay of 0.95 per epoch). For all the inpainting experiments normalize the ECGs by the max absolute value.
B.3.5
AAE 76
The model proposed in 76 was trained on the training set described in Appendix B.I.1 The architecture of the model was kept the same, except for the input channels, which were modified to instead of L
B.4 Classifier network for Classifier Enhancement task
The classifier used for the classification task is defined below, using the Flax library [36].
class Classifier (nn. Module):
.."A A simple CNN model. *M*
n_ classs:: int
@nn compact
def c_calll__ (self, x)
x nn. Conv ( (features=64 64, kernel_size (3,)) (x) (x)
relu (nn (ayerNorm() (x))
x nn avg.pool (x, windov_shape- (2,), strides (2
26

---

Conv (features= (ernel_size=33.))
relu (nn (a))
x un avg-pool(x, windor_shape=(2.)) strides=(2,)
x mn. nn. Con k kernel_size (x)
X (ellu(mm.aayerooom((
an. windov_shape (2,), strides (2,))
m.mean m. X nn Dnnse (features=256) (x)
flatten
x mn. r.rrelu (m..eeeroom) (x))
X mn Dense (features self (x)as)
return
All classifiers were executed with a batch size of 4096, Adam optimizer 49 with learning rate of 0.001 for 10 steps. All classifiers achieved 100% accuracy on the training set. Networks weights were initialized always using the same seed.
B.5 Evaluation Metrics
Sum of squared deviations (SSD):
The sum of squared deviations between arrays (2r, y)
R Rd is defined
SSD(x, v) = Ei= -v))²
Maximum absolute deviation (MAD): The maximum absolute deviation between two arrays (x,, v) R2d RR is defined
MAD(2, v)
-Vll-
:E[I:]]
Cosine distance (Cos.):
The cosine distance between two arrays (x, v) Rd x Rd is defined as
Cos,(2x,1 v) = [ y
B.6
Additional Results
B.6.1 Out of distribution (OOD) score 118
To quantify how unlikely each generated ECG is with respect to the training distribution, used the OOD-score proposed by [18]. Their method involves using randomly initialized network, which remains unchanged throughout the process, to produce "random prior" by associating each training data point (images in the original paper, real or generated ECGs in our case) with a random pattern. Subsequently, a second network is trained to learn this random prior distribution, meaning that the output of the network for training data point should be close (in terms of L.2 distance) to the random pattern from the first network. After training the second network, the OOD-score for input data point is the distance between the outputs of the two networks. The OOD-score boxplots and the resulting classification ROC curve in figure show that the OOD-scores of the generated ECGs are close to those of the test ECGs, and that the scores for MI ECGs are significantly higher than those for the test and generated ECG. The authors demonstrate the relevance of their score for out-of distriibbttio data detection by training on four classes of the CIFAR dataset and verifying that, test time, the score effectively distinguishes from those with different classes. In our case, we adopt the same residual network architectures proposed in [18, but replace the 2D convolutions with convolutions, as unidimensional residual networks are known for their efficiency in ECG classification [70]. We use 10 bootstraps and train the corresponding networks for 100 epochs with the Adam optimizer (learning rate=0.001) on healthy patients from the training set.
data with the same classes as the training data
27

---

Table 10: n²² -core between QT measured vs. regressed (intercept: QTg- slope: QT₁) as function of RR, generated samples, with 95%-CLT intervals over the test-sel.
METHOО
RR-SCORE
EXPRESSION
Framingham
0.88 + 0.03
QT QT 0.15541 RR)
Bazett
0.47 + 0.04
QT QTiVRR
Baz. (offset)
0.98 + 0.00
QT QT QTQV RR
Fridericia
0.94 = 0.02
QT QT; VRR
Frid. (offset)
0.98 + 0.00
QT QTé QTQ VRR
x10-
Single beat OOD secorre
TPR
DDM vs. MI (0.78)
Test va. MI (0.75)
Train vs. MI (0.75)
(real)
Heathy
FPR
Figure 8: Out-of-distribution evaluation. Left. Box-plot of OOD-score for train, test, generated (Gen) and MT heart beats. Right. ROC curves for classification between train/test/gen and MI based on OOD-score.
B.6.2 Prediction of QT from RR
In this section provide supplementary results for the experiments of the prediction of corrected QT: we provide the R2-score between QT measured vs. regressed (intercept: QTù, slope: QTi) as function of RR, in generated samples, with 95%-CLT intervals over the test-set, for several corrected QT formulas in Table I0
B.6.3 Ablation Study cardiac anomaly
In this section, we consider for each medical condition the AUC score of the anomaly detection task while varying the way that we use the conditioning ECGs.
The configurations are shown in Table II and we describe now for each configuration their electro- physiological motivation.
I, II. III: This choice of configuration implies generating the precordial leads V1-6 from the limb leads. It coherent when the abnormality expected manifest in localized way in one of the precordial leads.
This choice of configuration implies generating the ST segment (ventricle repolariza- tion) conditionally on the QRS observation over all the leads. It is particularly pertinent when an T-wave abnormality is expected.
QRS:
ST: This choice of configuration implies generating the QRS and P-wave from the ST segment. is particularly coherent when the abnormality is expected in the beginning the signal (i.e., the P-wave and QRS).
In Table 12 we display the AUC scores obtained using R² between the patient signal and the mean posterior signal from EM-Bese BeatDiff over the non-observed part of the signals.
28

---

Real data
Sample
Sample
Sample 3
Sample 4
Sample
Sample 6
aVL
aVR
VVF
VI
V2
V3
V4
V5
V6
Generation with DDM
Sample
Sample
Sample 3
Sample 4
Sample 5
Sample 6
aVL
avR
aVF
V1
V2
V3
V4
V5
V6
Generation with WGAN
Sample
Sample
Sample 3
Sample 4
Sample Sample 6
aVL
aVR
aVF
VI
V2
V3
V4
V5
V6
Figure 9: Real and generated ECG heart beat with DDM and WGAN.
29

---

Table 11: Configurations tested in the ablation study.
Conditioning
(L,T)
Aa
Aa
Be
Da
Do
I, II. III
(3.
Ttxt
ITXT
diag(
lXXT
QRS
(0,
Tzxt
TXxT
diag(o diag(01.2) Lixt
IXT lxxT
ST
(06)
Izxz
[Or;--ri mxxr]
Table 12: Anomaly detection abblation study. Confidence intervals obtained by running 10 times EM-BeatDiff per heartbeat.
Conditioning
MI
LAD
LAE
LQT
II, III QRS ST
84.82 + 0.01
91.63 = 0.03
79.02 0.07
77.40 0.11
81.88 + 0.02
70.45 0.09
62.89 0.06
84.73 0.04
84.05 + 0.01
93.06 0.03
78.33 0.05
79.72 0.06
B.6.4 Failure cases DeScoD artifact removal
BW
EM- BeatD
DeScoD
EM
BM-BeatD
DeScoD
II
III
V2
or
or
V3
V4
V5.
Input: noisy / incomplete beat
Output: generated beats vs. ground-truth
Figure 10: Failure of DeScoD ((6) on baseline wander (left) and electrode motion artifact (right).
Some (rare) ECGs in the test database already contain artifacts before the addition of noise from the MIT-BIH dataset. DeScoD is unable to effectively denoise these ECGs and produces inconsistent results because the noise in these ECGs is outside of the training domain of the model. The example in figure 10 illustraases that training an artifact removal model in a supervised manner is specific the MIT-BIH database and does not allow for the removal of artifacts not found in this database, even if they share the same characteristics (low frequency). On the other hand, our approach, which is not trained in supervised manner, more generalizable.
B.6.5
10s ECGs and arrythmic data
Figure 11: lead (I. II. III. V1-V6 from top to bottom) 5 second healthy ECG reconstruction. Red indicates
the ground-truth and blue the generated ECGs conditionned on leads II, III, V2 and V4.
30

---

Figure 12: 9 lead (I, II, III, V1-V6 from top to bottom) 5 second AF (Atrial fibrillation) ECG reconstruction.
Red indicates the ground-truth and blue the generated ECGs conditionned leads I, II, III, V2 and V4.
B.7 Computational resources
All the experiments were run in an internal server equipped with 8 A40 Nvidia GPUs, each with 46Gb of available memory. The server CPU has 72 threads and a total live memory of 378 Gb. All the data creation and preprocessing task were used CPU workers while all the neural network related tasks used GPU workers.
31

---

NeurIPS Paper Checklist
1. Claims
Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope?
Question:
Answer: [Yes]
Justification: We show numerically that our generative model is either on pair with the current models or better, while heing lightweight. We show that using this model for solving inverse problems without additional training results in performance on par with models trained for the specific inverse problem reconstruction problem.
Guidelines:
The answer NA means that the abstract and introduction do not include the claims made in the paper.
The abstract and/or introduction should clearly state the claims made, including the contributions made the paper and important assumptions and limitations. A No or NA answer to this question will not be perceived well by the reviewers.
The claims made should match theoretical and experimental results, and reflect how much the results can be expected to generalize to other settings.
It is fine to include aspirational goals as motivation as long as is clear that these goals attained by the paper.
2. Limitations
Question:
Does the paper discuss the limitations the work performed by the authors?
Answer: [Yes]
Justification:
We provide limitation sections in the main paper Section
Guidelines:
The answer NA means that the paper has limitation while the answer No means that the paper has limitations, but those are not discussed in the paper.
The authors are encouraged to create separate "I "Limitations" section in their paper.
The paper should point out any strong assumptions and how robust the results are to violations of these assumptions (e.g., independence assumptions, noiseless settings, model well-specification, asymptotic approximations only holding locally). The authors should reflect on how these assumptions might be violated in practice and what the implications would be.
The authors should reflect the scope of the claims made, e.g., if the approach was only tested on a few datasets or with few runs. In general, empirical results often depend implicit assumptions, which should be articulated.
The authors should reflect the factors that influence the performance of the approach. For example, facial recognition algorithm may perform poorly when image resolution low or images are taken in low lighting. Or speech-to-text system might not be used reliably to provide closed captions for online lectures because it fails to handle technical jargon.
The authors should discuss the computational efficiency the proposed algorithms and how they scale with dataset size.
If applicable, the authors should discuss possible limitations of their approach to address problems of privacy and fairness.
While the authors might fear that complete honesty about limitations might used by reviewers as grounds for rejection, worse outcome might be that reviewers discover limitations that aren't 't acknowledged in the paper. The authors should use their best judgment and recognize that individual actions in favor of transparency play impor- tant role in developing norms that preserve the integrity of the community. Reviewers will be specifically instructed to not penalize honesty concerning limitations.
3. Theory Assumptions and Proofs
Question: For each theoretical result, does the paper provide the full of assumptions and complete (and correct) proof?
32

---

Answer: [NA]
Justification: The paper introduces no new theoretical results, but a method that combines other methods such Sequential Monte Carlo and Expectation Maximization algorithm. We provide the relevant references where theoretical results can be found.
Guidelines:
The answer NA means that the paper does not include theoretical results.
All the theorems, formulas, and proofs in the paper should be numbered and cross- referenced.
All assumptions should be clearly stated or referenced the statement of any theorems.
The proofs can either appear the main paper or the supplemental material, but they appear in the supplemental material, the authors are encouraged to provide short proof sketch to provide intuition.
Inversely, any informal proof provided in the core of the paper should be complemented by formal proof's provided in appendix supplemental material.
Theorems and Lemmas that the proof relies upon should be properly referenced.
4. Experimental Result Reproducibility
Does the paper fully disclose all the information needed to reproduce the main ex- perimental results of the paper to the extent that it affects the main claims and/or conclusions the paper (regardless whether the code and data are provided or not)?
Question:
Answer: [Yes]
Justification: We provide detailled description of architecture, preprocessing and hyper parameters. Furthermore, we provide a anonymous git link for the code. Reproducing our experiments is possible provided that comparable computational budget is available.
Guidelines:
The answer NA means that the paper does not include experiments.
If the paper includes experiments, No answer to this question will not be perceived well by the reviewers: Making the paper reproducible is important, regardless of whether the code and data are provided or not.
If the contribution is dataset and/or model, the authors should describe the steps taken to make their results reproducible or verifiable.
Depending on the contribution, reproducibility can be accomplished in various ways. For example, if the contribution is novel architecture, describing the architecture fully might suffice, or if the contribution is specific model and empirical evaluation, it may be necessary to either make possible for others to replicate the model with the same dataset, or provide access to the model. In general. releasing code and data is often one good way to accomplish this, but reproducibility can also be provided via detailed instructions for how to replicate the results, access to a hosted model (e.g.. in the case of large language model), releasing of a model checkpoint, or other means that are appropriate to the research performed.
While NeurlPS does not require releasing code, the conference does require all submis- sions to provide some reasonable avenue for reproducibility, which may depend on the nature of the contribution. For example
(a) If the contribution is primarily a new algorithm, the paper should make it clear how to reproduce that algorithm.
(b) the contribution is primarily new model architecture, the paper should describe the architecture clearly and fully.
(c) the contribution is a new model (e.g., a large language model), then there should either be way access this model for reproducing the results or way to reproduce the model (e.g., with an open-source dataset or instructions for how to construct the dataset).
(d) We recognize that reproducibility may be tricky in some cases, in which case authors are welcome describe the particular way they provide for reproducibility. In the case of closed-source models, it may be that access to the model is limited in some way (c.g., to registered users), but it should possible for other researchers to have some path to reproducing verifying the results.
33

---

reproducible, they 5. Open access to data and code
Does the paper provide open access to the data and code, with sufficient instruc- tions faithfully reproduce the main experimental results, described in supplemental material?
Question:
Answer: [Yes]
Justification: We use for all the experiments the open source data from the Physionet Challange 2021 and the code is available via anonymous github. Detailed description of the architecture, training procedure and parammerrseserrss are provided in the supplementary material.
Guidelines:
The answer NA means that paper does not include experiments requiring code.
Please see the NeurlPS code and data submission guidelines (https://nips.cr cc/
for more details.
While we encourage the release of code and data, we understand that this might not be possible, "No" an acceptable answer. Papers cannot be rejected simply for not including code, unless this is central to the contribution (e.g., for new open-source benchmark).
The instructions should contain the exact command and environment needed to run to reproduce the results. See the NeurIPS code and data submission guidelines (https
halps..cc/ublicc/uu.deee httpa////gggdeee/eeeeuubbbbbbaia SCt////ooeSSeiieaeeeeeeee seciisssssooooooi onPolicy) for more details.
The authors should provide instructions on data access and preparation, including how access the raw data, preprocessed data, intermediate data, and generated data,
The authors should provide scripts to reproduce all experimental results for the new proposed method and baselines. If only subset of experiments should state which ones are omitted from the script and why.
At submission time, to preserve anonymity, the authors should release anonymized versions (if applicable).
Providing as much information as possible supplemental material (appended to paper) is recommended, but including URLs to data and code is permitted.
6. Experimental Setting/Details
Question: Does the paper specify all the training and test details (e.g., data splits, hyper- parameters, how they were chosen, type of optimizer, etc.) necessary to understand the results?
Answer: [Yes]
Justification: Detailed description of the architecture, training procedure and hyper- parameters are provided in the supplementary material.
Guidelines:
The answer NA means that the paper does not include experiments.
The experimental setting should be presented in the core of the paper to level of detail that is necessary to appreciate the results and make sense of them.
The full details can be provided either with the code, in appendix, as supplemental material.
7. Experiment Statistical Significance
Does the paper report error bars suitably and correctly defined or other appropriate information about the statistical significance of the experiments?
Question:
Answer: [Yes]
Justification: We provide confidence intervals for all the metrics that are either obtained by testing the algorithm on different data or by repeating the experiment with different initialization when pertinent. We did not provide training with several different train test splits due to the high-computational demands for the training of each model, but all the evaluation of the models and the inverse problem parts possesses the equivalent confidence intervals.
34

---

Guidelines:
The answer NA means that the paper does not include experiments.
The authors should answer "Yes" if the results are accompanied by error bars, confi- dence intervals, or statistical significance tests, least for the experiments that support the main claims of the paper.
The factors of variability that the error bars are capturing should be clearly stated (for example, train/test split, initialization, random drawing of some parameter, or overall run with given experimental conditions).
The method for calculating the error bars should be explained (closed form formula, call to a library function, bootstrap, etc.)
The assumptions made should be given (e.g.. Normally distributed errors).
It should be clear whether the error bar is the standard deviation or the standard error of the mean.
is OK to report 1-sigma error bars, but one should state it. The authors should preferably report a 2-sigma error bar than state that they have 96% CL, if the hypothesis of Normality of errors is not verified.
For asymmetric distributions, the authors should be careful not to show in tables or figures symmetric error bars that would yield results that out of range (e.g. negative error rates).
If error bars are reported in tables or plots, The authors should explain in the text how they were calculated and reference the corresponding figures or tables in the text.
8. Experiments Compute Resources
For each experiment, does the paper provide sufficient information on the com- puter resources (type of compute workers, memory, time of execution) needed reproduce the experiments?
Question:
Answer: [Yes]
Justification: We provide in Table I an overview of all the computational burden of each tested model. In Appendix B.7 7 we describe the hardware used for the experimental section.
Guidelines:
The answer NA means that the paper does not include experiments.
The paper should indicate the type of compute workers CPU or GPU, internal cluster, or cloud provider, including relevant memory and storage.
The paper should provide the amount of compute required for each of the individual experimental runs as well as estimate the total compute.
The paper should disclose whether the full research project required more compute than the experiments reported didn't 'tttt make it into the paper).
paper (e.g., preliminary or failed experiments that
9. Code Of Ethics
Question: Does the research conducted the paper conform, in every respect, with the NeurlPS Code of Ethics httppp//whorrppp....///baa/aeaaa
Answer: [Yes]
Justification: The database used is available on open source for some years and has been anonymized.
Guidelines:
The answer NA means that the authors have not reviewed the NeurlPS Code of Ethics.
If the authors answer No, they should explain the special circumstances that require deviation from the Code of Ethics.
The authors should make sure to preserve anonymity (e.g., there special consid- eration due to laws or regulations in their jurisdiction).
10. Broader Impacts
Question: Does the paper discuss both potential positive societal impacts and negative socictal impacts of the work performed?
35

---

Answer: [Yes]
Justification: We describe in the Limitations section that any usage of the tools described in this paper on real patients need to pass through the appropriate clinical trials and that in way we intend the available code to be used per se in real patient data.
Guidelines:
The answer NA means that there is no societal impact of the work performed.
If the authors answer NA No, they should explain why their work has no societal impact why the paper does not address societal impact.
Examples of negative societal impacts include potential malicious or unintended uses (e.g.. disinformation, generating fake profiles, surveillance), fairness considerations (e.g.. deployment of technologies that could make decisions that unfairly impact specific groups), privacy considerations, and security considerations.
The conference expects that many papers will be foundational research and not tied to particular applications, let alone deployments. However, if there is direct path to any negative applications, the authors should point it out, For example, it is legitimate to point out that improvement in the quality of generative models could be used to generate deepfakes for disinformation. On the other hand, it is not needed to point out that a generic algorithm for optimizing neural networks could enable people train models that generate Deepfakes faster.
The authors should consider possible harms that could arise when the technology is being used as intended and functioning correctly, harms that could arise when the technology is being used as intended but gives incorrect results, and harms following from (intentional or unintentional) misuse of the technology.
If there are negative societal impacts, the authors could also discuss possible mitigation strategies (e.g., gated release of models, providing defenses in addition to attacks, mechanisms for monitoring misuse, mechanisms to monitor how a system learns from feedback over time, improving the efficiency and accessibility of ML).
11. Safeguards
Does the paper describe safeguards that have been put in place for responsible release of data models that have high risk for misuse (e.g., pretrained language models, image generators, or scraped datasets)?
Question:
Answer: [NA]
Justification: N/A
Guidelines:
The answer NA means that the paper poses no such risks.
Released models that have a high risk for misuse or dual-use should be released with necessary safeguards to allow for controlled use of the model, for example by requiring that users adhere to usage guidelines or restrictions to access the model or implementing safety filters.
Datasets that have been scraped from the Internet could pose safety risks. The authors should describe how they avoided releasing unsafe images.
We recognize that providing effective safeguards is challenging, and many papers do not require this, but we encourage authors to take this into account and make best faith effort.
12. Licenses for existing assets
Question: Are the creators or original owners of assets (e.g., code, data, models), used in the paper, properly credited and are the license and terms of use explicitly mentioned and properly respected?
Answer: [Yes]
Justification: All the baselines and data providers are properly cited and all the license and terms of used are respected.
Guidelines:
The answer NA means that the paper does not use existing assets.
36

---

The authors should cite the original paper that produced the code package or dataset.
The authors should state which version of the asset is used and, if possible, include URL.
The name of the license (e.g., CC-BY 4.0) should be included for each asset. For scraped data from a particular source (c.g.. website), the copyright and terms of service of that source should be provided.
If assets are released, the license, copyright information, and terms of use in the package should be provided. For popular datasets, paperswi thcode com/ datasets has curated licenses for some datasets. Their licensing guide can help determine the license of dataset.
For existing datasets that re- re-packaged, both the original license and the license of the derived asset (if has changed) should provided.
If this information is not available online, the authors are encouraged to reach out to the asset's creators.
13. New Assets
Question: Are new assets introduced in the paper well documented and is the documentation provided alongside the assets?
Answer: [Yes]
Justification: The code and model are documented both in the appendix of the current paper and in the git repository. We will continue work improve the documentation of the anonymous git repository
Guidelines:
The answer NA means that the paper does not release new assets.
Researchers should communicate the details the datasct/code/mooell as part of their submissions via structured templates. This includes details about training, license, limitations, etc.
The paper should discuss whether and how consent was obtained from people whose asset used.
At submission time, remember to anonymize your assets (if applicable). You can either create an anonymized URL or include an anonymized zip file.
14. Crowdsourcing and Research with Human Subjects
Question: For crowdsourcing experiments and research with human subjects, does the paper include the full text of instructions given to participants and screenshots, if applicable, as well details about compensation (if any)?
Answer: [NA]
Justification: NA
Guidelines:
The answer NA means that the paper does not involve crowdsourcing nor research with human subjects.
Including this information in the supplemental material is fine, but if the main contribu- tion of the paper involves human subjects, then as much detail as possible should be included the main paper.
According the NeurIPS Code of Ethics, workers involved in data collection, curation, or other labor should be paid at least the minimum wage in the country of the data collector.
15. Institutional Review Board (IRB) Approvals or Equivalent for Research with Human Subjects
Question: Does the paper describe potential risks incurred by study participants, whether such risks were disclosed to the subjects, and whether Institutional Review Board (IRB) approvals (or an equivalent approval/review based on the requirements of your country or institution) were obtained?
Anonymous code available at httpps//anonymouss 4open. hptpa//sesooooacooeoooooooooooia
37

---

Answer: [NA]
Justification: NA
Guidelines:
The answer NA means that the paper does involve crowdsoureing nor research with
human subjects.
Depending on the country in which research is conducted, IRB approval (or equivalent)
may be required for any human subjects research. If you obtained IRB approval, you should clearly state this in the paper.
We recognize that the procedures for this may vary significantly between institutions and locations, and we expect authors to adhere to the NeurlPS Code of Ethics and the guidelines for their institution.
For initial submissions, do not include any information that would break anonymity (if applicable), such the institution conducting the review.
38


Reviews:
[{"review_id": "XnhRhVJxJf", "reviewer": "Reviewer_UDMo", "summary": "This paper introduces a Diffusion based generator of ECG heartbeat. The proposed technique builds on a very recently introduced sequential approach for diffusion models for linear inverse problems. The authors describe how elegantly the proposed approach can be used to solve several important ECG analysis problems (such as denoising, missing lead reconstruction, or anomaly detection)", "questions": "• Could the authors discuss how easily it would be for them it would be to generate 10s ECG signals instead of a simple heartbeat? It would be interesting to be able to generate arrhythmic data such as ECG with PVCs or AF rhythm ECG as well.\nCould the authors discuss the ability to generate precordial leads for limb leads only, and how to perform a more convincing evaluation of the usability of these additional simulated leads for classification purpose.", "limitations": "The authors could expand a bit on potential impact of their technique, especially the risk of hallucination for generative techniques, which could lead cardiologist to misdiagnosis when visually inspecting the generated ECG signals", "rating": 7, "confidence": 3, "soundness": 4, "presentation": 3, "contribution": 4, "strengths": "• The paper tackles important problems for the analysis of health (ECG) data by using an interesting approach namely generation of simulated data and showcasing how it could be linked to several applications.\n• The introduced method allows for an elegant solving of different problems, which makes it really appealing.\n• The authors have thoroughly evaluated their proposed technique, comparing it with SOTA approach", "weaknesses": "• The reconstruction of missing lead is an important avenue of research. I believe that cardiologists and clinicians are doubtful it is possible to accurately reconstruct precordial leads form Einthoven leads only. In order to convince clinicians, it would have been interesting to show that it is possible to detect pathologies (such as myocardial infraction) from the reconstructed precordial leads. AliveCor recently develop a new system based on 5 leads in order to reconstruct missing leads using a generative AI approach. But in their device, they have access to at least two precordial leads, and seem to have demonstrated their ability to detect ischemia (for example) from the reduced set of leads and by using the (simulated) reconstructed leads.", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "*… detect pathologies (such as MI) from the reconstructed precordial leads.* In our study, we show that it's possible to generate precordial leads from limb leads for healthy patients. This is because healthy patients have correct electrical signal conduction, and our model, trained on numerous healthy ECGs, can capture this information. However, challenges arise with conduction issues like Myocardial Infarctions (MI), where part of the heart is necrotic. If the necrosis is highly localized, predicting the ECG shape in precordial leads accurately becomes difficult. To address this, the model would need to be trained on ECGs with MI. Unfortunately, there are only 500 MI patients in Physionet, which is insufficient to cover all possible MI localizations. We are currently training a generative model on 600,000 patients from a partner hospital's cardiology service to evaluate if our algorithm can generate precordial leads for patients with localized MI or Long QT. This is a future task as the data is not yet publicly available due to anonymization reasons.\n\n*AliveCor recently develop a new system based…* Many thanks for the reference to Kardia12L from AliveCor. Their AI model for 12-lead reconstruction includes two precordial leads. This is likely because they reconstruct multiple beats of higher dimension than in our case. We found that generating higher-dimensional signals with our approach requires at least two precordial leads (see below).\nRegarding MI detection from limb leads, this is an interesting question but requires a dataset of MI to develop an accurate model. To our knowledge, there is no large public dataset of ischemia (Physionet has less than 1k, insufficient for training a diffusion model), but this would be valuable for future work.\nIt is worth noting that our approach has a distinct advantage over AliveCor's AI: We do not need to know which leads should be used to reconstruct the signal before training the model. Therefore, signals acquired by an AliveCor system with two precordial leads or signals acquired with smartwatches (where we can acquire I, II, III, V1, V3 and V6 depending on the placement of the smartwatch [van der Zande, Sensors 2023]) can be used.\n\n*How easily would it be to generate 10s ECG signals?* Thank you for this interesting question. Although our study focused on heartbeat morphology, we found that our approach can generate 10-second ECG signals. We trained a diffusion model to produce 5-second slices due to time and GPU constraints. We then applied our sampling algorithm to reconstruct 12-lead ECGs from limb leads only and limb leads + V2 + V4 (similar to Kardia12L). We found that reconstructing 12 leads from multi-beat ECGs is more complex and requires precordial leads for reasonable results (see attached figure). We will include an improved version of this experiment in the supplementary material to show that our methods apply to 10-second segments, though our main focus remains on heartbeat morphology and pathology detection.\n\n*It would be interesting to be able to generate arrhythmic data such as AF* Thank you for the question. While we have focused on the reconstruction of heart beats for morphologic analysis, it is important to point out that testing the ability to reconstruct arrhythmic ECGs is valuable for testing the method in a controlled environment, even if it is not necessarily of direct clinical interest. Indeed, arrhythmias like atrial fibrillation (AF) and premature ventricular contractions (PVC) can be detected from lead I alone (e.g., with an Apple Watch or Kardia), unlike morphological abnormalities such as MI or long QT, which require examining heartbeat characteristics. We trained a diffusion model on 5-second ECGs with AF from Physionet and successfully predicted a reasonable 12-lead ECG from limbs+V2+V4 (Kardia12L setting). A larger AF dataset (not yet publicly available) would yield more interesting results, but this experiment shows the method's potential for generating rhythmic abnormalities. We will include this study in the supplementary material.\n\n*discuss the ability to generate precordial leads for limb leads only…*\n* Healthy heartbeats: Our paper focuses on generating 12-lead healthy heartbeats from partial measurements (e.g., limb leads only). We show that our approach can also classify abnormal heartbeats. In Section 4, we generate healthy counterparts of abnormal heartbeats and use the distance as an anomaly score. The flexibility of our method allows the detection of various heart conditions (MI, LQT, LAD, LAE) by reconstructing 12 leads from limb leads only, QRS only, or ST only (see Table 12).\n* Unhealthy heartbeats case: Generating unhealthy heartbeats from incomplete heartbeat (e.g., limb leads) requires a large dataset of ECGs with morphological abnormalities, which is not yet publicly available. However, this would enable the use of additional simulated leads for abnormality detection from portable devices such as Smartwatch or AliveCor products.\n* 10s ECG: Generating 10s 12-lead ECGs from limb leads only, by solving an inverse problem, is non-trivial. Our current algorithm requires precordial leads (as observed by AliveCor). A special study is needed to build a relevant diffusion model and adapt the algorithm's parameters. This adaptation is complex due to the need for larger models and more particles for posterior sampling.\n\n*risk of hallucination* Our anomaly detection tool is semi-white-box: rather than outputting an abnormality score, our approach is also able to show the healthy counterparts of an abnormal signal and highlight where they differ from the patient's signals. This could theoretically enable cardiologists to rule out abnormalities that are not relevant. However, there is still a risk of hallucinations. We have shown that the generated signals are close to the real signals for healthy patients, a clinical study must be performed before clinical use. We'll mention this in the final paper.", "claims_and_evidence": "", "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": "", "extra_scores": {}}, {"review_id": "BsvzmN6NW6", "reviewer": "Reviewer_h18s", "summary": "Authors introduces BeatDiff based on denoising diffusion generative model and EM-BeatDiff combining BeatDiff with an Expectation-Maximization. BeatDiff is used for various ECG tasks, including noise and artifact removal, 12-lead ECG reconstruction from a single lead, and unsupervised anomaly detection. The EM-BeatDiff solves these tasks without fine-tuning, outperforming state-of-the-art methods across multiple metrics.", "questions": "- There are many different ECG generation models available. What are the advantages of using a diffusion model? A performance comparison with existing models for each task is necessary. If a comparison is difficult, it would be helpful to specify the exact reasons why only the respective models were used for each task.\n- The paper proposes EM-BeatDiff based on BeatDiff. Is it obvious that EM-BeatDiff performs better than using BeatDiff alone? A comparative analysis is needed.\n- Conditional options such as age, gender, and RR were used. However, only the effect of RR is confirmed in the actual paper. Can other conditions not be utilized?", "limitations": "- The rationale for choosing diffusion models and their advantages are not clearly articulated. The paper lacks a thorough comparison with other state-of-the-art generative models, which would provide a more convincing argument for the selection of diffusion \n- The dataset used in the study may be limited to specific conditions or environments. Therefore, the generalization ability of the model across diverse patient populations and different clinical settings may not be fully validated.", "rating": 4, "confidence": 4, "soundness": 2, "presentation": 1, "contribution": 2, "strengths": "- Applying existing frameworks to the problem of ECG is a very good approach. Additionally, the development has been done in a highly efficient manner compared to widely used models like GANs.\n- The authors have prepared a variety of tasks needed to analyze the ECG beat generation model based on a structural understanding of ECG and conducted precise analyses on these tasks.", "weaknesses": "- The content related to well-known methods such as DDM, Monte Carlo Guided Diffusion, and Bayesian inverse problems used in the presented model occupies too much space. It would be better to focus more specifically on the proposed methods. This also raises many questions about the experiments.\n- There is a shortcoming in the selection of comparison models. Although performance evaluations were conducted on various tasks, different models were used for each task. The model should be comparable regardless of the task. A comprehensive comparison is needed. It would be beneficial to separate the diffusion-based and GAN-based models and compare their performance in detail.", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "We thank the reviewer for their detailed feedback.\n\n* *There is a shortcoming in the selection of comparison models. Although performance evaluations were conducted on various tasks, different models were used for each task. The model should be comparable regardless of the task. A comprehensive comparison is needed. It would be beneficial to separate the diffusion-based and GAN-based models and compare their performance in detail.*\n\nComparison methods are specialized for specific tasks and cannot be used interchangeably. For example, the DeScoD model is designed for baseline-wander removal and cannot be used for ECG reconstruction or ECG anomaly detection, while EkGAN and AAE are not suitable for baseline-wander removal. To our knowledge, EM-BeatDiff is the only one capable of addressing all these tasks.\nFor each task, we have taken care to use the most appropriate comparison methods and to compare our results with the state-of-the-art for the corresponding task.\nCould you please specify how you envision comparing all of these methods regardless of the task?\n\n* *It would be beneficial to separate the diffusion-based and GAN-based models and compare their performance in detail.*\n\nSome of the methods we have included in our study, such as the Adversarial Autoencoder (AAE), do not fall into either of these categories. Would you mind providing more details on how you envision the separation of these methods?\n\n* *There are many different ECG generation models available. What are the advantages of using a diffusion model?*\n\nSection 4 of the paper provides the advantages of using a diffusion model. In Table 1 and in Figure 1 of the paper, we provide comparisons of BeatDiff with various ECG generation models in terms of size, inference time, and different evaluation metrics. As stated on line 214, \"Diffusion-based models BeatDiff and SSDM outperform WGAN, with BeatDiff being 400 times faster than SSDM\".\n\n* *A performance comparison with existing models for each task is necessary. If a comparison is difficult, it would be helpful to specify the exact reasons why only the respective models were used for each task.*\n\nWe already provide an exhaustive comparison of our BeatDiff model with existing ECG generation models such as SSDM or WGAN (which to the best of our knowledge are currently the state of the art). We also extensively compare our EM-BeatDiff algorithm on multiple tasks with multiple approaches that are respectively the state of the art on their tasks (such as DeScoD for baseline-wander removal, EkGAN for missing lead reconstruction, and AAE for anomaly detection). For each task, we merely selected the baseline approach which was the state-of-the-art method for this task. To better address your concerns, we are happy to provide additional comparison. Please let us know if there is a specific method that you think we should include, and on which specific task.\n\n* *The paper proposes EM-BeatDiff based on BeatDiff. Is it obvious that EM-BeatDiff performs better than using BeatDiff alone? A comparative analysis is needed.*\n\nBeatDiff and EM-BeatDiff serve different purposes and are not directly comparable. BeatDiff is a diffusion model trained to generate ECGs, while EM-BeatDiff is a sampling algorithm that utilizes BeatDiff as a prior to address various challenges in heartbeat morphology reconstruction from partial observations. As stated in the paper (line 63), \"we show how BeatDiff can be used as a prior to address various challenges in heartbeat morphology reconstruction from partial observations.\"\nTherefore, BeatDiff alone cannot be used to solve the same tasks as EM-BeatDiff. BeatDiff serves as the generative prior for EM-BeatDiff, and the two are not meant to be compared directly. EM-BeatDiff leverages the generative capabilities of BeatDiff to perform downstream tasks such as heartbeat morphology reconstruction, which a diffusion model alone cannot accomplish.\n\n* *Conditional options such as age, gender, and RR were used. However, only the effect of RR is confirmed in the actual paper. Can other conditions not be utilized?*\n\nAge, sex, and RR all have an impact on ECG morphology. However, although age and sex have a significant impact on ECG morphology, there is no known formula in the literature that represents this correlation in a closed form. The RR interval has a more subtle impact, but it is still significant and well established in the ECG literature under the Fridericia formula (QT linearly correlated with RR^(1/3)). Furthermore, the effect of the sex variable is visible in the classifier improvement score given in Table 1. We will clarify this in the updated version of the paper. Thank you for pointing this out.\n\n* *The rationale for choosing diffusion models and their advantages are not clearly articulated. The paper lacks a thorough comparison with other state-of-the-art generative models, which would provide a more convincing argument for the selection of diffusion*\n\nc.f. response to above question on the justification of using diffusion models.\n\n* *The dataset used in the study may be limited to specific conditions or environments. Therefore, the generalization ability of the model across diverse patient populations and different clinical settings may not be fully validated.*\n\nWe used the PhysioNet Challenge dataset, comprising 43k 12-lead ECGs. This dataset contains the largest and most diverse database of 12-leads ECGs publicly available. Building a larger ECG database is beyond the scope of this paper.", "claims_and_evidence": "", "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": "", "extra_scores": {}}, {"review_id": "FtGefJHzGz", "reviewer": "Reviewer_sRY5", "summary": "The manuscript describes a diffusion model that provides a prior to a conditioned linear Bayesian inverse model to produce the heart beat normalized morphology of the  12 lead ECG signal from a single lead  ECG measurement.  The result is shown very promising results in finding anomalous heart, baseline wander and electron motion artifacts. \n\nIn addition the Authors bring up an extensive set of use cases (missing lead reconstruction, Anomaly detection including QT detection) for their system and compare their algorithm to state of the art solutions, GAN and  Adversarial auto encoder.", "questions": "Look above.", "limitations": "As this is a proof of concept rather than a clinical tool, the Authors have addressed the addressed the limitations in a adequate level.", "rating": 8, "confidence": 5, "soundness": 3, "presentation": 4, "contribution": 3, "strengths": "The Manuscript introduces a capability to produce the morphological features of the heart beat from single lead recordings (e.g. smart watches). \n\nThe combination of conditioned linear Bayesian inverse problem with deep learning (diffusion model) based prior distribution generation bring out good parts in both domains.\n\nPresentation is clear and thorough going meticulously through the implementation of the diffusion model as well as the linear inversion problem. The topics delegated appendices are well selected and informative.", "weaknesses": "In  Table 1 BeatDiff, WGAN and SSDM are compared and it seems that WGAN has fastest inference and smallest models. SSDM seem out of league with huge model size and long latency. \n\nUsually accuracy is improved if the parameter counts are increased, Hence one could expect that a bigger GAN - comparable to BeatDiff in memory  size and latency could achieve the performance level of BeatDiff. Why is it not so in this case?", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "We would like to first thank the reviewer for taking the time to review our work.\n\nRegarding the question formulated in the weakness section, indeed, it is generally accepted that increasing the number of parameters can improve model accuracy. However, in our case, we found that increasing the size of the GAN compared to the WGAN proposed in the literature made the training strategy much more complex. We did not manage to achieve better results with a larger GAN. It is possible that a different architecture and an adapted training procedure could make a larger GAN competitive with BeatDiff, but this was not the main purpose of our work. We plan to explore this avenue in subsequent work.", "claims_and_evidence": "", "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": "", "extra_scores": {}}, {"review_id": "fotbFn42dc", "reviewer": "Reviewer_TuvT", "summary": "This work presents BeatDiff, a lightweight denoising diffusion generative model for multi-lead ECG signal morphology, addressing the complexities of heartbeat analysis due to noise, missing leads, and limited annotated data. It introduces the EM-BeatDiff algorithm, which leverages BeatDiff as a prior within a Bayesian framework to perform conditional generation tasks, enhancing the efficacy of ECG analysis. The combined application of BeatDiff and EM-BeatDiff demonstrates superior performance in noise removal, ECG reconstruction from single leads, and unsupervised anomaly detection compared to existing state-of-the-art methods.", "questions": "Besides the weaknesses, there are some confusing points:\n* In data preprocessing, authors claim that the proposed model is trained on a healthy set. Do the authors use the annotation from the dataset to remove all unhealthy samples?\n* From B1.1, authors use [R −192 ms, R + 512 ms] as the window size. Is there an ablation study exploring the effect of window size?\n* Normally, ECG is 10 seconds following clinical protocol, as shown in the PTBXL and MIMIC-ECG datasets [1][2], but this work uses a single beat. Could the authors explain the reasons?\n\n\n[1] Gow, B., Pollard, T., Nathanson, L. A., Johnson, A., Moody, B., Fernandes, C., Greenbaum, N., Waks, J. W., Eslami, P., Carbonati, T., Chaudhari, A., Herbst, E., Moukheiber, D., Berkowitz, S., Mark, R., & Horng, S. (2023). MIMIC-IV-ECG: Diagnostic Electrocardiogram Matched Subset (version 1.0). PhysioNet. https://doi.org/10.13026/4nqg-sb35. \\\n[2] Wagner, P., Strodthoff, N., Bousseljot, R., Samek, W., & Schaeffter, T. (2022). PTB-XL, a large publicly available electrocardiography dataset (version 1.0.3). PhysioNet. https://doi.org/10.13026/kfzx-aw45.", "limitations": "authors have already mentioned the social impact in the manuscript.", "rating": 4, "confidence": 4, "soundness": 2, "presentation": 2, "contribution": 3, "strengths": "This work proposes an interesting framework for ECG morphology tasks.\n\n* Evaluation on different tasks and datasets.\n* Good attempt at applying diffusion to ECG tasks.", "weaknesses": "Even this work explore an interesting application of diffusion model, and show multiple experimental results. here are still potential improvemnets.\n* Authors reimplement EkGAN, DeScoD, SSSD, WGAN on the PhysioNet Challenge dataset, which differs from the original implementation of these baselines, making fair comparison difficult.\n* There are two common baselines [1] focused on missing lead reconstruction in ECG that are not compared in this work.\n* From line 128, authors claim to preprocess all ECGs from 10-second signals to single beat ECGs, and implement generation tasks on single beat ECGs rather than the original signals, reducing the novelty and applicability.\n* In Table 1, the inference time of the baseline WGAN is \\(3.8 \\times 10^{-2}\\), but the proposed work requires \\(1.6 \\times 10^{2}\\), making it much slower than the baseline, which is inefficient and fails to outperform the baseline.\n\n\n[1] Golany, Tomer, et al. \"12-lead ecg reconstruction via Koopman operators.\" International Conference on Machine Learning. PMLR, 2021.\\\n[2] Chen, Jintai, et al. \"ME-GAN: Learning panoptic electrocardio representations for multi-view ECG synthesis conditioned on heart diseases.\" International Conference on Machine Learning. PMLR, 2022.", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "We thank the reviewer for the feedback and the appreciation of our effort to apply and propose new methods to use diffusion models (DDM) in ECG. We now address the points raised by the reviewer.\n* *Authors reimplement EkGAN, DeScoD, SSSD, WGAN on the PhysioNet...*: We thank the reviewer their comment, we will clarify the following in the supplementary material. The pretrained weights were not available for the baselines or minor adaptation was needed to extend the networks to our case, so we had to retrain the models from scratch on the PhysionNet dataset. Our code and weights are available to ensure reproducibility and fair comparison.\n* *There are two common baselines ...*: [1] and [2] are indeed important contributions to the generative ECG community, and we regret overlooking them in our introduction. We will rectify this oversight. For the numerical comparison, we compare our work with that of Joo et al. (2023) (EkGAN in our paper), which is a more recent work that aligns with [2] as it also uses a GAN to generate 12-lead ECGs from a single lead. Unlike [2], the code for the experiments is available\n* *..to preprocess all ECGs from 10-second signals to single beat...* and *Normally, ECG is 10 seconds ... Could the authors explain the reasons?*:\n  * In this work, we focus on analyzing the morphology of heartbeats, a task that is distinct from the general ECG analysis. While the methods we present for ECG restoration and anomaly detection from partial observations can be applied, it would be necessary to define a new, presumably more complex, DDM and train it on a much larger dataset. This work is very interesting, but it differs from the work carried out in this paper.\n  * However, we want to emphasize that heartbeat analysis is an important aspect which is extremely relevant to all diseases related to the morphology of the ECG (see references [64], [65], [19], [38] in the paper). Other generative models have previously focused on a single beat, such as WGAN. Furthermore, centralizing the data is a common practice in generative models. A well known illustration is the CelebA dataset, one of the most used benchmarks in image generation tasks, where the generative models are always trained in the version of the dataset obtained by first centering all faces.\n  * We have absolutely no doubts about the contribution of the general methodology we present in the context of long ECGs [rather than heartbeats]. However, it is quite clear that a special study should be carried out to build a relevant DDM on the one hand, and to adapt the parameters of EMBeat-Diff to this new context on the other.\nLarger models allow smaller batches for parallel evaluation and thus a smaller number of maximum particles that can be used in the particle filter. However, since the distribution is more complex, we need a larger number of particles at the same time to achieve reasonable posterior sampling.\n  * We have nevertheless provided a proof of concept in those lines. We trained a DDM to produce 5-second slices instead of 10 seconds due to time and GPU constraints. We then applied \"EMBeat-diff\" to reconstruct 12-lead ECGs from limb leads only and I, II, III + V2 + V4 (similar to the Kardia12L mentioned by reviewer UDMo). We found that the reconstruction of the 12 leads becomes more complex when we use multi-beat ECGs, and we also need precordial leads to generate reasonable ECGs (see attached figure). We will include an improved version of this new experiment in the supplementary material to demonstrate that the inference methods we presented also apply to the analysis of 10-second segments, even though this was not the immediate aim of our study.\n* *In Table 1, the inference time of the baseline WGAN is ...*: It is well known that DDM are slower than GAN models, as they require more than one neural function evaluation (NFE). The great value of DDMs is that one can make a trade-off between quality and inference time and thereby achieve better sample quality than some state-of-the-art GAN models, as is the case in the field of computer vision [5]. In our work, we show that this is also the case for the heartbeat morphology generation of the ECG. We show that the proposed DDM outperforms WGAN in equalising a dataset (Table 1) and that it achieves a lower Earth Mover's Distance (EMD) even when performing relatively few NFEs (Figure 1).\nFurthermore, DDMs are easier to train and show better theoretical convergence results. GANs, on the other hand, are notoriously difficult to train and suffer from mode collapse.\nWe would also like to point out that the WGAN has a small number of parameters. Although in principle it should be possible to obtain a better GAN network with a larger number of parameters, we consider the development of a more efficient GAN network to be outside the scope of the present work.\n* *In data preprocessing, authors claim ...*:We used the annotation from the dataset to select patients with the labels \"NSR\" (normal sinus rhythm), \"ST\" (sinus tachycardia) and \"SA\" (sinus arrhythmia). Thank you for pointing this out, we add a sentence in the appendix B.1.1.\n* *From B1.1, authors use [R -192 ms, R + 512 ms] ...*: Thank you for your question. We chose the window [R-192ms, R+512ms] for single beat analysis because a normal PR interval is between 120ms and 200ms (see [3]), and a normal QT interval is less than 450ms (see [4]). Anything outside this interval should not correspond to cardiac activity during a normal heartbeat.\nAdditionally, the 5s ECG experiment can be considered an ablation study of the window size. It shows that reconstructing 12 leads from 5s crops is more complex and requires precordial leads for reasonable results. We will include this discussion on the choice of the window in the supplementary material.", "claims_and_evidence": "", "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": "", "extra_scores": {}}]

Author rebuttal:
We thank the reviewers for taking the time to give their much valued feedback to our work. We believe that the reviews and the discussion will contribute to improve the clarity of our work. We thank the reviewers for pointing out the interest, elegance and applicability of our approach. We have addressed the suggestion and questions from each reviewer individually in their dedicated rebuttal section and precised the additions that we will make in the revised version of our work.

We provide a support pdf containing figures that support the claims made in the rebuttal for the reviewers UDMo and TuvT.

Meta-review: We thank the authors for their submission.  Reviewers agreed that this work was an adept application of DDMs to ECG traces with an effective extension for conditional generation.  Further, the authors provide a thorough empirical study and comparison with appropriate baseline techniques regarding the various ECG-related tasks.

Reviewers were also quite interested if this approach could generate realistic and useful samples that were more than just a single beat --- e.g., an entire 10-second recording.  Inclusion of the longer ECG experiment mentioned in the author rebuttal will make this submission more compelling.
Decision: Accept (poster)