Leveraging an ECG Beat Diffusion Model for Morphological Reconstruction from Indirect Signals

Authors: lisa  bedin
ecole  polytechnique
josselin  duchateau
remi  dubois
eric  moulines
Venue: NeurIPS_cc_2024_Conference
Published: 2024-05-14 11:55:54

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.

Main paper: 
 introduction: 
 Electrocardiograms (ECG) are essential tools for diagnosing cardiac conditions. Two main types of diagnostics can be obtained from an ECG signal: rhythm-based and morphology-based. Rhythmbased diagnostics focus on the frequency and regularity of heartbeats, while morphology-based diagnostics focus on the shape and amplitude of the various waves and segments of the ECG signal; see [40] . Many critical cardiac conditions can be diagnosed by analyzing the morphology of the different phases of a single beat ( [66, 67, 20, 39] ). For example, an increase in the ST segment suggests a myocardial infarction ( [93] ), while a long QT syndrome is associated with an increased risk of sudden death ( [92] ). 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; see e.g., [30, 99, 79, 23, 104, 100, 3] . We focus in this paper on the morphology of a single heartbeat.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-which can indicate Arrhythmogenic Right Ventricula Dysplasia-might only appear on one or two precordial leads ( [102] ). Furthermore, the specific precordial lead in which a disease is detected has an important diagnostic value about the disease location in the heart ( [52] ).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., [101, 47, 14, 56] 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 disease-specific aspects. Therefore, methods that can accurately reconstruct 12-lead ECGs from partial observations are central to analysing the morphology of heartbeats. 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 ( [87, 38, 21] ). The observation vector is an affine transformation of the signal of interest, which is 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-posed (in the missing lead case, the affine function is 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 in 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, 98] ). Many techniques have been recently proposed. We focus here on MCGDiff ( [13] ), 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 a 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 as a prior to 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 (e.g., noise level estimation, noise and artifact model, etc.), leading to a new fullfledged algorithm for conditional ECG generation, called EM-BeatDiff. • We demonstrate the effectiveness of our approach by comparing it to state-of-the-art methods.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.Related works: The use of generative models ( [50, 51, 33] ) as informative priors in solving Bayesian inverse problems has attracted significant interest ([4, 96, 88, 42, 77, 103, 74] ). In particular, DDMs have been demonstrated as a particularly suitable choice of prior for solving inverse problems ( [83, 17, 85, 45, 46] ). DDMs are generative models that transform a simple reference distribution into the training data distribution through a denoising process called denoising diffusion. These models are 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, 83, 84, 9] ). 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 a series of theoretical guarantees in realistic scenarios.Generative modeling, denoising methods, and automatic anomaly detection algorithms are commonly used for ECG analysis. In particular, DDMs have been demonstrated to be capable of generating realistic ECGs: [2] focuses on generating a single healthy beat for a single ECG lead, [3] generates a 10-second period conditioned on various complementary ECG information. Additionally, numerous methods address the denoising problem in ECGs; see e.g., [79, 56, 15] . Classical approaches like Dower matrices ( [59] ) are used to reconstruct missing leads in ECGs. [97, 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 a single pretrained model.2 BeatDiff -a 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 varianceexploding (VE) framework ( [86] ). In the forward path an initial state X 0 is sampled from the data distribution q data and independent Gaussian noise with zero-mean and increasing variance is added to generate subsequent statesX k = X k-1 + ρ k ε k , where k ∈ N * , ρ k > 0, and ε k ∼ N (0, I). The joint p.d.f. of the Markov chain is q 0:K (x 0:K ) = q data (x 0 ) K k=1 q k (x k |x k-1 ), where q k (•|x k-1 ) = N (x k-1 , ρ 2 k I) and K ∈ N * . The conditional distribution of X k given X s with k > s ≥ 0 is given by q k|s (•|x s ) = N (x s , (υ 2 k -υ 2 s ) I) with υ 2 k = k j=1 ρ 2 j (and υ 2 0 = 0). The number of forward steps K is chosen such that υ 2 K = υ 2max is far larger than the variance of q data . With such choice, q K|0 (•|x 0 ) is close to the reference distribution q ref = N (0, υ 2 max I). We learn for each state X k a denoiser D φ 0|k with parameters φ trained to minimize L D (φ) := K k=1 γ 2 k E X0∼q data ,ϵ∼N (0,I) î ∥D φ 0|k (X 0 + υ k ϵ, υ k ) -X 0 ∥ 2 ó, where {γ k } k∈[1:K] is a sequence of appropriately defined positive weights. We denote the result of this minimization as φ * . In the backward path, we samplex K ∼ q ref and for k = K to k = 2 we sample x k-1 given x k with p k-1|k (x k-1 |x k ) = N Ä x k-1 ; µ k-1 (x k , D φ * 0|k (x k , υ k )), η 2 k-1 I d ä where the variances are hyperparameters η = {η k } k∈N satisfying η 2 k ≤ υ 2 k and µ k-1 (x k , x 0 ) := x 0 +(υ 2 k-1 /υ 2 k -η 2 k-1 /υ 2 k ) 1/2 (x k -x 0 ). Finally, we sample x 0 ∼ p 0 (•|x 1 ) := N (D φ * 0|1 (x 1 , υ 1 ), η 2 0 I). To keep the notations simple, we remove in the sequel the dependence in η and φ * . For k ∈ [0 : K -1], we denote by p k (x k ) the marginal distribution of X k :p k (x k ) := q ref (x K ) k+1 s=K p s-1|s (x s-1 |x s )dx k+1:K .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) ([59, Vol 1, Chapter 11] ). Hence, it is standard practice to select either the augmented leads or the limb leads to model the ECG ( [3, 35] ). We exclude the augmented leads and use the leads (I, II, III, V1-6). We denote by L = 9 the number of leads, and by T the maximal heartbeat 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 q data of heartbeats over the retained leads conditionally on the patient characteristics P := (A, S, RR). The denoiser of BeatDiff D φ 0|k takes as input (x, υ k , e P ) where x is the L × T matrix of single heartbeat samples, υ k is the k-th step diffusion variance and e P encodes the patient features. We obtain e P from P = (A, S, RR) by first one-hot-coding the Boolean variable S and then embedding it using a fully connected 2-layer network. For υ k we use the Fourier positional encoding ( [91] ) of log(υ k ) as in [24] . For D φ 0|k we use a modified 1d Unet, the specific details are given in Appendix B.1.4. The model has 10 6 parameters. Compared to [3] , the inference time is 400 times shorter and the memory footprint is 900 times smaller.BeatDiff training We utilize the PhysioNet Challenge dataset ( [31, 68, 69] ), comprising 43,101 12-lead ECGs. The 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 L = 9 (I, II, III, V1-V6). See Appendix B.1.1 for details. Each patient (and the entirety of its recordings) is attributed to one of the three datasets: Training, Cross-validation (CV) or Test. During training, a batch of size b 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 D φ 0|k is trained to minimize L D using the Adam optimizer ( [49] ) with a batch-size 2 10 on the healthy training set, and the best model in terms of L D over the cross-validation set is retained. See Appendix B.1.4 for details.Our preprocessing follows:• Align the recording-frequency 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 [11] .  
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] (see also [89, 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 ϕ 0 (x 0 ) := g 0 (x 0 )p 0 (x 0 )/Z, where g 0 is a nonnegative potential function, p 0 , the marginal of the diffusion model at time 0, and Z := g 0 (x)p 0 (x)dx is the normalizing constant. For example, in a Bayesian setting, g 0 is the likelihood function (the conditional distribution of the observation given the current value of the state x 0 ) and p 0 (x 0 ) is the prior distribution of the state. In such case, ϕ 0 (x 0 ) is the posterior distribution of the state x 0 given the current observation. A simple idea for sampling the posterior ϕ 0 (x 0 ) is to use sampling importance resampling (SIR, [72] ), where p 0 is used as the instrumental distribution. However, this method may be inefficient since the instrumental distribution neglects the potential g 0 .We define a distribution over the path spaceϕ 0:K (x 0:K ) := Z -1 g 0 (x 0 ) K k=1 p k-1|k (x k-1 |x k )q ref (x K ).In [13] , a sequence of positive intermediate potentials {g k } k∈[1:K] with g K ≡ 1 was introduced to guide the backward Markov chain to regions where the potential g 0 is large. The path space distributions may be equivalently rewritten asEQUATIONwhere, for k ∈[1 : K], pk-1|k (•|x k ) := g k-1 (•)p k-1|k (•|x k )/Z k (x k ), and Z k (x k ) := g k-1 (x ′ )p k-1|k (x ′ |x k )dx, and ω k (x k ) := Z k (x k )/g k (x k ).We implicitly assume that these formulas have a closed form. Sampling according to (3.1) passes through the intermediate distribu-tions ϕ k (x k ) := q ref (x K ) K s=k+1 ω s (x s )p s-1|s (x s-1 |x s )dx k+1:K for each k ∈ [1 : K], which verifies ϕ k-1 (x k-1 ) ∝ g k-1 (x k-1 )p k-1 (x k-1 ) ∝ ω k (x)p k-1|k (x k-1 |x)ϕ k (x)dx . (3.2)Each ϕ k-1 thus has the same structure as ϕ 0 : a product of a potential function and the marginal law at time k -1 of the backward diffusion.It remains to approximate this sequence of distributions. For this purpose, we use Sequential Monte Carlo (SMC); see [25, 16] . Suppose that we have at iteration k a particle approximationϕ M k = M -1 M j=1 δ ξ j k of ϕ k through a set of M ∈ N >0 particles ξ 1:M k , initialized with ξ 1:M K ∼ q ×M ref . Plugging this approximation into Equation (3.2) gives ϕ • k-1 ∝ M j=1 ω k (ξ j k )p k-1|k (•|ξ j k ) .Hence, to obtain ξ 1:M k-1 , we first sample M ancestors according toI 1:M k-1 ∼ Cat {ω k (ξ j k )/ M i=1 ω k (ξ i k )} M j=1×M , then we sample new particlesξ 1:M k-1 ∼ {p k-1|k (•|ξ I j k-1 k )} M j=1 , leading to ϕ M k-1 = M -1 M j=1 δ ξ j k-1. Algorithm is given in Appendix A.1.1.We assume that the d y × 1 vector of observations Y (noisy/partial heartbeat) is given byY = A θ X 0 + b θ + D θ ϵ, ϵ ∼ N (0, I), X 0 ∼ p 0 (3.3)where A θ is a d y × d x matrix (for selecting the lead/time observed indices), b θ is a d y × 1 vector (modeling hearbeat artifacts; e.g., baseline wander, electrode motion), D θ is a d y × d y invertible matrix (the variance of the noise), and θ ∈ Θ is a vector of unknown parameters. Define by g θ,y 0 (x 0 ) the likelihood of the observation, given by g θ,y 0 (x 0 ) := N (y; A θ x + b θ , D θ D ⊤ θ ). Given an observation y and a value of the parameter θ, we may sample X 0 from the posterior X 0 |y, θ, with p.d.f. ϕ θ,y 0 (x 0 ) = p 0 (x 0 )g θ,y 0 (x 0 )/Z θ,y , Z θ,y = g θ,y 0 (x)p 0 (x)dx is the normalizing constant. We use MCGDiff with the intermediate potentials {g θ,y k } k∈[0:K] defined asEQUATIONwhere the sequence of covariance matrices Σ k,θ are specified in Appendix A.2.1. For this choice of potentials, pθ,y k-1|k and ω θ,y k admit closed forms given in Appendix A.2.2. MCGDiff allows to sample X 0 |y, θ for a known parameter θ. When θ is unknown, we maximize the penalized marginal log-likelihoodθ * = argmax θ∈R d (l(θ) + Pen(θ)) , l(θ) := log Z θ,y = log g y,θ 0 (x)p 0 (x)dx (3.5)where Pen(θ) is a penalty. The best-known method for optimizing the marginal log-likelihood (3.5) is the expectation maximization algorithm (EM); see [61] . The EM iterates between two main steps: expectation (E) and maximization (M). Starting from an initial guess θ 0 , the EM algorithm alternates between: (E) compute the surrogate function Q(θ; θ i ) := log g y,θ 0 (x 0 )ϕ θi,y 0 (x 0 )dx 0 ; and (M) solve for θ i+1 := arg max θ∈Θ Q(θ; θ i ) + Pen(θ). Under general conditions, the sequence of parameter estimates (θ i ) i∈N converges to a stationary point θ * of the marginal penalized likelihood; see [61, Chapter 3] . In this setting, the E-step is untractable; we approximate the surrogate function in the (E) step using MCGDiff with the current parameter θ i and the sequence of intermediate potentials defined in (3.4) . Such scheme becomes a specific instance of the Monte Carlo EM algorithm (MCEM), initially introduced in [95] and further analyzed in [54, 26, 53] .The EM-BeatDiff 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 are gathered in a matrix Y of size L × T -where L is the number of observed leads and T the number of observed samples on each lead. The state we are attempting to reconstruct is a matrix of size L × T . The observation equation takes the formY = A θ X 0 Āθ + B θ + D θ ϵ Dθ ,where (A θ , D θ ) and ( Āθ , Dθ ) are L × L and T × T matrices, B θ is a L × T matrix, and ϵ is a L × T matrix with i.i.d. standard Gaussian entries. The model (3.3) is obtained by applying the vectorization operator to Y. The full algorithm is detailed in Appendix A.3. Note that EM-BeatDiff is also applicable to "standard" ECG signals and could be used in combination with the ECG generative model of [3] , for example.Question: For each theoretical result, does the paper provide the full set of assumptions and a complete (and correct) proof?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, confidence intervals, or statistical significance tests, at 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. 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 no 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 or No, they should explain why their work has no societal impact or 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 a direct path to any negative applications, the authors should point it out. For example, it is legitimate to point out that an 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 to 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). 
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. 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 figure 1 show that a few diffusion steps are sufficient to generate an accurate prediction distribution, with BeatDiff performing better than [1] in replicating the real data distribution. In Appendix B.6.1 we present a third evaluation of the generated ECGs' quality using the out-of-distribution score proposed in [18] .SSDM [3] 39 × 10 3 7.5 × 10 4 76 ± 0 69 ± 1 77 ± 1 74 ± 0 64 ± 0 71 ± 1 WGAN [1] 27 3.8 × 10 -2 76 ± 0 69 ± 1 77 ± 1 74 ± 0 64 ± 1 72 ± 1 BeatDiff 42 1.6 × 10 2 78 ± 0 73 ± 1 79 ± 1 77 ± 1 72 ± 1 76 ± 1 Unbalanced - - 76 ± 0 69 ± 1 74 ± 3 74 ± 1 64 ± 1 70 ± 3 Balanced - - 82 ± 0 81 ± 0 86 ± 1 82 ± 0 81 ± 0 86 ± 1Prediction of Corrected QT: Both the EMD and Classifier Enhancement tasks are concerned with how different the generated ECGs are from the ECGs in the dataset. We are now focusing on the question "Is the algorithm able to correctly capture underlying physiological mechanism?". To do so, we evaluate EM-BeatDiff on the prediction of corrected QT, which is an important clinical indicator obtained from the ECG; see [7] .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 is 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 are known to prolong the QT interval; see [58] .We use EM-BeatDiff to generate the T-Wave from a given patient QRS complex (the sequence of waves (Q, R, 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 in figure 2 . The configuration of the related inverse problem is given in Table 2 under the name QT. Table 2 : Configurations used for EM-BeatDiff for each task.Task ( L, T ) θ Aθ Āθ Bθ Dθ Dθ QT (L, 70) σ1:L IL×L I T × T 0 L, T diag(σ1:L) I T × T AR (L, T ) (σ1:L, ϑ1:K,1:L) IL×L IT ×T (4.1) diag(σ1:L) IT ×T ML (SW) (1, T ) σ IL ×L IT ×T 0L ,T σ IL ×L IT ×T ML (V1-6) (3, T ) σ 1: L IL ×L IT ×T 0L ,T diag(σ 1: L) I L×L IT ×T AD (MI) (3, T ) (σ 1: L, ϑ 1:K,1: L) IL ×L IT ×T (4.1) diag(σ 1: L) I L×L IT ×T AD (LAE) (3, T ) (σ 1: L, ϑ 1:K,1: L) IL ×L IT ×T (4.1) diag(σ 1: L) I L×L IT ×T AD (LAD) (L, 106) σ1:L IL×L 0 T ,T -T ; I T × T T (4.1) diag(σ1:L) I L×L I T × T AD (LQT) (L, 70) σ1:L IL×L IT ×T 0 L, T diag(σ1:L) IL×L I T × TTo evaluate this, we rely on well-known empirical formulas from [7, 27, 73] . These formulas introduce coefficients called "corrected QT" denoted as QT c 0 and QT c 1 , which depend on the patient and are determined from ECGs measured during stress test. We regress the intercept QT c 0 and slope QT c 1 of the Fridericia formula from [27] , which states that QT = QT c 0 + QT c 1 3 √ RR, from the generated curves. As shown in figure 2 , we observe a consistent trend between the observed and regressed curves for four patients. Additionally, Table 10 indicates a high R 2 -score of 0.98 between observed and expected QT curves in the test set. EM-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-also a low-frequency artifact caused by bad electrode contact-have been proposed so far, most often based on adaptive filter, time-frequency (and most notably empirical mode decomposition) and time-scale decomposition; see [22, 94, 101, 55, 14] and the references therein. We use in this experiment a sparse representation of the artifacts in 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 a given L ∈ {1, L} andEQUATIONwith {c j } J j=1 be a known set of functions (such as B-splines, a Fourier or a wavelet basis). We choose a Fourier basis in the experiments as expressed in Equation (B.1). The other parameters are given in Table 2 under the name AR.We therefore remove the artifacts by subtracting a vector assumed to have a sparse representation on an appropriate basis. We use the sparse group LASSO penalty defined asPen(θ) = λ 1 J j=1 Ä L ℓ=1 (ϑ j,ℓ ) 2 ä 1/2 + λ 2 J j=1 L ℓ=1 |ϑ j,ℓ | (4.2)which leads to parsimony at both the group and individual levels, in order to promote the selection of the same functions (e.g. Fourier frequency) over all the leads; see [28, 78] . The first term promotes 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 a 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 a 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., [82, 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 , EM-BeatDiff outperforms EkGAN ( [41] ), a 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.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 (LAE), and Long QT syndrome (LQT). These anomalies were selected due to their typical association with localized alterations in P-Wave, QRS, or T-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 P-wave.For each conditioning type and medical condition, we generate samples from the posterior distribution using EM-BeatDiff. Th anomaly score is the 1 -R 2 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 are presented in Table 2 , designated as AD followed by the respective medical condition name. Table 5 shows that EM-BeatDiff outperforms AAE ( [76] ), which uses as anomaly score the MSE between the output of an Adversarial Auto Encoder and the input ECG, according to the AUC of the anomaly score. See Appendix B.3.5 for implementation details. A key advantage of the aforementioned approach is its ability to function in an interactive manner, unlike methods that rely on training on a specific setting. By simply selecting a different set of ECG leads for conditioning, the posterior can be regenerated in a near-online fashion following visual assessment of the posterior and the patient ECGs as in the MI case in Figure 3 . 
conclusion: 
 In this work, we have described a 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 as Bayesian linear inverse problems. Our method utilises BeatDiff a DDM pre-trained to generate the heartbeat morphology on 12 leads, as a prior for sampling solutions to 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 or 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 4 . We show that EM-BeatDiff can also be used to classify abnormal heartbeats in an unsupervised manner: 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 Tables 11 and 12 . 
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 in a clinical environment, a prior impact assessment and clinical trial must be conducted. This notably includes verifying performance on other datasets that better represent patient characteristics, as well as conditioning all the hyperparameters chosen in this study on this dataset. 
acknowledgment: 
 This work was supported by the French National Research Agency (ANR-10-IAHU04-LIRYC). We would like to thank PNY Technology for the computing power made available to us for this study. The work of LB and GC has been partly funded by the European Union (ERC-2022-SYG-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. 
safeguards: 
 Question: Does the paper describe safeguards that have been put in place for responsible release of data or models that have a high risk for misuse (e.g., pretrained language models, image generators, or scraped datasets)? 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 a 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.• 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 a 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 (e.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, paperswithcode.com/datasets has curated licenses for some datasets. Their licensing guide can help determine the license of a dataset. • For existing datasets that are re-packaged, both the original license and the license of the derived asset (if it has changed) should be 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 to work to 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 of the dataset/code/model 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 is used. • At submission time, remember to anonymize your assets (if applicable). You can either create an anonymized URL or include an anonymized zip file. 
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 as 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 contribution of the paper involves human subjects, then as much detail as possible should be included in the main paper. • According to 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. 
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? 
 
 Appendix: We would like to point out that this anomaly detection tool is semi-whitebox: 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, but a 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 a 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 Kardia12L * . We found that reconstructing 12 leads from multi-beat ECGs is more complex and requires precordial leads for reasonable results (see figure 11 ). A special study is needed to build a relevant diffusion model and adapt the algorithm's parameters in 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.Arrhythmic data Testing EM-BeatDiff's ability to reconstruct arrhythmic ECGs is valuable as it 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 a reasonable 12-lead ECG from limbs + V2 + V4 (Kardia12L setting) (see figure 12 ). A larger AF dataset would yield more interesting results, but this experiment shows EM-BeatDiff's potential for generating rhythmic abnormalities.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 a 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 to 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 if they significantly alter the ECG phase. Indeed, one could detect PVCs using available methods such as [12] and remove them from inference.In this section we first provide the SMC algorithm 1.Input: observation y, number of diffusion steps K, number of particles MOperations involving index i are repeated for i ∈ [1 : M ] Initialization:ξ i K ∼ q ref for k = K -1 to 0 do I i k ∼ Cat {ω k (ξ j k+1 )/ M i=1 ω k (ξ i k+1 )} M j=1 ξ i k ∼ py k (•|ξ I i k k+1 ) end for Output: ξ 1:M 0 A.2 MCGDiffSimplified setting Following [13, Section 2.1], we first give explicitly the potentials for the simplified caseY = V T X + σ y S -1 ε , ε ∼ N (0, I dy ) , (A.1)where V ∈ R dx×dy is an orthonormal matrices and S ∈ R dy×dy is diagonal. For i ∈ [1 : d y ], we define τ i := min{k ∈ [1 : K]|υ k > σ y /s i } where s i is the i-th element of the diagonal matrix S. τ i is defined such that the i-th coordinate of Y , Y[i] and the i-th coordinate of V T X τi 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 k ∈ [1 : K], R k ∈ R dy×dy a diagonal matrix with valuesR k [i, i] = ® (υ 2 k -υ 2 τi ) 1/2 if k > τ i , σ y /s i if k ≤ τ i .We can finally define the MCGDiff potentials when the measurement models are of the type A.1. Fork ∈ [1 : K], define g y l (x) := N (y; Vx, R k R T k ) . Note that if k < min{τ i |i ∈ [1 : d y ]}, then g y k (x) = g y 0 (x).General A θ and diagonal D θ . Even though A.1 corresponds to a simplified version of 3.3, MCGDiff can also be applied to the case where D θ = σ y I and thusY = A θ X + b θ + σ y εwhere ε ∼ N (0 dy , I dy ) and σ ≥ 0 and the singular value decomposition (SVD)A θ = U θ S θ V θ T ,where V θ ∈ R dx×dy , U θ ∈ R dy×dy are two orthonormal matrices, and S θ ∈ R dy×dy is diagonal.Set b = d x -d y . Multiplying the measurement equation by S -1 θ U T θ and substracting S -1 θ U T θ b θ yields Y := S -1 θ U T θ (Y -b θ ) = V θ X + σ y S -1 θ ε , ε ∼ N (0, I dy ) .Therefore, it is possible to use the potentials defined above which yieldsg θ,y k (x) := N (y; A θ x + b θ , U θ S 2 θ R 2 k,θ U T θ :=Σ k,θ) .Using conjugate formulas we compute the proposal kernel and the weights defined in Section 3 used in SMC algorithmpθ,y k|k+1 (x k |x k+1 ) = g y k (x k )p k|k+1 (x k |x k+1 ) g y k (z)p k|k+1 (z|x k+1 )dz = N Ä x k ; W k,θ ¶ A T θ Σ -1 k,θ (y -b θ ) + υ -2 k µ k (x k+1 , D 0|k (x k+1 )) © , W k,θ ä , ω θ,y k+1 (x k+1 ) = g y k (z)p k|k+1 (z|x k+1 )dz g y k+1 (x k+1 ) = N (y; A θ µ k (x k+1 , D 0|k (x k+1 )) + b θ , Σ k,θ + υ 2 k A θ A T θ ) N (y; A θ x k+1 + b θ , Σ k+1,θ ),where W k,θ := Ä υ -2 k I +A T θ Σ -1 k,θ A θ ä -1 = υ -2 k I +V θ R -2 k,θ V T θ -1.Algorithm 2: MCEM Input: observation y, number of diffusion steps K, number of particles M , regularization parameters (λ 1 , λ 2 ) (4.2), M step optimization parameters (N M , γ), total number of iterations N EM , initial parameters θ 0 .for k = 1 to N EM do ξ t 1:M ← MCGDiff(θ t-1 , K, y, M ) θ t ← M-step(θ t-1 , ξ t 1:M , (λ 1 , λ 2 ), N M , γ, y) (Algorithm 3) end for Output: ξ 1:M 0 Algorithm 3: M-step (implemented using [10] )Input: initial parameter θ, particles ξ 1:M , regularization parameters (λ 1 , λ 2 ), number of gradient steps N M , learning rate γ, observation y. for k = 1 to N M do θ ← Prox λ1∥.∥1+λ2∥.∥2 (θ + γ∇F (θ; ξ 1:M , y)) (see Equation (A.2) for definition of F ) end for Output: θ In algorithm 3, F is the empirical error defined as follow for parmater θ when provided observation y and particles ξ 1:MF (θ; ξ 1:M , y) = 1 M M i=1 ∥A θ ξ i Āθ + B θ + D θ ϵ Dθ -y∥ 2 2 . (A.2) B Numerical appendix B.1 BeatDiff B.1.For ECG generation in Section 4 we follow the scheduling prposed by [44] which consists of, for a total number of backward steps K ∈ [1 : K], defining for t ∈ [1 : K]υ t = ï υ 1/ρ K + t K Ä υ 1/ρ 1 -υ 1/ρ K ä ò ρThroughout our experiments, we used ρ = 5.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 {υ k } K k=1 . We denote those different instances of the same network as {D θ 0|k } K k=1 . We describe below the different adaptations that we used for the specific case of the ECG. We start by describing how we 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 [44] of the F θ and finally we describe precisely the structure of the denoising network.As explained in Section 2, we use the P = (A, S, RR) as a conditioning variable for D 0|k . We encode the sex S as a boolean feature S. For the numerical features, we choose the following normalization: Ã = (A -50)/50, › RR = (RR -500)/500 .This values are chosen so that Ã = 0 for a 50 year old patient and RR = 0 if the patient heart rate is of 120 bpm. The resulting vector obtained by concatenating S, Ã, › RR is fed into a two-layer dense network, yielding a 192 × 1 vector called ẽP . The final embedding is obtained by passing ẽP through one MLP with SiLu activation and 2 × 192 neurons and a second linear layer projecting back to R 192 . This procedure leads to an embedding vector e P .We are interested in generating a fixed ECG beat. Therefore, the time wise position (t ∈ [1 : T ]) of each event is important to 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 t < 50 we observe the P-wave, for t ∈ [50 : 100] we should observe the QRS-wave and for t > 100 we should observe the T-Wave. 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 t = 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 c ∈ N and maximum sequence length T ∈ N, Positional encoding generates, for each sequence time t ∈[1 : T ] a PosEnc(t) ∈ R c by PosEnc(t)[l] = ® sin(1000 -(2r/c) t) if ℓ = 2r , cos(1000 -(2r/c) t) if ℓ = 2r + 1 .For the time embedding, we set c = 192 and we obtain a vector e T = (PosEnc(1),• • • , PosEnc(T )) ∈ R T ×192 .Noise level conditioning (e υ k ): For encoding the noise level, we follow [24] and used also Positional encoding to generate a first embedding ẽυ k = PosEnc(4 -1 log(υ k )) ∈ R 192 . The final embedding is obtained by passing ẽυ k through one MLP with SiLu activation and 2 × 192 neurons and a second linear layer projecting back to R 192 . This procedure leads to an embedding vector e υ k .Final conditioning vector (e cond ): We combine (e P , e T , e υ k ) into a single matrix e cond ∈ R T ×192 by broadcasting (repeating across the first dimension) e P and e υ k into (T , 192) matrices and then defining e cond := SiLu(e P + e T + e υ k ) Denoising network design: We use the definition of the Denoising network used in [24] and which is called the F net decomposition in [44] :D θ 0|k (x, υ k , e cond ) = c skip (υ k )x + c out (υ k ) F θ (c in (υ k )x, e cond ) .where x is a 9 × 176 matrix corresponding to the noisy ECG beat,c in (υ k ) = (υ 2 k + σ 2 data ) -1/2 , c skip (υ k ) = (υ 2 k + σ 2 data ) -1 σ 2 data , c out (υ k ) = υ k σ data (υ 2 k + σ 2 data ) -1/2, and σ data is the (estimated) empirical standard deviation of q data . The key idea of this decomposition is that what is expected of the neural network is different for small υ k and large υ k .For small υ k , c skip (υ k ) ≈ 1 and c out (υ k ) ≈ 0, thus D θ 0|k (x, υ k , e cond ) ≈ x, which is expected since x is already a good reconstruction of the original data. On the contrary, when υ k is large, then c skip (υ k ) ≈ 0 and c out ≈ 1, thus D θ 0|k (x, υ k , e cond ) relies heavily on the network F θ to provide a good reconstruction.The input scaling c in (υ k ) = (υ 2 k + σ 2 data ) -1/2 is introduced so that c in (υ k )x has always the same standard deviation. As x is a realization of X k ∼ X 0 + υ k ϵ k with ϵ k ∼ N (0, I), X 0 ∼ q data and σ data is and approximation of the standard deviation of q data , we expect c in (υ k )X k to have an standard deviation of approximately 1.F θ architecture The F θ is an evolution of the UNet firstly introduced in [71] and we follow the one proposed by [24] . We illustrate the general architecture of our F θ of depth 2 in figure 5 . 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.The Decoder block consist of a GroupNorm layer, followed by SiLu activation and finally a 1d Convolutional layer with kernel size 3 and padding and stride 1, with 9 kernels. UNet block: The terms in figure 6 describing the UNet with parameters (Up, Down, d out , Attention, n heads ) block corresponds to:• Conv(k, p, s) means a 1d-convolutional layer with kernel size k, padding p and strides s,• ConvT (k, s) means a 1d transposed convolutional layer with kernel size k and stride s using the padding configuration "Same".The number of output channels for the convolution layers are always d out . From UNet blocks, we can construct The final configuration retained for BeatDiff is given in Table 7 . In Appendix B.1.5 we tested running a 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 θ 0|k is trained to minimize L D through stochastic gradient descent on the healthy training set, and the best model is selected using the cross-validation set. We also use exponential moving average of the network parameters with coefficient 0.9999.For the (forward diffusion) we used the following parameters:• σ min = 2 × 10 -4 ,• σ max = 80,• σ data = 0.5,• Importance law of σ for training: Log N (-1.2, 1.2 2 I).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 8 . We find that conditioning over A, S, RR leads to smaller EMD. No substantial improvements were observed when utilizing a deeper network.As the number of particles, denoted as M , increases, we observe a corresponding decrease in the discrepancy between the target posterior distribution and the distribution of particles generated by algorithm 1. 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 a patient from the test dataset and used algorithm 1 to generate 10 3 samples with a high particle count of M = 10 4 . We consider these samples as our reference representing the target posterior distribution. We then generated 10 3 samples with algorithm 1 for different values of M and calculated the Earth Mover's Distance (EMD) relative to the reference samples. This process helps us to evaluate the convergence of the distribution generated by the algorithm to the posterior as M varies. Figure 7 illustrates the relationship between M and the EMD. From this analysis, M = 50 provides an effective equilibrium that provides a reasonable approximation to the posterior distribution while ensuring manageable inference times. Choice of artifact basis: We choose the following Fourier basis for removing baseline wander and electrode motion.EQUATIONwhere J = 200 is the number of Fourier function is the basis, f s = 250Hz is the sampling frequency, f a min = 0Hz and f a max = 1Hz is the typical range of frequency of baseline wander and electrode motion artifact.Regularization parameters: In Table 9 we display the parameters used in the EM algorithm inside EM-BeatDiff. (N M , γ) indicates the number of gradient steps and the learning rate used in the M-step of the EM algorithm algorithm 2. N EM indicates the total number of EM steps used and N M the number of iterations per M step. In this section, we provide implementation details of the adaptations that were needed to test the existing baselines to the problem in hand.In [1] , the WGAN is conditioned on 15 categorical heart disease labels. These labels are embedded into a vector of size 100 and concatenated with the latent variable before being inputted into the generator. They are also embedded into a 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 a 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, S, RR)), in order to compare the results obtained with our DDM and the WGAN, we instead use a multi-layer perceptron (MLP) with the following architecture: a linear layer from 4 to 864, a 1D normalization layer, LeakyReLU, and a linear layer from 864 to 64. This MLP maps the 4-size feature vector ( Ã, S, RR) to a 64-vector, which is then used in the same way as the embedding was in the original paper.We adapt the approach described in [3] . We first used the same training procedure to train a network on the same training set as ours. We added conditioning on Sex and changed the sampling frequency from 100hz to 250hz to match ours. To compare with our approach, we generate a 10s according to patient characteristics and using the NSR label from the Physionet dataset. We then use the procedure described in Appendix B.1.1 to extract heartbeats from generated ECG. For all the generation done with SSSD, we use a DDIM [83] schedule with 100 steps and η = 0.01.The model proposed in [56] is trained to denoise the beats from the PhysioNet training set, to which noise from the MIH dataset was added. The provided code † was modified to train the model on 9-lead ECGs instead of 1-lead ECGs. The 9-lead preprocessed PhysioNet training set, as described in Appendix B.1.1, 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, 20] . 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.We train the model proposed in [41] to reconstruct I,II,III, V1-6 leads from I (with lr=0.0001 for 100 epochs and then applied weight decay of 0.95 per epoch). For all the inpainting experiments we normalize the ECGs by the max absolute value.The model proposed in [76] was trained on the training set described in Appendix B.1.1. The architecture of the model was kept the same, except for the input channels, which were modified to L = 9 instead of L = 1.The classifier used for the sex classification task is defined below, using the Flax library [36] .class Classifier ( nn . Module ) : """ A simple CNN model . """ n_class : int = 2 @nn . compact def __call__ ( self , All classifiers were executed with a batch size of 4096, Adam optimizer [49] with learning rate of 0.001 for 10 5 steps. All classifiers achieved 100% accuracy on the training set. Networks weights were initialized always using the same seed.Sum of squared deviations (SSD): The sum of squared deviations between two arrays (x, y) ∈ R d × R d is defined asSSD(x, y) = d i=1 (x i -y i ) 2 .The maximum absolute deviation between two arrays(x, y) ∈ R d × R d is defined as MAD(x, y) = max i∈[1:d] |x i -y i | .Cosine distance (Cos.): The cosine distance between two arrays (x, y) ∈ R d × R d is defined as Cos.(x, y) = x T y ∥x∥∥y∥ .B.6.1 Out of distribution (OOD) score [18] To quantify how unlikely each generated ECG is with respect to the training distribution, we used the OOD-score proposed by [18] . Their method involves using a randomly initialized network, which remains unchanged throughout the process, to produce a "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 a training data point should be close (in terms of L2 distance) to the random pattern from the first network. After training the second network, the OOD-score for an 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 8 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-distribution data detection by training on four classes of the CIFAR dataset and verifying that, at test time, the score effectively distinguishes test data with the same classes as the training data from those with different classes. In our case, we adopt the same residual network architectures proposed in [18] , but replace the 2D convolutions with 1D 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. 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 illustrates that training an artifact removal model in a supervised manner is specific to 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 a supervised manner, is more generalizable. 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.NeurIPS Paper Checklist Guidelines:• The answer NA means that the paper has no 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 a separate "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 on the scope of the claims made, e.g., if the approach was only tested on a few datasets or with a few runs. In general, empirical results often depend on implicit assumptions, which should be articulated. • The authors should reflect on the factors that influence the performance of the approach.For example, a facial recognition algorithm may perform poorly when image resolution is low or images are taken in low lighting. Or a 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 of 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 be used by reviewers as grounds for rejection, a worse outcome might be that reviewers discover limitations that aren't acknowledged in the paper. The authors should use their best judgment and recognize that individual actions in favor of transparency play an important role in developing norms that preserve the integrity of the community. Reviewers will be specifically instructed to not penalize honesty concerning limitations.‡ Anonymous code available at https://anonymous.4open.science/r/ecg_inpainting-44A6 


Decision: 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.

Reviews: review: paper_summary: paper_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)
strength_weakness: strength_weakness: • 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.
questions: 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.
Could 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: 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
paper_summary: paper_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.
strength_weakness: strength_weakness: - 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.
- 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.
questions: 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.
- 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.
- 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: 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 
- 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.
paper_summary: paper_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. 

