信息网络安全 ›› 2026, Vol. 26 ›› Issue (7): 1012-1027.doi: 10.3969/j.issn.1671-1122.2026.07.002
收稿日期:2026-01-26
出版日期:2026-07-10
发布日期:2026-09-03
通讯作者:
周扬
E-mail:2521664181@qq.com
作者简介:张大伟(1974—),男,辽宁,副教授,博士,主要研究方向为应用密码学|周扬(2001—),女,辽宁,硕士研究生,主要研究方向为软件缺陷预测|杜晔(1978—),男,黑龙江,教授,博士,主要研究方向为云安全、空天地一体化网络安全、网络攻防与漏洞检测|唐宇(1998—),男,河北,博士研究生,主要研究方向为群智能优化算法、软件缺陷预测
基金资助:
Zhang Dawei1,2, Zhou Yang1(
), Du Ye1,2, Tang Yu1
Received:2026-01-26
Online:2026-07-10
Published:2026-09-03
Contact:
Zhou Yang
E-mail:2521664181@qq.com
摘要:
针对传统随机森林应用于软件缺陷预测领域存在结构冗余度高、可解释性差以及参数优化与结构剪枝相割裂导致预测性能受限的问题,文章提出一种融合多视角结构冗余剪枝(MSRP)机制与改进麻雀搜索算法(SCSSA)的随机森林优化模型(POMRF)。首先,构建多视角冗余评估体系,通过特征使用向量与加权结构向量融合语义相似度和结构距离,精准识别并剔除冗余决策树;然后,对麻雀搜索算法进行改进,引入正弦协同更新机制与混合变异策略优化随机森林核心参数,进而提升算法全局寻优能力与鲁棒性;最后,将POMRF模型应用于软件缺陷预测任务,在6个公开软件缺陷数据集上与多种对比算法开展实验验证。实验结果表明,POMRF模型在多种评价指标上均优于其他对比算法,不仅有效解决了传统方法单视角冗余评估不精准的问题,提升了模型可解释性与结构紧凑性,还通过参数优化与剪枝的协同联动突破了两者割裂的局限,显著提升了预测精度与稳定性,为软件缺陷预测领域提供了兼顾精度与可解释性的高效可靠解决方案。
中图分类号:
张大伟, 周扬, 杜晔, 唐宇. 基于多视角剪枝与优化随机森林的软件缺陷预测方法[J]. 信息网络安全, 2026, 26(7): 1012-1027.
Zhang Dawei, Zhou Yang, Du Ye, Tang Yu. Software defect prediction method based on multi-view pruning and optimized random forest[J]. Netinfo Security, 2026, 26(7): 1012-1027.
表4
算法寻优结果
| 函数 | 算法 | 最优值 | 最差值 | 平均值 | 标准差 |
|---|---|---|---|---|---|
| F1 | SCSSA | 0 | 7.3932×10-10 | 3.2209×10-11 | 1.2989×10-10 |
| SSA | 4.9188×10-17 | 8.9397×10-8 | 5.8409×10-9 | 1.7085×10-8 | |
| WOA | 2.1221×10-2 | 9.0309×10 | 4.1207×10 | 2.5661×10 | |
| GWO | 4.1734×10-8 | 2.1611×10-6 | 6.2249×10-7 | 5.5418×10-7 | |
| PSO | 7.3670×10-2 | 1.5808×1 | 1.1511×1 | 2.0960×10-1 | |
| F2 | SCSSA | 2.3899×10-11 | 1.4657×10-3 | 2.5467×10-4 | 3.2584×10-4 |
| SSA | 2.4516×10-7 | 7.8324×10-3 | 1.8652×10-3 | 2.2125×10-3 | |
| WOA | 2.6363×10 | 2.8801×10 | 2.7894×10 | 4.7531×10-1 | |
| GWO | 2.5858×10 | 2.8540×10 | 2.6902×10 | 6.5391×10-1 | |
| PSO | 2.0128×10 | 2.6970×102 | 8.2491×10 | 4.7653×10 | |
| F3 | SCSSA | 8.8817×10-16 | 8.8817×10-16 | 8.8817×10-16 | 0 |
| SSA | 8.8817×10-16 | 2.9309×10-14 | 3.3959×10-15 | 4.9894×10-15 | |
| WOA | 8.8817×10-16 | 7.9936×10-15 | 4.8588×10-15 | 2.0688×10-15 | |
| GWO | 7.9047×10-14 | 2.4602×10-13 | 1.4958×10-13 | 3.5985×10-14 | |
| PSO | 1.3542×10-3 | 1.3423×1 | 1.4487×10-1 | 3.5845×10-1 | |
| F4 | SCSSA | 1.7055×10-11 | 9.2728×10-7 | 1.2786×10-7 | 2.0958×10-7 |
| SSA | 5.3193×10-9 | 2.1406×10-5 | 2.0275×10-6 | 3.7874×10-6 | |
| WOA | 4.5643×10-3 | 1.1371×10-2 | 2.2716×10-2 | 2.2676×10-2 | |
| GWO | 6.6768×10-3 | 7.3037×10-2 | 3.2545×10-3 | 1.5525×10-2 | |
| PSO | 6.0767×10-8 | 4.7868×10-5 | 4.0319×10-6 | 9.4008×10-6 |
表5
各算法在不同数据集上的AUC与MCC值对比
| 数据集 | 评价指标 | RF | PSO-RF | SSA-RF | SCSSA -RF |
|---|---|---|---|---|---|
| ProjectK | AUC | 0.8662 | 0.9268 | 0.9225 | 0.9285 |
| MCC | 0.8039 | 0.8784 | 0.8788 | 0.8835 | |
| JDT | AUC | 0.7150 | 0.7382 | 0.7498 | 0.8105 |
| MCC | 0.5108 | 0.5370 | 0.5644 | 0.5981 | |
| PDE | AUC | 0.5902 | 0.6036 | 0.7412 | 0.7933 |
| MCC | 0.2725 | 0.3099 | 0.4413 | 0.5987 | |
| PC1 | AUC | 0.7012 | 0.7211 | 0.7522 | 0.8014 |
| MCC | 0.4231 | 0.4583 | 0.5122 | 0.6215 | |
| MC2 | AUC | 0.6795 | 0.6764 | 0.7554 | 0.8152 |
| MCC | 0.3426 | 0.4522 | 0.5698 | 0.6920 | |
| apache | AUC | 0.6534 | 0.7304 | 0.7370 | 0.7736 |
| MCC | 0.3107 | 0.4597 | 0.7275 | 0.7943 | |
| 平均性能 | AUC | 0.7008 | 0.7328 | 0.7764 | 0.8204 |
| MCC | 0.4576 | 0.5159 | 0.6323 | 0.6980 |
| [1] | Khadijah,Sasongko P S. The comparison of imbalanced data handling method in software defect prediction[J]. Kinetik: Game Technology, Information System, Computer Network, Computing, Electronics, and Control, 2020, 5(3): 203-210. |
| [2] | Zain Z M, Sakri S, Ismail N H A, et al.Software defect prediction harnessing on multi 1-dimensional convolutional neural network structure[J]. Computers, Materials & Continua, 2021, 71(1): 1521-1546. |
| [3] | Zhu Kun, Ying Shi, Zhang Nana, et al.Software defect prediction based on enhanced metaheuristic feature selection optimization and a hybrid deep neural network[J]. Journal of Systems and Software, 2021, 180: 111026. |
| [4] | Alazba A, Aljamaan H.Software defect prediction using stacking generalization of optimized tree-based ensembles[J]. Applied Sciences, 2022, 12(9): 4577. |
| [5] | Khan F, Kanwal S, Alamri S, et al.Hyper-parameter optimization of classifiers using an artificial immune network and its application to software bug prediction[J]. IEEE Access, 2020, 8: 20954-20964. |
| [6] | Thomas N S, Kaliraj S.An improved and optimized random forest based approach to predict software faults[J]. SN Computer Science, 2024, 5: 530. |
| [7] | Ho T K. Random decision forests[C]//The 3rd International Conference on Document Analysis and Recognition. New York:IEEE, 1995: 278-282. |
| [8] | Breiman L.Bagging predictors[J]. Machine Learning, 1996, 24: 123-140. |
| [9] | Ho T K. The random subspace method for constructing decision forests[J]. IEEE Transactions on Pattern Analysis and Machine Intelligence, 1998, 20(8): 832-844. |
| [10] | Usman-hamza F E, Balogun A O, Mamman H, et al.Empirical analysis of data sampling-based decision forest classifiers for software defect prediction[J]. Software, 2025, 4(2): 7. |
| [11] | 孔祥维, 唐鑫泽, 王子明.人工智能决策可解释性的研究综述[J]. 系统工程理论与实践, 2021, 41(2): 524-536. |
| [12] | Wyatt J C, Altman D G.Commentary: prognostic models: clinically useful or quickly forgotten?[J]. BMJ, 1995, 311: 1539. |
| [13] | Heinze G, Wallisch C, Dunkler D.Variable selection-a review and recommendations for the practicing statistician[J]. Biometrical Journal, 2018, 60(3): 431-449. |
| [14] | Banerjee M, Ding Y, Noone A M.Identifying representative trees from ensembles[J]. Statistics in Medicine, 2012, 31(15): 1601-1616. |
| [15] | Laabs B H, Westenberger A, Konig I R.Identification of representative trees in random forests based on a new tree-based distance measure[J]. Advances in Data Analysis and Classification, 2024, 18: 363-380. |
| [16] | Ghosh D, Cabrera J.Enriched random forest for high dimensional genomic data[J]. IEEE/ACM Transactions on Computational Biology and Bioinformatics, 2022, 19(5): 2817-2828. |
| [17] | Mustaqeem M, Mustajab S, Alam M.Enhancing software defect prediction through root cause analysis: a hybrid approach integrating permutation importance with Xgboost (PERMBoost)[C]//2024 International Conference on Communication, Computer Sciences and Engineering (IC3SE). New York:IEEE, 2024: 1-6. |
| [18] | Verdugo E, Abad A, Hurtado R.A structured approach to software defect classification and explanation: random forest and gradient boosting ensembles with a focus on prediction interpretability[C]//The 10th International Congress on Information and Communication Technology (ICICT 2025). Lecture Notes in Networks and Systems, Heidelberg:Springer, 2025: 409-420. |
| [19] | Kaur M, Gianey H K, Singh D, et al.Multi-objective differential evolution based random forest for e-health applications[J]. Modern Physics Letters B, 2019, 33(5): 1950022. |
| [20] | Asadi S, Roshan S E, Kattan M W.Random forest swarm optimization-based method for heart diseases diagnosis[J]. Journal of Biomedical Informatics, 2021, 115: 103690. |
| [21] | Ma Jie, Hao Zhiyuan, Sun Wenjing.Enhancing sparrow search algorithm via multi-strategies for continuous optimization problems[J]. Information Processing & Management, 2022, 59(2): 102854. |
| [22] | 唐宇, 戴琪, 杨梦圆, 等.膜内麻雀优化极限学习机的SDP算法[J]. 北京航空航天大学学报, 2024, 50(2): 643-654. |
| [23] | 胡金昊.基于随机森林和SVM的SDP方法研究[D]. 杭州:浙江工业大学, 2020. |
| [24] | Alzaqebeh M A, Jawarneh S, Mohammad R M A, et al.Hybrid feature selection method based on particle swarm optimization and adaptive local search method[J]. International Journal of Electrical and Computer Engineering, 2020, 11(3): 2414-2422. |
| [25] | Xue Jiankai, Shen Bo.A novel swarm intelligence optimization approach: sparrow search algorithm[J]. Systems Science & Control Engineering, 2020, 8(1): 22-34. |
| [26] | Altinger H, Siegl S, Dajsuren Y, et al.A novel industry grade dataset for fault prediction based on model-driven developed automotive embedded software[C]//2015 IEEE/ACM 12th Working Conference on Mining Software Repositories. New York:IEEE, 2015: 494-497. |
| [27] | D'ambros M, Lanza M, Robbes R.An extensive comparison of bug prediction approaches[C]//2010 7th IEEE Working Conference on Mining Software Repositories. New York:IEEE, 2010: 31-41. |
| [28] | Jureczko M, Madeyski L.Towards identifying software project clusters with regard to defect prediction[C]//The 6th International Conference on Predictive Models in Software Engineering. New York:ACM, 2010: 1-10. |
| [29] | Sayyad Shirabad J, Menzies T.The PROMISE repository of software engineering databases[EB/OL]. [2026-02-13]. http://promise.site.uottawa.ca/SERepository. |
| [30] | Wu Rongxin, Zhang Hongyu, Kim S, et al.Relink: recovering links between bugs and changes[C]//The 19th ACM SIGSOFT Symposium and the 13th European Software Engineering Conference. New York:ACM, 2011: 15-25. |
| [31] | Cao Jingjing, Li Wenfeng, Ma Congcong, et al.Optimizing multi-sensor deployment via ensemble pruning for wearable activity recognition[J]. Information Fusion, 2018, 41: 68-79. |
| [32] | Sagi O, Rokach L.Approximating XGBoost with an interpretable decision tree[J]. Information Sciences, 2021, 572: 522-542. |
| [33] | Lipton Z C. The mythos of model interpretability[J]. Communications of the ACM, 2018, 61(10): 36-43. |
| [1] | 张志强, 暴亚东. 融合RF和CNN的异常流量检测算法[J]. 信息网络安全, 2024, 24(11): 1655-1664. |
| [2] | 吕国华, 胡学先, 杨明, 徐敏. 基于联邦随机森林的船舶AIS轨迹分类算法[J]. 信息网络安全, 2022, 22(4): 67-76. |
| [3] | 蔡满春, 王腾飞, 岳婷, 芦天亮. 基于ARF的Tor网站指纹识别技术[J]. 信息网络安全, 2021, 21(4): 39-48. |
| [4] | 徐国天. 基于异常加密流量标注的Android恶意进程识别方法研究[J]. 信息网络安全, 2020, 20(7): 30-41. |
| [5] | 宋鑫, 赵楷, 张琳琳, 方文波. 基于随机森林的Android恶意软件检测方法研究[J]. 信息网络安全, 2019, 19(9): 1-5. |
| [6] | 马泽文, 刘洋, 徐洪平, 易航. 基于集成学习的DoS攻击流量检测技术[J]. 信息网络安全, 2019, 19(9): 115-119. |
| [7] | 段詠程, 王雨晴, 李欣, 杨乐. 基于RSAR的随机森林网络安全态势要素提取[J]. 信息网络安全, 2019, 19(7): 75-81. |
| [8] | 翟继强, 肖亚军, 杨海陆, 王健. 改进的人工蜂群结合优化的随机森林的U2R攻击检测研究[J]. 信息网络安全, 2018, 18(12): 38-45. |
| [9] | 林伟宁, 陈明志, 詹云清, 刘川葆. 一种基于PCA和随机森林分类的入侵检测算法研究[J]. 信息网络安全, 2017, 17(11): 50-54. |
| [10] | 吴坚, 沙晶. 基于随机森林算法的网络舆情文本信息分类方法研究[J]. 信息网络安全, 2014, 14(11): 36-40. |
| 阅读次数 | ||||||
|
全文 |
|
|||||
|
摘要 |
|
|||||