## 2 Materials and Methods
### Log-Cosh Variational Auto Encoder  
This section also explains the variational autoencoder (VAE) and its role in fitting the input data using a multidimensional Gaussian distribution. The encoder network (\(q_{f}(z\big{|}x)\)) is the first part of the VAE, with model parameters (\(\phi\)). It maps the input, \(X\), to the feature variable, Z, effectively compressing the input data into a potential low-dimensional space. The decoder network (\(p_{\theta}(x|z)\)) is the second part, with model parameters (\(\theta\)). Its task is to map the feature variable, \(Z\), back to the data, \(\overline{X}\), by reconstructing the feature variable, \(Z\). By using the VAE approach, the decoder can generate new data by reconstructing the latent spatial feature variable, \(Z\). Equation (1) summarizes the formulation of the conventional VAE loss function. \[L_{VAE}=E[\log p(X|Z)]-D_{KL}[q(Z|X)||p(Z)] \tag{1}\]  
There are two fundamental parts of the VAE loss function in Equation (1). The logarithmic reconstruction loss term, or the probability distribution \(E[\log p(X|Z)]\) from which the data are derived, is the initial component. Its goal is to minimize the squared \(L_{2}\) which is the loss between the reconstructed data \(\overline{X}\) and the input data \(X\). The second portion is the Kullback-Leibler (KL) divergence, \(D_{KL}[q(Z|X)||p(Z)]\), which minimizes the difference between the learned distribution \(q(Z|X)\) and the predefined distribution \(p(Z)\). This facilitates efficient learning of the input data's latent space representation using the VAE model. By integrating these two elements, the VAE loss function encourages the learning distribution to match the predefined distribution while optimizing the reconstruction accuracy. This dual goal allows the VAE model to provide excellent reconstructions and capture the underlying structure of the input data. The squared \(L_{2}\) loss function, represented by Equation (2), plays a crucial role in the VAE framework. It seeks to minimize the difference between the input vector, \(X\), and its corresponding reconstructed vector, \(\overline{X}\), ensuring the accurate reconstruction of the original data. The ith sample in \(X\) is denoted by the term \(x_{i}\), while the ith sample in \(\overline{X}\) is denoted by the term \(\overline{x}_{i}\). In order to ensure the correct reconstruction of the original data, this loss function seeks to minimize the difference between the input vector and its corresponding recreated vector. \[L_{\text{reconstruction}}=\sqrt{\sum_{i=1}^{n}\left(x_{i}-\overline{x}_{i} \right)^{2}}=\sum_{i=1}^{n}\Big{|}x_{i}-\overline{x}_{i}\Big{|}_{2}={L_{2}}^{2} \tag{2}\]  
Figure 1: The overall structure of the method proposed in this paper. The primary purpose of the conventional VAE is data generation; nonetheless, it has significant limitations. Reconstructing data using a low-dimensional latent spatial feature variable, Z, is one such difficulty. Dealing with intrusion detection datasets, like the CICIDS2017 dataset, which frequently contains discrete and high-dimensional data, makes this extremely difficult. As a result, the efficiency of the created data is decreased since there is typically a large reconstruction loss between the generated and input data. To address this problem, our goal is to balance the weights given to the reconstructed data and the latent space in Equation (1). However, the estimated reconstruction loss is usually very small, resulting in a limited error margin and a negligible penalty for the reconstruction loss component. Consequently, the KL divergence, represented by the second part of Equation (1), becomes the dominant part of the loss function. An efficient way to address this issue and take different loss regions into consideration is to make the reconstruction loss weight heavier when the loss is tiny and to keep the reconstruction loss from increasing too much when the reconstruction error rises linearly.