nCMD: Benign-Anchored Feature Selection for Imbalanced Network Intrusion Detection
Summary
This paper introduces nCMD, a benign-anchored feature selection method for imbalanced network intrusion detection that scores features by deviation from benign class mean, outperforming classical filters on benchmark datasets.
View Cached Full Text
Cached at: 06/10/26, 06:18 AM
# nCMD: Benign-Anchored Feature Selection for Imbalanced Network Intrusion Detection
Source: [https://arxiv.org/html/2606.09934](https://arxiv.org/html/2606.09934)
###### Abstract
Feature selection is critical for network intrusion detection systems \(NIDS\) operating under high\-dimensional, highly imbalanced traffic, as found in operational and defense networks\. Traditional filter methods rank features using global statistics computed symmetrically across classes, and thus fail to capture the asymmetry of intrusion detection, where attacks are best characterized as deviations from dominant benign traffic\. We propose benign\-anchored Classwise Mean Deviation \(nCMD\), a lightweight and interpretable method that scores feature relevance by the deviation of attack\-class distributions from the benign\-class mean rather than a globally biased reference, aligning selection with the operational semantics of NIDS at no additional computational cost\. Across four benchmark datasets—CICIDS2017, CICDDoS2019, NSL\-KDD, and UNSW\-NB15—multiple feature budgets, and three downstream classifiers, nCMD matches or exceeds classical filter baselines in macro\-averaged F1\-score, attaining the best result on three of the four datasets and under every classifier, with its advantage most pronounced under tight feature budgets and severe class imbalance\. These results support benign\-anchored ranking as a scalable, interpretable preprocessing component for resource\-constrained NIDS\.
## IIntroduction
Network intrusion detection systems \(NIDS\) operate in a fundamentally asymmetric regime: traffic is high\-dimensional and overwhelmingly benign, while attacks are sparse and diverse, ranging from high\-volume denial\-of\-service floods to low\-rate reconnaissance\[[16](https://arxiv.org/html/2606.09934#bib.bib2),[15](https://arxiv.org/html/2606.09934#bib.bib3),[17](https://arxiv.org/html/2606.09934#bib.bib8)\]\. This extreme class imbalance is intrinsic to operational networks, not an artifact of datasets, and is a long\-standing challenge for learning\-based detection\[[7](https://arxiv.org/html/2606.09934#bib.bib12),[4](https://arxiv.org/html/2606.09934#bib.bib9)\]\. The challenge is amplified in defense and tactical environments, where detection must run on resource\-constrained edge nodes, meet tight latency budgets, and remain interpretable enough for operators to trust\. In such settings benign baselines are abundant while curated attack samples are scarce, making lightweight, interpretable preprocessing that preserves attack\-relevant signal especially valuable\.
Among feature selection strategies,*filter\-based*methods are widely adopted in security pipelines for their efficiency, model independence, and compatibility with real\-time constraints\[[8](https://arxiv.org/html/2606.09934#bib.bib7),[3](https://arxiv.org/html/2606.09934#bib.bib13),[13](https://arxiv.org/html/2606.09934#bib.bib10)\]\. Classical filters—Variance Thresholding, Mutual Information, Pearson correlation, and Fisher\-style criteria—rank features using global statistics computed symmetrically across classes\[[19](https://arxiv.org/html/2606.09934#bib.bib14),[5](https://arxiv.org/html/2606.09934#bib.bib15)\], implicitly assuming equal class importance\. In intrusion detection this assumption is misaligned with the problem: benign traffic defines the operational baseline, and attacks are best characterized as deviations from it\[[17](https://arxiv.org/html/2606.09934#bib.bib8),[4](https://arxiv.org/html/2606.09934#bib.bib9)\]\. Because global statistics are dominated by the benign majority, symmetric relevance scores can suppress signals from minority attack classes, systematically under\-ranking features that capture rare but critical threats\[[7](https://arxiv.org/html/2606.09934#bib.bib12)\]\. Redundancy\-aware extensions such as mRMR partially address feature dependency but add overhead and retain symmetric relevance definitions\[[6](https://arxiv.org/html/2606.09934#bib.bib18),[12](https://arxiv.org/html/2606.09934#bib.bib21)\], leaving the semantic misalignment unresolved\.
Recent work introduced*Classwise Mean Deviation*\(CMD\), showing that simple mean\-shift statistics are an effective relevance signal for intrusion detection while retaining linear complexity and interpretability\[[1](https://arxiv.org/html/2606.09934#bib.bib1)\]\. CMD ranks features by aggregating class\-wise deviations from a*global*reference mean\. However, under heavy imbalance this global mean is itself biased toward the benign class, diluting the contribution of minority attack classes—motivating a principled refinement\.
We propose*benign\-anchored Classwise Mean Deviation*\(nCMD\), which replaces the global reference with the benign\-class mean\. Anchoring relevance to normal traffic aligns feature scoring with the operational objective of intrusion detection—identifying deviations from benign behavior—and amplifies discriminative signals from attack classes\. Crucially, this refinement comes at*no additional cost*: nCMD preserves the linear\-time efficiency, interpretability, and modularity of CMD, making it well suited to large\-scale, real\-time deployment on constrained platforms\.
We evaluate nCMD against four classical filter baselines and the original CMD across multiple feature budgets, four benchmark datasets—CICIDS2017\[[16](https://arxiv.org/html/2606.09934#bib.bib2)\], CICDDoS2019\[[15](https://arxiv.org/html/2606.09934#bib.bib3)\], NSL\-KDD\[[18](https://arxiv.org/html/2606.09934#bib.bib6)\], and UNSW\-NB15\[[9](https://arxiv.org/html/2606.09934#bib.bib4)\]—and three downstream classifiers\. nCMD matches or exceeds these baselines in macro\-averaged F1\-score, attaining the best result on three of the four datasets and under every classifier, with its advantage most pronounced under tight feature budgets and severe imbalance—the regime most relevant to constrained operational deployment\.
Contributions\.
- •We propose*benign\-anchored Classwise Mean Deviation*\(nCMD\), aligning feature relevance with the asymmetric semantics of intrusion detection by measuring deviations from benign traffic, at no additional cost over symmetric mean\-deviation scoring\.
- •We evaluate nCMD across four benchmark datasets, multiple feature budgets, and three downstream classifiers against classical filter baselines and CMD, showing it attains the best macro\-F1 on three of four datasets and under every classifier\.
- •We provide a lightweight, interpretable, and efficient method suited to resource\-constrained NIDS deployment, and release the implementation for reproducibility\.111Code:https://github\.com/FuadAhmad/nCMD
## IIRelated Work
Feature selection has been extensively studied as a key preprocessing step for high\-dimensional data analysis\. Filter\-based approaches, including mutual information, correlation, and Fisher\-style methods, are widely used due to their computational efficiency and model independence\[[8](https://arxiv.org/html/2606.09934#bib.bib7),[19](https://arxiv.org/html/2606.09934#bib.bib14),[5](https://arxiv.org/html/2606.09934#bib.bib15)\]\. While effective in general machine learning tasks, these methods rely on global statistical measures that assume balanced class distributions\.
In the context of network intrusion detection, feature selection plays a critical role in improving detection performance and scalability\[[4](https://arxiv.org/html/2606.09934#bib.bib9),[13](https://arxiv.org/html/2606.09934#bib.bib10),[20](https://arxiv.org/html/2606.09934#bib.bib22)\]\. However, the highly imbalanced nature of network traffic presents significant challenges, as minority attack classes are often underrepresented\[[7](https://arxiv.org/html/2606.09934#bib.bib12)\]\. Traditional symmetric feature selection criteria may therefore fail to capture subtle deviations associated with rare but critical attack patterns\[[17](https://arxiv.org/html/2606.09934#bib.bib8)\]\. Recent work introduced Classwise Mean Deviation \(CMD\), which leverages mean\-shift statistics for feature ranking in intrusion detection\[[1](https://arxiv.org/html/2606.09934#bib.bib1)\]\. While effective and computationally efficient, CMD relies on a global reference mean and thus remains influenced by class imbalance\.
In contrast, this work proposes a benign\-anchored formulation that explicitly aligns feature relevance with deviations from normal traffic behavior, addressing the semantic asymmetry inherent in intrusion detection tasks\.
## IIIMethodology
The proposed nCMD method builds upon our prior Classwise Mean Deviation \(CMD\)\[[1](https://arxiv.org/html/2606.09934#bib.bib1)\]framework by explicitly anchoring feature relevance to benign traffic distributions\. This modification introduces a principled asymmetry aligned with intrusion detection semantics, resulting in improved discriminative feature ranking under class imbalance\.
Problem Setting\.LetD=\{\(xi,yi\)\}i=1ND=\\\{\(x\_\{i\},y\_\{i\}\)\\\}\_\{i=1\}^\{N\}denote a labeled network traffic dataset, where each samplexi∈ℝdx\_\{i\}\\in\\mathbb\{R\}^\{d\}is add\-dimensional feature vector andyi∈\{0,1,…,C\}y\_\{i\}\\in\\\{0,1,\\ldots,C\\\}is the corresponding class label\. The labely=0y=0denotes benign \(normal\) traffic, while labelsy∈\{1,…,C\}y\\in\\\{1,\\ldots,C\\\}correspond to different attack classes\. This formulation reflects the operational reality of NIDS, where benign traffic dominates and attacks are defined as deviations from normal behavior\.
Low\-Variance Feature Filtering\.Features with near\-zero empirical variance provide limited discriminative information and are especially sensitive to sampling noise\. We therefore remove features whose variance falls below a thresholdϵ\>0\\epsilon\>0:
Var\(𝐱j\)<ϵ\.\\mathrm\{Var\}\(\\mathbf\{x\}\_\{j\}\)<\\epsilon\.\(1\)This step reduces estimator variance and computational cost, and serves as a noise suppression stage prior to discriminative scoring\. In all experiments,ϵ\\epsilonis fixed across methods to ensure fair comparison\.
Benign\-Anchored Classwise Mean Deviation \(nCMD\)\.The core idea of the proposed method is to quantify feature relevance by measuring the deviation of attack\-class distributions relative to benign traffic along each feature dimension\. To this end, we first compute class\-wise mean vectors\. Letμc∈ℝd\\mu\_\{c\}\\in\\mathbb\{R\}^\{d\}denote the mean vector of classcc, computed over all samples with labely=cy=c\. In particular,μ0\\mu\_\{0\}denotes the benign\-class mean\.
For each feature dimensionj∈\{1,…,d\}j\\in\\\{1,\\ldots,d\\\}, we compute the normal\-anchored relevance score as:
Dj\(nCMD\)=∑c=1C\|μc,j−μ0,j\|\.D^\{\(\\mathrm\{nCMD\}\)\}\_\{j\}\\;=\\;\\sum\_\{c=1\}^\{C\}\\left\|\\mu\_\{c,j\}\-\\mu\_\{0,j\}\\right\|\.\(2\)This score measures the accumulated absolute deviation of attack\-class means from the benign mean along featurejj\. Features with largerDj\(nCMD\)D^\{\(\\mathrm\{nCMD\}\)\}\_\{j\}values exhibit stronger and more consistent deviations from normal behavior across attack classes and are therefore considered more informative for intrusion detection\. Importantly, the resulting nCMD scores remain interpretable as class\-aggregated mean\-shift magnitudes relative to benign behavior\.
Feature Ranking and Selection\.Features are ranked in descending order according to their nScores\. For a given feature budgetkk, the top\-kkranked features are selected and used to train downstream classifiers\. The score remains directly interpretable as a*mean\-shift magnitude*\. As a univariate filter, the proposed method does not depend on any specific learning algorithm and can be applied as a modular preprocessing step in diverse NIDS pipelines\.
Algorithm\.Algorithm[1](https://arxiv.org/html/2606.09934#alg1)summarizes the proposed nCMD feature selection procedure\. Unlike wrapper or embedded methods, the approach does not require iterative model training and operates solely on class\-wise summary statistics\. The computational complexity is linear in the number of samples and features, i\.e\.,𝒪\(Nd\)\\mathcal\{O\}\(Nd\), making it well\-suited for high\-dimensional network traffic datasets\.
Algorithm 1Feature Selection via Benign\-Anchored Classwise Mean Deviation \(nCMD\)0:Feature matrix
X∈ℝN×dX\\in\\mathbb\{R\}^\{N\\times d\}, label vector
yy, number of features
kk
0:Selected feature subset
𝒮k\\mathcal\{S\}\_\{k\}
1:Remove features with variance below threshold
ϵ\\epsilon
2:Impute missing values using feature\-wise means
3:Normalize features using Min–Max scaling
4:for
c=0c=0to
CCdo
5:Compute class\-wise mean vector
μc←mean\(Xy=c\)\\mu\_\{c\}\\leftarrow\\mathrm\{mean\}\(X\_\{y=c\}\)
6:endfor
7:foreach feature index
j=1j=1to
dddo
8:
Dj←0D\_\{j\}\\leftarrow 0
9:for
c=1c=1to
CCdo
10:
Dj←Dj\+\|μc,j−μ0,j\|D\_\{j\}\\leftarrow D\_\{j\}\+\|\\mu\_\{c,j\}\-\\mu\_\{0,j\}\|
11:endfor
12:endfor
13:Rank features in descending order of
DjD\_\{j\}
14:Select top\-
kkfeatures
𝒮k\\mathcal\{S\}\_\{k\}
15:return
𝒮k\\mathcal\{S\}\_\{k\}
## IVExperimental Setup
### IV\-ADatasets
We evaluate nCMD on four widely used intrusion detection benchmarks spanning modern large\-scale and legacy settings: CICIDS2017\[[16](https://arxiv.org/html/2606.09934#bib.bib2)\], CICDDoS2019\[[15](https://arxiv.org/html/2606.09934#bib.bib3)\], NSL\-KDD\[[18](https://arxiv.org/html/2606.09934#bib.bib6)\], and UNSW\-NB15\[[9](https://arxiv.org/html/2606.09934#bib.bib4)\]\.
CICIDS2017provides realistic traffic with diverse contemporary attacks \(e\.g\., brute force, denial\-of\-service\) over 88 flow\-based features, and is heavily imbalanced toward benign traffic\.CICDDoS2019focuses on diverse distributed denial\-of\-service variants under realistic multi\-protocol conditions, with benign traffic forming the overwhelming majority\.NSL\-KDD, a refined version of KDD’99 that removes its redundancy and bias, has 41 numerical and categorical features and four attack groups \(DoS, Probe, R2L, U2R\); despite its age it remains a standard benchmark\.UNSW\-NB15offers a more recent benchmark with 49 features, nine attack categories, and moderate class imbalance\.
### IV\-BBaselines
To rigorously assess the effectiveness of nCMD, we compare it against a set of widely used and conceptually relevant filter\-based feature selection methods\. All baselines are chosen for their computational efficiency, statistical grounding, and prior use in intrusion detection and high\-dimensional learning, ensuring a fair and meaningful comparison\.
- •Variance Thresholdremoves features with near\-zero variance, eliminating attributes that contribute little discriminative information\. This method is unsupervised and computationally inexpensive, making it a common preprocessing baseline\[[14](https://arxiv.org/html/2606.09934#bib.bib24)\]\.
- •Pearson Correlationranks features according to the absolute value of their linear correlation with the class label\. Features exhibiting stronger linear association with the target variable are considered more relevant\[[10](https://arxiv.org/html/2606.09934#bib.bib20)\]\.
- •Mutual Informationquantifies the statistical dependence between each feature and the target label, capturing both linear and non\-linear relationships\. Higher mutual information indicates greater predictive relevance\[[2](https://arxiv.org/html/2606.09934#bib.bib17)\]\.
- •Fisher Scoreevaluates feature importance using the ratio of inter\-class variance to intra\-class variance, favoring features that achieve strong class separation with minimal within\-class dispersion\[[5](https://arxiv.org/html/2606.09934#bib.bib15)\]\.
- •Class\-wise Mean Deviation \(CMD\)ranks features based on the sum of absolute deviations of class means from a global reference mean\[[1](https://arxiv.org/html/2606.09934#bib.bib1)\]\. CMD serves as a direct and essential baseline in this study, as nCMD is derived from CMD by replacing the global reference with a benign\-class anchor\.
For each method, features are ranked and the top\-kkfeatures are selected for evaluation, ensuring consistent comparison across different feature budgets\.
### IV\-CClassification and Evaluation Protocol
Experiments use Python 3\.12 withscikit\-learn\[[11](https://arxiv.org/html/2606.09934#bib.bib33)\]andpandas, with Fisher Score implemented following\[[5](https://arxiv.org/html/2606.09934#bib.bib15)\]\. We compare nCMD against four classical filter baselines—Variance Threshold, Pearson Correlation, Mutual Information, and Fisher Score—and the original CMD, from which nCMD is derived\. For every method, the top\-kkfeatures are selected on the training data using identical partitions to ensure fair comparison, with a uniform variance threshold ofε=0\.0\\varepsilon=0\.0removing only constant features\.
To verify that gains are not model\-specific, we evaluate three downstream classifiers of differing capacity: a three\-hidden\-layer MLP \(\{64,128,64\}\\\{64,128,64\\\}\), a single\-hidden\-layer MLP, and a Decision Tree; the MLPs use the Adam optimizer with learning rate10−310^\{\-3\}\. Unless stated otherwise, main\-text results use the three\-hidden\-layer MLP\. For datasets with canonical splits \(NSL\-KDD, UNSW\-NB15\) we use them directly, yielding single\-split estimates; otherwise \(CICIDS2017, CICDDoS2019\) we report the mean and standard deviation over stratified 5\-fold cross\-validation\. We report Accuracy, Macro\-F1, and Weighted\-F1, emphasizing Macro\-F1 for its equal weighting of all classes and sensitivity to minority attacks\. All experiments run on an Intel Core i9\-10980XE CPU with an NVIDIA RTX A4000 GPU\.
## VResults and Discussion
### V\-APerformance Under Tight Feature Budgets
We first evaluate feature selection under extremely constrained settings, where only a small number of features are available \(k=5k=5\)\. Tables[I](https://arxiv.org/html/2606.09934#S5.T1)and[II](https://arxiv.org/html/2606.09934#S5.T2)report classification performance on CICIDS2017 and CICDDoS2019, respectively, using the three\-hidden\-layer MLP\.
TABLE I:Classification performance under a tight feature budget \(k=5k=5\) on the highly imbalanced CICIDS2017 dataset\.TABLE II:DDoS\-focused classification performance comparison of feature selection methods using a tight feature budget \(k=5k=5\) on the CICDDoS2019 dataset\.On CICIDS2017, nCMD achieves the highest Macro\-F1 \(0\.46110\.4611\), edging out CMD \(0\.45630\.4563\) and substantially exceeding the classical filters, the strongest of which \(Pearson Correlation\) reaches only0\.39740\.3974\. Mutual Information attains the highest accuracy but a markedly lower Macro\-F1, reflecting a bias toward the dominant benign class; nCMD instead maintains balanced performance across classes, indicating greater sensitivity to minority attack categories—the property that matters most under severe imbalance\.
On CICDDoS2019, nCMD attains the best score on all three metrics, including Macro\-F1 \(0\.72780\.7278\), narrowly ahead of CMD and Fisher Score \(both0\.72440\.7244\)\. The margins here are small: the leading methods cluster within roughly0\.0050\.005Macro\-F1, which is expected given that CICDDoS2019 is dominated by a few high\-volume DDoS classes that are strongly separable from benign traffic regardless of the reference anchor\. Even so, anchoring relevance to benign behavior is never detrimental at this budget and yields the top result\.
### V\-BPerformance Across Varying Feature Budgets
To assess robustness under different resource constraints, we evaluate all methods across feature subset sizes fromk=5k=5tok=40k=40on CICIDS2017\. Table[III](https://arxiv.org/html/2606.09934#S5.T3)reports Macro\-F1 at each budget, and Fig\.[1](https://arxiv.org/html/2606.09934#S5.F1)visualizes the trends\.
TABLE III:Macro\-averaged F1\-score comparison across different feature selection methods and varying numbers of selected features \(5–40\) on the highly imbalanced CICIDS2017 dataset\.Figure 1:Macro\-averaged F1\-score across feature subset sizes \(k=5k=5–40\) for the proposed and baseline methods on the highly imbalanced CICIDS2017 dataset\.nCMD attains the best Macro\-F1 at four of the five budgets, and is the strongest of the two mean\-deviation methods at every budget exceptk=20k=20, where CMD leads by0\.01340\.0134\. The gap between the two is otherwise consistently in nCMD’s favor \(e\.g\.,\+0\.0189\+0\.0189atk=30k=30and\+0\.0191\+0\.0191atk=10k=10\), indicating that benign anchoring improves feature ranking in both tightly constrained and more expressive regimes\. Critically, both mean\-deviation methods dominate the classical filters across the entire range: atk=5k=5, nCMD reaches0\.46110\.4611Macro\-F1 versus0\.39740\.3974for the best classical baseline, a margin that is operationally meaningful when feature budgets are dictated by edge\-device constraints\.
The classical filters also exhibit markedly less stable behavior across budgets\. Variance Thresholding, in particular, degrades sharply as features are removed—from0\.72020\.7202atk=40k=40to0\.43970\.4397atk=20k=20—indicating that purely unsupervised, symmetric criteria can fail to preserve discriminative features when the subset is small\. By contrast, the benign\-anchored ranking retains attack\-relevant features more reliably under tight budgets, which is the regime of greatest practical interest for deployable NIDS\.
### V\-CCross\-Dataset Generalization
We evaluate the generalization of nCMD across all four benchmarks using the top\-40 selected features and a three\-hidden\-layer MLP, with results summarized in Table[IV](https://arxiv.org/html/2606.09934#S5.T4)\. nCMD attains the highest macro\-F1 on three of the four datasets—CICIDS2017, NSL\-KDD, and UNSW\-NB15—and remains competitive on the fourth\. Relative to CMD, its closest baseline and the method it directly refines, nCMD improves macro\-F1 on three datasets, with the largest gain on the legacy NSL\-KDD benchmark \(0\.3124→0\.34290\.3124\\rightarrow 0\.3429,\+0\.0305\+0\.0305\) and consistent gains on CICIDS2017 \(\+0\.0097\+0\.0097\) and UNSW\-NB15 \(\+0\.0094\+0\.0094\)\.
The single exception is CICDDoS2019, where nCMD \(0\.72760\.7276\) trails CMD \(0\.73200\.7320\) by a narrow margin\. Notably, this dataset is dominated by a small number of high\-volume DDoS classes whose distributions differ strongly from benign traffic regardless of the reference point; here the top filter methods \(CMD, Fisher, and nCMD\) cluster within0\.0050\.005macro\-F1 of one another, indicating that the choice of anchor has limited effect when attack classes are large and clearly separable\. The benefit of benign anchoring is instead most evident on datasets with greater attack\-class diversity and more severe minority underrepresentation, such as NSL\-KDD and UNSW\-NB15, which is consistent with the motivation of the method\.
Overall, these results indicate that nCMD generalizes across both modern \(CICIDS\-series\) and legacy \(NSL\-KDD, UNSW\-NB15\) benchmarks, and that benign anchoring yields the clearest advantage precisely in the diverse, highly imbalanced regimes that characterize operational network defense\.
TABLE IV:Macro\-averaged F1\-score \(mean±\\pmstd over 5 fold CV\) using the top\-40 selected features with a three\-hidden\-layer MLP across four benchmark intrusion detection datasets\. NSL\-KDD and UNSW\-NB15 use their canonical predefined test splits, so variance is zero\. Best result per dataset inbold\.
### V\-DRobustness Across Downstream Classifiers
Because feature selection is a preprocessing step, a useful selector should improve performance independently of the downstream model\. To test this, we re\-evaluate all methods on CICIDS2017 using three classifiers of differing capacity: a Decision Tree, a single\-hidden\-layer MLP, and the three\-hidden\-layer MLP used elsewhere in this work \(Table[V](https://arxiv.org/html/2606.09934#S5.T5)\)\. nCMD achieves the highest macro\-F1 under every classifier, and improves over CMD in all three cases \(\+0\.0052\+0\.0052for the Decision Tree,\+0\.0097\+0\.0097for the 3\-layer MLP, and\+0\.0146\+0\.0146for the 1\-layer MLP\)\. The advantage is largest for the lowest\-capacity model, suggesting that benign\-anchored ranking is particularly beneficial when the downstream classifier cannot compensate for poorly chosen features—an operationally relevant setting for lightweight, edge\-deployed detectors\.
TABLE V:Macro\-averaged F1\-score \(mean±\\pmstd\) on CICIDS2017 with top\-40 selected features across three downstream classifiers\. nCMD ranks first under every classifier, indicating that its advantage is not tied to a specific model\.
### V\-EDiscussion
The empirical results support the central hypothesis of this work: feature relevance in intrusion detection is inherently asymmetric and is well measured relative to benign traffic behavior\. By anchoring classwise mean deviation to the benign class, nCMD provides a semantically aligned scoring mechanism that improves the visibility of minority attack classes, attaining the best macro\-F1 on three of the four benchmarks and on all three downstream classifiers\.
The pattern of results also clarifies*when*benign anchoring helps\. Its advantage is largest on datasets with diverse attack classes and severe minority underrepresentation, such as NSL\-KDD and UNSW\-NB15, and under tight feature budgets where the choice of relevance criterion is most consequential\. Conversely, on CICDDoS2019—dominated by a few high\-volume DDoS classes that are strongly separable from benign traffic—nCMD, CMD, and Fisher Score perform near\-identically, indicating that the reference anchor matters little once attack classes are large and clearly distinguishable\. This is consistent with the formulation: for highly imbalanced data the global mean already lies close to the benign mean, so the two scores diverge most when attack classes are numerous and individually small\.
Notably, nCMD achieves these gains while preserving the key advantages of CMD and classical filters—linear computational complexity, interpretability, and ease of integration—at no additional cost\. The improvement is most pronounced for the lowest\-capacity classifier, suggesting that benign\-anchored ranking is especially valuable when the downstream model cannot compensate for poorly chosen features, as in lightweight, edge\-deployed detectors\. Overall, these findings indicate that a simple, semantically grounded modification to the feature relevance criterion can improve intrusion detection performance under class imbalance without increasing model complexity\.
## VILimitations and Scope
While nCMD performs strongly across multiple intrusion detection benchmarks, several limitations define its scope\.
First, nCMD is a*univariate, mean\-based*method, sensitive only to first\-order shifts\. Attacks that deviate from benign traffic through higher\-order characteristics—variance, temporal dependencies, or feature interactions—may be missed, in which case wrapper or embedded methods, or more expressive classifiers, may offer complementary benefits\.
Second, nCMD assumes a well\-defined benign class\. This holds in most supervised settings but is less applicable to unsupervised or open\-world scenarios where benign labels are unavailable or evolving; extending benign anchoring to such settings remains future work\.
Third, all attack classes contribute equally to the deviation score\. This emphasizes rare attacks but may underweight dominant categories; class\-dependent weighting could offer a tunable trade\-off between sensitivity to rare and frequent attacks\.
Finally, our evaluation relies on four benchmark datasets that may contain artifacts and biases, so results should be read within that context\. Validation on additional sources and live network traffic would further strengthen generalization claims\.
Despite these limitations, nCMD provides a simple, interpretable, and efficient feature ranking that improves detection under severe class imbalance while remaining scalable for practical deployment\.
## VIIConclusion
We proposed*benign\-anchored Classwise Mean Deviation*\(nCMD\), a lightweight, interpretable feature selection method that addresses the asymmetric, highly imbalanced nature of network intrusion detection by anchoring relevance to benign traffic\. Across four benchmark datasets—CICIDS2017, CICDDoS2019, NSL\-KDD, and UNSW\-NB15—and three downstream classifiers, nCMD matches or exceeds classical filter methods, attaining the best macro\-averaged F1\-score on three of the four datasets and under every classifier, with its advantage most pronounced under tight feature budgets and severe imbalance\. It achieves this while retaining the efficiency, interpretability, and ease of integration of filter\-based methods at no additional computational cost, making it well suited to scalable, resource\-constrained NIDS deployments such as those in defense and tactical networks\.
Future work will extend the benign\-anchored formulation to streaming and open\-world settings, incorporate higher\-order statistics to capture more complex attack behaviors, and evaluate nCMD in operational and adversarial environments\.
## References
- \[1\]A\. F\. Ahmad, J\. Liu, Q\. Gong, S\. Misra, and J\. Harikumar\(2025\)Feature selection via class\-wise mean deviation\.In2025 International Conference on Machine Learning and Applications \(ICMLA\),pp\. 698–703\.External Links:[Document](https://dx.doi.org/10.1109/ICMLA66185.2025.00100)Cited by:[§I](https://arxiv.org/html/2606.09934#S1.p3.1),[§II](https://arxiv.org/html/2606.09934#S2.p2.1),[§III](https://arxiv.org/html/2606.09934#S3.p1.1),[5th item](https://arxiv.org/html/2606.09934#S4.I1.i5.p1.1)\.
- \[2\]M\. Beraha, A\. M\. Metelli, M\. Papini, A\. Tirinzoni, and M\. Restelli\(2019\)Feature selection via mutual information: new theoretical insights\.arXiv preprint arXiv:1907\.07384\.Cited by:[3rd item](https://arxiv.org/html/2606.09934#S4.I1.i3.p1.1)\.
- \[3\]V\. Bolón\-Canedo, D\. Rego\-Fernández, D\. Peteiro\-Barral, A\. Alonso\-Betanzos, B\. Guijarro\-Berdiñas, and N\. Sánchez\-Maroño\(2018\)On the scalability of feature selection methods on high\-dimensional data\.Knowledge and Information Systems56,pp\. 395–442\.External Links:[Document](https://dx.doi.org/10.1007/s10115-017-1140-3),[Link](https://link.springer.com/article/10.1007/s10115-017-1140-3)Cited by:[§I](https://arxiv.org/html/2606.09934#S1.p2.1)\.
- \[4\]A\. L\. Buczak and E\. Guven\(2016\)A survey of data mining and machine learning methods for cyber security intrusion detection\.IEEE Communications Surveys & Tutorials\.Cited by:[§I](https://arxiv.org/html/2606.09934#S1.p1.1),[§I](https://arxiv.org/html/2606.09934#S1.p2.1),[§II](https://arxiv.org/html/2606.09934#S2.p2.1)\.
- \[5\]Q\. Gu, Z\. Li, and J\. Han\(2012\)Generalized fisher score for feature selection\.arXiv preprint arXiv:1202\.3725\.Cited by:[§I](https://arxiv.org/html/2606.09934#S1.p2.1),[§II](https://arxiv.org/html/2606.09934#S2.p1.1),[4th item](https://arxiv.org/html/2606.09934#S4.I1.i4.p1.1),[§IV\-C](https://arxiv.org/html/2606.09934#S4.SS3.p1.2)\.
- \[6\]M\. A\. Hall\(1999\)Correlation\-based feature selection for machine learning\.Ph\.D\. Thesis,University of Waikato\.External Links:[Link](https://www.lri.fr/~pierres/donnees/save/these/articles/lpr-queue/hall99correlationbased.pdf)Cited by:[§I](https://arxiv.org/html/2606.09934#S1.p2.1)\.
- \[7\]H\. He and E\. A\. Garcia\(2009\)Learning from imbalanced data\.IEEE Transactions on Knowledge and Data Engineering21\(9\),pp\. 1263–1284\.Cited by:[§I](https://arxiv.org/html/2606.09934#S1.p1.1),[§I](https://arxiv.org/html/2606.09934#S1.p2.1),[§II](https://arxiv.org/html/2606.09934#S2.p2.1)\.
- \[8\]J\. Li, K\. Cheng, S\. Wang, F\. Morstatter, R\. P\. Trevino, J\. Tang, and H\. Liu\(2018\)Feature selection: a data perspective\.ACM Computing Surveys \(CSUR\)50\(6\),pp\. 94\.Cited by:[§I](https://arxiv.org/html/2606.09934#S1.p2.1),[§II](https://arxiv.org/html/2606.09934#S2.p1.1)\.
- \[9\]N\. Moustafa and J\. Slay\(2015\)UNSW\-NB15: a comprehensive data set for network intrusion detection systems \(UNSW\-NB15 network data set\)\.In2015 Military Communications and Information Systems Conference \(MilCIS\),pp\. 1–6\.Cited by:[§I](https://arxiv.org/html/2606.09934#S1.p5.1),[§IV\-A](https://arxiv.org/html/2606.09934#S4.SS1.p1.1)\.
- \[10\]I\. M\. Nasir, M\. A\. Khan, M\. Yasmin, J\. H\. Shah, M\. Gabryel, R\. Scherer, and R\. Damaševičius\(2020\)Pearson correlation\-based feature selection for document classification using balanced training\.Sensors20\(23\),pp\. 6793\.External Links:[Document](https://dx.doi.org/10.3390/s20236793),[Link](https://www.mdpi.com/1424-8220/20/23/6793)Cited by:[2nd item](https://arxiv.org/html/2606.09934#S4.I1.i2.p1.1)\.
- \[11\]F\. Pedregosa, G\. Varoquaux, A\. Gramfort, V\. Michel, B\. Thirion, O\. Grisel, M\. Blondel, P\. Prettenhofer, R\. Weiss, V\. Dubourg, J\. Vanderplas, A\. Passos, D\. Cournapeau, M\. Brucher, M\. Perrot, and E\. Duchesnay\(2011\)Scikit\-learn: machine learning in python\.Vol\.12\.External Links:[Link](https://scikit-learn.org/)Cited by:[§IV\-C](https://arxiv.org/html/2606.09934#S4.SS3.p1.2)\.
- \[12\]H\. Peng, F\. Long, and C\. Ding\(2005\)Feature selection based on mutual information: criteria of max\-dependency, max\-relevance, and min\-redundancy\.IEEE Transactions on Pattern Analysis and Machine Intelligence27\(8\),pp\. 1226–1238\.Cited by:[§I](https://arxiv.org/html/2606.09934#S1.p2.1)\.
- \[13\]M\. Ring, S\. Wunderlich, D\. Gründl, D\. Landes, and A\. Hotho\(2019\)A survey of network\-based intrusion detection data sets\.Computers & Security\.Cited by:[§I](https://arxiv.org/html/2606.09934#S1.p2.1),[§II](https://arxiv.org/html/2606.09934#S2.p2.1)\.
- \[14\]Scikit\-learn\(2025\)VarianceThreshold — scikit\-learn 1\.7\.0 documentation\.Note:https://scikit\-learn\.org/stable/modules/generated/sklearn\.feature\_selection\.VarianceThreshold\.htmlCited by:[1st item](https://arxiv.org/html/2606.09934#S4.I1.i1.p1.1)\.
- \[15\]I\. Sharafaldin, A\. Habibi Lashkari, I\. Sahib, and A\. Ghorbani\(2019\-10\)Developing realistic distributed denial of service \(ddos\) attack dataset and taxonomy\.InIEEE 53rd International Carnahan Conference on Security Technology, Chennai, India\.,pp\. 1–8\.Note:https://www\.unb\.ca/cic/datasets/ddos\-2019\.htmlCanadian Institute for CybersecurityExternal Links:[Document](https://dx.doi.org/10.1109/CCST.2019.8888419)Cited by:[§I](https://arxiv.org/html/2606.09934#S1.p1.1),[§I](https://arxiv.org/html/2606.09934#S1.p5.1),[§IV\-A](https://arxiv.org/html/2606.09934#S4.SS1.p1.1)\.
- \[16\]I\. Sharafaldin, A\. H\. Lashkari, and A\. A\. Ghorbani\(2018\)Toward generating a new intrusion detection dataset and intrusion traffic characterization\.InInternational Conference on Information Systems Security and Privacy,Note:https://www\.unb\.ca/cic/datasets/ids\-2017\.htmlCanadian Institute for CybersecurityExternal Links:[Link](https://api.semanticscholar.org/CorpusID:4707749)Cited by:[§I](https://arxiv.org/html/2606.09934#S1.p1.1),[§I](https://arxiv.org/html/2606.09934#S1.p5.1),[§IV\-A](https://arxiv.org/html/2606.09934#S4.SS1.p1.1)\.
- \[17\]R\. Sommer and V\. Paxson\(2010\)Outside the closed world: on using machine learning for network intrusion detection\.InIEEE Symposium on Security and Privacy,Cited by:[§I](https://arxiv.org/html/2606.09934#S1.p1.1),[§I](https://arxiv.org/html/2606.09934#S1.p2.1),[§II](https://arxiv.org/html/2606.09934#S2.p2.1)\.
- \[18\]M\. Tavallaee, E\. Bagheri, W\. Lu, and A\. A\. Ghorbani\(2009\)A detailed analysis of the kdd cup 99 data set\.In2009 IEEE Symposium on Computational Intelligence for Security and Defense Applications,Vol\.,pp\. 1–6\.External Links:[Document](https://dx.doi.org/10.1109/CISDA.2009.5356528)Cited by:[§I](https://arxiv.org/html/2606.09934#S1.p5.1),[§IV\-A](https://arxiv.org/html/2606.09934#S4.SS1.p1.1)\.
- \[19\]J\. R\. Vergara and P\. A\. Estévez\(2014\)A review of feature selection methods based on mutual information\.Neural Computing and Applications24,pp\. 175–186\.External Links:[Document](https://dx.doi.org/10.1007/s00521-013-1368-0)Cited by:[§I](https://arxiv.org/html/2606.09934#S1.p2.1),[§II](https://arxiv.org/html/2606.09934#S2.p1.1)\.
- \[20\]C\. Westphal, S\. Hailes, and M\. Musolesi\(2025\)Feature selection for network intrusion detection\.InProceedings of the 31st ACM SIGKDD Conference on Knowledge Discovery and Data Mining V\.1,KDD ’25,pp\. 1599–1610\.External Links:ISBN 9798400712456,[Link](https://doi.org/10.1145/3690624.3709339),[Document](https://dx.doi.org/10.1145/3690624.3709339)Cited by:[§II](https://arxiv.org/html/2606.09934#S2.p2.1)\.Similar Articles
Adapting prior-data fitted networks for tabular anomaly detection
This paper explores adapting prior-data fitted networks (PFNs) for tabular anomaly detection, proposing a fine-tuning-free approach (ZEN) using frozen TabPFN features with nearest-neighbor scoring, and a fine-tuned method (FOCUS) that surpasses all baselines on the ADBench benchmark.
Calibrating Post-Training Feature Shifts for LLM Data Contamination Detection
This paper proposes CalibDCD, a calibration framework for feature-based LLM data contamination detection that mitigates feature shifts caused by post-training, improving detection performance by up to 7.0% AUC and 15.0% TPR@5%FPR.
CALAD: Channel-Aware contrastive Learning for multivariate time series Anomaly Detection
Proposes CALAD, a channel-aware contrastive learning framework for multivariate time series anomaly detection that uses estimated channel relevance to construct contrastive samples, achieving state-of-the-art performance.
MSAIC-Net: A Multi-Scale Attention and Imbalance-Aware Contrastive Network for ECG-Based Myocardial Substrate Abnormality Detection
Proposes MSAIC-Net, a multi-scale attention-enhanced convolutional network for detecting myocardial substrate abnormalities from ECG signals, using imbalance-aware contrastive learning and lead-wise permutation importance for interpretability.
CAFD: Concept-Aware DNN Fault Detection using VLMs
This paper introduces CAFD, a learning-based approach for DNN fault detection that integrates model-based, distance-based, and a novel concept-based feature called Concept Failure Ratio (CFR) derived from Vision-Language Models. CAFD consistently outperforms state-of-the-art baselines in fault detection rate across multiple datasets and budgets.