## 3 Proposed Approach
### Class Weights
#### 3.3.1 Convolutional Neural Networks (CNN)
This carefully designed architecture, as summarized in Table 19, is optimized to handle the unique characteristics of both datasets, ensuring effective learning and high-performance multi-class classification. (iii) Hyperparameter Configuration for the CNN Model  
The hyperparameters for the CNN model, as outlined in Table 20, are meticulously tuned for both binary and multi-class classification tasks. In both classifier configurations, a batch size of 128 is consistently utilized, ensuring efficient processing of data during training. The learning rate for both the binary and multi-class classifiers is adaptively managed through the ReduceLROnPlateau scheduler. If the validation loss shows no improvement over a set number of epochs (patience), the learning rate is halved. This \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Dataset** & **Block** & **Layers** & **Layer Size** & **Activation** \\ \hline NF-UNSW-NB15-v2 & Input block & Input layer & 25 & - \\ \hline CICIDS2017 & Input block & Input layer & 69 & - \\ \hline \multirow{6}{*}{Shared Structure} & \multirow{2}{*}{Hidden block 1} & 1D CNN layer & 256 & ReLU \\ \cline{3-5}  & & 1D Max Pooling layer & 2 & - \\ \cline{3-5}  & & Dropout layer & 0.000001 & - \\ \cline{3-5}  & & 1D CNN layer & 256 & ReLU \\ \cline{3-5}  & & 1D Max Pooling layer & 4 & - \\ \cline{3-5}  & & Dropout layer & 0.000001 & - \\ \cline{3-5}  & & 1D Max Pooling layer & 4 & - \\ \cline{3-5}  & & Dropout layer & 0.000001 & - \\ \cline{3-5}  & & 1D Max Pooling layer & 4 & - \\ \cline{3-5}  & & Dropout layer & 0.000001 & - \\ \cline{3-5}  & & 1D Max Pooling layer & 2 & - \\ \cline{3-5}  & & Dropout layer & 0.0000001 & - \\ \cline{3-5}  & & 1D CNN layer & 256 & ReLU \\ \cline{3-5}  & & 1D Max Pooling layer & 4 & - \\ \cline{3-5}  & & Dropout layer & 0.000001 & - \\ \cline{3-5}  & & Dense layer & 1024 & ReLU \\ \cline{3-5}  & & Dropout layer & 0.000001 & - \\ \hline NF-UNSW-NB15-v2 & Output block & Output layer & 10 & Softmax \\ \hline CICIDS2017 & Output block & Output layer & 15 & Softmax \\ \hline \hline \end{tabular}
\end{table} 
Table 18: CNN model layers for binary classification. \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Dataset** & **Block** & **Layers** & **Layer Size** & **Activation** \\ \hline NF-UNSW-NB15-v2 & Input block & Input layer & 27 & - \\ \hline CICIDS2017 & Input block & Input layer & 35 & - \\ \hline \multirow{6}{*}{Shared Structure} & \multirow{2}{*}{Hidden block 1} & 1D CNN layer & 256 & ReLU \\ \cline{3-5}  & & 1D Max Pooling layer & 2 & - \\ \cline{3-5}  & & Dropout layer & 0.000001 & - \\ \cline{3-5}  & & 1D CNN layer & 256 & ReLU \\ \cline{3-5}  & & 1D Max Pooling layer & 4 & - \\ \cline{3-5}  & & Dropout layer & 0.000001 & - \\ \cline{3-5}  & & Dense layer & 1024 & ReLU \\ \cline{3-5}  & & Dropout layer & 0.000001 & - \\ \hline NF-UNSW-NB15-v2 & Output block & Output layer & 10 & Softmax \\ \hline CICIDS2017 & Output block & Output layer & 15 & Softmax \\ \hline \hline \end{tabular}
\end{table} 
Table 19: CNN model layers for multi-class classification. approach allows the model to make finer adjustments during training, which can help accelerate convergence. To avoid excessively small updates, the learning rate is capped at a minimum value of \(1\times 10^{-5}\). This method ensures more efficient and stable training, enabling the model to converge steadily without overshooting the optimal solution. Across both classifier types, the Adam optimizer is employed, known for its adaptive learning rate capabilities, which enhances training performance. The choice of loss function is tailored to the nature of the classification task. Binary cross-entropy is adopted for the binary classification scenario, while categorical cross-entropy is utilized in multi-class classification, ensuring appropriate measurement of model performance based on the output format. Lastly, accuracy is designated as the evaluation metric for both classifiers, providing a straightforward assessment of their performance in correctly classifying the input data.