<p>Cross-project defect prediction (CPDP) is a software defect detection (SDP) technique that aims to overcome the challenge of insufficient defect data in target projects. In CPDP, previous approaches based on abstract syntax trees (AST) have primarily relied on extracting features from either leaf nodes or syntactic structure type nodes. However, methods based on leaf nodes often suffer from information redundancy and may encounter gradient vanishing issues when recursively traversing the AST, while methods based on syntactic structure type nodes generally face limitations such as structural information loss caused by AST serialization and a restricted range of node selection. In addition, most existing methods introduce Maximum Mean Difference (MMD) at the file level to align the global feature distributions between the source and target projects. However, this coarse-grained alignment often ignores the finer-grained semantic and syntactic structures in the code. To solve these problems, this paper proposes a CPDP method based on node-level MMD alignment mechanism – Transfer Graph Convolutional Network (TGCN). Starting from the node hierarchy of the AST, the method aligns the feature distributions of nodes with the same type across different projects at a fine-grained level, thereby realizing node-level MMD alignment and improving the model’s capability for cross-project transfer. Specifically, the source code is first parsed into an AST. A subgraph is then constructed by traversing the AST, where only syntactic structure type nodes are retained. Each node type is mapped to an integer index using a dictionary, and these indices are used as node features to build the final syntactic graph. Moreover, to ensure consistent alignment, only the node types that are shared between the source and target projects are preserved. The syntax graph is inputted into GCN to extract transferable syntactic features. Subsequently, perform linear dimensionality reduction on the syntactic features through Principal Component Analysis (PCA), and input into a logistic regression (LR) classifier for training. The experimental results on 12 benchmark projects show that compared with the best performing Semantic and Syntactic Encoding (SSE) among the baseline methods, the proposed TGCN method improves F-measure by 5.47%, accuracy (ACC) by 5.67%, matthews correlation coefficient (MCC) by 8.84%, geometric mean (G-Mean) by 3.31%, and precision by 4.38%.</p>

错误:搜索内容不能为空,请输入英文关键词
错误:关键词超出字数限制,请精简
高级检索

Cross-project defect prediction based on transfer graph convolutional network

  • Yanjun Wang,
  • Pu Wang,
  • Hongwei Tao,
  • Tao Wang,
  • Zhenhao Geng,
  • Yongheng Xie

摘要

Cross-project defect prediction (CPDP) is a software defect detection (SDP) technique that aims to overcome the challenge of insufficient defect data in target projects. In CPDP, previous approaches based on abstract syntax trees (AST) have primarily relied on extracting features from either leaf nodes or syntactic structure type nodes. However, methods based on leaf nodes often suffer from information redundancy and may encounter gradient vanishing issues when recursively traversing the AST, while methods based on syntactic structure type nodes generally face limitations such as structural information loss caused by AST serialization and a restricted range of node selection. In addition, most existing methods introduce Maximum Mean Difference (MMD) at the file level to align the global feature distributions between the source and target projects. However, this coarse-grained alignment often ignores the finer-grained semantic and syntactic structures in the code. To solve these problems, this paper proposes a CPDP method based on node-level MMD alignment mechanism – Transfer Graph Convolutional Network (TGCN). Starting from the node hierarchy of the AST, the method aligns the feature distributions of nodes with the same type across different projects at a fine-grained level, thereby realizing node-level MMD alignment and improving the model’s capability for cross-project transfer. Specifically, the source code is first parsed into an AST. A subgraph is then constructed by traversing the AST, where only syntactic structure type nodes are retained. Each node type is mapped to an integer index using a dictionary, and these indices are used as node features to build the final syntactic graph. Moreover, to ensure consistent alignment, only the node types that are shared between the source and target projects are preserved. The syntax graph is inputted into GCN to extract transferable syntactic features. Subsequently, perform linear dimensionality reduction on the syntactic features through Principal Component Analysis (PCA), and input into a logistic regression (LR) classifier for training. The experimental results on 12 benchmark projects show that compared with the best performing Semantic and Syntactic Encoding (SSE) among the baseline methods, the proposed TGCN method improves F-measure by 5.47%, accuracy (ACC) by 5.67%, matthews correlation coefficient (MCC) by 8.84%, geometric mean (G-Mean) by 3.31%, and precision by 4.38%.