Computer Engineering and Applications ›› 2023, Vol. 59 ›› Issue (9): 86-94.DOI: 10.3778/j.issn.1002-8331.2208-0297

• Theory, Research and Development • Previous Articles     Next Articles

Similarity-Based Training Set Recommendation for Software Defect Prediction

WANG Chao, YU Qiao, HAN Hui   

  1. School of Computer Science and Technology, Jiangsu Normal University, Xuzhou, Jiangsu 221116, China
  • Online:2023-05-01 Published:2023-05-01

基于相似性度量的软件缺陷预测训练集推荐

王朝,于巧,韩惠   

  1. 江苏师范大学 计算机科学与技术学院,江苏 徐州 221116

Abstract: In the process of software defect prediction, the quality of training set is the key factor affecting the prediction results. In recent years, training set selection has also become a research hotspot in cross-project defect prediction and cross-version defect prediction scenarios. However, most of the existing studies focus on a single prediction scenario, which may affect the quality of training set to some extent. Based on two scenarios of cross-project defect prediction and cross-version defect prediction, this paper proposes an approach of similarity-based training set recommendation(STSR) from the perspective of data distribution. Firstly, the candidate source projects and target project are divided into the same number of clusters by clustering, and the Euclidean distances between the cluster centers are calculated to measure the similarity of datasets. Then, the target project is sampled, and the defect rate differences between the candidate source projects and sampled target project are calculated. Moreover, the interference class ratio is calculated. Finally, the recommendation of training set is realized. The experiments are conducted on 40 versions of 11 projects from the PROMISE repository, and the performance of STSR is evaluated by F1 and AUC. The results indicate that the performance of STSR is better than that of cross-version defect prediction under F1, and similar under AUC. In terms of time cost, the maximum recommended time of STSR method is 5.09?s, which is acceptable.

Key words: software defect prediction, training set recommendation, cross-project defect prediction, cross-version defect prediction

摘要: 在软件缺陷预测过程中,训练集质量是影响预测结果的关键因素。近几年,训练集选择也成为跨项目缺陷预测和跨版本缺陷预测等场景下的研究热点。然而,现有研究大多针对单一预测场景,可能会在一定程度上影响训练集质量。基于跨项目缺陷预测和跨版本缺陷预测两个场景,从数据分布角度提出一种基于相似性度量的训练集推荐(similarity-based training set recommendation,STSR)方法。采用聚类将候选源项目与目标项目划分为相同个数的簇,计算簇心之间的欧氏距离衡量数据集的相似度,对目标项目进行抽样,计算候选源项目与抽样目标项目缺陷率的差值,并计算干扰类比率,最终实现训练集推荐。在PROMISE数据集的11个项目共40个版本上进行实验验证,采用F1和AUC指标评价STSR方法的性能。实验结果表明,与跨版本缺陷预测相比,STSR方法的F1更优,在AUC指标上两者相当;在时间代价方面,STSR方法的最长推荐时间为5.09?s,是可接受的。

关键词: 软件缺陷预测, 训练集选择, 跨项目缺陷预测, 跨版本缺陷预测