机器学习在Android代码异味检测中的应用
The Application of Machine Learning in Android Code Smell Detection
孙梦琪 1边奕心1
作者信息
- 1. 哈尔滨师范大学,黑龙江哈尔滨 150025
- 折叠
摘要
由于现有代码异味检测方法存在多方面的限制,无法准确高效的检测An-droid 代码异味共存,提出基于机器学习的Android代码异味共存检测方法.首先提出并实现工具ASSD得到分离好的正负样本集,提取源代码中的文本信息作为机器学习分类器的输入,从而实现机器学习检测Android代码异味共存.设计对比实验,实验结果表明机器学习可以检测Android代码异味共存,并且检测效果较现有基于静态程序分析的检测方法有较大提升,其中随机森林模型效果最好,其F1值提升了22%.
Abstract
Due to the limitations of existing code smell detection methods,it is difficult to accu-rately and efficiently detect the coexistence of code smells in Android code.In this regard,a ma-chine learning-based approach for detecting the coexistence of code smells in Android code is proposed.Firstly,a tool called ASSD is proposed and implemented to obtain well-separated posi-tive and negative sample sets.The textual information extracted from the source code is used as the input for the machine learning classifier,thus achieving the detection of code smell coexis-tence using machine learning.Comparative experiments are designed,and the results show that machine learning can effectively detect the coexistence of code smells in Android code,with sig-nificantly improved detection performance compared to existing static program analysis-based methods.Among them,the random forest model performs the best,with an F1 score improve-ment of 22%.
关键词
机器学习/代码异味共存/An-droid代码异味Key words
Machine Learning/co-occurrences of code smells/Android code smells引用本文复制引用
出版年
2024