## 4 Result and Analysis
### Results of Deep Learning Models  
In the later stages of the experiments, we compared the performance of three deep learning models--multilayer perceptron (MLP), convolutional neural network (CNN), and long short-term memory (LSTM)--for network intrusion detection, in comparison to machine learning methods. The classification report results offer a thorough understanding of how these models performed. In Figure 5, we present the confusion matrices of the MLP, CNN, and LSTM models. The annotations indicate that while all models perform well in detecting the majority class, there are notable misclassifications in underrepresented attack classes, particularly in classes 3 and 4. The CNN model demonstrates improved detection in these classes compared to MLP, but LSTM shows the best overall balance between precision and recall across all classes. In Figure 6, the training and validation loss curves for the deep learning models are displayed. The updated annotations clarify that CNN and LSTM models converge more smoothly than MLP, indicating better generalization. Additionally, fluctuations in the validation loss for MLP suggest possible overfitting, which can be mitigated through regularization techniques such as dropout or batch normalization. \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Model** & **Accuracy** & **Avg F1 Score** & **95\% Confidence Interval** \\ \hline Logistic Regression & 96.91\% & 74.00\% & [96.50, 97.32] \\ Naive Bayes & 64.59\% & 48.88\% & [63.85, 65.33] \\ KNN & 99.88\% & 97.46\% & [99.75, 99.98] \\ Decision Tree & 99.83\% & 97.60\% & [99.70, 99.96] \\ SVM & 97.32\% & 73.33\% & [96.90, 97.74] \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Performance metrics of different ML models. The multilayer perceptron (MLP) model achieves an overall accuracy of 97%, demonstrating high precision and recall for classes 0, 1, and 2, reflecting its effectiveness in identifying these classes accurately. However, its performance drops slightly for class 3 and significantly for class 4. The model's average macro F1 score is 0.82, indicating a solid ability to distinguish between classes. Despite this, the lower F1 scores for classes 3 and 4 highlight areas for improvement in these classifications. The convolutional neural network (CNN) model achieves an overall accuracy of 98%, slightly outperforming the MLP model. Similar to the MLP, the CNN model displays  
Figure 4: Confusion matrices showing the performance of logistic regression (LR), naive Bayes (NB), decision trees (DTs), random forest (RF), K-nearest neighbors (KNNs), and support vector machines (SVMs) models in classifying network intrusions. Figure 5: Confusion matrices for MLP, CNN, and LSTM models to assess classification performance, including true positive, true negative, false positive, and false negative rates. Figure 6: Training and validation accuracy comparison of MLP, CNN, and LSTM models across epochs to evaluate model performance and generalization. high precision and recall for classes 0, 1, and 2, and shows comparable performance for classes 3 and 4. Its macro average F1 score is 0.83, slightly higher than the MLP model, indicating improved performance in class differentiation. However, the lower F1 scores for classes 3 and 4 remain a concern, suggesting the need for further refinement in classifying these categories. The long short-term memory (LSTM) model also reaches an overall accuracy of 98%. It maintains high precision and recall for classes 0, 1, and 2, and shows comparable performance for classes 3 and 4 when compared to the other two models. The LSTM model's macro average F1 score is 0.84, the highest among the three deep learning models, signifying its superior performance in class differentiation. Nonetheless, the lower F1 scores for classes 3 and 4 still persist, indicating that improvements are necessary for these specific classes. All three deep learning models exhibit strong performance in network intrusion detection, with the LSTM model slightly outperforming the MLP and CNN models.