## 6 Conclusions  
In this study, we introduce CBF-IDS, an innovative IDS that effectively addresses the issue of class imbalance in IDS. The proposed model integrates CNN and BiLSTM, enabling it to capture both spatial and temporal features in network traffic. A notable aspect of CBF-IDS is its utilization of the focal loss function to handle class imbalance. By incorporating focal loss, the model assigns higher weights to minority classes, effectively prioritizing their correct classification. We assessed the effectiveness and generalization capability of CBF-IDS by employing three benchmark datasets. The experimental findings consistently demonstrate that CBF-IDS outperforms other classification algorithms. It is worth noting that focal loss performs better in minority classes compared to CE and \(\alpha\)-balanced CE, further emphasizing its effectiveness in addressing the issue of class imbalance. Our model achieves remarkable performance when using the three datasets. Specifically, for the NSL-KDD dataset, CBF-IDS achieves 99.40% accuracy and an F1 score of 99.40%. On the UNSW-NB15 dataset, CBF-IDS achieves 82.30% accuracy and an F1 score of 79.61%. Finally, for the CIC-IDS2017 dataset, CBF-IDS achieves 99.53% accuracy and an F1 score of 99.53%. These results unequivocally showcase the effectiveness of the proposed CBF-IDS in mitigating the issue of class imbalance in IDS, thus augmenting the overall performance of IDS. The proposed model is a hybrid model that achieves excellent detection performance at the cost of increased model complexity.  
Future work will focus on two aspects. First, we plan to use datasets specifically designed for the IoT environment to train the model, enhancing the generalization capability of CBF-IDS in diverse network environments. Second, given that CBF-IDS is a hybrid model that demands more computational resources and time to improve detection performance, we will use feature engineering to enhance the model's resource utilization, making it suited for resource-constrained environments. These two aspects of work will further refine CBF-IDS, making it applicable to different types of network environments.  
**Author Contributions:** Conceptualization, H.P. and C.W.; methodology, H.P.; software, H.P.; validation, H.P. and Y.X.; formal analysis, H.P. and Y.X.; investigation, H.P. and Y.X.; resources, C.W.; data curation, H.P.; writing--original draft preparation, H.P.; writing--review and editing, C.W. and Y.X.; visualization, H.P.; supervision, C.W.; project administration, H.P. and C.W.; funding acquisition, C.W. All authors have read and agreed to the published version of the manuscript.  
This work is supported by the \"Pioneer\" and \"Leading Goose\" R&D Program of Zhejiang (2022C01085).  
**Infrared Consent Statement:** Not applicable.  
**Data Availability Statement:** This study used the NSL-KDD dataset, USNW-NB15 dataset, and CIC-IDS2017 dataset, all of which are publicly available datasets. They can be found at [[https://www.unb.ca/cic/datasets/nsl.html](https://www.unb.ca/cic/datasets/nsl.html)]([https://www.unb.ca/cic/datasets/nsl.html](https://www.unb.ca/cic/datasets/nsl.html)), [[https://research.unsw.edu.au/projects/unsw-nb15-dataset](https://research.unsw.edu.au/projects/unsw-nb15-dataset)]([https://research.unsw.edu.au/projects/unsw-nb15-dataset](https://research.unsw.edu.au/projects/unsw-nb15-dataset)), and [[https://www.unb.ca/cic/datasets/ids-2017.html](https://www.unb.ca/cic/datasets/ids-2017.html)]([https://www.unb.ca/cic/datasets/ids-2017.html](https://www.unb.ca/cic/datasets/ids-2017.html)) (accessed on 31 August 2023).  
The authors declare no conflict of interest.