Network intrusion detection must handle increasingly complex traffic across different environments. This study compares four classical machine learning algorithms: Random Forest, Decision Tree, K-Nearest Neighbor (KNN), and Support Vector Machine (SVM) on CICIDS2017 and UNSW-NB15. Labels were binarized, data were cleaned with median imputation and deduplication, and models were evaluated with stratified splits (CICIDS2017: 70/30, seed 42; UNSW-NB15: official train/validation/test), leakage-controlled pipelines, and Accuracy, Precision, Recall, F1-Score, ROC-AUC, and confusion matrices. Random Forest performed best on CICIDS2017 (F1-Score 0.9997, ROC-AUC 1.0000), while SVM performed best on UNSW-NB15 (F1-Score 0.8954, ROC-AUC 0.9636), followed by Random Forest (0.8937), Decision Tree (0.8872), and KNN (0.8705). Classical machine learning remained accurate on both benchmarks, but performance differed substantially between datasets, reflecting dataset difficulty and evaluation protocol rather than intrinsic algorithm robustness; because no cross-dataset training was performed, this gap should not be read as a measure of generalization. Measured training times ranged from 0.49 s (KNN, CICIDS2017) to 760.71 s (SVM, UNSW-NB15), and inference times ranged from 0.03 s (Decision Tree) to 428.90 s (KNN) across the two benchmarks.
Copyrights © 2026