## 5 Experimental Setup
### Evaluation Time
\begin{table}
\begin{tabular}{c c c c c c c} \hline \hline
**Algorithms** & \multicolumn{2}{c}{**DoS Attack**} & \multicolumn{2}{c}{**Brute-Force Attack**} & \multicolumn{2}{c}{**Malformed Attack**} \\ \hline
**-** & **Precision** & **Recall** & **Precision** & **Recall** & **Precision** & **Recall** \\ \hline NB & 89.51\% & 87.27\% & 93.24\% & 92.71\% & 94.79\% & 95.18\% \\ DT & 96.03\% & 95.93\% & 99.81\% & 99.81\% & 99.66\% & 99.67\% \\ NN & 94.73\% & 94.65\% & 99.64\% & 99.64\% & 98.77\% & 98.77\% \\ RF & 96.03\% & 95.93\% & 99.81\% & 99.81\% & 99.66\% & 99.67\% \\ GB & 95.73\% & 95.51\% & 99.31\% & 99.31\% & 96.97\% & 96.88\% \\ LR & 89.70\% & 87.39\% & 93.14\% & 93.13\% & 95.33\% & 95.32\% \\ MLP & 94.43\% & 94.33\% & 99.69\% & 99.69\% & 99.33\% & 99.34\% \\ DNN & 89.94\% & 87.74\% & 99.67\% & 99.66\% & 96.88\% & 95.75\% \\ \hline \hline \end{tabular}
\end{table} 
Table 5: Precision and Recall of DoS, BF, Malformed anomalies attacks—using FS. In the other side the comparison matrix table is presented in Table 7, and the techniques are ranked in ascending order based on the gain achieved using feature selection (FS) with respect to testing time. In the DoS attack, the LR technique took the least amount of time for testing, which was 0.0115 s, ranking it first. In contrast, the DNN technique took the longest time for testing, which was 48.19 s, ranking it eighth. In the BF attack, the LR technique took the least amount of time for testing, which was 0.0067 s, ranking it first. On the other hand, the DNN technique took the longest time for testing, which was 27.66 s, ranking it eighth. In the malformed attack, the LR technique took the least amount of time for testing, which was 0.0106 s, ranking it first. In contrast, the DNN technique took the longest time for testing, which was 18.84 s, ranking it eighth. Overall, the results show that DNN takes the longest time for testing across all three types of attacks, while LR takes the least amount of time. The results also demonstrate the effectiveness of feature selection in reducing the testing time of the techniques. The plot presented in Figure 11, which compares the testing time of a DoS attack by applying defaults to 34 attributes with respect to the reduced 13 features obtained from the feature analysis of the MQTT dataset. \begin{table}
\begin{tabular}{c c c c c c c} \hline \hline
**Learning Algorithms** & \multicolumn{2}{c}{**DoS Attack**} & \multicolumn{2}{c}{**Brute-Force Attack**} & \multicolumn{2}{c}{**Malformed Attack**} \\ \hline
**Training Time (s)** & *** DA (34 attri)** & *** FS (13 attri)** & **DA (34 attri)** & **FS (17 attri)** & **DA (34 attri)** & **FS (16 attri)** \\ \hline NB & 1489.22 & 59.81 & 5500.23 & 153.66 & 7141.23 & 271.17 \\ DT & 1683.16 & 60.3 & 5843.74 & 154.02 & 7269.13 & 271.57 \\ NN & 895.03 & 47.02 & 5244.97 & 139.59 & 6990.8 & 262.42 \\ RF & 1338.05 & 58.7 & 5331.31 & 152.89 & 7037.06 & 270.38 \\ GB & 2132.6 & 115.45 & 6159.54 & 232.52 & 7512.83 & 308.43 \\ LR & 2258.15 & 122.44 & 6238.33 & 236.03 & 7624.17 & 311.84 \\ MLP & 2098.39 & 107.31 & 6129.44 & 230.44 & 7410.03 & 305.93 \\ DNN & 17,228.64 & 7.67 & 26.16 & 546.75 & 16.82 & 402.84 \\ NB & 0.0484 & 0.0248 & 0.0318 & 0.0131 & 0.0291 & 0.0125 \\ DT & 0.0401 & 0.0258 & 0.0306 & 0.0149 & 0.0208 & 0.0157 \\ NN & 5.2142 & 4.3855 & 2.7147 & 8.7942 & 19.8231 & 2.7996 \\ RF & 0.7409 & 0.7298 & 0.4652 & 0.4388 & 0.4957 & 0.4777 \\ GB & 0.0714 & 0.1035 & 0.036 & 0.0295 & 0.0315 & 0.0331 \\ LR & 0.0333 & 0.0115 & 0.0219 & 0.0067 & 0.0181 & 0.0106 \\ MLP & 0.3122 & 0.1565 & 0.1423 & 0.0601 & 0.08 & 0.1021 \\ DNN & 5.24 & 48.19 & 3.27 & 27.66 & 10.63 & 18.84 \\ \hline \hline \end{tabular}  
* DA = Default attributes, FS = Feature selection.  
\end{table} 
Table 6: Comparison of Training and Testing time in (seconds) before and after feature engineering. Figure 11: Compare Testing CPU time in sec w.r.t. DoS attack between defaults attributes and feature selection.