paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Deep Learning Based Feature Envy Detection Boosted by Real-World Examples

基于深度学习并由真实世界样本增强的 Feature Envy(特性依恋)检测
FSE Proceedings of the 31st ACM Joint European Software Engineering Conference and Symposium on the Foundations of Software Engineering2023匹配度 4/10 · 论文属于机器学习与程序语言交叉,但具体任务是代码坏味(Feature Envy)检测,不涉及用户核心关注的LLM/Agent、静态分析在ML/Agentic程序中的应用、浮点程序分析或贝叶斯程序分析。其深度学习方法和特征工程与用户研究方向仅有边缘关联。引用 24 inbox
Bo Liu, Hui Liu, Guangjie Li, Nan Niu, Zimao Xu, Yifan Wang, Yunni Xia, Yuxia Zhang, Yanjie Jiang
crossref: 2026-09-12dblp: 2026-09-12

AI 速览

一句话:用真实重构样本训练深度学习模型,并引入方法与类间耦合特征,大幅提升 Feature Envy 检测精度。

Feature Envy 是一种典型的代码异味,通常应通过重构消除。其检测难点在于传统方法准确率较低,而深度学习方法又缺乏高质量的大规模训练数据;虽然重构检测工具可发现真实样本,但结果中含大量假阳性噪声,会严重影响训练数据与模型性能。本文提出一组启发式规则和基于决策树的分类器,用于过滤当前先进重构检测工具报告中的假阳性,将过滤后的样本作为正例,并从同一项目中随机选取不同方法作为负例。基于这些真实样本,作者设计并训练了一个深度学习二分类模型,判断给定方法是否应移动到潜在目标类。该模型还利用了已有方法未使用的特征:方法与类之间的耦合(CBMC)以及方法与类之间的消息传递耦合(MCMC)。在真实开源项目上的评估表明,该方法显著优于现有最佳方法,精确率和召回率分别提升 38.5% 和 20.8%。

问题
Feature Envy 检测传统方法准确率不足,而深度学习方法受限于高质量大规模训练数据的缺乏,且重构检测工具产生的样本中存在大量假阳性噪声。
方法
提出启发式规则与决策树分类器过滤重构检测工具报告中的假阳性,以过滤后的真实样本为正例、随机选取的其他方法为负例,训练深度学习二分类模型,并引入方法与类耦合(CBMC)及消息传递耦合(MCMC)特征。
评估
在真实开源项目上评估,与当前最佳方法相比,精确率提升 38.5%,召回率提升 20.8%。
原文摘要(Abstract)

Feature envy is one of the well-recognized code smells that should be removed by software refactoring. A major challenge in feature envy detection is that traditional approaches are less accurate whereas deep learning-based approaches are suffering from the lack of high-quality large-scale training data. Although existing refactoring detection tools could be employed to discover real-world feature envy examples, the noise (i.e., false positives) within the resulting data could significantly influence the quality of the training data as well as the performance of the models trained on the data. To this end, in this paper, we propose a sequence of heuristic rules and a decision tree-based classifier to filter out false positives reported by state-of-the-art refactoring detection tools. The data after filtering serve as the positive items in the requested training data. From the same subject projects, we randomly select methods that are different from positive items as negative items. With the real-world examples (both positive and negative examples), we design and train a deep learning-based binary model to predict whether a given method should be moved to a potential target class. Different from existing models, it leverages additional features, i.e., coupling between methods and classes (CBMC) and the message passing coupling between methods and classes (MCMC) that have not yet been exploited by existing approaches. Our evaluation results on real-world open-source projects suggest that the proposed approach substantially outperforms the state of the art in feature envy detection, improving precision and recall by 38.5% and 20.8%, respectively.

链接与引用

DOI 原文 · PDF(开放获取) · DBLP

BibTeX
@inproceedings{LiuLLNXWXZJ23,
  title = {Deep Learning Based Feature Envy Detection Boosted by Real-World Examples},
  author = {Bo Liu and Hui Liu and Guangjie Li and Nan Niu and Zimao Xu and Yifan Wang and Yunni Xia and Yuxia Zhang and Yanjie Jiang},
  booktitle = {FSE},
  year = {2023},
  doi = {10.1145/3611643.3616353}
}