aalosbeh/xdf-cfi

GitHub: aalosbeh/xdf-cfi

XDF-CFI 是一个结合正则化回归特征增强、级联森林分类器与 SHAP/LIME 可解释性分析的网络异常检测研究框架,在 NSL-KDD 和 UNSW-NB15 基准上提供了完整可复现的实验 pipeline。

Stars: 0 | Forks: 0

# XDF-CFI:一个用于云端与网络取证调查中异常检测的可解释级联森林框架 [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE) 本仓库包含 XDF-CFI 的完整从头实现:一个正则化回归特征增强阶段,馈入级联森林(gcForest 风格)分类器,并通过 SHAP 和 LIME 进行端到端的可解释性分析。 ## 为什么本次修订是现在的样子 本工作的早期版本曾报告了在 BiSHM 云 hypervisor 遥测数据集(Purnaye & Kulkarni, 2022)上的结果。在准备本次修订时,该数据集已无法获取(其 Kaggle 链接现在返回 404;其 IEEE DataPort 发布版本需要我们无法获得的凭证 —— 参见 `data/README.md`)。我们没有让框架处于未经验证的状态,而是重新在两个可独立下载且被广泛使用的公开基准测试集 —— **NSL-KDD** 和 **UNSW-NB15** —— 上端到端地运行了整个 pipeline,涵盖了二分类和多分类形式,并与六个基线模型进行了对比,同时进行了 McNemar 显著性检验、bootstrap 置信区间分析、5 折交叉验证以及消融研究。论文中的每一个数据都是由本仓库中的代码生成的,没有一个是沿用自早期基于 BiSHM 的草稿的。 我们也未能找到原版 gcForest 库针对现代 Python 的维护版本,因此 `code/deep_forest.py` 是在 scikit-learn 基础上从头重新实现的级联机制。 ## 仓库结构 ``` code/ data_utils.py Dataset loading, cleaning, splitting, checksums regression_stage.py Stage 1: Ridge/Lasso/ElasticNet/Logistic + feature augmentation deep_forest.py Stage 2: from-scratch cascade-forest classifier baselines.py The six comparison models metrics_utils.py Accuracy/F1/MCC/ROC-AUC, McNemar's test, bootstrap CI run_experiments.py Main experiment runner (one dataset x label-mode per run) xai_and_figures.py Stage 3 (SHAP/LIME) + every figure in the paper patch_lightgbm.py Class-weighting fix applied post-hoc for fairness (see below) make_architecture_diagram.py Generates the Figure 1 pipeline diagram from scratch (matplotlib) seed_sensitivity.py Reruns the cascade at extra seeds (7, 123) for the seed-sensitivity table explanation_stability_check.py Non-adversarial SHAP/prediction stability probe (Threat Model, Table 1) data/ README.md Dataset provenance, checksums, why BiSHM is absent download_data.sh Re-fetches NSL-KDD / UNSW-NB15 from the mirrors used here raw/ (not committed — see .gitignore; populate via download_data.sh) results/ .json Full metrics/ablation/McNemar/timing output per configuration log_.txt Training logs (*_models.joblib are not committed — regenerate via run_experiments.py; see .gitignore) figure_new/ Every figure in the paper, generated from real results figure/ Architecture diagrams (methodology.jpg, gcforest.jpg) requirements.txt ``` ## 复现结果 ``` python3 -m venv venv && source venv/bin/activate pip install -r requirements.txt bash data/download_data.sh # fetches NSL-KDD + UNSW-NB15 (~64 MB) cd code python3 run_experiments.py --dataset nslkdd --label_mode binary python3 run_experiments.py --dataset unsw --label_mode binary python3 run_experiments.py --dataset nslkdd --label_mode multiclass python3 run_experiments.py --dataset unsw --label_mode multiclass python3 xai_and_figures.py --tag nslkdd_binary python3 xai_and_figures.py --tag unsw_binary python3 xai_and_figures.py --tag nslkdd_multiclass python3 xai_and_figures.py --tag unsw_multiclass ``` 每次调用 `run_experiments.py` 都会生成 `results/.json`(包含论文中报告的所有指标)和 `results/_models.joblib`(包含拟合好的模型,供 `xai_and_figures.py` 使用)。超参数(`--n_estimators 150 --max_depth 18 --max_layers 6 --n_folds_cascade 3`)是论文中每一个数据所使用的默认值;关于为何选择这些值而不是原版 gcForest 的默认值,请参见手稿的第 5.2 节。 从已经训练好的模型中,还可以复现两项补充的鲁棒性检查:针对级联模型的多随机种子稳定性检查,以及非对抗性的解释稳定性探针。 ``` python3 seed_sensitivity.py --dataset nslkdd --label_mode binary --seeds 7 123 python3 explanation_stability_check.py --tag nslkdd_binary --n_instances 40 ``` ## 许可证 代码:MIT 许可证(见 `LICENSE`)。手稿文本和图表版权归作者所有;本文本身拟投递至 *Computers & Security*,在发表前适用标准的学术重用条款。
标签:Apex, 可解释AI, 异常检测, 机器学习, 级联森林, 网络流量分析, 逆向工具