An Explainable Machine Learning Framework for Network Intrusion Detection and Cyberattack Classification: Performance Evaluation, Feature Importance, and Threshold Optimization
The rapid evolution of sophisticated cyberattacks necessitates intelligent and adaptive Network Intrusion Detection Systems (NIDS).While machine learning (ML) offers promising capabilities for automated threat identification, conventional ML-based IDS frameworks often struggle with severe class imbalance, suboptimal default classification thresholds, and a lack of interpretability.Furthermore, models may inadvertently learn dataset-specific signatures, compromising their generalizability across diverse network environments.This study proposes an explainable, threshold-optimized ML framework for network intrusion detection and cyberattack classification.Utilizing a highly imbalanced dataset (24:1 benign-to-malicious ratio) comprising 10,000 network traffic records and 9 distinct attack categories, we systematically evaluate five ML classifiers (Gradient Boosting, Extra Trees, Random Forest, Logistic Regression, and SVM).To address class imbalance, we employ class-sensitive metrics (e.g., PR-AUC, Macro-F1, MCC) alongside a validation-driven threshold optimization strategy.Additionally, we integrate Explainable AI (XAI) techniques, including permutation importance and SHAP, alongside feature ablation experiments to investigate model decision-making and feature dependence.Experimental results demonstrate that Gradient Boosting achieves the most favorable operating point when the decision threshold is optimized from the default 0.50 to 0.169, improving recall from 0.260 to 0.580 and the F1-score to 0.558.However, feature importance analysis reveals a heavy reliance on the user_agent attribute, raising concerns regarding model generalization and highlighting the need for robust feature-ablation and chronological validation.In multiclass scenarios, significant disparities between Macro-F1 and Weighted-F1 scores expose the models' difficulties in recognizing rare attack categories.Ultimately, this research contributes a unified, transparent, and operationally relevant IDS architecture that bridges predictive performance, threshold aware detection, and explainable feature analysis, providing actionable insights for cybersecurity practitioners.
Authors
- Yao-Liang Chung (ORCID: https://orcid.org/0000-0001-6512-1127)
Institutions
- National Taiwan Ocean University (TW)
Publication Details
- Journal
- Information Security Education Journal (ISEJ)
- Published
- 2026-11-26
- DOI
- https://doi.org/10.6025/isej/2026/13/2/84-121
- Primary Topic
- Network Security and Intrusion Detection
- Type
- article
- Field-Weighted Citation Impact
- 0.00