An Ensemble Machine Learning Approach for Detecting Intrusion using Advance Feature Selection Technique

Md Raihan Al Masud, Hossen Asiful MustafaarXiv 2026

TL;DR

Finding stealthy, rare cyberattacks in a sea of normal network traffic is a classic "needle in a haystack" problem—one where even heavy-duty deep learning models often miss the needle. This paper shows that pairing a fast statistical feature filter with a surprisingly simple ensemble of Naive Bayes classifiers dramatically boosts the detection of rare attack types, outperforming more complex neural networks without needing every piece of network data.

What Problem Does This Paper Address?

Imagine trying to train a security guard to spot four types of intruders. One type (Denial of Service, or DoS) barges through the front door thousands of times a day, making them easy to learn and spot. Another type—say, a User-to-Root (U2R) attacker quietly escalating privileges from the inside—shows up almost never.

Network Intrusion Detection Systems (NIDSs) face this exact dilemma: severe class imbalance. Traditional machine learning and modern deep learning models tend to optimize for the majority classes (Normal traffic and DoS attacks) to get a high overall accuracy score, while largely failing to catch rare but devastating intrusions like U2R and Remote-to-Local (R2L) attacks. Furthermore, many existing studies lump all attacks together when reporting recall, hiding poor performance on minority classes, and rely on bloated feature sets to make predictions. The authors set out to improve detection rates specifically for each individual attack category while trimming down the number of input features required.

Methods

Instead of reaching for an oversized deep neural network, the authors combine classical statistical filtering with ensemble learning.

First, they clean the network data (dropping constant and non-categorical noise to leave 39 candidate features), encode text labels into numbers, and standardize numerical values. For feature selection, they use a fast chi-square ($\chi^2$) filter test to measure how strongly each feature correlates with the traffic class. Features are ranked by their statistical significance (ascending p-values, where smaller means more informative), and the authors systematically test subsets from the top 1 up to all 39 features.

Data preparation and chi-square feature selection stages

Next, they feed these ranked feature subsets into two competing ensemble strategies:

  • Bagging_NB (Proposed): Bootstrap Aggregation ("Bagging") using Naive Bayes as the base learner. Bagging trains multiple models in parallel on random, replacement-sampled slices of the data and takes a majority vote, reducing variance and curbing overfitting.
  • Boosting_DT: A sequential Boosting ensemble using Decision Trees, where each new tree focuses more heavily on the mistakes of the previous ones.
Model development and evaluation pipeline

Datasets

The models are trained and evaluated on the NSL-KDD benchmark dataset (from the Canadian Institute for Cybersecurity), an improved version of the classic KDD Cup 99 dataset.

  • Splits: KDDTrain+ (125,973 samples) for training and KDDTest+ (22,544 samples) for evaluation.
  • The Imbalance: In the training set, there are 67,343 Normal records and 45,927 DoS attacks, compared to just 995 R2L attacks and a minuscule 52 samples of U2R attacks. Notably, the test set includes specific attack subtypes that do not appear in the training set, testing the model's ability to spot unknown anomalies.

Key Insights and Ideas

  • Simpler ensembles beat deep nets on rare classes: While deep learning models like CNNs and DNNs dominate DoS detection, a bagged Naive Bayes ensemble is remarkably sensitive to minority classes—likely because Naive Bayes handles small sample regimes well without overfitting to majority-class boundaries, and bagging stabilizes its predictions.
  • Different attacks peak at different feature counts: Looking at feature subsets one by one revealed that there is no universal "magic number" of features for all attacks in isolation—for instance, with Bagging_NB, U2R detection actually peaked at just 12 features, whereas R2L needed over 36. However, 36 features emerged as the sweet spot for strong overall multiclass attack detection.
  • Looking beyond overall accuracy: By evaluating class-specific Detection Rates (True Positive Rates) and plotting per-class Precision–Recall curves, the authors expose trade-offs that single-number accuracy metrics completely mask in imbalanced security datasets.

Key Results

Using 36 selected features, the proposed Bagging_NB model achieved the highest detection rates for three out of four attack categories compared to both Boosting_DT and established baselines in the literature (including CNN, DNN, Random Forest, and SVM):

  • Probe attacks: 91% detection rate (surpassing DNN's 77% and CNN's 73%, and achieving the highest area under the precision–recall curve).
  • U2R attacks (the rarest class): 60% detection rate—more than double the best deep learning baseline (DNN at 26%) and far ahead of CNN (8%) and Random Forest (1%).
  • R2L attacks: 33% detection rate (edging out DNN's 30% and DeciTree's 21%).
  • DoS attacks: 82% detection rate, remaining competitive with top performers like CNN (85%) and DNN/DeciTree (84%).
  • Meanwhile, Boosting_DT lagged behind on minority classes, managing 78% (DoS), 69% (Probe), 4% (R2L), and 15% (U2R).

Limitations and Future Work

There is one major catch—and the authors are upfront about it: while Bagging_NB is stellar at catching attacks, it performs poorly at identifying normal traffic. Looking at its confusion matrix, only 16% of normal test traffic was classified as normal, with 74% misclassified as DoS (implying a high false-alarm rate in practice).

For future work, the authors plan to:

  • Measure false-positive rates and processing times to see if the approach is viable for real-time network monitoring.
  • Explore alternative classifier combinations to boost R2L and U2R detection even further (since 33% and 60% still leave room for improvement).
  • Test the pipeline on newer, modern network-attack datasets beyond NSL-KDD.

Summary updated

BibTeX
@misc{masud2026ensemble,
  author = {Md Raihan Al Masud and Hossen Asiful Mustafa},
  title = {{An Ensemble Machine Learning Approach for Detecting Intrusion using Advance Feature Selection Technique}},
  year = {2026},
  eprint = {2611.35058},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.35058},
}
Figure