Computer Science and Engineering, Central South University, Changsha, China.
PLoS One. 2021 Mar 4;16(3):e0247444. doi: 10.1371/journal.pone.0247444. eCollection 2021.
Software defect prediction (SDP) can be used to produce reliable, high-quality software. The current SDP is practiced on program granular components (such as file level, class level, or function level), which cannot accurately predict failures. To solve this problem, we propose a new framework called DP-AGL, which uses attention-based GRU-LSTM for statement-level defect prediction. By using clang to build an abstract syntax tree (AST), we define a set of 32 statement-level metrics. We label each statement, then make a three-dimensional vector and apply it as an automatic learning model, and then use a gated recurrent unit (GRU) with a long short-term memory (LSTM). In addition, the Attention mechanism is used to generate important features and improve accuracy. To verify our experiments, we selected 119,989 C/C++ programs in Code4Bench. The benchmark tests cover various programs and variant sets written by thousands of programmers. As an evaluation standard, compared with the state evaluation method, the recall, precision, accuracy and F1 measurement of our well-trained DP-AGL under normal conditions have increased by 1%, 4%, 5%, and 2% respectively.
软件缺陷预测(SDP)可用于生成可靠、高质量的软件。目前的 SDP 是针对程序粒度组件(如文件级、类级或函数级)进行实践的,无法准确预测故障。为了解决这个问题,我们提出了一个名为 DP-AGL 的新框架,该框架使用基于注意力的 GRU-LSTM 进行语句级缺陷预测。通过使用 clang 构建抽象语法树(AST),我们定义了一组 32 个语句级别的指标。我们对每个语句进行标记,然后创建一个三维向量并将其作为自动学习模型应用,然后使用门控循环单元(GRU)和长短期记忆(LSTM)。此外,还使用注意力机制生成重要特征并提高准确性。为了验证我们的实验,我们在 Code4Bench 中选择了 119,989 个 C/C++程序。该基准测试涵盖了数千名程序员编写的各种程序和变体集。作为评估标准,与状态评估方法相比,我们经过良好训练的 DP-AGL 在正常情况下的召回率、精度、准确性和 F1 测量分别提高了 1%、4%、5%和 2%。