## 5 Results and Discussion
### A Brief Description of the Models Used for Comparison
This LSTM layer efficiently compresses the input data into a fixed-size latent representation that is stored in the 'encoded' variable. The'return_sequences' parameter is set to 'False', which indicates that it captures only the last hidden state of the LSTM, thereby summarizing the input sequence. The decoding phase starts with a 'RepeatVector' layer, which repeats the latent representation to match the length of the original input sequence. Subsequently, another LSTM layer is used to decode the repeated latent representation, effectively reconstructing the input sequence. By configuring'return_sequences' as 'True', this LSTM layer generates an output sequence that closely mirrors the original input sequence. The last step involves using the 'TimeDistributed' layer in conjunction with the 'Dense' operation. This combination enables the reconstruction of each time step in the output sequence independently, effectively mapping the latent representation to the original data space. The reconstructed sequence is stored in the 'decoded' variable. Additionally, model compilation employs the Adam optimizer with a specified learning rate and the loss function of the Mean Squared Error (MSE). - Variational Autoencoder (VA) [38]: This model is a neural network architecture known for its efficiency in probabilistic data modeling and anomaly detection. In this regard, Algorithm 4 starts by specifying the input shape, allowing flexibility to accommodate various data sequences. The 'inputs' variable is initialized as the input layer, which is designed to accept data with the specified shape. The VAE architecture consists of an encoder and a decoder, which makes it a generative model. In the encoding phase, the input sequence is processed by an LSTM layer with 64 units. The outputs of this LSTM layer are passed through two dense layers named 'z_mean' and 'z_log_var'. These layers produce two important latent variables: the mean and the logarithm variances of the latent space. The latent representation, denoted as 'z', is generated by sampling from a Gaussian distribution defined by 'z_mean' and 'z_log_var'. The encoder is then defined as a separate model and takes the input data and outputs 'z_mean', 'z_log_var', and 'z'. This separation is fundamental to the probabilistic nature of VAE and allows for efficient sampling during training and generation. The decoding phase starts by defining 'latent_inputs' as an input layer with the shape '(latent_dim)'. This layer receives the sampled latent representation 'z'. The 'decoded' variable is initialized as the 'RepeatVector' layer, which repeats the latent representation to match the length of the original input sequence. Another LSTM layer is applied, and configured to return sequences, which generates a sequence that is very similar to the input data. The TimeDistributed' layer along with the 'Dense' operation is then used to reconstruct each time step in the output sequence independently, effectively mapping the latent representation to the original data space. The reconstructed sequence is stored in the 'decoded' variable. Moreover, Algorithm 4 includes a model compilation where the VAE loss function is defined. The loss function consists of two parts: a reconstruction loss, which measures the dissimilarity between the input and reconstructed sequences using MSE, and a regularization term that encourages the latent space to follow a Gaussian distribution. These components ensure that the model learns to accurately reconstruct input data and generate meaningful latent representations.