In 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.
strength_weakness: strength_weakness: 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. 

Usually 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?
questions: questions: Look above.
limitations: 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.
paper_summary: paper_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.
strength_weakness: strength_weakness: Even this work explore an interesting application of diffusion model, and show multiple experimental results. here are still potential improvemnets.
* Authors reimplement EkGAN, DeScoD, SSSD, WGAN on the PhysioNet Challenge dataset, which differs from the original implementation of these baselines, making fair comparison difficult.
* There are two common baselines [1] focused on missing lead reconstruction in ECG that are not compared in this work.
* 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.
* 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.


[1] Golany, Tomer, et al. "12-lead ecg reconstruction via Koopman operators." International Conference on Machine Learning. PMLR, 2021.\
[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.
questions: questions: Besides the weaknesses, there are some confusing points:
* 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?
* 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?
* 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?


[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. \
[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: limitations: authors have already mentioned the social impact in the manuscript.

Comments: title: Thank you for the clarifications.
References to rebuttal
comment: I will retain my score.
Thank you for addressing our rebuttal.

As mentioned in our answer to reviewer TuVT, we regret our omission of [1], [2] and will amend this in the final version of the paper. We thank the reviewer for the dataset suggestion.

Regarding your additional question, we do not see any contradiction. Our goal in the anomaly section is to investigate morphological heartbeat anomalies, such as Long QT syndrome (LQT) or Myocardial Infarction (MI), and to develop a white-box tool for detecting these anomalies. We have developed a flexible method based on the reconstruction of 12 leads from a subpart of the ECG, that allows us to generate the healthy counterpart of a heartbeat associated with localized MI or LQT (see Section 4). In addition to outputting an abnormality score, our approach is also able to highlight where the patient’s signal is abnormal, allowing cardiologists to rule out non-relevant abnormalities, thereby limiting the risk of hallucination.
Thank you for addressing our comment.

**Question on evaluation data:**

We would like to clarify that all the data used for evaluation in both the paper and the rebuttal were from real human signals and were not used during training or cross-validation.

**Segmentation of single heartbeats:**

The segmentation of single heartbeats is a common practice in the literature. Many works, including the baselines we analyzed in our paper, such as EkGAN and DeScoD, and more recent papers [1], rely on external tools to segment the common 10-second clinical ECG signal into single heartbeats.

**Generalization to patients with PVC:**

It is true that the literature on PVC detection often evaluates their works on the publicly available MIT-BIH dataset, which contains 22 records. However, it is important to note that these records last 30 minutes and correspond to approximately 3k occurrences of PVC.

Additionally, a more recent study [2], evaluates their method on the Incart dataset, which contains 75 ECGs of 30 minutes, totaling approximately 20k PVCs. This further demonstrates the availability of more robust methods evaluated in substantial datasets.

Moreover, in the article by Strodthoff, Nils et al. cited by the reviewer, it is indicated that "PVC is easily verifiable also for non-cardiologists." Thus, the detection of PVC prior to heartbeat segmentation is reasonable for applying the heartbeat analysis.

**Benchmark Reference:**

The paper by Strodthoff, Nils et al. is very interesting, and we thank the reviewer for bringing it to our attention. However, we do not fully understand how the classification of ECGs according to cardiac conditions relates to our proposed algorithm for morphological analysis of heartbeats, which does not require preliminary classification.

[1] Kim, Y.; Lee, M.; Yoon, J.; Kim, Y.; Min, H.; Cho, H.; Park, J.; Shin, T. Predicting Future Incidences of Cardiac Arrhythmias Using Discrete Heartbeats from Normal Sinus Rhythm ECG Signals via Deep Learning Methods. Diagnostics 2023, 13, 2849.

[2] Cai, Z.; Wang, T.; Shen, Y.; Xing, Y.; Yan, R.; Li, J.; Liu, C. Robust PVC Identification by Fusing Expert System and Deep Learning. Biosensors 2022, 12, 185.
Dear Reviewer sRY5,

We are grateful for your insightful review of our work. Your comments have been invaluable in helping us improve the quality and clarity of our paper. We have carefully considered each of your points and have made a thorough and comprehensive response to address your concerns (here, and in the Main Comment above).

We would like to inquire if you have any further questions regarding our response. Your insights are valuable to us, and we greatly appreciate your attention and feedback!

Sincerely
Dear Reviewer UDMo,

We are grateful for your insightful review of our work. Your comments have been invaluable in helping us improve the quality and clarity of our paper. We have carefully considered each of your points and have made a thorough and comprehensive response to address your concerns (here, and in the Main Comment above).

We would like to inquire if you have any further questions regarding our response. Your insights are valuable to us, and we greatly appreciate your attention and feedback!

Sincerely
For comparison models:

1. Generally, GANs are considered more computationally efficient compared to Diffusion Models.
2. As mentioned, although some models might not directly address the paper’s tasks, a comprehensive literature review is necessary.

Relevant Papers for Generative Models in ECG Reconstruction:

- [1] Golany, Tomer, et al. “12-lead ECG reconstruction via Koopman operators.” International Conference on Machine Learning. PMLR, 2021.
- [2] Jo, Yong-Yeon, et al. “ECGT2T: Towards Synthesizing Twelve-Lead Electrocardiograms from Two Asynchronous Leads.” ICASSP.

Dataset Consideration:
- [1] Gow, B., et al. (2023). MIMIC-IV-ECG: Diagnostic Electrocardiogram Matched Subset (version 1.0). PhysioNet. https://doi.org/10.13026/4nqg-sb35.

Additional Question:
- There seems to be a contradiction: the proposed method is designed to detect abnormal cases, but is it unable to reconstruct 12-lead ECGs for those cases?

I have reviewed it again, but I still intend to maintain my score.
Thanks for the rebuttal.

> Currently, there is no sufficiently large public dataset to train generative models for these conditions.
- **Question on Evaluation Data**: Does this mean all evaluation data is simulated? If true, the performance is not convincing because the performance is evaluated based on human-simulated data, but real heart behavior is too complex to be simulated by only human-designed algorithms.

> The reviewer's argument about heartbeat segmentation is unconvincing. The detection of PVC is a well-established topic...
- **Reference Critique**: From the reference provided by the author, `Murthy, Ivaturi SN, and Mandayam R. Rangaraj. "New concepts for PVC detection." IEEE Transactions on Biomedical Engineering 7 (1979): 409-416.`, it mentions on Page 4, start of Section VII, "ECG recordings of two patients with PVC's were used to test the proposed scheme." Evaluating on two samples is insufficient by current research standards, as most research must be evaluated on large-scale datasets, not just a few samples.
- **Further Reference Analysis**: Another reference, `Mazidi, Mohammad Hadi, Mohammad Eshghi, and Mohammad Reza Raoufy. "Detection of premature ventricular contraction (PVC) using linear and nonlinear techniques: an experimental study." Cluster Computing 23 (2020): 759-774.`, mentions in Section 3.2 that only 23 samples were used to evaluate their method. This is also insufficient to demonstrate that PVC is a well-established topic, as there is no well-defined method that can detect PVC on large-scale datasets.
- **Benchmark Reference**: In the PTB-XL benchmark work, `Strodthoff, Nils, et al. "Deep learning for ECG analysis: Benchmarks and insights from PTB-XL." IEEE Journal of Biomedical and Health Informatics 25.5 (2020): 1519-1528.`, they provide a benchmark on multiple cardiac diseases based on ECG analysis. As shown in their work Fig 4, several diseases have AUC scores definitely lower than 95%, indicating that successfully detecting heart disease before implementing the submission method is not realistic on large-scale datasets.

Since the author cannot address all the issues, I will keep the original score.
We are afraid that the reviewer may have misunderstood the focus of our paper and the rebuttal.

The goal of our paper is not merely the "analysis of single beats", but rather to investigate morphological heartbeat anomalies, such as Long QT syndrome (LQT) or Myocardial Infarction (MI), and to develop a white-box tool for detecting these localized anomalies. For example, LQT is only visible on the QT segment, and MI may only be visible on the precordial leads. Currently, there is no sufficiently large public dataset to train generative models for these conditions. We have developed a flexible method based on the reconstruction of 12 leads from a partial ECG, that allows us to generate the healthy counterpart of a heartbeat associated with localized MI or LQT (see Section 4). In addition to outputting an abnormality score, our approach is also able to highlight where the patient’s signal is abnormal, allowing cardiologists to rule out non-relevant abnormalities, thereby limiting the risk of hallucination.

Moreover, we demonstrate that the proposed approach can be used to solve several important ECG analysis problems, such as baseline wander removal, electrode motion removal, and missing lead reconstruction. We have thoroughly evaluated the proposed technique and compared it with state-of-the-art approaches.

As mentioned in the answer to UDMo’s question "how easily would it be to generate 10s ECG signals" and in the last paragraph of the rebuttal to the current reviewer TuvT, our method can be directly applied to 10-second ECGs. We have done this for healthy ECGs and ECGs with Atrial Fibrillation (see the attached PDF in the rebuttal). Furthermore, it is important to note that applying a 12 lead ECG reconstruction to arrhythmias such as Premature Ventricular Contractions (PVCs) has limited added value beyond visualization, as arrhythmia detection can be done directly by analyzing a single lead, as mentioned below.

The reviewer's argument about heartbeat segmentation is unconvincing. The detection of PVC is a well-established topic, and methods for detecting PVCs have existed since 1979 (Murthy et al., Transactions on Biomedical Engineering, 1979). Today, there are methods with a sensitivity of 99.91% and specificity of 99.37% (Mazidi et al., Cluster Computing, 2020). In fact, devices like AliveCor’s KardiaMobile1L already integrate PVC detection by default. Therefore, it is straightforward to apply our heartbeat analysis to PVCs: one simply needs to detect PVCs prior to studying the heartbeats.

Murthy, Ivaturi SN, and Mandayam R. Rangaraj. "New concepts for PVC detection." IEEE Transactions on Biomedical Engineering 7 (1979): 409-416.

Mazidi, Mohammad Hadi, Mohammad Eshghi, and Mohammad Reza Raoufy. "Detection of premature ventricular contraction (PVC) using linear and nonlinear techniques: an experimental study." Cluster Computing 23 (2020): 759-774.
Thank you for the authors' rebuttal. However, the explanations provided were cursory and unconvincing. For instance, the paper focuses on analyzing single beats rather than 10-second ECG segments. This approach relies heavily on robust external tools to segment the common 10-second clinical ECG signal into single heartbeats, which could limit the generalization of the method. Additionally, certain disease patterns, such as Premature Ventricular Contractions (PVCs), significantly alter the ECG phase, making it difficult to segment single heartbeats accurately.

Overall, I believe that the paper is not sufficiently robust for acceptance at NeurIPS.
[1] Golany, Tomer, et al. "12-lead ecg reconstruction via Koopman operators." International Conference on Machine Learning. PMLR, 2021.

[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.

[3] Douedi S, Douedi H. P wave. [Updated 2023 Jul 24]. In: StatPearls [Internet]. Treasure Island (FL): StatPearls Publishing; 2024 Jan-. Available from: https://www.ncbi.nlm.nih.gov/books/NBK551635/

[4] Goldenberg, I. L. A. N., Arthur J. Moss, and Wojciech Zareba. "QT interval: how to measure it and what is “normal”." Journal of cardiovascular electrophysiology 17.3 (2006).

[5] Song, Yang, and Stefano Ermon. "Generative modeling by estimating gradients of the data distribution." Advances in neural information processing systems 32 (2019).