## 4 Data-Level Sampling and Resampling Methods  
Data-level sampling and resampling methods attempt to solve the data imbalance problem by adjusting the data distribution to obtain a balanced representation of the majority and minority examples in the training dataset. In general, data-level sampling and resampling often occur before learning takes place. Unlike algorithm-level methods, which focus on modifying the learning algorithm to reduce the bias towards the majority class, data-level methods do not solve the data imbalance directly, but solve it indirectly by modifying the training dataset to artificially balance the majority and minority examples in the dataset [5,7]. Data-level methods fall broadly into three main categories: undersampling, oversampling, and hybrid [41]. The hybrid method combines undersampling and oversampling methods [42]. It reduces the degree of imbalance in the dataset by synthetically creating a new class of minority examples. In contrast to the hybrid method, oversampling and undersampling methods use the same data to reduce the degree of data imbalance. Undersampling methods, however, balance the data distribution by increasing the weight of the minority examples, whereas oversampling methods reduce the weight of the majority examples to address the data imbalance [43]. Despite their promise, each type of method suffers from a particular issue; for example, oversampling causes overfitting due to the increased data size, and undersampling results in data loss due to a reduced data size [44]. Further, the combination of oversampling and undersampling causes overfitting and overlapping. However, overlapping, which occurs due to interpolation between relatively adjacent minority class examples, has a less significant impact on hybrid methods than overlapping. In general, oversampling methods are more accurate than undersampling methods when measuring their performance using ROC and AUC measurements. In addition to the data sampling methods mentioned above, we consider a fourth category of methods known as generative methods to generate new synthetic data from the original data by reconstruction, which we then use to train the AMiDS models. We use the autoencoder (AE) and variational autoencoder (VAE), two unsupervised learning methods, to generate synthetic data that are closer to the original data but not quite the same. The main idea behind these two methods, each of which consists of two fully connected neural networks (an encoder and a decoder), is to first compress the input data using an encoder while ignoring the noise and then decompress it using a decoder to generate data as close as possible to the original [35, 45]. Their main objective is to learn latent representations. Figure 4 shows the main components of an autoencoder network. In general, autoencoders are trained to reconstruct the data at their output layer while minimizing the error between the input and reconstructed data. However, an autoencoder must first learn the data distribution to generate new data samples. While the two generative methods, AE ad VAE, are structurally similar, they are mathematically different [46, 47, 48]. Unlike AEs, VAEs use statistical means to interpolate by imposing a probability distribution on the latent space. Further, its inference model is a stochastic function of the input, i.e., the decoder is probabilistic. On the other hand, an AE uses a separate variational distribution for each data point, which could be more efficient when using a large dataset. Additionally, an AE uses a computationally expensive inference approach, whereas a VAE uses a less expensive training approach. Perhaps the most important distinction between AEs and VAEs is that, unlike AEs, the hidden layer or latent space in the VAE network is smooth and continuous, making it easy to construct new data points using interpolation [45].