## 2 Materials and Methods
### Workflow for Predicting Cardiovascular Diseases
#### 2.2.3 Resampling Techniques for Imbalance Learning  
Most ML algorithms work reasonably well when the number of training samples in the different classes is almost equal (balanced dataset) [49]. Nevertheless, in real-world scenarios, it is common that the distribution of training samples for each class is skewed. This hampers the application of ML algorithms since the learning process can be monopolized by samples of the majority class, impacting the generalization and performance of the classifiers [49]. To address this, class balancing strategies, which include oversampling, undersampling, and a hybrid approach are used to modify the class distribution of imbalanced datasets [8]. In undersampling, a random number of samples of the majority class is discarded [50]. However, the aim of oversampling techniques is to increase the number of samples by creating samples from the minority class. In this latter approach, exact copies of the training samples in the minority class can be created and therefore the generalization capabilities may decrease [10]. In the case of the hybrid strategy, the two approaches just exposed are used. The idea is to balance the number of the training samples in both classes by first oversampling the minority class and then undersampling the majority class. In this paper, we compared the results when using different oversampling methods, using Random Under Sampling (RUS) as a benchmark. Among the most common oversampling methods, SMOTE [10] and variants such as SMOTE nominal (SMOTEN) have been applied in prior works for balancing datasets, improving the performance of predictive models [11; 12]. The SMOTE algorithm is based on oversampling the minority class by adding random synthetic samples from the minority class [51]. Since SMOTE only deals with continuous features, SMOTEN [10] has been proposed for dealing with categorical features. This section also presents the two generative neural network models implemented in this work: TVAE [52] and GANs [53]. TVAE is based on VAE, a latent generative model proposed by [PERSON] and [PERSON] [52] which is composed of two parts, a generative and an inference model. In the generative part, given a sample \(\mathbf{x}\), a probabilistic decoder produces a distribution over the latent values \(\mathbf{z}\). In the inference part, a probabilistic encoder outputs a latent variable \(\mathbf{z}\) into \(\mathbf{\hat{x}}\). The variational lower boundary of the marginal likelihood of the input data is selected as an objective function of VAE. In recent years, VAE has been extensively used in applications such as image/text classification, anomaly detection or image generation [54]. To generate structured/tabular data, the variant TVAE proposed in [21] allows the generation of mixed-type tabular data. GANs were proposed by [PERSON] [53] and are generative models composed of two ANNs: (i) A generator \(G\) that takes a random vector \(\mathbf{z}\) from a distribution \(F_{z}\sim\mathcal{N}(0,1)\) and projects it to a vector \(\mathbf{\hat{x}}\); and (ii) a discriminator \(D\) that seeks to discriminate between real and synthetic data. The goal of \(G(\cdot)\) is to generate synthetic data with characteristicsthat are as close to real data as feasibly possible. \(G(\cdot)\) and \(D(\cdot)\) aim to optimize a zero-sum min-max game, with the value function \(V(G,D)\) as follows:  
\[\min_{G}\max_{D}V(G,D)\ =\ \mathbb{E}_{x\sim\rho_{data}(x)}[logD(\mathbf{x})]+ \mathbb{E}_{z\sim\rho_{z}(z)}[log(1-D(G(\mathbf{z}))),\]  
where \(\rho_{data}(x)\) and \(\rho_{z}(z)\) are the distribution of the real data and that of the samples generated by \(G\), respectively. Symbols \(\mathbf{x}\) and \(\mathbf{z}\) represent the samples from the input and the latent space, and \(E_{x}\) and \(E_{z}\) are the expected log-likelihood from the different outputs of both real and generated samples.