## 5 Discussion  
In this experiment, we evaluated the performance of six machine learning models and three deep learning models for network intrusion detection. The machine learning models included logistic regression, Gaussian naive Bayes, random forest, KNN, SVM, and decision tree, while the deep learning models consisted of MLP, CNN, and LSTM. Upon reviewing the results, logistic regression achieved an accuracy of 0.97 and a weighted average F1 score of 0.97. Gaussian naive Bayes reached an accuracy of 0.65 and a weighted average F1 score of 0.71. Random forest demonstrated outstanding performance, with an accuracy of 0.998 and a weighted average F1 score of 1.00. The KNN model achieved an accuracy of 0.99 and a weighted average F1 score of 0.99. Finally, the decision tree model showed an accuracy of 0.998 and a weighted average F1 score of 1.00. Naive Bayes and logistic regression exhibited lower performance compared to random forest and decision tree due to their inherent limitations in handling high-dimensional and complex network traffic data. Naive Bayes operates under the assumption that features are conditionally independent given the class label. However, network intrusion data often contains highly correlated features, making this assumption unrealistic. As a result, naive Bayes struggles to model intricate relationships within the dataset, leading to poor classification performance, especially for minority attack classes. Logistic regression is a linear model that performs well when data points can be separated using a linear decision boundary. However, network intrusion detection data is inherently complex and non-linearly separable, which limits the effectiveness of logistic regression. The model fails to capture intricate patterns in network traffic, leading to a high misclassification rate. Decision trees and random forests are suited well for capturing non-linear relationships in high-dimensional datasets. Unlike logistic regression, they can model intricate decision boundaries without requiring prior feature transformations. The ensemble nature of random forest allows it to handle class imbalances better than naive Bayes and logistic regression, which are more sensitive to skewed distributions. For the deep learning models, the MLP model achieved an accuracy of 0.97 and a weighted average F1 score of 0.98. The CNN model attained an accuracy of 0.98 and a weighted average F1 score of 0.98. The LSTM model showed an accuracy of 0.98 and a weighted average F1 score of 0.98. Comparing the machine learning and deep learning models reveals that the random forest and decision tree models exhibit the highest performance, with accuracy and weighted average F1 scores nearly reaching 1.00. KNN also performed well, with an accuracy of 0.99 and a weighted average F1 score of 0.99. The deep learning models, MLP, CNN, and LSTM, performed similarly, with accuracy scores ranging from 0.97 to 0.98 and weighted average F1 scores of 0.98. In conclusion, the random forest and decision tree models were the best performers for network intrusion detection tasks in this study. However, the deep learning models (MLP, CNN, and LSTM) also showed strong performance, suggesting their potential for use in network intrusion detection systems. It is important to consider that the selection of a model depends on specific application requirements and constraints, such as computational resources, interpretability, and real-time detection needs. As network traffic increases and cyber threats grow more complex, intrusion detection systems must be capable of efficiently processing and analyzing large-scale data streams in real-time. Our research has highlighted the potential of deep learning-based intrusion detection systems to address these challenges. However, optimizing the computational efficiency and resource utilization of these models is critical for their successful deployment in real-world scenarios. To achieve this, we explored various methods to enhance the performance of deep learning models in intrusion detection systems.