同构集成深度学习的代码异味检测
作者:
作者单位:

作者简介:

通讯作者:

中图分类号:

基金项目:

中国博士后科学基金面上项目(2024M761927); 上海市“科技创新行动”启明星项目(扬帆专项) (24YF2719900)


Code Smell Detection Based on Homogeneous Ensemble Deep Learning
Author:
Affiliation:

Fund Project:

  • 摘要
  • |
  • 图/表
  • |
  • 访问统计
  • |
  • 参考文献
  • |
  • 相似文献
  • |
  • 引证文献
  • |
  • 资源附件
  • |
  • 文章评论
    摘要:

    代码异味是软件源代码中存在的不良设计问题, 它影响着代码可维护性, 可读性以及可扩展性. 研究人员可以通过检测代码异味确定待重构的代码, 进而改善代码质量. 过去的研究广泛将机器学习技术应用于代码异味检测, 虽取得一定成果, 但在检测准确性、泛化能力方面仍存在局限. 本文构建两种模型: 直接同构集成CNN和RNCNN (random forest-negative correlation learning-CNN), 来检测4种代码异味(Data class, God class, Feature envy, Long method), 利用基于随机森林的特征选择技术提取更重要的特征, 利用深度学习技术对代码的结构特征进行建模, 再使用负相关学习同构集成深度学习模型方法训练模型, 进行异味检测. 与基线工作相比, 本研究的F1值最高提升4.93%.

    Abstract:

    Code smells are undesirable design characteristics in software source code that negatively affect maintainability, readability, and scalability. By detecting code smells, it becomes possible to identify code segments requiring refactoring, thus enhancing code quality. Although machine learning techniques have been widely applied in previous studies for code smell detection, challenges persist regarding detection accuracy and generalization capability. In this study, we propose two models: a directly isomorphic ensemble model combining convolutional neural network (CNN) and a random forest-negative correlation learning-CNN (RNCNN), to detect four types of code smells: Data class, God class, Feature envy, and Long method. A feature selection technique based on random forests is employed to extract the most informative features, and deep learning techniques are utilized to model the structural characteristics of the code. The model is then trained using a homogeneous ensemble deep learning approach based on negative correlation learning. Experimental results demonstrate that the proposed method improves the F1 score by up to 4.93% compared to baseline approaches.

    参考文献
    相似文献
    引证文献
引用本文

张苗,黄子杰,陈军华,高建华.同构集成深度学习的代码异味检测.计算机系统应用,2025,34(10):133-142

复制
分享
相关视频

文章指标
  • 点击次数:
  • 下载次数:
  • HTML阅读次数:
  • 引用次数:
历史
  • 收稿日期:2025-02-26
  • 最后修改日期:2025-03-18
  • 录用日期:
  • 在线发布日期: 2025-08-26
  • 出版日期:
文章二维码
您是第位访问者
版权所有:中国科学院软件研究所 京ICP备05046678号-3
地址:北京市海淀区中关村南四街4号,邮政编码:100190
电话:010-62661041 传真: Email:csa@iscas.ac.cn
技术支持:北京勤云科技发展有限公司

京公网安备 11040202500063号