Skip to content
Open access

Cost-Sensitive Stacking Ensemble with Hybrid Feature Selection for Rare Attack Detection in Network Intrusion Detection Systems

Jul 2026 · Electronics · Vol 15, pp. 3094 · 0 citations · 34 references

TL;DR

The results show that cost-sensitive learning is a simple and practical mechanism for improving rare-attack visibility, but also reveal a remaining limitation for R2L detection, where feature overlap with Normal traffic remains substantial.

Abstract

Machine learning-based network intrusion detection systems are often optimized using aggregate accuracy, although operational security depends on the reliable detection of rare, high-impact attacks. This paper proposes a data-preserving intrusion detection framework that combines hybrid feature selection, heterogeneous ensemble learning and cost-sensitive optimization for imbalanced multi-class attack detection. The method first applies Mutual Information filtering and Recursive Feature Elimination to reduce the NSL-KDD feature space from 122 one-hot encoded attributes to 25 discriminative features. Four classifiers, Random Forest, XGBoost, Support Vector Machine and K-Nearest Neighbors, are evaluated individually, and a stacking ensemble is constructed using Logistic Regression as a meta-learner. Class imbalance is addressed by balanced class weighting rather than by synthetic oversampling, preserving the original minority-class observations. Experiments on the NSL-KDD benchmark show that the proposed cost-sensitive configuration improves rare attack recognition, most notably increasing U2R recall from 0.00% to 35.82% (24 of 67 test instances) for the stacking ensemble; this improvement, together with the accompanying weighted F1-score change from 0.7120 to 0.7214, is statistically significant under the Wilcoxon signed-rank test across repeated random seeds, and both values are reported with their variability rather than as single point estimates. SVM obtains the largest global gain, with a 7.06 percentage point improvement in weighted F1-score. The results show that cost-sensitive learning is a simple and practical mechanism for improving rare-attack visibility, but also reveal a remaining limitation for R2L detection, where feature overlap with Normal traffic remains substantial. The revised validation design explicitly includes direct resampling baselines, repeated-seed evaluation, statistical significance testing, feature-subset sensitivity analysis, and absolute true-positive counts for R2L and U2R in order to avoid overinterpreting marginal point-estimate gains. All experiments, including the resampling comparison, the component ablation, the feature-subset sensitivity analysis and the repeated-seed statistical evaluation, are executed on the complete KDDTrain+ training set of 125,973 instances under a single unified protocol, so that every reported per-class value refers to the same experimental setting. The revised study additionally reports probability-level evaluation for the primary model, including class-level PR-AUC, precision-recall curves and a U2R threshold and alert-budget analysis, and validates the framework externally on the UNSW-NB15 benchmark, where balanced class weighting raises the recall of the rarest categories (Worms, Shellcode, Backdoor) from near-zero baseline levels to 69–96% under an identical protocol.

Read PDF

Similar papers

Open access Sep 2026

CLEAR-IDS: Leakage-Free Adaptive Resampling and Diversity-Weighted Explainable Ensemble Learning for Network Intrusion Detection

Reliable network intrusion detection requires more than high aggregate accuracy because data leakage, severe class imbalance, unstable feature selection, redundant ensemble decisions, and poorly calibrated probabilities can produce optimistic yet operationally weak results. This study presents CLEAR-IDS, a cross-fold l...

1Muna Al-Saadi · 0 citations
Open access 2025

Robustness-Aware Machine Learning for Network Intrusion Detection under Feature and Distribution Variations Using UNSW-NB15

Network intrusion-detection models are commonly evaluated with a fixed training and testing configuration. Such an evaluation does not fully show how a classifier behaves when feature values or class distributions change. This paper evaluates the robustness of a Random Forest model using the UNSW-NB15 dataset. The expe...

D. P., H. S · 0 citations
Open access Aug 2026

Random Forest-Based Network Intrusion Detection with Feature Selection and Class Balancing on UNSW-NB15 Traffic

Machine-learning intrusion detection is challenged by attacks resembling legitimate traffic and by class imbalance. This study evaluates Random Forest detection on the UNSW-NB15 dataset for five binary attack-versus-normal tasks: DoS, Exploit, Backdoor, Analysis, and Reconnaissance. Categorical attributes were label-en...

J. Pospíchal, A. Augustín, L. Huraj et al. · 0 citations
Conference Aug 2026

A Lightweight Hybrid CNN–Gradient Boosting Framework for Real-Time Network Intrusion Detection

Network intrusion detection systems must distinguish malicious from benign traffic under realistic conditions where attack types seen at deployment time may not have appeared during training. This paper presents a lightweight hybrid framework combining a compact one-dimensional convolutional neural network (CNN), used...

S. Satla, M. N. Rao, Tejaswi Katari et al. · 0 citations
Conference Sep 2026

Network intrusion detection based on strict validation-guided hybrid feature selection and LightGBM

Network intrusion detection often involves high-dimensional and redundant traffic features. This paper proposes a validation-guided MI-RF feature selection method with LightGBM for binary intrusion detection. Mutual information and random forest importance are combined to rank features from statistical dependency and e...

Fan Zhou, Kai Yan, Fei He · 0 citations
Open access 2026

Network Intrusion Detection With Contrastive Learning and Transformer

A Transformer-based network intrusion detection system (t-NIDS) that integrates a Transformer encoder with contrastive learning to learn discriminative and robust feature representations for network traffic classification is proposed, suitable for practical deployment in real-world network intrusion detection environme...

Gyu-Bum Han, Byung-Chang Chung · 0 citations

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.