# Machine learning-based network intrusion detection for big and imbalanced data using oversampling, stacking feature embedding and feature extraction

Md. Alamin Talukder, Md. Manowarul Islam, Md Ashraf Uddin, Khondokar Fida Hasan, Selina Sharmin, Salem A. Alyami and 1 more · arXiv · 2024-1-22

- **Problem** Many ML-based intrusion detectors are trained on small, dated and balanced datasets, and often skip class imbalance and feature-count reduction, which limits their use on large, skewed traffic data.
- **Method** Random Oversampling balances the classes, clustering results are appended as meta-features, and PCA reduces the features to 10 before DT, RF, ET and XGB classifiers are trained under 10-fold cross-validation.
- **Results** Reached 99.59% binary accuracy with RF and 99.95% multilabel accuracy with RF and ET on UNSW-NB15 using 10 PCA features.

![Figure 1: Proposed framework for stacking feature embedded with PCA for intrusion detec- tion](https://refivu.com/papers/ffcd2c90-0ecb-4bf2-968e-883dd5d0ec8e/figures/figure-42d57853e06b58e5fce9dbc59ff752d7.png?thumb=512)

**Fig. 1** Proposed framework for stacking feature embedded with PCA for intrusion detec- tion.

[Original paper](https://arxiv.org/abs/2401.12262v1) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Md. Alamin Talukder, Md. Manowarul Islam, Md Ashraf Uddin, Khondokar Fida Hasan, Selina Sharmin, Salem A. Alyami, Mohammad Ali Moni · Machine learning-based network intrusion detection for big and imbalanced data using oversampling, stacking feature embedding and feature extraction · Original paper figure · Extracted the figure area from page 14 of the original PDF.

## Why imbalance and feature count limit IDS models

Many ML-based intrusion detectors are trained on small, outdated and balanced datasets, which raises doubts about how well they carry over to big traffic data. Earlier works often skip data balancing, and that choice shifts their false positive and false negative rates. Most of them train on the full feature set, which is slow and computationally heavy, and few analyse time complexity.

The proposed framework is aimed at large and imbalanced datasets and chains three operations: Random Oversampling for the classes, Stacking Feature Embedded for extra features, and PCA for reduction. The authors point out that no reviewed work uses Stacking Feature Embedded, which they argue could add information through meta-features.

## Benchmark datasets and how they were cut down

UNSW-NB15 covers 9 types of malicious activity and has 257673 entries in total. The authors note that this dataset is very unbalanced.

CIC-IDS2017 was built with B-Profile to generate attacks such as Brute Force FTP, Brute Force SSH, DoS and DDoS, and its flows are labelled with CICFlowMeter.

For CIC-IDS2018 the authors sampled 10% of the data from each class to fit computational resource limits.

## Balancing and clustering features before reduction

The first stage cleans the data: missing values are handled, spaces are removed from column names, duplicate rows are dropped, similar low-instance classes are merged, and data types are reduced from int64 to int32 and float64 to float32. Input features are standardized and output labels are label-encoded, so that all features sit on a common scale.

Random Oversampling adds randomly chosen minority-class samples until the classes are of comparable size. It runs after scaling, so the added rows are already standardized.

Stacking Feature Embedded takes the clustering results and appends them to the original IDS features as meta-features. The conclusion names Kmeans and GM clustering as the sources of these results. The text does not give the number of clusters.

Because these steps come before PCA, the reduction stage works on the original columns together with the clustering-derived columns.

## PCA reduction to 10 features

The authors motivate reduction by high dimensionality, which they say makes models more complex, prone to overfitting and slower to train. PCA converts correlated variables into uncorrelated ones through an orthogonal transformation.

The mean of the data is taken as \\\[\\mu=\\frac{1}{n}\\sum\_{i=1}^{n}x\_i\\\] where n is the number of instances and x\_i the data points. Each feature is then rescaled to unit variance, using \\\[\\sigma\_j^{2}=\\frac{1}{n}\\sum\_{i=1}^{n}\\bigl(x\_j^{(i)}\\bigr)^{2}\\\] and dividing each value by σ.

The covariance matrix is computed as \\\[CM=\\frac{1}{n}\\sum\_{i=1}^{n}x\_i x\_i^{T}\\\]. Its eigenvectors are sorted by eigenvalue, the top k form the matrix w, and each sample is projected with \\\[y=w^{T}x\\\] to a k-dimensional vector.

Ten of 45 features gives 22.22% for UNSW-NB15, and ten of 79 gives 12.65% for CIC-IDS2017.

The authors fixed 10 components for both datasets to test performance at these lower ratios, and Figure 9 depicts the process.

## Classifiers and evaluation split

The data is split into training and testing subsets, and a 10-fold cross-validation with k set to 10 is used. Each fold is held out in turn, so the model is tested on different subsets of the data.

The Decision Tree chooses splits by information gain or the Gini index. The authors give \\\[\\mathrm{Gini}(D)=1-\\sum\_{i=1}^{n}p\_i^{2}\\\] and \\\[\\mathrm{Gain}(A)=\\mathrm{Entropy}(D)-\\mathrm{Entropy}\_{A}(D)\\\].

Random Forest builds each tree on a bootstrap resample and combines the trees by majority vote.

Extra Trees build each tree on the whole learning sample and choose cut-points at random. The authors describe the ensemble as a set of unpruned randomized trees.

XGB minimizes an objective written as \\\[O(\\theta)=L(\\theta)+\\Omega(\\theta)\\\], where L is the training loss and Ω is the regularization term. Ω controls complexity through γ, the number of terminal nodes T, and the leaf weights w, with λ scaling the weight term.

## UNSW-NB15 accuracy with 10 features

The authors note that XGB has the lowest accuracy of the four in binary and multilabel classification.

In multilabel classification the accuracy was 99.79% for DT, 99.95% for RF, 99.95% for ET and 95.04% for XGB. RF and ET are the highest in both tasks on this dataset.

Table 13 places these values beside earlier UNSW-NB15 results, such as 98.43 binary for Moualla et al (2021) and 98.67 binary and 97.37 multilabel for Ahmad et al (2021). Those works use their own balancing and feature choices, so the rows show context rather than a controlled comparison.

## CIC-IDS2017 accuracy, confusion rates and AUC

In binary classification, accuracy was 99.91% for DT, 99.94% for RF, 99.95% for ET and 99.65% for XGB. In multilabel classification it was 99.99% for DT, RF and ET, and 99.94% for XGB.

In the binary confusion matrices the false positive rate is 0.0% for DT, RF and ET and 0.17% for XGB. The false negative rates are 0.08% for DT, 0.06% for RF, 0.05% for ET and 0.18% for XGB.

The authors attribute the close RF and ET results to RF's bootstrap resampling with best-split selection, and to ET's use of the whole sample with random splits.

Binary AUC values are 99.92% for DT, 99.98% for RF, 99.97% for ET and 99.99% for XGB. In multiclass classification the AUC is 99.99% for DT and 100% for RF, ET and XGB.

## CIC-IDS2018 accuracy and the all-features comparison

The discussion gives 99.94% for DT, 99.93% for RF, 99.94% for ET and 99.87% for XGB on CIC-IDS2018.

The CIC-IDS2018 comparison also includes an All Features scenario without oversampling. The authors report that the accuracy gain is larger for the proposal features than for all features.

## Limitations and inconsistent reported values

The authors state that they did not employ deep learning models or optimization techniques, and they plan to add DNN, RNN or hybrid models later.

CIC-IDS2018 was sampled at 10% per class because of computational resource constraints, so its figures do not describe the full dataset.

The discussion gives 99.95% for binary ET on CIC-IDS2017, matching Table 14, while the results summary gives 99.99% for the same binary case. For CIC-IDS2018, RF is 99.93% in the discussion and 99.94% in Table 15 and the conclusion.

Section 6 gives asymptotic time expressions for DT, RF, MLP, KNN, LGB and XGB, and the text reports no measured run times for the proposed pipeline.

The steps place data splitting after RO, SFE and PCA, and the text does not say whether these steps were fitted inside each cross-validation fold. The reduction ratio uses 45 input features for UNSW-NB15, while the dataset description gives 49 features with the class label, and the text does not reconcile the two.

## Paper info

- **Authors**: Md. Alamin Talukder, Md. Manowarul Islam, Md Ashraf Uddin, Khondokar Fida Hasan, Selina Sharmin, Salem A. Alyami, Mohammad Ali Moni
- **Venue**: arXiv · Preprint
- **First published**: 2024-1-22
- **Added**: 2026-11-6
- **Updated**: 2024-1-22
- **Version**: v1
- **arXiv**: 2401.12262
- **Category**: cs.CR · cs.LG
- **Original paper terms**: [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)
- **What we show**: Paper info, commentary and permitted figures from the original paper

[Original paper ↗](https://arxiv.org/abs/2401.12262v1) · [PDF ↗](https://arxiv.org/pdf/2401.12262v1)

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

## Abstract

Cybersecurity has emerged as a critical global concern. Intrusion Detection Systems (IDS) play a critical role in protecting interconnected networks by detecting malicious actors and activities. Machine Learning (ML)-based behavior analysis within the IDS has considerable potential for detecting dynamic cyber threats, identifying abnormalities, and identifying malicious conduct within the network. However, as the number of data grows, dimension reduction becomes an increasingly difficult task when training ML models. Addressing this, our paper introduces a novel ML-based network intrusion detection model that uses Random Oversampling (RO) to address data imbalance and Stacking Feature Embedding based on clustering results, as well as Principal Component Analysis (PCA) for dimension reduction and is specifically designed for large and imbalanced datasets. This model's performance is carefully evaluated using three cutting-edge benchmark datasets: UNSW-NB15, CIC-IDS-2017, and CIC-IDS-2018. On the UNSW-NB15 dataset, our trials show that the RF and ET models achieve accuracy rates of 99.59% and 99.95%, respectively. Furthermore, using the CIC-IDS2017 dataset, DT, RF, and ET models reach 99.99% accuracy, while DT and RF models obtain 99.94% accuracy on CIC-IDS2018. These performance results continuously outperform the state-of-art, indicating significant progress in the field of network intrusion detection. This achievement demonstrates the efficacy of the suggested methodology, which can be used practically to accurately monitor and identify network traffic intrusions, thereby blocking possible threats.

## Quote from the paper

Md. Alamin Talukder, Md. Manowarul Islam, Md Ashraf Uddin, Khondokar Fida Hasan, Selina Sharmin, Salem A. Alyami, Mohammad Ali Moni (2024). Machine learning-based network intrusion detection for big and imbalanced data using oversampling, stacking feature embedding and feature extraction. arXiv:2401.12262v1. https://arxiv.org/abs/2401.12262v1

**BibTeX**

```
@misc{talukder2024machine,
  title = {{Machine learning-based network intrusion detection for big and imbalanced data using oversampling, stacking feature embedding and feature extraction}},
  author = {Md. Alamin Talukder and Md. Manowarul Islam and Md Ashraf Uddin and Khondokar Fida Hasan and Selina Sharmin and Salem A. Alyami and Mohammad Ali Moni},
  year = {2024},
  eprint = {2401.12262},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2401.12262v1}
}
```

## Other paper commentary

- [Deep Visual Attention Prediction](https://refivu.com/en/papers/f63842a2-f64a-4970-8075-0c7abdfe8be0-deep-visual-attention-prediction.md)
- [DL-Droid: Deep learning based android malware detection using real devices](https://refivu.com/en/papers/e8c4fb2d-bb8d-43c7-b570-745e501ed499-dl-droid-deep-learning-based-android-malware-detection.md)
- [A Deep Learning Approach for Brain Tumor Classification and Segmentation Using a Multiscale Convolutional Neural Network](https://refivu.com/en/papers/c75a012b-6db8-4ef0-a0e2-0109acd56af3-a-deep-learning-approach-for-brain-tumor-classification.md)
- [Geometric Feature-Based Facial Expression Recognition in Image Sequences Using Multi-Class AdaBoost and Support Vector Machines](https://refivu.com/en/papers/35c52440-dea0-43bf-acc7-d2f2458fe00a-geometric-feature-based-facial-expression-recognition-in.md)
- [Image-to-Image Translation with Conditional Adversarial Networks](https://refivu.com/en/papers/92d09be2-7a1b-4f53-9d24-569d7cc94149-image-to-image-translation-with-conditional-adversarial.md)
- [Rethinking the Inception Architecture for Computer Vision](https://refivu.com/en/papers/5a8c1d5f-a10c-4a76-a110-b62861a7dc8a-rethinking-the-inception-architecture-for-computer-vision.md)
- [Mastering the Game of Stratego with Model-Free Multiagent Reinforcement Learning](https://refivu.com/en/papers/c8ba1a5f-8040-4096-92b0-d848951ca124-mastering-the-game-of-stratego-with-model-free.md)
- [Learning Agile Soccer Skills for a Bipedal Robot with Deep Reinforcement Learning](https://refivu.com/en/papers/3ef41329-5e9b-477a-9ece-c7d4b12b603d-learning-agile-soccer-skills-for-a-bipedal-robot.md)
- [Quantum agents in the Gym: a variational quantum algorithm for deep Q-learning](https://refivu.com/en/papers/61131563-04fb-4585-b080-efba1e8d4a85-quantum-agents-in-the-gym-a-variational-quantum.md)
- [Real-World Humanoid Locomotion with Reinforcement Learning](https://refivu.com/en/papers/8e42e14f-83b7-4879-ab8c-1bd8a7bcea8a-real-world-humanoid-locomotion-with-reinforcement-learning.md)
- [Weakly-Supervised Convolutional Neural Networks for Multimodal Image Registration](https://refivu.com/en/papers/bfc7dfd6-1596-4541-9723-c26ab0c5a3f5-weakly-supervised-convolutional-neural-networks-for.md)
- [Variational Quantum Circuits for Deep Reinforcement Learning](https://refivu.com/en/papers/f6af79b4-b092-4c2a-8589-70b19b37fcc5-variational-quantum-circuits-for-deep-reinforcement-learning.md)

## Terms in this paper

- [Accuracy](https://refivu.com/en/terms/1995c0cd6282-accuracy)
- [random forest](https://refivu.com/en/terms/e69b7b54f2ea-random-forest)
- [decision tree](https://refivu.com/en/terms/3158e0807c66-decision-tree)
- [binary classification](https://refivu.com/en/terms/800bc06db3f8-binary-classification)
- [clustering](https://refivu.com/en/terms/d6caf59cf624-clustering)
- [Principal Component Analysis (PCA)](https://refivu.com/en/terms/84a4d2030ed5-principal-component-analysis-pca)
- [k-fold cross-validation](https://refivu.com/en/terms/0ad05af8de0e-k-fold-cross-validation)
- [Extreme Gradient Boosting](https://refivu.com/en/terms/2fad2c2f8094-extreme-gradient-boosting)
- [Standardization](https://refivu.com/en/terms/26b16247adaa-standardization)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/ffcd2c90-0ecb-4bf2-968e-883dd5d0ec8e-machine-learning-based-network-intrusion-detection-for-big)
