# Enhanced Intrusion Detection Systems Performance with UNSW-NB15 Data Analysis
## 5 Results and Discussion
### Models with Important Features
Finally, Random Forest with Feature Selection sustains precision with 664,054 TP and 93,755 TN. The results of seven machine learning models applied to the UNSW_NB15 dataset are presented in Table 7, showing their overall performance based on three evaluation metrics: Accuracy, Precision, Recall, F1-Score, and FAR. The Random Forest managed to achieve the highest accuracy score of 0.994 and 0.9945 for Random Forest and Random Forest with \begin{table}
\begin{tabular}{l l l l l l l l} \hline \hline  & \multicolumn{2}{c}{**Train**} & \multicolumn{4}{c}{**Test**} \\ \hline
**Algorithm** & **TP** & **FP** & **FN** & **TN** & **TP** & **FP** & **FN** & **TN** \\ \hline LR & 1,539,416 & 13,446 & 5629 & 219,541 & 660,174 & 5728 & 2461 & 93,652 \\ Linear SVM & 1,532,183 & 20,679 & 732 & 224,438 & 657,023 & 8879 & 329 & 95,784 \\ DT & 1,539,546 & 13,316 & 3489 & 221,681 & 660,123 & 5779 & 1526 & 94,587 \\ RF & 1,241,042 & 1241 & 2455 & 177,687 & 663,950 & 1952 & 2483 & 93,630 \\ GBDT & 1,240,920 & 1363 & 1439 & 178,703 & 663,662 & 2240 & 2275 & 93,838 \\ DT with FS & 1,231,647 & 10,636 & 2883 & 1,777,259 & 660,125 & 5777 & 1602 & 94,511 \\ RF with FS & 1,241,434 & 849 & 1999 & 178,143 & 664,054 & 1848 & 2358 & 93,755 \\ \hline \hline \end{tabular}
\end{table} 
Table 6: Confusion matrix of all ML models. \begin{table}
\begin{tabular}{l l} \hline \hline
**Algorithm** & **Train** & **Test** \\ \hline LR & 0.983171129855572 & 0.982896428268793 \\ Linear SVM & 0.99171621060382 & 0.991621576012526 \\ DT & 0.987964953232175 & 0.987722200601008 \\ f & 0.992686447486772 & 0.985617231685103 \\ GBDT & 0.99545734190109 & 0.986483043307548 \\ DT with FS & 0.98771751251344 & 0.987328334371178 \\ RF with FS & 0.994109889715638 & 0.986345597491184 \\ \hline \hline \end{tabular}
\end{table} 
Table 5: AUC results for training and test datasets for all ML algorithms. feature selection, respectively. Moreover, the precision, recall and f1 score were higher than 99.5% for both showing the stability of the detection of the model. Decision trees based on the Boost, decision trees and decision trees with feature selection also secured high accuracy with an accuracy of 0.9941, 0.9904 and 0.9903, respectively. Logistic regression and linear regression managed to get accuracy scores of 0.9893 and 0.9879, respectively, with high precision, recall and F1 score. In general, both precision and recall have reasonably good results which shows that the models have not overfitted. In terms of the FAR, Random Forest with feature selection and Random Forest have the lowest values with 0.0194 and 0.0204, respectively. The other models' FAR ranges between 2.3 % and 8.4%, and more false alarms can be generated during detection. Therefore, the study concludes that the Random Forest ML model can be utilized to enhance the accuracy of cyber-attack detection. The observed can be attributed to various factors including model complexity, data importance and data imbalance. Model complexity, given the dataset's 49 features, is one of these factors in which SVM and Decision Tree models are capable of handling data relationships, and exhibited high accuracy and recall scores. SVM, with the highest accuracy at 0.991621 and a recall of 0.9995, showcased its effectiveness in managing complex patterns. The Decision Tree model, achieving an accuracy of 0.987722 and a recall of 0.9977, also demonstrated competitive performance. Feature importance, especially highlighted in Random Forest and Decision Tree models with feature selection, emphasized the impact of identifying essential features on precision and recall. Random Forest, in particular, achieved an accuracy of 0.985477, precision of 0.9971, and recall of 0.9963. Ensemble methods, like Random Forest, known for their ability to reduce overfitting, contributed to competitive performance across multiple metrics. The significance of hyperparameter tuning was evident, with SVM's fine-tuned configuration resulting in an accuracy of 0.991621 and a recall of 0.9995.