## 4 Results and Discussion
However, performance disparities emerge in underrepresented classes (e.g., password-based, XSS), where limited training samples lead to lower F1 scores. These gaps highlight the dataset's inherent class imbalance, suggesting the need for synthetic oversampling (e.g.,  
Figure 5: Comparison of the proposed method’s accuracy with other methods. SMOTE) or cost-sensitive learning to improve minority class representation. While the CNN's binary classification accuracy (100% vs. 99.98% for RF) may appear marginal, it translates to detecting \(\sim\)89 additional attacks in critical environments--a significant gain for mitigating high-impact breaches. \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Method** & **Metrics** & **Normal** & **Attacks** \\ \hline \multirow{4}{*}{**DT**} & Pr & 1.00 & 1.00 \\ \cline{2-4}  & Rc & 1.00 & 1.00 \\ \cline{2-4}  & F1 & 1.00 & 1.00 \\ \hline \multirow{4}{*}{**RF**} & Pr & 1.00 & 1.00 \\ \cline{2-4}  & Rc & 1.00 & 1.00 \\ \cline{2-4}  & F1 & 1.00 & 1.00 \\ \hline \multirow{4}{*}{**SVM**} & Pr & 1.00 & 0.857 \\ \cline{2-4}  & Rc & 0.118 & 1.00 \\ \cline{2-4}  & F1 & 0.211 & 0.923 \\ \hline \multirow{4}{*}{**KNN**} & Pr & 0.559 & 0.876 \\ \cline{2-4}  & Rc & 0.279 & 0.958 \\ \cline{2-4}  & F1 & 0.372 & 0.915 \\ \cline{2-4}  & Pr & 1.00 & 1.00 \\ \cline{2-4}  & Rc & 1.00 & 1.00 \\ \cline{2-4}  & F1 & 1.00 & 1.00 \\ \hline \hline \end{tabular}
\end{table} 
Table 10: Results of ML and DL methods for 2-class classification. \begin{table}
\begin{tabular}{c c c c c c c c} \hline \hline
**Method** & **Metrics** & **Normal** & **DDoS** & **Injection** & **MITM** & **Malware** & **Scanning** \\ \cline{2-8}  & & Pr & 1.00 & 0.959 & 0.863 & 1.00 & 0.924 & 0.974 \\ \cline{2-8}  & Rc & 1.00 & 0.965 & 0.843 & 1.00 & 0.922 & 0.970 \\ \cline{2-8}  & F1 & 1.00 & 0.962 & 0.853 & 1.00 & 0.923 & 0.972 \\ \hline \multirow{4}{*}{**RF**} & Pr & 1.00 & 0.964 & 0.867 & 1.00 & 0.950 & 0.973 \\ \cline{2-8}  & Rc & 1.00 & 0.966 & 0.864 & 1.00 & 0.921 & 0.998 \\ \cline{2-8}  & F1 & 1.00 & 0.965 & 0.865 & 1.00 & 0.935 & 0.986 \\ \hline \multirow{4}{*}{**SVM**} & Pr & 0.434 & 0.731 & 0.00 & 0.00 & 0.438 & 0.00 \\ \cline{2-8}  & Rc & 0.649 & 0.780 & 0.00 & 0.00 & 0.637 & 0.00 \\ \cline{2-8}  & F1 & 0.520 & 0.755 & 0.00 & 0.00 & 0.519 & 0.00 \\ \hline \multirow{4}{*}{**KNN**} & Pr & 0.523 & 0.757 & 0.346 & 0.986 & 0.991 & 0.340 \\ \cline{2-8}  & Rc & 0.666 & 0.770 & 0.242 & 1.00 & 0.883 & 0.216 \\ \cline{2-8}  & F1 & 0.586 & 0.764 & 0.285 & 0.993 & 0.934 & 0.264 \\ \hline \multirow{4}{*}{**Proposed**} & Pr & 1.00 & 0.990 & 0.911 & 1.00 & 1.00 & 1.00 \\ \cline{2-8}  & Rc & 1.00 & 1.00 & 0.946 & 0.944 & 0.480 & 1.00 \\ \cline{2-8}  & F1 & 1.00 & 0.995 & 0.929 & 0.971 & 0.649 & 1.00 \\ \hline \hline \end{tabular}
\end{table} 
Table 11: Results of ML and DL methods for 6-class classification. Finally, Figure 6 displays the five most significant features for the 6-class classification. These results were obtained by analyzing the predictions using the random forest model, which highlights the influence of each feature in detecting the type of attack and shows that features related to MQTT and DNS protocols are of high relevance for traffic classification. Finally, according to the results obtained, the CNN-based model achieves exceptional performance in multiclass attack classification for IoT/IIoT networks, particularly in detecting complex and evolving threats. While marginal accuracy gains (e.g., 100% vs. 99.98%) may appear incremental, they hold critical significance in high-stakes industrial environments, where even a 0.02% reduction in false negatives can prevent dozens of dangerous attacks from going undetected. The model's strength lies in its ability to autonomously extract spatial patterns from traffic flows, especially for protocol-specific attacks (e.g., DDoS, SQL injection) in the DNN-EdgelIoT dataset. However, traditional methods like random forest may outperform CNNs on datasets with weaker spatial correlations (e.g., UNSW-NB15), underscoring the importance of context-driven architecture selection.