College of Aerospace Engineering, Nanjing University of Aeronautics and Astronautics, Nanjing, China.
Software Evaluation Center, Nanchang Hangkong University, Nanchang 330063, Jiangxi, China.
Comput Intell Neurosci. 2022 Aug 3;2022:4311548. doi: 10.1155/2022/4311548. eCollection 2022.
Currently, software defect-prediction technology is being extensively researched in the design of metrics. However, the research objects are mainly limited to coarse-grained entities such as classes, files, and packages, and there is a wide range of defects that are difficult to predict in actual situations. To further explore the information between sequences of method calls and to learn the code semantics and syntactic structure between methods, we generated a method-call sequence that retains the code context structure information and the token sequence representing semantic information. We embedded the token sequence into the method-call sequence and encoded it into a fixed-length real-valued vector. We then built a defect-prediction model based on the transformer, which maps the code-vector representation containing the method-call sequences to a low-dimensional vector space to generate semantic features and syntactic structure features and also predicts the defect density of the method-call sequence. We conducted experiments on 10 open-source projects using the ELFF dataset. The experimental results show that the method-call sequence-level prediction effect is better than the class-level effect, and the prediction results are more stable than those of the method level. The mean absolute error (MAE) value of our approach was 8% lower than that of the other deep-learning methods.
目前,软件缺陷预测技术在度量设计中得到了广泛的研究。然而,研究对象主要局限于类、文件和包等粗粒度实体,在实际情况下存在着大量难以预测的缺陷。为了进一步探索方法调用序列之间的信息,并学习方法之间的代码语义和语法结构,我们生成了一个保留代码上下文结构信息和表示语义信息的令牌序列的方法调用序列。我们将令牌序列嵌入到方法调用序列中,并将其编码为固定长度的实值向量。然后,我们基于转换器构建了一个缺陷预测模型,该模型将包含方法调用序列的代码向量表示映射到低维向量空间,以生成语义特征和语法结构特征,并预测方法调用序列的缺陷密度。我们使用 ELFF 数据集在 10 个开源项目上进行了实验。实验结果表明,方法调用序列级别的预测效果优于类级别,并且预测结果比方法级别更稳定。我们的方法的平均绝对误差(MAE)值比其他深度学习方法低 8%。