## 3 Proposed Approach
### Class Weights  
Class weights are a valuable technique used to address class imbalance in datasets by assigning different weights to each class during model training. This approach ensures that the model pays more attention to minority classes, thereby improving its ability to correctly classify instances from these groups. By applying class weights to the training data, both binary and multi-class classification tasks benefit from enhanced model performance and generalization. This method helps mitigate the risks associated with biased predictions, ensuring a more balanced representation of all classes throughout the learning process. The class weights can be calculated using the following formula to address class imbalance within the dataset. This approach assigns different weights to each class, ensuring that the model pays more attention to minority classes during training. The formula for calculating class weights is provided in Equation (7) [86]. \[Weight_{c}=\frac{N}{k.n_{c}} \tag{7}\] \begin{table}
\begin{tabular}{c c c} \hline \hline \multirow{2}{*}{**Class Type**} & **Number of Samples Before** & **Number of Samples After** \\  & **Resampling (ENN)** & **Resampling (ENN)** \\ \hline \hline Normal & 81,320 & 81,320 \\ \hline Attack & 83,980 & 83,754 \\ \hline \hline \end{tabular}
\end{table} 
Table 14: Sample distribution in each Train class before/after resampling using ENN for binary classification on NF-UNSW-NB15-v2 dataset. \begin{table}
\begin{tabular}{c c c} \hline \hline \multirow{2}{*}{**Class Type**} & **Number of Samples Before** & **Number of Samples After** \\  & **Resampling (ENN)** & **Resampling (ENN)** \\ \hline \hline Benign & 81,200 & 80,713 \\ \hline Exploits & 85,361 & 72,076 \\ \hline Fuzzers & 85,259 & 80,288 \\ \hline Reconnaissance & 85,388 & 74,094 \\ \hline Generic & 85,363 & 77,164 \\ \hline DoS & 85,564 & 75,066 \\ \hline Shellcode & 85,562 & 85,531 \\ \hline Backdoor & 85,446 & 61,014 \\ \hline Analysis & 85,562 & 66,110 \\ \hline Worms & 85,502 & 85,318 \\ \hline \hline \end{tabular}
\end{table} 
Table 15: Sample distribution in each Train class before/after resampling using ENN for multi-class classification on NF-UNSW-NB15-v2 dataset. In this context, \(Weight_{c}\) denotes the weight assigned to class \(c\). The total number of instances in the dataset is represented by \(N\), while \(k\) indicates the total number of classes. Additionally, \(n_{c}\) signifies the number of instances belonging to class \(c\). The weights assigned to each class in the training data for binary classification using class weights on the NF-UNSW-NB15-v2 dataset are presented in Table 16. The 'Normal' class is assigned a weight of 1.0150, while the 'Attack' class receives a weight of 0.9855. These weights reflect the importance of each class during model training, with the goal of addressing any imbalances in the dataset. By incorporating these class weights, the model can enhance its performance and improve the accuracy of its predictions, particularly for the minority class. The weights assigned to each class in the training data for multi-class classification using class weights on the NF-UNSW-NB15-v2 dataset are shown in Table 17. The 'Benign' class has a weight of 0.9384, while 'Exploits' is assigned a weight of 1.0508. Other classes, such as 'Fuzzers' and 'Reconnaissance,' receive weights of 0.9433 and 1.0222, respectively. The 'Generic' class has a weight of 0.9815, and 'DoS' is given a weight of 1.0089. Notably, the 'Backdoor' class receives the highest weight at 1.2413, followed closely by 'Analysis' with a weight of 1.1456. These weights are designed to improve the model's performance by addressing class imbalances, allowing for a more effective and accurate representation of each class during training. In this study, a variety of model architectures were utilized, encompassing CNN, auto encoder, DNN, and Transformer-CNN. These models were selected due to their outstanding performance across multiple evaluation metrics [83; 87; 88].