## 3 Materials and Methods
### Variational Autoencoders  
Over time, autoencoder models have emerged with different approaches, one of which are the variational autoencoders (VAEs) [43]. VAE are autoencoders whose encoding distribution is regularized during their training in order to ensure that its latent space has good properties, allowing us to generate new samples that are consistent with actual data. Formally, VAEs are generative models that attempt to describe how the data might be generated through a probabilistic distribution. Specifically, given an observed dataset \(\mathbf{X}\), we assume a generative model for each datum \(\mathbf{x}_{i}\) conditioned to an unobserved random latent variable \(\mathbf{z}_{i}\), where \(\boldsymbol{\theta}\) are the parameters governing the generative distribution. This generative model is also equivalent to a probabilistic decoder. Symmetrically, we assume an approximate posterior distribution over the latent variable \(\mathbf{z}_{i}\) given a datum \(\mathbf{x}_{i}\) denoted by recognition, which is equivalent to a probabilistic encoder which is governed by parameters \(\boldsymbol{\phi}\). Finally, we assume a prior distribution for the latent variables \(\mathbf{z}_{i}\) denoted by \(\mathbf{p}_{0}(\mathbf{z}_{i})\). The observed latent variables \(\mathbf{z}_{i}\) can be interpreted as a code given by the recognition model \(\mathbf{q}_{\boldsymbol{\phi}}(\mathbf{z}||\mathbf{x})\). The marginal log-likelihood is expressed as a sum over the individual data points as expressed next,  
\[log\,\mathbf{p}_{0}(\mathbf{x}_{i})=D_{KL}\big{(}q_{\boldsymbol{\phi}}( \mathbf{z}|\mathbf{x}_{i})||(\mathbf{p}_{0}(\mathbf{z}|\mathbf{x}_{i})\big{)} +\boldsymbol{\phi}(\boldsymbol{\theta},\boldsymbol{\phi};\mathbf{x}_{i}) \tag{1}\]  
where the first term is the Kullback-Leibler divergence of the approximate recognition model from the true posterior and the second term is called the variational lower bound on the marginal likelihood, defined as expressed next:  
\[\boldsymbol{\phi}(\boldsymbol{\theta},\boldsymbol{\phi};\mathbf{x}_{i}) \doteq\mathbf{E}_{\boldsymbol{\phi}(\mathbf{z}|\mathbf{x}_{i})}\big{[}-log \,\mathbf{q}_{\boldsymbol{\phi}}(\mathbf{z}|\mathbf{x})+log\,\big{(}\mathbf{ p}_{\boldsymbol{\theta}}(\mathbf{z},\mathbf{x})\big{]} \tag{2}\]  
Variational inference follows by maximizing \(\boldsymbol{\phi}(\boldsymbol{\theta},\boldsymbol{\phi};\mathbf{x}_{i})\) for all data points with respect to \(\boldsymbol{\theta}\) and \(\boldsymbol{\phi}\).  
With the intensive use of autoencoders, new techniques have been developed and techniques commonly used in other algorithms have been adapted to improve their performance, one of which is known as fine-tuning. The goal of fine-tuning is to adjust the weights of the trained model from the final phase to improve the prediction outcome. This procedure, based on the concept of transfer learning [44], includes the step of pretraining neural networks with a generative objective followed by additional training procedures with a discriminative objective on the same dataset [45], but some other studies follow the process of reusing weight values from large datasets as initialization in applications with limited access to labeled data [46]. Let \(\mathbf{X}\in\mathbf{R}^{N\times L}\) be the input data matrix, containing the input set of vectors in rows, with \(N\) observations of \(L\) features. We consider latent space output variable \(\mathbf{Y}\in\mathbf{R}^{P\times N}\), with \(P\) being the size of the reduction feature space or latent space. The algorithm is summarized as shown in Algorithm 1, where an autoencoder is fitted to obtain the weights, after which the encoder weights are frozen and the softmax layer is added for readjustment.