Improved Software Defect Prediction by Combining Natural Language-Based Features from Comments with Conceptual Features Extracted from the Source Code
摘要
The goal of the present paper is to improve software defect prediction (SDP) by combining natural language-based features from comments with conceptual features extracted from the source code. An enriched semantic representation of a source code is obtained by fusing code embedding and comments embedding. Two types of semantic representations are generated for comparison. In the first representation, doc2vec, a natural language-based model, is trained on the input dataset, using separately the codes and attached comments, respectively, to learn the corresponding embeddings. In the second representation, pre-trained language models based on BERT (CodeBERT for code embedding and RoBERTa for comments embedding) are applied. Experiments on the Calcite dataset using the XGBoost classifier demonstrate that the addition of features provided by code comments is beneficial in improving the performance of SDP. A comparative analysis is conducted between the performance of the feature extraction-based approach and fine-tuning applied on input consisting of the complete source code (code and attached comments). The results indicate that equivalent or superior performance is obtained only when the standard fine-tuning approach is extended to handle longer texts.