Vol.:(0123456789) The Journal of Supercomputing https://doi.org/10.1007/s11227-023-05073-x 1 3 Addressing the class imbalance problem in network intrusion detection systems using data resampling and deep learning Ahmed Abdelkhalek 1  · Maggie Mashaly 1 Accepted: 20 January 2023 © The Author(s) 2023 Abstract Network intrusion detection systems (NIDS) are the most common tool used to detect malicious attacks on a network. They help prevent the ever-increasing dif- ferent attacks and provide better security for the network. NIDS are classifed into signature-based and anomaly-based detection. The most common type of NIDS is the anomaly-based NIDS which is based on machine learning models and is able to detect attacks with high accuracy. However, in recent years, NIDS has achieved even better results in detecting already known and novel attacks with the adoption of deep learning models. Benchmark datasets in intrusion detection try to simulate real-network trafc by including more normal trafc samples than the attack sam- ples. This causes the training data to be imbalanced and causes difculties in detect- ing certain types of attacks for the NIDS. In this paper, a data resampling technique is proposed based on Adaptive Synthetic (ADASYN) and Tomek Links algorithms in combination with diferent deep learning models to mitigate the class imbalance problem. The proposed model is evaluated on the benchmark NSL-KDD dataset using accuracy, precision, recall and F-score metrics. The experimental results show that in binary classifcation, the proposed method improves the performance of the NIDS and outperforms state-of-the-art models with an achieved accuracy of 99.8%. In multi-class classifcation, the results were also improved, outperforming state-of- the-art models with an achieved accuracy of 99.98%. Keywords Class imbalance · Cybersecurity · Deep convolutional neural networks · Intrusion detection · Long-short-term memory Ahmed Mashaly and Maggie Mashaly contributed equally to this work. * Ahmed Abdelkhalek ahmed.abdelhaleem@guc.edu.eg Maggie Mashaly maggie.ezzat@guc.edu.eg 1 Networks Department, German University in Cairo, El-Tagamoa El-Khames, Cairo, Egypt